Compare commits

...

1119 Commits

Author SHA1 Message Date
Ingvar Stepanyan
760dd9e8a0 Update avif_enc_mt.js 2021-03-04 13:15:10 +00:00
Ingvar Stepanyan
f1a9235de2 Update avif_enc_mt.js 2021-03-04 13:12:17 +00:00
Ingvar Stepanyan
e66c292e86 [temp] Warn on unavailable worker 2021-03-03 16:55:09 +00:00
Surma
37d778e4da Merge pull request #963 from veluca93/jxl_uprev
Update JPEG XL.
2021-02-24 16:44:22 +00:00
Luca Versari
8f24c9b5ce Update JPEG XL.
This in particular fixes encoding with progressive enabled.
2021-02-24 16:38:22 +01:00
Surma
9d3401762e Merge pull request #962 from GoogleChromeLabs/butteraugli-fix 2021-02-22 18:07:33 +00:00
Surma
a783de618d Review 2021-02-22 18:05:26 +00:00
Surma
659d2b8277 Fix butteraugli for auto-optimizer 2021-02-22 17:58:15 +00:00
Surma
934ab9065a Merge pull request #957 from veluca93/jxl_v03
Bump jxl version and remove workaround for enc memory usage.
2021-02-11 14:50:44 +00:00
Luca Versari
029c2ebb83 Bump jxl version and remove workaround for enc memory usage. 2021-02-10 12:55:18 +01:00
Jake Archibald
dc40f84a65 Update stuff and keep new Typescript happy 2021-01-25 15:35:52 +00:00
Surma
2c0dd363d4 Merge pull request #949 from GoogleChromeLabs/RReverser-patch-1
Remove no-op variable in imagequant Makefile
2021-01-22 19:25:41 +00:00
Ingvar Stepanyan
e6916575b7 Remove no-op variable in imagequant Makefile
One more follow-up...
2021-01-22 15:30:41 +00:00
Jake Archibald
1c7486056d Avoid cache when updating SW, for now 2021-01-22 13:58:16 +00:00
Jake Archibald
8e8b75684d Remove caching headers for now 2021-01-22 13:51:30 +00:00
Ingvar Stepanyan
92ade727aa Fix browser version of imagequant (#947)
Fix Makefile compiling same file twice and overriding the correct browser version (ENVIRONMENT=$(ENVIRONMENT)) with Node.js one (ENVIRONMENT=node).

Looks like this was introduced by accident in 33d60658cd.

Fixes #946.
2021-01-22 13:13:18 +00:00
Ingvar Stepanyan
6117c9dd26 Update HQX to latest (#943)
I've played a bit and added a non-invasive change to the HQX - https://github.com/CryZe/wasmboy-rs/pull/1 - to work around the code size regression (https://github.com/rust-lang/rust/issues/74947) introduced in the latest Rust.

As a side benefit of the change, the build time also went down significantly and now takes only 1 minute altogether - including spawning Docker, fetching Cargo, building Wasm and optimising it with wasm-opt - instead of 15-20 minutes it took before.

P.S. h/t @CryZe for a very quick review & publish.
2021-01-22 12:27:44 +00:00
François Beaufort
a3be343959 Add manifest fields for PWA install bottom sheet (#933)
* Add manifest fields for PWA install bottom sheet

* Switch to webp

* Revert "Switch to webp"

This reverts commit c60d0d9629.

* Try JPEG

* Use mime-type library

* Automate image size

Co-authored-by: Jake Archibald <jaffathecake@gmail.com>
2021-01-21 09:45:52 +00:00
Surma
39c6be41df Merge pull request #937 from akrisrn/patch-1
Update CLI README.md
2021-01-20 12:34:42 +00:00
Surma
5603f2d6e7 Merge branch 'dev' into patch-1 2021-01-20 12:31:46 +00:00
Surma
0d72f652c5 Merge pull request #940 from GoogleChromeLabs/reproducible-mozjpeg
Make MozJPEG builds reproducible
2021-01-19 16:56:53 +00:00
Ingvar Stepanyan
7ce0c8a4fc Make MozJPEG builds reproducible
I was wondering why MozJPEG produces different Wasm binaries even when nothing is changed.

After looking at the binary diffs, I think I have figured & fixed the reason.
2021-01-19 13:21:00 +00:00
Ingvar Stepanyan
30528c2330 Disable filesystem in C++ codecs (#938) 2021-01-18 12:59:40 +00:00
Ingvar Stepanyan
b4329c5bed Rebuild codecs (#935) 2021-01-18 12:29:38 +00:00
AkrISrn
5845e566da Update README.md 2021-01-16 01:24:27 +08:00
Adam Argyle
5d0c856fa0 match manifest.json (#936)
removes the orange for the hotpink
2021-01-15 09:00:13 +00:00
Surma
ff25dd81f8 Merge pull request #931 from GoogleChromeLabs/unaligned_access_is_fast
Use UNALIGNED_ACCESS_IS_FAST for OxiPNG -> libdeflate
2021-01-13 13:16:45 +00:00
Ingvar Stepanyan
c7d156e8d7 Use UNALIGNED_ACCESS_IS_FAST for OxiPNG -> libdeflate
I only observed ~10-15% increase in perf on single-threaded bench, which isn't much, but no harm in adding flag anyway.

Fixes #833.
2021-01-13 13:07:01 +00:00
Surma
02532b5a31 Merge pull request #930 from GoogleChromeLabs/wp2-update
Update WP2
2021-01-07 20:57:29 +00:00
Surma
c5c95254f0 Update WP2 2021-01-07 17:46:54 +00:00
Ingvar Stepanyan
dfa7695a97 Switch to upstream freestanding support (#864)
Co-authored-by: Jake Archibald <jaffathecake@gmail.com>
2021-01-06 17:16:10 +00:00
Surma
7095ed2f7a Merge pull request #911 from aethelz/fix-permissions 2021-01-05 16:52:25 +00:00
Surma
61a66c4ed4 Merge branch 'dev' into fix-permissions 2021-01-05 16:40:57 +00:00
Surma
c6188c8846 Merge pull request #927 from veluca93/update_jxl_v02 2021-01-05 16:40:39 +00:00
Surma
ae583f7581 Merge branch 'dev' into update_jxl_v02 2021-01-05 16:37:42 +00:00
Surma
22a948267c Rebuild WebP codec 2021-01-05 16:23:46 +00:00
Surma
35f5ad6e2b Merge branch 'dev' into fix-permissions 2021-01-05 16:22:10 +00:00
Surma
34d3c13b5d Merge pull request #910 from GoogleChromeLabs/banding-fix 2021-01-05 15:32:14 +00:00
Surma
dba8f097d3 Merge remote-tracking branch 'origin/dev' into banding-fix 2021-01-05 15:30:07 +00:00
Surma
36293d756b Move variable assignment out of loop 2021-01-05 15:29:57 +00:00
Surma
ad07584730 Update codecs/resize/src/lib.rs
Co-authored-by: Ingvar Stepanyan <me@rreverser.com>
2021-01-05 14:50:08 +00:00
Surma
e260994600 Update codecs/resize/src/lib.rs 2021-01-05 14:49:41 +00:00
Surma
f55e4cf9a8 Update codecs/resize/src/lib.rs
Co-authored-by: Ingvar Stepanyan <me@rreverser.com>
2021-01-05 14:49:08 +00:00
Ingvar Stepanyan
a1ea6223ac Merge branch 'dev' into fix-permissions 2021-01-05 14:38:35 +00:00
Surma
e7e205c326 Simplify WorkerPool joining (closes #925) 2021-01-05 14:26:26 +00:00
Surma
990a43b733 Merge pull request #923 from DetachHead/dev 2021-01-05 12:51:59 +00:00
Surma
1a40c57876 Merge branch 'dev' into banding-fix 2021-01-05 12:34:29 +00:00
Luca Versari
e8afe408f1 Update JPEG XL to v0.2 (format freeze). 2020-12-31 00:05:25 +01:00
DetachHead
9352569852 remove outdated comment 2020-12-27 16:01:02 +10:00
DetachHead
10d648c28d check if path is directory using lstat instead of requiring trailing slash 2020-12-27 15:59:56 +10:00
DetachHead
1e64e52298 fix reading directories 2020-12-26 23:26:27 +10:00
DetachHead
733b470f1f allow passing entire directories as input 2020-12-26 22:56:23 +10:00
Surma
e72dcd6c6e Merge pull request #917 from dtinth/patch-1
Fix wrong development script in README
2020-12-19 18:30:44 +00:00
Thai Pangsakulyanont
62b4d39128 Fix wrong development script in README 2020-12-19 05:46:16 +07:00
Surma
d338e8a048 Merge pull request #813 from samal-rasmussen/keyboard-shortcuts 2020-12-15 12:04:17 +00:00
Surma
f2a947df9e Merge branch 'dev' into keyboard-shortcuts 2020-12-15 12:01:04 +00:00
Surma
3ec55b0a03 Merge pull request #913 from GoogleChromeLabs/default-resize-type
Make vector the default resize type for vector images
2020-12-15 11:53:05 +00:00
Jake Archibald
3338808f17 Make vector the default resize type for vector images 2020-12-15 10:42:18 +00:00
Eugene
5bdba43b33 Fix oxipng build script permissions 2020-12-13 20:18:33 +03:00
Surma
c63120d4ce Minor cleanup 2020-12-13 16:36:00 +00:00
Surma
405dd1cdfa Fix banding from linear RGB color space conversion 2020-12-13 16:27:59 +00:00
Sámal Rasmussen
b958d46086 Add keyboard shortcuts for moving the split view separator 2020-12-10 19:58:10 +00:00
Surma
c3d05e0e2d Merge pull request #892 from XhmikosR/gitignore 2020-12-10 14:00:56 +00:00
Surma
0c848a33ad Merge branch 'dev' into gitignore 2020-12-10 13:49:38 +00:00
Surma
57357f5c8d Merge pull request #894 from fernap3/validate-input-files
Validate that input files exist before attempting to process them
2020-12-10 13:22:11 +00:00
Surma
6bfd1f2c29 Merge branch 'dev' into validate-input-files 2020-12-10 13:18:41 +00:00
Surma
8b20aa5f14 Merge branch 'dev' into gitignore 2020-12-10 13:11:45 +00:00
Surma
81e171e684 Merge pull request #891 from kurtextrem/patch-1
Fix typo
2020-12-10 13:06:52 +00:00
Surma
7b4dbbfe2d Merge branch 'dev' into patch-1 2020-12-10 13:03:27 +00:00
XhmikosR
a972dfdeed Update .gitignore 2020-12-10 14:29:53 +02:00
Surma
f190ca6069 Merge branch 'dev' into validate-input-files 2020-12-10 12:26:54 +00:00
Jake Archibald
adb2f7ed50 Use real font. Fixes #895 2020-12-10 10:45:43 +00:00
Jake Archibald
d6de741ddc Copying over old sw-bridge
This is from the webpack build, but the old build failed to make this file work offline. It's the file that handles the "update available" stuff, which is why users using the old version aren't seeing the UI update. We can remove this file once everyone's off the old version.
2020-12-10 10:33:56 +00:00
Peter Fernandes
b5f708a1e6 Fix formatting 2020-12-09 17:17:31 -05:00
Peter Fernandes
15248bf85a Validate that input files exist before attempting to process them 2020-12-09 17:14:43 -05:00
Jake Archibald
5d691af8a1 Simpler fallback 2020-12-09 22:03:34 +00:00
Jake Archibald
722f1c806c Correct service worker name 2020-12-09 21:54:08 +00:00
XhmikosR
522449adc1 Add .DS_Store to .gitignore. 2020-12-09 22:35:41 +02:00
Jacob Groß
07b4e53718 Fix typo 2020-12-09 19:15:12 +01:00
Jake Archibald
c6e6042726 Merge branch 'plan-b' into dev 2020-12-09 17:33:54 +00:00
Ingvar Stepanyan
94b9d08719 Update SIMD token (#889) 2020-12-09 16:26:30 +00:00
Surma
064b152e2a CLI v0.6.0 2020-12-09 16:06:58 +00:00
Jake Archibald
9de95f74fe Copy setting button 2020-12-09 14:36:50 +00:00
Jake Archibald
21a8f62dcc Styled viewport controls & cli copy 2020-12-09 14:28:32 +00:00
Jake Archibald
9062a75541 Cache correct assets (#887)
* Cache correct assets

* Update lib/entry-data-plugin.js

Co-authored-by: Surma <surma@surma.dev>

* Actually commit the fix this time

Co-authored-by: Surma <surma@surma.dev>
2020-12-09 12:20:14 +00:00
Jake Archibald
fec826b106 (Almost the) rest of the redesign (#880)
* Load demo img

* two-up styles

* Back button

* Button size tweak

* Move back btn

* Move options and back button into a single grid

* Simpler max height

* Responsive grid

* Feed index into options

* Option heading themes

* More option styles

* Changing checkbox position

* Theme range input & use transforms

* Range input underline theme

* Checkbox color

* Add toggle

* Reorder

* Arrow revealer

* Round two-up thumb

* Don't bundle CSS urls starting #

* Results in progress

* Fix Safari bugs

* Download blobs

* Loading spinner

* Hook up download button

* Different style for original image

* Mobile design for results

* Remove demo auto-loader

* Remove redundant colors

* Sticky headings
2020-12-09 11:47:23 +00:00
Surma
12889d9d50 Add node version of MozJPEG encoder & decoder (#886)
* Add node version of MozJPEG

* Update paths for MozJPEG encoder
2020-12-09 11:44:46 +00:00
Surma
a19e97b2ed Merge pull request #875 from GoogleChromeLabs/visdf 2020-12-09 10:19:16 +00:00
Surma
5765ea5aa4 Update cli/src/image_data.js 2020-12-09 10:16:02 +00:00
Jason Miller
c11e99c811 collaboration 2020-12-08 18:21:42 -05:00
Jason Miller
76d8a636af de-throned 2020-12-08 18:21:20 -05:00
Ingvar Stepanyan
5758e5db9a Fix PNG decoder returning Rust-owned ImageData 2020-12-08 20:19:48 +00:00
Ingvar Stepanyan
4e4778397f Update cli/src/codecs.js 2020-12-08 19:12:14 +00:00
Surma
aff137218d Update codecs/jxl/Makefile
Co-authored-by: Ingvar Stepanyan <me@rreverser.com>
2020-12-08 18:28:24 +00:00
Surma
fa5bd3d1c6 Update cli/src/image_data.js
Co-authored-by: Ingvar Stepanyan <me@rreverser.com>
2020-12-08 18:24:26 +00:00
Surma
d1533d66a2 Update cli/src/codecs.js
Co-authored-by: Ingvar Stepanyan <me@rreverser.com>
2020-12-08 18:24:16 +00:00
Surma
83b52cabc1 Update cli/src/codecs.js
Co-authored-by: Ingvar Stepanyan <me@rreverser.com>
2020-12-08 18:23:30 +00:00
Surma
c832287fa6 Release build of png 2020-12-08 18:15:45 +00:00
Surma
ed55660c88 Merge remote-tracking branch 'origin/dev' into visdf 2020-12-08 17:56:26 +00:00
Surma
33d60658cd Makefile review 2020-12-08 17:55:49 +00:00
Surma
5af8810e0b CLI code review 2020-12-08 16:33:33 +00:00
Surma
33c3fd3278 Update cli/lib/asset-plugin.js
Co-authored-by: Ingvar Stepanyan <me@rreverser.com>
2020-12-08 16:25:33 +00:00
Surma
f5be882b10 Update cli/README.md 2020-12-08 16:15:13 +00:00
Surma
2a8a2f2952 Merge pull request #878 from veluca93/makefile_sha
Make the JXL Makefile work with both tags and SHAs.
2020-12-08 15:03:49 +00:00
Luca Versari
200e01132c Make the JXL Makefile work with both tags and SHAs. 2020-12-08 11:18:20 +01:00
Surma
fe6cc5c503 Merge pull request #877 from veluca93/update_jxl 2020-12-07 14:37:54 +00:00
Luca Versari
d25d01c705 Update JPEG XL to v0.1.1. 2020-12-07 14:23:58 +01:00
Jake Archibald
7699f75b45 Allow non-0 quality in webp (#876) 2020-12-07 11:35:27 +00:00
Surma
4976ad8481 v0.5.0 2020-12-05 22:07:39 +00:00
Surma
60cef4cb3a README update 2020-12-05 22:05:23 +00:00
Surma
6b8d2e058c Add node version of WebP 2020-12-05 22:04:53 +00:00
Surma
004e18036b Add a CLI README 2020-12-05 21:50:41 +00:00
Surma
f051dcb07c Add node version of WP2 2020-12-05 21:36:31 +00:00
Surma
4e5bb64565 Reenable rotate 2020-12-05 20:50:20 +00:00
Surma
89508c9385 Reenable resize 2020-12-05 20:26:05 +00:00
Surma
951e0dc93a Reenable PNG 2020-12-05 20:23:48 +00:00
Surma
c35c285273 Add node version for JXL 2020-12-05 20:23:44 +00:00
Surma
45fe4d2917 Add node version for imagequant 2020-12-05 20:23:35 +00:00
Surma
ef31e5cbd1 Add node version to AVIF 2020-12-05 20:23:34 +00:00
Surma
d8bd12fc6a Merge remote-tracking branch 'origin/dev' into visdf 2020-12-05 17:26:02 +00:00
Jake Archibald
3abc770053 Site isolation headers & redirect fix (#866)
* Fix redirect behaviour

* Generate headers file

* Specific redirect

* Another try

* And again

* Use dedent
2020-12-05 11:23:32 +00:00
Jake Archibald
a3b341f813 New homepage (#861)
* Paste button

* Logo and animated blobs

* Predictable initial blob position

* Initial blob shape

* Update canvas on resize if not updating every frame

* lol

* Get styles from CSS

* Background blobs

* Fade into the center

* Get initial focus

* Pause time while page is hidden

* Footer

* Optimise amount of initial CSS

* More CSS optimisation

* Install button

* Home page with demo loading

* Tweak size

* Replace thumbnails

* Responsive demo section

* Responsive main section

* Remove debug stuff

* Fix prerender SVG size

* Changes from feedback

* Blob nudges (#872)

* more smaller blobs

* less blobs that are practically invisible

* more dynamic speed range and stronger gravity

* Reverting resize observer change

The content rect is different to getBoundingClientRect

Co-authored-by: Adam Argyle <atom@argyleink.com>
2020-12-05 11:21:33 +00:00
Ingvar Stepanyan
58a6abffbb Threads and threads+SIMD builds for JPEG-XL (#865) 2020-12-02 15:40:16 +00:00
Ingvar Stepanyan
869d3f7732 Update WebP & WebP2 to latest upstream
Includes renaming "speed" to "effort" in WebP2.
2020-12-01 14:36:30 +00:00
Ingvar Stepanyan
618a4d777b Update WebP2 binding code 2020-12-01 14:36:30 +00:00
Ingvar Stepanyan
7266c94f52 Rebuild WebP 2020-12-01 14:36:30 +00:00
Ingvar Stepanyan
d15dba7d20 Make Docker runs interactive
Otherwise they're impossible to cancel via Ctrl+C and this is driving me mad.
2020-12-01 14:36:30 +00:00
Ingvar Stepanyan
0ded493489 Switch to upstream libwebp2 2020-12-01 14:36:30 +00:00
Ingvar Stepanyan
990018f758 Switch to upstream libwebp
The patches were merged now.
2020-12-01 14:36:30 +00:00
Ingvar Stepanyan
4f4eaf01b7 Add comment to thread_level in wp2 2020-12-01 14:36:30 +00:00
Ingvar Stepanyan
19fab33d3c Update webpEncode.ts 2020-12-01 14:36:30 +00:00
Ingvar Stepanyan
6f19d027b4 Delete processor.ts 2020-12-01 14:36:30 +00:00
Ingvar Stepanyan
73499d4a27 Add SIMD origin trial for dev--squoosh.netlify.app 2020-12-01 14:36:30 +00:00
Ingvar Stepanyan
8581785869 Rebase fixes 2020-12-01 14:36:30 +00:00
Ingvar Stepanyan
198ad0fb1b Add SIMD support to libwebp 2020-12-01 14:36:30 +00:00
Ingvar Stepanyan
f0d341aefa Update Emscripten for SIMD 2020-12-01 14:36:30 +00:00
Ingvar Stepanyan
69e62339e6 Fixup 2020-12-01 14:36:30 +00:00
Ingvar Stepanyan
195762f64f Point to custom fork for SIMD builds 2020-12-01 14:36:30 +00:00
Ingvar Stepanyan
a951096aaa Support threads and threads+SIMD in WebP2 2020-12-01 14:36:30 +00:00
Ingvar Stepanyan
24d241564e Simplify how BUILD_DIR is passed 2020-12-01 14:36:30 +00:00
Jake Archibald
3d1ecc1215 Don't restrict drag & drop to images (so it works with wp2 & JXL) 2020-11-23 14:23:21 +00:00
Jake Archibald
25fb1a9c80 Fix dev server config & redirect /editor 2020-11-23 14:20:41 +00:00
Ingvar Stepanyan
3ae1cf86f5 Autoformat staged C++ and Rust 2020-11-21 03:56:30 +00:00
Luca Versari
a699a5c4dc Fix Lossless+Progressive JXL.
Also limit the workaround for memory usage to large images.
2020-11-20 22:27:49 +00:00
Ingvar Stepanyan
613401c541 Add .gitattributes to fold generated files in PRs 2020-11-20 22:21:21 +00:00
Ingvar Stepanyan
f450373e3f Fix nightly Rust pinning; rebuild Oxi 2020-11-20 22:21:21 +00:00
Ingvar Stepanyan
750872aca6 Delete old oxipng files 2020-11-20 22:21:21 +00:00
Jason Miller
beaabe47dc Merge pull request #858 from GoogleChromeLabs/gh-actions
Switch from Travis to Github Actions
2020-11-20 17:08:51 -05:00
Ingvar Stepanyan
8f7369068c Remove sizereport step
Apparently it doesn't exist anymore, even though it was referenced in Travis.
2020-11-20 21:41:57 +00:00
Ingvar Stepanyan
10bfd60e20 Try to fix multiple OS 2020-11-20 21:39:18 +00:00
Ingvar Stepanyan
7f08348509 Delete .travis.yml 2020-11-20 21:37:38 +00:00
Ingvar Stepanyan
f77ddac652 Add Github Action 2020-11-20 21:37:00 +00:00
Jake Archibald
13631f1cfc Extra Wp2 Options (#853)
* wip

* wip

* Add extra options

* Even more options!

* Update src/features/encoders/wp2/client/index.tsx

Co-authored-by: Surma <surma@surma.dev>

Co-authored-by: Surma <surma@surma.dev>
2020-11-20 16:12:38 +00:00
Jake Archibald
f11e692d58 Unset loading on error. Fixes #855 2020-11-20 16:11:57 +00:00
Jake Archibald
f0221b626d Prettier ignore file 2020-11-20 11:51:43 +00:00
Jake Archibald
10c5ed0495 Don't prettify codec code 2020-11-20 10:48:41 +00:00
Ingvar Stepanyan
d945c79796 Use run-p for cross-platform parallel runs (#850) 2020-11-20 08:53:44 +00:00
Jake Archibald
30b628c1b9 Fixing windows build (#849)
Co-authored-by: Ingvar Stepanyan <rreverser@google.com>
2020-11-19 15:03:51 +00:00
Jake Archibald
6ebf94d1b6 Auto edge filter 2020-11-19 11:35:12 +00:00
Jake Archibald
a229662bed Change JXL defaults 2020-11-19 11:27:03 +00:00
Jake Archibald
e995b445ef Updating node version and lockfile 2020-11-19 11:20:04 +00:00
Jake Archibald
6da590c7d0 Merge branch 'rollup-build' into dev
# Conflicts:
#	_headers.ejs
#	codecs/oxipng/pkg/squoosh_oxipng_bg.js
#	src/codecs/avif/encoder.ts
#	src/codecs/oxipng/encoder.ts
#	src/codecs/processor.ts
#	src/codecs/util.ts
#	src/components/intro/imgs/logo.svg
#	src/missing-types.d.ts
#	webpack.config.js
2020-11-19 11:12:29 +00:00
Jake Archibald
56e10b3aa2 Rollup build 2020-11-19 11:00:23 +00:00
Ingvar Stepanyan
fd87ae7d2a Force-rebuild codecs with -O3
Follow-up to https://github.com/GoogleChromeLabs/squoosh/pull/838.

I have no idea what the JS+Wasm diffs in the original PR even represented if they weren't proper rebuilds, but this time I just removed node_modules in all codecs to enforce a proper, clean rebuild for each C++ codec.

(Still think the speed-ups are worth it.)
2020-11-02 17:37:35 +00:00
Surma
67df305594 v0.4.0 2020-11-02 17:00:14 +00:00
Surma
106d733fec Add rotate support 2020-11-02 16:59:29 +00:00
Surma
67c64d4df3 Add ImageQuant support 2020-11-02 16:09:58 +00:00
Surma
75d571cb6c Add proper aspect ratio resizing support 2020-11-02 15:14:07 +00:00
Surma
af954bd9e0 Build preprocessor pipeline 2020-11-02 14:55:29 +00:00
Ingvar Stepanyan
5df7dd7590 Update helper.Makefile 2020-11-02 13:54:41 +00:00
Ingvar Stepanyan
013946b137 Pass CODEC_DIR and LIBAOM_DIR via export
Slightly simpler than passing them in HELPER_MAKEFLAGS.
2020-11-02 13:54:41 +00:00
Ingvar Stepanyan
81c183b0d6 Restructure the AVIF directories
Change the way AVIF finds AOM from default ([avif source]/ext/aom) to custom paths. This allows us to avoid unpacking same archives into duplicate folders, and instead make multiple builds from the same source.
2020-11-02 13:54:41 +00:00
Ingvar Stepanyan
f523db6403 Try out new flags for building only AVIF encoder/decoder
See the discussion in https://github.com/AOMediaCodec/libavif/issues/254 where this was implemented.

This allows us to avoid using ERROR_ON_UNDEFINED_SYMBOLS and build a truly separate encoder/decoder libs.
2020-11-02 13:54:41 +00:00
Ingvar Stepanyan
cc6ea9e11c Switch to -O3 for C++ codecs 2020-11-02 12:46:12 +00:00
Cătălin Mariș
bd4b67037b Further optimize logo.svg (#761)
Co-authored-by: Jake Archibald <jaffathecake@gmail.com>
2020-10-15 15:48:56 +01:00
Ingvar Stepanyan
8c5c97e106 Remove obsolete @ts-ignore 2020-10-07 20:42:48 +01:00
Ingvar Stepanyan
a9d3bd71b5 Bump oxipng
Integrating some upstream fixes from my branch.
2020-10-07 20:42:48 +01:00
Ingvar Stepanyan
0d0a9b4cdf Add COOP+COEP headers 2020-10-07 20:42:48 +01:00
Ingvar Stepanyan
f583770696 Explicitly disable HDR only for encoder 2020-10-07 20:42:48 +01:00
Ingvar Stepanyan
bae243ccdb Add feature detection to OxiPNG 2020-10-07 20:42:48 +01:00
Ingvar Stepanyan
02c113a68f Point oxipng to a patched version
Some upstream changes required for parallel build to work.
2020-10-07 20:42:48 +01:00
Ingvar Stepanyan
600eead007 Disable parallel feature for non-parallel OxiPNG 2020-10-07 20:42:48 +01:00
Ingvar Stepanyan
05416768d5 Update oxipng build system 2020-10-07 20:42:48 +01:00
Ingvar Stepanyan
35d31f2324 Add some comments to explain Rust thread glue 2020-10-07 20:42:48 +01:00
Ingvar Stepanyan
82fadac70e Fixup import.meta in OxiPNG 2020-10-07 20:42:48 +01:00
Ingvar Stepanyan
47f9d22dd8 Switch to crossbeam-channel
Still not perfect due to usage of a static global, but this is much cleaner and more efficient thanks to proper blocking of Workers that wait for new messages instead of a manual spin-loop.
2020-10-07 20:42:48 +01:00
Ingvar Stepanyan
9420dba3bc Parallel OxiPNG improvements
- Refactor to work around Chromium's issue with postMessage queuing. https://bugs.chromium.org/p/chromium/issues/detail?id=1075645
 - Convert codec code to TypeScript.
 - Make separate parallel and non-parallel builds.
 - Switch to nightly Rust for OxiPNG to allow parallel builds (but also reuse it for regular builds to avoid installing two toolchains).
2020-10-07 20:42:48 +01:00
Ingvar Stepanyan
e462875807 Type fix for gesturestart event 2020-10-07 20:42:48 +01:00
Ingvar Stepanyan
0747d2c419 Rework fallback for postMessage issue
Now initialise all workers with module+memory separately, and then instead of using postMessage to send thread pointers, push them into a crossbeam-deque on the Rust side.

Rayon already depends on crossbeam-dequeue, so we're not even adding another dependency, and this model allows us to push "tasks" (thread pointers) on the main thread and pop them on worker threads in arbitrary order without sacrificing correctness.
2020-10-07 20:42:48 +01:00
Ingvar Stepanyan
4c658b79ef OxiPNG + threads PoC 2020-10-07 20:42:48 +01:00
Ingvar Stepanyan
685558847f Multithread AVIF PoC 2020-10-07 20:42:48 +01:00
Jason Miller
612cee0011 not-fully-working autoOptimize for oxipng 2020-10-05 22:51:53 -04:00
Jason Miller
911ca32c35 Fancy progress output 2020-10-05 22:51:23 -04:00
Jason Miller
49cb8b268c Fix misnamed butteraugliDistanceGoal parameter 2020-10-05 22:50:49 -04:00
Jason Miller
4946268ae2 Move image decoding into the worker pool 2020-10-05 22:50:06 -04:00
Jason Miller
4487da9e9e Add Babel to fix Node <14 compat 2020-10-05 22:45:36 -04:00
Jason Miller
09f65d0cd7 Fix worker_pool for node 2020-10-05 22:38:23 -04:00
Trevor Manz
63ac34a662 Promisify emscripten modules & fix webp examples (#817) 2020-09-30 00:05:59 +01:00
Surma
261b3ad013 0.3.1 2020-09-21 23:58:39 +01:00
Surma
1b886aa4e2 v0.3.0 2020-09-21 18:21:00 +01:00
Surma
1d5fd98a3e Add support for no-value encoder flags 2020-09-21 18:20:02 +01:00
Surma
588d5ad44e Add OxiPNG 2020-09-21 18:14:42 +01:00
Surma
139b635eed Add PNG encoding support 2020-09-18 16:00:29 +01:00
Surma
516c0aa8e7 Update wasm-bindgen version 2020-09-17 14:49:58 +01:00
Surma
273b4211c9 Add support for PNG decoding (encoding still buggy) 2020-09-16 23:59:06 +01:00
Surma
ef920ac6ba Add suffix support 2020-09-16 14:58:04 +01:00
Surma
f445a5dcbe Parameterize auto optimizer 2020-09-16 13:32:09 +01:00
Surma
42f9e4aed2 Merge pull request #828 from GoogleChromeLabs/create-dir
Ensure node_modules is created
2020-09-16 10:36:11 +01:00
Jake Archibald
e14790f0b9 Ensure node_modules is created 2020-09-16 10:24:20 +01:00
Velu S Gautam
dfee848a39 Update example.html (#827)
rawImage is a Uint8ClampedArray and doesn't have width and height property.
2020-09-16 07:42:32 +01:00
Surma
c8dc88f8a1 Add auto optimizer 2020-09-15 17:53:49 +01:00
Jake Archibald
a437afdf2b Update AVIF build to produce shipped wasm (#823)
* argh

* It works!

* Silly me

* Changes following feedback
2020-09-15 11:08:20 +01:00
Surma
1d7b6ab13e v0.2.0 2020-09-14 17:23:01 +01:00
Surma
1e700cd7c3 Add better output formatting 2020-09-14 17:20:49 +01:00
Surma
01c04d4a72 Add worker pool implementation 2020-09-14 17:05:02 +01:00
Surma
df45b996d1 v0.1.3 2020-09-09 23:44:01 +01:00
Surma
c9a271f57a Use __filename for worker instead 2020-09-09 23:43:30 +01:00
Surma
c37f798565 v0.1.2 2020-09-09 23:38:39 +01:00
Surma
e9b9993189 Add shebang to output 2020-09-09 23:38:26 +01:00
Surma
96b1ec2356 v0.1.1 2020-09-09 23:30:07 +01:00
Surma
e5d254ad80 Add package-level bin 2020-09-09 23:29:48 +01:00
Surma
b1b3c8c461 v0.1.0 2020-09-09 18:57:32 +01:00
Surma
1f2f5d1c61 Add .npmignore 2020-09-09 18:52:21 +01:00
Surma
12a719f05a Make it public 2020-09-09 18:33:47 +01:00
Surma
28c7b7aa94 Put right package name 2020-09-09 18:26:42 +01:00
Surma
6e3e6af70e Moar prettier 2020-09-09 18:25:32 +01:00
Surma
31118daa18 Add .gitignore 2020-09-09 18:23:51 +01:00
Surma
47fb7f9f71 Rollup for proper CLI 2020-09-09 18:22:50 +01:00
Surma
3b07862efb Use workers for parallelization 2020-09-09 15:48:56 +01:00
Surma
f0eb79f2f1 Use all the codecs 2020-09-09 15:22:39 +01:00
Surma
ebdb00f50d Keep planarized reference image around across runs 2020-09-09 12:50:02 +01:00
Surma
4b6334a212 Switch to Butteraugli and simpel CLI 2020-09-08 00:18:57 +01:00
Surma
483daa0493 Trying out more 2020-08-27 20:01:36 +01:00
Jake Archibald
4768bc17ba 1.12.0 2020-08-26 12:57:35 +01:00
Surma
0934c6c00f Merge pull request #804 from GoogleChromeLabs/avif-options 2020-08-26 12:53:37 +01:00
Jake Archibald
9d81a9cd57 Merge branch 'dev' into avif-options 2020-08-26 12:39:40 +01:00
Jake Archibald
239ffeb7a7 Comment out grayscale and 4:2:0 for now 2020-08-26 12:36:59 +01:00
Jake Archibald
95570c8b3c Revert "Merge pull request #800 from GoogleChromeLabs/mozjpeg_dec"
This reverts commit 5715fb7b1b, reversing
changes made to 2c923e5239.
2020-08-26 12:28:06 +01:00
Jake Archibald
6e52ac2a73 Simpler canDecode check 2020-08-26 11:41:21 +01:00
Jake Archibald
fd5c557065 Cheeky smaller wasms 2020-08-26 11:09:15 +01:00
Jake Archibald
0abb6f18ba Update options when updating state. 2020-08-25 16:54:01 +01:00
Jake Archibald
4e5a810770 Avoid caching the decoder if the browser already supports it 2020-08-25 14:31:20 +01:00
Jake Archibald
8a81792bd5 Finger-in-the-air defaults 2020-08-25 14:13:37 +01:00
Jake Archibald
3f57f9fef1 Feature test decoding capability 2020-08-25 14:13:21 +01:00
Jake Archibald
549e1fc50a Use bt709 if not lossless so colour is correct 2020-08-25 14:12:26 +01:00
Jake Archibald
f3749a4e24 Ensure that mins can't be greater than maxs 2020-08-25 13:39:28 +01:00
Jake Archibald
e316b0d667 Use identity coefficients for true lossless 2020-08-25 13:39:01 +01:00
Jake Archibald
8f2dcb5f48 Options mostly working 2020-08-25 13:11:10 +01:00
Surma
0b4a673b13 It runs but not really 2020-08-25 13:03:10 +01:00
Surma
8c56d16aea Switch to dssim_core 2020-08-24 17:06:08 +01:00
Surma
5715fb7b1b Merge pull request #800 from GoogleChromeLabs/mozjpeg_dec 2020-08-24 14:25:37 +01:00
Surma
cd33a2f759 Fine. Count the lines. 2020-08-24 14:21:35 +01:00
Surma
ee561bb00e Allow more than one scanline at a time 2020-08-24 14:03:44 +01:00
Surma
773208d76e Trying dssim 2020-08-24 14:01:48 +01:00
Surma
75275a5596 Update codecs/mozjpeg/dec/mozjpeg_dec.cpp
Co-authored-by: Ingvar Stepanyan <rreverser@google.com>
2020-08-24 14:00:38 +01:00
Surma
8cd811cafd Review 2020-08-24 12:43:12 +01:00
Surma
4e090ea2f8 Remove unnecessary includes 2020-08-21 16:43:36 +01:00
Surma
6b007a0235 Update paths for Squoosh PWA 2020-08-21 16:33:58 +01:00
Surma
c23d1091e7 Implement decoder 2020-08-21 16:31:04 +01:00
Surma
d4f8b7f38b Add LICENSES to codecs 2020-08-21 13:44:36 +01:00
Surma
2c923e5239 Merge pull request #722 from GoogleChromeLabs/avif 2020-08-12 11:15:45 +01:00
Surma
fe52c9b307 Fix Makefile 2020-08-11 18:49:07 +01:00
Surma
3745a3fff1 Revert "Enable address sanitizer"
This reverts commit d89e846896.
2020-08-11 18:41:42 +01:00
Surma
d89e846896 Enable address sanitizer 2020-08-11 18:41:09 +01:00
Ingvar Stepanyan
db6dea846a AVIF Makefile improvements 2020-08-05 15:56:36 +01:00
Ingvar Stepanyan
8036579a3c RawImage -> ImageData; report errors with null 2020-08-05 15:10:33 +01:00
Ingvar Stepanyan
0807fa4b9a Remove obsolete free_result refs 2020-08-05 14:40:15 +01:00
Surma
3cda8285a1 Update src/lib/util.ts
Co-authored-by: Ingvar Stepanyan <rreverser@google.com>
2020-08-05 14:40:09 +01:00
Surma
0218d0aac5 Avoid leaks during encoding 2020-08-05 14:40:04 +01:00
Surma
cfba6e7bd5 Disable examples 2020-08-05 14:39:58 +01:00
Surma
c6015e2e8d Don't copy dem pixels 2020-08-05 14:39:54 +01:00
Surma
94a2a7b32f Free pixels 2020-08-05 14:39:50 +01:00
Surma
03f33847a3 Code review 2020-08-05 14:39:46 +01:00
Surma
563b558204 Remove free() method 2020-08-05 14:39:41 +01:00
Surma
3c92f2d531 Download sources as tar.gz 2020-08-05 14:39:35 +01:00
Surma
f5ab9a9a59 Remove CFLAGS and improve git folder targets 2020-08-05 14:39:30 +01:00
Surma
7893660679 Fix alpha channel in encoder 2020-08-05 14:39:26 +01:00
Surma
15dac42a7f Remove stray files 2020-08-05 14:39:21 +01:00
Surma
53298a23ad Remove package.json and move git to Makefile 2020-08-05 14:39:14 +01:00
Surma
7ffa45ba86 Update libavif and libaom 2020-08-05 14:39:07 +01:00
Surma
ee99cf6e0b Move to makefile for AVIF 2020-08-05 14:39:01 +01:00
Ingvar Stepanyan
2edb8cbd7e Upgrade AVIF decoding code
- Update to newer APIs.
 - Avoid manual pixel-by-pixel copy in favour of decoding directly to desired format & bit depth.
 - Avoid use-after-free by cloning the Uint8Array Wasm memory view into a JS-owned Uint8Array right away.
2020-08-05 14:38:56 +01:00
Ingvar Stepanyan
0ac3d17969 Move AOM cloning to napa 2020-08-05 14:38:51 +01:00
Ingvar Stepanyan
1baa823d77 Upgrade libavif 2020-08-05 14:38:48 +01:00
Ingvar Stepanyan
368ad9505e Use make -j in AVIF 2020-08-05 14:38:42 +01:00
Ingvar Stepanyan
08c267a98b Add LTO to AVIF 2020-08-05 14:38:37 +01:00
Ingvar Stepanyan
0c3ef3fdf5 Migrate AVIF to Emscripten upstream 2020-08-05 14:38:33 +01:00
Surma
17dcc9c7d4 Update AVIF encoder README 2020-08-05 14:38:31 +01:00
Surma
ac9a7767d2 Expose some options for AVIF 2020-08-05 14:38:29 +01:00
Surma
c29006d593 Add AVIF encoder without options 2020-08-05 14:38:26 +01:00
Surma
e1ab43b76f Add AVIF encoder 2020-08-05 14:38:23 +01:00
Surma
409df481db Fix HDR image support in AVIF decoder 2020-08-05 14:38:19 +01:00
Surma
02807aab32 Add AVIF decoder to squoosh 2020-08-05 14:38:13 +01:00
Surma
34cb55978f Add avif decoder binaries 2020-08-05 14:36:21 +01:00
Surma
d0f5d5a644 Make build-cpp.sh executable 2020-08-04 13:35:58 +01:00
Surma
37f09245a6 Merge pull request #790 from GoogleChromeLabs/button-position 2020-08-04 09:51:26 +01:00
Ingvar Stepanyan
c43f75f1f2 Merge branch 'dev' into button-position 2020-07-31 19:49:14 +01:00
Ingvar Stepanyan
227d32be7b Fix install button position
Add `position: relative` to the parent `div` that owns the scrollbar, so that Install button positions itself relative to it and not to the whole document.

Fixes a bug where button would get rendered on top of a scrollbar.
2020-07-31 18:33:20 +01:00
Pete LePage
87955ab9a0 Merge pull request #784 from petele/analytics-update-3
Don't fire install analytics on hidden pages
2020-07-31 10:43:40 -04:00
Pete LePage
ecb0b15cdc Merge branch 'dev' into analytics-update-3 2020-07-31 10:28:23 -04:00
Jake Archibald
ed451e4dfa "native" to "builtin" (#788) 2020-07-30 14:43:46 +01:00
Ingvar Stepanyan
1a26057452 Switch from napa to curl
Instead of using 127 deps brought by napa just to download the one dependency we actually care about, just use curl & tar directly from Makefile.
2020-07-30 13:28:41 +01:00
Ingvar Stepanyan
98b930abde Switch from napa to curl
Instead of using 127 deps brought by napa just to download the one dependency we actually care about, just use curl & tar directly from Makefile.
2020-07-30 12:31:20 +01:00
Jake Archibald
ddbeaa0870 Merge branch 'dev' into analytics-update-3 2020-07-29 11:52:24 +01:00
Pete LePage
b69dc4c7f4 Merge pull request #773 from petele/maskable-icon
Adds a maskable icon
2020-07-28 13:56:23 -04:00
Pete LePage
ed6b8b89c6 Merge branch 'dev' into maskable-icon 2020-07-28 13:52:20 -04:00
Surma
2580f1e292 Merge pull request #785 from GoogleChromeLabs/hqx-build 2020-07-28 18:50:43 +01:00
Pete LePage
2ac684f98f Merge branch 'dev' into maskable-icon 2020-07-28 13:45:52 -04:00
Pete LePage
b8d921ec16 Merge branch 'dev' into analytics-update-3 2020-07-28 13:45:20 -04:00
Ingvar Stepanyan
9c0a375f01 Fixup HQX build
Porting over few more improvements from #777 that can be applied to HQX despite the older Rust version:

 - Removed Cargo.lock from .gitignore (the file itself was added in the original PR, but is still ignored and wouldn't get committed on changes).
 - Removed couple of stray .DS_Store accidentally added in that PR.
 - Added a `--locked` to `wasm-pack` build to make sure we rebuild HQX with the same versions from Cargo.lock.
 - Removed separate `wasm-strip` and `wasm-opt -Os` steps from build.sh in HQX because they're already included in wasm-pack, and running twice only makes build slower.
2020-07-28 18:37:17 +01:00
Ingvar Stepanyan
d1cff7d84e Consolidate C++ builds
Use a shared base image with fixed Emscripten version, autotools and optimisation flags for all C++ codecs.

Additionally, move build commands for codecs themselves to Makefile - they're already platform-specific, and Make allows for better caching and parallelisation that custom ad-hoc scripts.

This is essentially same as #777 but for C++.
2020-07-28 18:05:09 +01:00
Surma
9c2b582986 Merge branch 'dev' into maskable-icon 2020-07-28 18:03:09 +01:00
Ingvar Stepanyan
e342766cbf Switch vals to thread_locals
It's not possible to share them across threads, so in case we decide to use multithreading in the future, it's best to mark them as thread_local right away, even if it's a no-op right now.
2020-07-28 16:35:00 +01:00
Ingvar Stepanyan
f1cd6a87da Update JS/Wasm 2020-07-28 16:35:00 +01:00
Ingvar Stepanyan
39e5741cb2 Fix few more issues detected in MozJPEG wrapper 2020-07-28 16:35:00 +01:00
Ingvar Stepanyan
93cbe557cd Simplify memory management for other C++ codecs 2020-07-28 16:35:00 +01:00
Ingvar Stepanyan
97931bad22 C++ify imagequant memory management 2020-07-28 16:35:00 +01:00
Ingvar Stepanyan
1f35c40d3f Create Uint8ClampedArray from C++ 2020-07-28 16:35:00 +01:00
Ingvar Stepanyan
c39383333f Localize variables in imagequant 2020-07-28 16:35:00 +01:00
Ingvar Stepanyan
4fc18de5f9 Fix use-after-free in imagequant 2020-07-28 16:35:00 +01:00
Pete LePage
aac30e6fd3 Don't fire install analytics on hidden pages 2020-07-27 12:46:15 -04:00
Surma
45785bcca3 1.11.4 2020-07-24 14:59:47 +01:00
Surma
f36cb5d3ef Merge pull request #777 from GoogleChromeLabs/consolidate-rust 2020-07-24 14:57:55 +01:00
Jake Archibald
b7f7a5ac0a Rebuild resize wasm 2020-07-24 14:52:24 +01:00
Surma
dd895f026b Remove old wasm files 2020-07-24 14:25:55 +01:00
Surma
548c126521 Merge remote-tracking branch 'origin/dev' into consolidate-rust 2020-07-24 13:30:16 +01:00
Surma
ca00a22303 Reset HQX to old build system 2020-07-24 13:29:40 +01:00
Jake Archibald
1ce6dd73d8 Fix clamping. Fixes #782. Fixes #711. 2020-07-24 12:52:21 +01:00
Surma
ff7dc2c4cf Merge pull request #725 from almandsky/fix_hml 2020-07-20 11:45:10 +01:00
Surma
117b87132e Merge branch 'dev' into fix_hml 2020-07-20 11:35:28 +01:00
Ingvar Stepanyan
42e7a7e165 Merge branch 'dev' into consolidate-rust 2020-07-15 17:48:35 +01:00
Jason Miller
796324ad71 Update webpack configuration for Webpack 4 2020-07-15 17:37:00 +01:00
Jason Miller
cf1a718534 Fix windows builds breaking due to mixed paths 2020-07-15 17:37:00 +01:00
Ingvar Stepanyan
718427badb Use lockfiles & update Rust deps 2020-07-14 17:23:31 +01:00
Ingvar Stepanyan
c5c520a71d Consolidate Rust builds
This consolidates Rust build process for various codecs into a single top-level image that is built once and reused.

This ensures that we use same version of tools across codecs (now controlled from a single place), simplifies build configs and commands, speeds up common builds and reduces disk space taken by Docker images by reusing same one.

Additionally, this PR renames all codecs to squoosh-* to work around the https://github.com/rustwasm/wasm-pack/issues/829 (which has been already fixed on master of wasm-pack but not released in a while), as well as adds `publish = false` to Cargo.toml to avoid accidental publishing for now.

I'm planning to do similar for Emscripten in a separate PR, although abilities to share configs there are much more limited due to lack of package manager in C++.
2020-07-14 17:20:40 +01:00
Jake Archibald
17ffa57a8b Updating oxi build & enabling alpha optimisations (#776)
* Updating oxi build & enabling alpha optimisations

* Renaming package
2020-07-14 16:19:35 +01:00
Jason Miller
005d5180b4 Merge branch 'dev' into fix_hml 2020-07-13 21:52:43 -04:00
Pete LePage
ce9b96994c Merge branch 'dev' into maskable-icon 2020-07-08 10:29:27 -04:00
Jake Archibald
a1fb445b06 1.11.3 2020-07-08 14:55:39 +01:00
Pete LePage
8a516131ea Updates to analytics for PWAs (#772)
* Updates to analytics experiments

* adjust hover color on install button

* adjust event action names

* adjust utm_source for share_target launches

Co-authored-by: Jake Archibald <jaffathecake@gmail.com>
2020-07-08 14:53:36 +01:00
Ingvar Stepanyan
9816be83ab Add Windows to Travis config (#775)
This will help to catch somewhat frequent Windows-specific issues in the future (latest example: #774).
2020-07-08 14:28:31 +01:00
Pete LePage
63f607a3ea Adds a maskable icon 2020-07-07 14:01:18 -04:00
Jake Archibald
57418034c4 1.11.2 2020-07-07 16:08:26 +01:00
Jake Archibald
3892490023 Update size report branch 2020-07-07 16:08:13 +01:00
Anton
5bedff583b Update privacy link (#771)
The link doesn't work, as the default branch has been renamed
2020-07-07 16:06:33 +01:00
Jake Archibald
d94835402f 1.11.1 2020-07-02 14:29:00 +01:00
Jake Archibald
b7e45ab843 Bringing live back in sync 2020-07-02 14:28:40 +01:00
Leo Postovoit
8313246fd1 Fix typo for "spatial" (#768) 2020-07-02 14:25:51 +01:00
Surma
2b3cafb1f4 1.11.0 2020-06-24 16:22:06 +01:00
Surma
d52698f005 Merge remote-tracking branch 'origin/dev' into live 2020-06-24 16:21:49 +01:00
Surma
6ad28c0b5c Merge pull request #765 from petele/dimension 2020-06-24 16:15:16 +01:00
Surma
c76dabf063 Merge branch 'dev' into dimension 2020-06-24 16:12:59 +01:00
Surma
e6d8bac9c5 Merge pull request #764 from petele/install-prompt 2020-06-24 16:12:48 +01:00
Jake Archibald
42e43730c8 Naming changes 2020-06-24 15:16:38 +01:00
Jake Archibald
5c17fba349 Minor tweaks 2020-06-24 15:12:48 +01:00
Pete LePage
85eb94b725 Set the dimension value 2020-06-24 09:54:54 -04:00
Pete LePage
4fa73be842 Apply suggestions from code review
Co-authored-by: Surma <surma@surma.dev>
2020-06-24 09:40:56 -04:00
Surma
7c89d09139 Add missing prop to navigator 2020-06-24 14:08:52 +01:00
Pete LePage
079e56f1e1 Use a dimension to note how the user opened squoosh 2020-06-23 16:34:47 -04:00
Pete LePage
6065ceabfe update readme 2020-06-23 16:16:32 -04:00
Pete LePage
265e6db2bd Adds install button to Squoosh 2020-06-23 16:10:40 -04:00
Surma
3a5c0aa30c Merge pull request #757 from GoogleChromeLabs/fixup-clang-format 2020-05-14 17:02:50 +01:00
Ingvar Stepanyan
f0c3ec9d51 Fixup clang-format
I've actually comitted files formatted with column limit of 100, but forgot to include updated .clang-format 🤦🏻‍♂️
2020-05-14 16:30:12 +01:00
Ingvar Stepanyan
1ae93b527c Revert docker run --rm change 2020-05-13 19:39:27 +01:00
Ingvar Stepanyan
a95cb740bf Format C / C++ with Chromium style 2020-05-13 19:39:27 +01:00
Ingvar Stepanyan
de543b3206 Further speed improvements
- Store Emscripten cache inside node_modules/.em_cache. Docker image ships without LTO libs, so Emscripten has to rebuild stdlibs on every build otherwise.
 - Merge webp_enc + webp_dec build scripts. Core libwebp library is same in both cases, so there's no point in storing and building two copies of it.
2020-05-13 19:39:27 +01:00
Ingvar Stepanyan
1542bfb7fd Tweak up compile flags
- Remove unnecessary `-x c++`.
 - Improve rebuild speed by caching:
   - Remove `-f` from `autoreconf` to reuse generated configure scripts.
   - Remove `--rm` from `docker run` to avoid rebuilding Emscripten stdlib.
   - Add `-C` to `./configure` to reuse stored information about `emcc`.
   - Remove `rm -rf build` from WebP encoder/decoder.
2020-05-13 19:39:27 +01:00
Sky Chen
f95954a9f1 Merge branch 'master' into fix_hml 2020-05-05 15:03:25 -07:00
Ingvar Stepanyan
bc8d75128f Remove libpng-dev dependency from WebP (#752)
It's unnecessary as we disable PNG support via ./configure anyway.

Co-authored-by: Surma <surma@surma.dev>
2020-05-05 13:23:12 +01:00
Ingvar Stepanyan
d3252bb1bb Add LTO for C++ builds (#755)
* Add LTO for C++ builds

This didn't have much effect on fastcomp builds, but provides further size savings with new LLVM backend we switched to in #750 (and fixes the MozJPEG size regression from the same PR).

In the future we won't need to pass `--llvm-lto 1` explicitly, but latest Emscripten Docker image doesn't contain the Emscripten version with the necessary fixes for this.

* Delete build.log

Co-authored-by: Jake Archibald <jaffathecake@gmail.com>
2020-05-05 11:54:28 +01:00
Surma
83d9d2c764 Disable renovate 2020-05-05 11:19:40 +01:00
Surma
476268fe19 Merge pull request #748 from GoogleChromeLabs/cleanup 2020-05-01 17:21:37 +01:00
Ingvar Stepanyan
74492af675 Merge branch 'master' into cleanup 2020-05-01 17:08:08 +01:00
Surma
bd4179aff2 Merge pull request #751 from GoogleChromeLabs/make-j 2020-05-01 16:48:45 +01:00
Ingvar Stepanyan
27ae47117e Leverage make -j to parallelise C++ builds
We've been running each Make command in a single thread, resulting in fairly slow builds for C++ codecs.

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

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

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

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

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

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

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

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

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

* Fix build on Windows

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

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

* It works in wasm

* Integrate with UI

* Remove benchmark

* Integrate Hqx into Resizer module

* Link against repo for hqx

* Remove unused defaultOpts

* Re-add test file

* Adding size dropdown

* Chrome: go and sit on the naughty step

* Better docs

* Review

* Add link to crbug

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

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

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

* More testing

* More testing

* Removing transfer for now

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

* Disable minification to ease debugging

* Adding navigate lock

* lol oops

* Add minifying back

* Removing minification again, for debugging

* Removing broadcast channel bits, to simplify the code

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

This reverts commit 0b2a3ecf2986aae0dd65fdd1ddda2bd9e4e1eac7.

* I think this fixes it

* Refactor

* Suppress flash of home screen during share target

* Almost ready, so switching to real name

* Removing log

* Ahh yes the trailing comma thing

* Removing use of BroadcastChannel

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

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

* Add clamping for color space conversions

* Clip for demultiplication as well

* Fixing linear <-> srgb conversion

* Update benchmark

* Decouple srgb calculations

* Generate lookup tables

* Update src/codecs/resize/options.tsx

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

* Add benchmark to resize

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

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

* Expose resize algorithms

* Lanczos3 working!

* lol copy paste

* Adding support for other resizers

* Don’t track generated README

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

* Fix trailing commas for function calls

* Reverting trailing comma change

* Avoiding trailing comma rule for imports

* I never know what the right thing to do is

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

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

* Update package.json

* Update README.md

* Update README.md

* Use cmake for libwebp

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

* Clarifying comment

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

* Move history management to Compress component

* Remove unused pathname property from history

* Rename history listener functions

* Use history.back instead of history.replace

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

* Add netlify redirects file

* Use 301 status code for redirect

* Cleanup _redirects file

* Use 200 status code for redirects

* Simplify onPopState function

* Always redirect to 301 with url rewrite

* Remove redundant history function

* Remove file check on render. Call openEditor synchronously

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

* Simplify openEditor condition

* Update early return condition

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

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

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

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

* Flipping resize when orientation changes

* Hack around critters issue.

* Removing generator. Huge perf boost.

* Stable positioning

* Creating input processors

* Allowing rotation to be changed

* Reverting old change

* Adding tooltips

* No more flip

* Removing need for wrapper element boxing

* Adding comment

* Addressing nits

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

* minor fixes

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

* Let's try this.

* Adding comment

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

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

* Remove babel and associated plugins

* Re-enable strictNullChecks and noImplicitAny

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

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

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

* Don't prerender analytics

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

* PR feedback

* Excluding service worker stuff from prerender

* Build SW in dev

* Let's give this a try

* lol

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

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

* Stupid file

* Ditching changelog for now. Using package json.

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

* I hate this file

* Inline main script

* Reverting change to do a fairer perf comparison

* Inlining again. Weeeeee!

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

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

* rename + fix random extra character

* Fixing worker typings

* Fixing types properly this time.

* Once of those rare cases where this matters.

* Naming the things.

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

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

* MVP service worker

* Two stage-service worker

* Fix prerendering by conditionally awaiting Custom Elements polyfill.

* Fix icon 404's

* add doc comment to autoswplugin

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

* Working around some glitching when page was scrolled.

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

* Adding separate chroma quality.

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

* Simplifying chroma subsample

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

* Undo copy settings across.

* Oops

* Fixing stupid minification bug

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

* Download button on the outside.

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

* Fixing thumb on two-up

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

* Allow multi-panel to keep one open only

* Edge cases for one-open

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

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

* Adding labels to collapsed view

* Adding height animation to multi-panel

* Fixing animation bugs

* Expand/collapse icon

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

* Range bubble now behaves properly on mobile

* No longer need this.

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

* Commenting stuff to keep the build happy

* Revealing sections

* Custom select elements & more form work

* Range input styles

* Text fields with inputs do the right thing

* Safari & Firefox fixes

* Large compress select

* oops

* MozJPEG options updated

* OptPNG options

* These asserts weren't true

* Generic options

* WebP options

* Hiding "edit" when "original image"

* Download icon

* Copy setting button - still not happy with this

* Progress indicator

* Loading icon enter/exit anim

* Preventing controls going under options

* Ahh so that's what was causing scrolling

* Ahh so that's what was causing outlines

* Simplifying range styles and fixing cross-browser

* Processing custom element styles

* Get precision from step by default

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

* Don't need that many steps

* Avoid having an element that covers the pinch zoom

* Preventing overlap with zoom controls

* Prevent ts warning

* Fixing spinner position

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

* OCD

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

* Flattening CSS

* Fixing zoom input in Firefox

* Fixing 'container' scaleTo

* two-up closer design match & smaller line

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

* Plugging in new processor

* Fixing decorator

* MozJPEG free issue

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

* Better comment

* Ooops, half-typed comment

* Uncommenting problematic line

* Surma fixed it!

* Abstracting WASM initialisation

* Better comment

* Don't need this.

* Adding ticket

* noInitalRun

* Reverting MozJPEG issue demo

* Making a const for worker timeout

* Inline docs

* Bail early rather than nesting

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

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

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

Also improving the transition from intro to compressor.

* Showing error if app fails to load.

* lol these aren't async

* Please don't tell anyone I did this

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

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

This reverts commit f5964635b2.

* Fix reflection

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

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

* Update mozjpeg encoder

* Update optipng encoder

* Update webp decoder

* Update webp encoder

* Remove old codec build tasks

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

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

* Handling SVG without width/height set.

* Simplifying maths

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

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

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

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

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

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

* make _functions private

* fix spelling errors

* spacing fix

* spelling fix

* store result of _getClosestHeading and avoid calling twice.

* remove returns that are not needed

* move getClosestHeading as separate function

* re-thinking casting and logic

* reflect code review

* do not remove focus when hit spacebar

* add comments and fix type

* handle heading keyevents

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

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

* Using ! on form

* Haha oops

* Using createImageBitmapPolyfill

* Updating package.json

* Oops again

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

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

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

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

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

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

* Utilities used by this PR

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

* Add a dummy comment to test netlify deploy

* Remove commented-out code.

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

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

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

* Remove commented-out svg fill

* Remove dummy comment

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

* Dependency updates

* Remove color animations from dnd overlay

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

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

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

* Remove box-shadow animation.

* Simplify font stack

* Remove commented out code

* Remove gzip compression from size component

* Remove memoization bits

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

* Remove unused packages.

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

* Simplify calculateSize()

* Fix types for FileSize!

* Remove FileSize title

* Make delta variable consistent.

* Skip passing compareTo value for original image

* Remove manual focus

* Fix whitespace

* remove unused keyframes

* remove pointless flex-wrap property

* Remove unused resetZoom() method

* Remove pointless flex properties

* Use `on` prefix for event handling

* Remove pointless justify-self property

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

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

* Make the options panels responsive :)

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

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

* Fix top/bottom options panels being reversed

* remove commented out code

* lockfile

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

* Remove minimum delta for compare size

* Rename data prop to file.

* scale int -> float

* remove tabIndex

* Remove old icon files

* Add width to options panels

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

* example actually works

* Expose compression level options

* Disable crypto and path module emulation in webpack

* Update README

* Remove small image

* Use -O3 on optipng

* Free memory after copy

* Handle unexpected file reader return types

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

* Update webp_dec README

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

* This doesn't work

* This does!

* Better cast?

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

* Adding options to mozjpeg wasm

* Updating packages

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

* Adding mozjpeg options UI

* Forgot about this enum

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

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

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

* Moving to our own cleanSet and cleanMerge.

* Oops, this can be simpler

* Allow the path to be a number

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

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

* Add missing types

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

* Use `_` for private fields

* Remove rogue handler

* Remove impossible fallback value

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

* will-change for the button ripple

* Guard against mutliple button action clicks

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

* remove transitionend

* Replace inline ref callback with linkRef

* showError only accepts strings

* Remove undefined initialization

* Throw on error

* Add missing error type.

* `SnackBar` ▶️ `Snack`

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

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

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

* Adding ZX option

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

* Putting it behind a konami code

* Better comments

* Adding comment

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

The key to upload is in travis env variable.

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

* Holy shit struct binding

* Options in the encoder!

* Integrating webp options

* Addressing feedback

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

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

* Switching to orientation attr

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

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

* Hoisting getFileData

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

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

* Fixing PR issues

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

* Case sensitivity change

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

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

* Adding WebP check

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

* Adding native JPEG & file size output

* Removing log

* Fixing blob typing

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

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

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

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

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

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

* Dep updates.

* Remove commented out code.

* Fix Encoder typing

* Fix lint issues

* Apparently I didnt have tslint autofix enabled on the chromebook

* Attempt to fix layout/panning issues

* Fix missing custom element import!

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

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

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

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

* lint fixes.

* cleanup

* smaller PR feedback fixes

* rename "jpeg" codec to "MozJpeg"

* Formatting fixes for Options

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

* Handle canvas errors

* Throw if quality is undefined, add default quality

* add note about temp styles

* add note about temp styles [2]

* Renaming updateOption

* Clarify option input bindings

* Move updateCanvas() to util and rename to drawBitmapToCanvas

* use generics to pass through encoder options

* Remove unused dependencies

* fix options type

* const

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

* Display encoding errors in the UI.

* I fought typescript and I think I won

* This doesn't need to be optional

* Quality isn't optional

* Simplifying comlink casting

* Splitting counters into loading and displaying

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

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

* Ignoring CSS defs
2018-05-04 09:20:34 -07:00
Jason Miller
5f7f9e32a8 Merge pull request #23 from GoogleChromeLabs/dont-transpile-classes
Don't transpile ES Classes.
2018-05-03 12:04:25 -07:00
Jason Miller
1196d4f54f Merge pull request #19 from GoogleChromeLabs/prerendering
Prerendering!
2018-05-03 12:01:30 -07:00
Jason Miller
da53b5fedc Add more long-term caching headers, fix missing hash in main.css, switch Workbox to use locally generated files instead of Fastly (improves TTI), delay SW install by 1s. 2018-04-22 00:36:58 -04:00
Jason Miller
c5e3f9e737 Remove env preset and decorator plugin 2018-04-18 14:44:43 -04:00
Jason Miller
3b47ee6fe5 Don't transpile ES Classes. 2018-04-17 21:26:28 -04:00
Jason Miller
aa02cf2157 Add firebase hosting 2018-04-17 15:34:17 -04:00
445 changed files with 49535 additions and 14977 deletions

View File

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

2
.clang-format Normal file
View File

@@ -0,0 +1,2 @@
BasedOnStyle: Chromium
ColumnLimit: 100

View File

@@ -7,3 +7,6 @@ end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[Makefile]
indent_style = tab

2
.gitattributes vendored Normal file
View File

@@ -0,0 +1,2 @@
/codecs/**/*.js linguist-generated=true
/codecs/*/pkg*/*.d.ts linguist-generated=true

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

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

View File

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

22
.github/workflows/node.js.yml vendored Normal file
View File

@@ -0,0 +1,22 @@
name: Node.js CI
on: [push, pull_request]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v2
- id: nvmrc
uses: browniebroke/read-nvmrc-action@v1
- uses: actions/setup-node@v1
with:
node-version: '${{ steps.nvmrc.outputs.node_version }}'
- run: npm ci
- run: npm run build

13
.gitignore vendored
View File

@@ -1,3 +1,12 @@
.tmp
node_modules
/build
/*.log
*.scss.d.ts
*.css.d.ts
build
*.o
.DS_Store
# Auto-generated by lib/feature-plugin.js
src/features-worker/index.ts
src/client/lazy-app/worker-bridge/meta.ts
src/client/lazy-app/feature-meta/index.ts

1
.nvmrc Normal file
View File

@@ -0,0 +1 @@
14.15.1

12
.prettierignore Normal file
View File

@@ -0,0 +1,12 @@
codecs
.tmp
node_modules
*.scss.d.ts
*.css.d.ts
build
*.o
# Auto-generated by lib/feature-plugin.js
src/features-worker/index.ts
src/client/lazy-app/worker-bridge/meta.ts
src/client/lazy-app/feature-meta/index.ts

4
.prettierrc.json Normal file
View File

@@ -0,0 +1,4 @@
{
"singleQuote": true,
"trailingComma": "all"
}

View File

@@ -1,5 +1,36 @@
# Squoosh!
# [Squoosh]!
Squoosh will be an image compression web app that allows you to dive into the
advanced options provided by various image compressors.
[Squoosh] is an image compression web app that allows you to dive into the advanced options provided
by various image compressors.
# CLI
[Squoosh now has a CLI](https://github.com/GoogleChromeLabs/squoosh/tree/dev/cli) that allows you to compress many images at once.
# Privacy
Google Analytics is used to record the following:
- [Basic visit data](https://support.google.com/analytics/answer/6004245?ref_topic=2919631).
- Before and after image size once an image is downloaded. These values are rounded to the nearest
kilobyte.
- If install is available, when Squoosh is installed, and what method was used to install Squoosh.
Image compression is handled locally; no additional data is sent to the server.
# Building locally
Clone the repo, and:
```sh
npm install
npm run build
```
You can run the development server with:
```sh
npm run dev
```
[squoosh]: https://squoosh.app

3
cli/.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
node_modules
build
.DS_Store

1
cli/.npmignore Normal file
View File

@@ -0,0 +1 @@
node_modules

0
cli/.npmrc Normal file
View File

59
cli/README.md Normal file
View File

@@ -0,0 +1,59 @@
# Squoosh CLI
Squoosh CLI is an _experimental_ way to run all the codecs you know from the [Squoosh] web app on your command line using WebAssembly. The Squoosh CLI uses a worker pool to parallelize processing images. This way you can apply the same codec to many images at once.
Squoosh CLI is currently not the fastest image compression tool in town and doesnt 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/cli/src/codecs.js
[butteraugli]: https://github.com/google/butteraugli

75
cli/lib/asset-plugin.js Normal file
View File

@@ -0,0 +1,75 @@
/**
* Copyright 2020 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.
*/
import { promises as fs } from "fs";
import { basename } from "path";
const defaultOpts = {
prefix: "asset-url"
};
export default function assetPlugin(opts) {
opts = { ...defaultOpts, ...opts };
/** @type {Map<string, Buffer>} */
let assetIdToSourceBuffer;
const prefix = opts.prefix + ":";
return {
name: "asset-plugin",
buildStart() {
assetIdToSourceBuffer = new Map();
},
augmentChunkHash(info) {
// Get the sources for all assets imported by this chunk.
const buffers = Object.keys(info.modules)
.map(moduleId => assetIdToSourceBuffer.get(moduleId))
.filter(Boolean);
if (buffers.length === 0) return;
for (const moduleId of Object.keys(info.modules)) {
const buffer = assetIdToSourceBuffer.get(moduleId);
if (buffer) buffers.push(buffer);
}
const combinedBuffer =
buffers.length === 1 ? buffers[0] : Buffer.concat(buffers);
return combinedBuffer;
},
async resolveId(id, importer) {
if (!id.startsWith(prefix)) return;
const realId = id.slice(prefix.length);
const resolveResult = await this.resolve(realId, importer);
if (!resolveResult) {
throw Error(`Cannot find ${realId}`);
}
// Add an additional .js to the end so it ends up with .js at the end in the _virtual folder.
return prefix + resolveResult.id + ".js";
},
async load(id) {
if (!id.startsWith(prefix)) return;
const realId = id.slice(prefix.length, -".js".length);
const source = await fs.readFile(realId);
assetIdToSourceBuffer.set(id, source);
this.addWatchFile(realId);
return `export default import.meta.ROLLUP_FILE_URL_${this.emitFile({
type: "asset",
source,
name: basename(realId)
})}`;
}
};
}

View File

@@ -0,0 +1,12 @@
import { promises as fsp } from 'fs';
export default function autojsonPlugin() {
return {
name: 'autojson-plugin',
async load(id) {
if (id.endsWith('.json') && !id.startsWith('json:')) {
return 'export default ' + await fsp.readFile(id, 'utf8');
}
}
};
};

38
cli/lib/json-plugin.js Normal file
View File

@@ -0,0 +1,38 @@
import { promises as fsp } from 'fs';
const prefix = 'json:';
const reservedKeys = ['public'];
export default function jsonPlugin() {
return {
name: 'json-plugin',
async resolveId(id, importer) {
if (!id.startsWith(prefix)) return;
const realId = id.slice(prefix.length);
const resolveResult = await this.resolve(realId, importer);
if (!resolveResult) {
throw Error(`Cannot find ${realId}`);
}
// Add an additional .js to the end so it ends up with .js at the end in the _virtual folder.
return prefix + resolveResult.id;
},
async load(id) {
if (!id.startsWith(prefix)) return;
const realId = id.slice(prefix.length);
const source = await fsp.readFile(realId, 'utf8');
let code = '';
for (const [key, value] of Object.entries(JSON.parse(source))) {
if (reservedKeys.includes(key)) {
continue;
}
code += `
export const ${key} = ${JSON.stringify(value)};
`;
}
return code;
},
};
}

2168
cli/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

32
cli/package.json Normal file
View File

@@ -0,0 +1,32 @@
{
"name": "@squoosh/cli",
"version": "0.6.0",
"description": "A CLI for Squoosh",
"public": true,
"bin": {
"squoosh-cli": "build/index.js",
"@squoosh/cli": "build/index.js"
},
"scripts": {
"build": "rollup -c"
},
"keywords": [],
"author": "Google Chrome Developers <chromium-dev@google.com>",
"license": "Apache-2.0",
"dependencies": {
"web-streams-polyfill": "^3.0.0"
},
"devDependencies": {
"@babel/core": "^7.11.6",
"@babel/preset-env": "^7.11.5",
"@rollup/plugin-babel": "^5.2.1",
"@rollup/plugin-commonjs": "^15.0.0",
"@rollup/plugin-node-resolve": "^9.0.0",
"commander": "^6.0.0",
"json5": "^2.1.3",
"kleur": "^4.1.3",
"ora": "^5.1.0",
"rollup": "^2.26.11",
"rollup-plugin-terser": "^7.0.2"
}
}

45
cli/rollup.config.js Normal file
View File

@@ -0,0 +1,45 @@
import resolve from '@rollup/plugin-node-resolve';
import cjs from '@rollup/plugin-commonjs';
import asset from './lib/asset-plugin.js';
import json from './lib/json-plugin.js';
import autojson from './lib/autojson-plugin.js';
import { getBabelOutputPlugin } from '@rollup/plugin-babel';
import { builtinModules } from 'module';
/** @type {import('rollup').RollupOptions} */
export default {
input: 'src/index.js',
output: {
dir: 'build',
format: 'cjs',
assetFileNames: '[name]-[hash][extname]',
// This is needed so the resulting `index.js` can be
// executed by `npx`.
banner: '#!/usr/bin/env node',
},
plugins: [
resolve(),
cjs(),
asset(),
autojson(),
json(),
getBabelOutputPlugin({
babelrc: false,
configFile: false,
minified: process.env.DEBUG != '',
comments: false,
presets: [
[
'@babel/preset-env',
{
targets: {
node: 12,
},
loose: true,
},
],
],
}),
],
external: builtinModules,
};

70
cli/src/auto-optimizer.js Normal file
View File

@@ -0,0 +1,70 @@
import { instantiateEmscriptenWasm } from "./emscripten-utils.js";
import visdif from "../../codecs/visdif/visdif.js";
import visdifWasm from "asset-url:../../codecs/visdif/visdif.wasm";
// `measure` is a (async) function that takes exactly one numeric parameter and
// returns a value. The function is assumed to be monotonic (an increase in `parameter`
// will result in an increase in the return value. The function uses binary search
// to find `parameter` such that `measure` returns `measureGoal`, within an error
// of `epsilon`. It will use at most `maxRounds` attempts.
export async function binarySearch(
measureGoal,
measure,
{ min = 0, max = 100, epsilon = 0.1, maxRounds = 8 } = {}
) {
let parameter = (max - min) / 2 + min;
let delta = (max - min) / 4;
let value;
let round = 1;
while (true) {
value = await measure(parameter);
if (Math.abs(value - measureGoal) < epsilon || round >= maxRounds) {
return { parameter, round, value };
}
if (value > measureGoal) {
parameter -= delta;
} else if (value < measureGoal) {
parameter += delta;
}
delta /= 2;
round++;
}
}
export async function autoOptimize(
bitmapIn,
encode,
decode,
{ butteraugliDistanceGoal = 1.4, ...otherOpts } = {}
) {
const { VisDiff } = await instantiateEmscriptenWasm(visdif, visdifWasm);
const comparator = new VisDiff(
bitmapIn.data,
bitmapIn.width,
bitmapIn.height
);
let bitmapOut;
let binaryOut;
// Increasing quality means _decrease_ in Butteraugli distance.
// `binarySearch` assumes that increasing `parameter` will
// increase the metric value. So multipliy Butteraugli values by -1.
const { parameter } = await binarySearch(
-1 * butteraugliDistanceGoal,
async quality => {
binaryOut = await encode(bitmapIn, quality);
bitmapOut = await decode(binaryOut);
return -1 * comparator.distance(bitmapOut.data);
},
otherOpts
);
comparator.delete();
return {
bitmap: bitmapOut,
binary: binaryOut,
quality: parameter
};
}

361
cli/src/codecs.js Normal file
View File

@@ -0,0 +1,361 @@
import { promises as fsp } from 'fs';
import { instantiateEmscriptenWasm, pathify } from './emscripten-utils.js';
// MozJPEG
import mozEnc from '../../codecs/mozjpeg/enc/mozjpeg_node_enc.js';
import mozEncWasm from 'asset-url:../../codecs/mozjpeg/enc/mozjpeg_node_enc.wasm';
import mozDec from '../../codecs/mozjpeg/dec/mozjpeg_node_dec.js';
import mozDecWasm from 'asset-url:../../codecs/mozjpeg/dec/mozjpeg_node_dec.wasm';
// WebP
import webpEnc from '../../codecs/webp/enc/webp_node_enc.js';
import webpEncWasm from 'asset-url:../../codecs/webp/enc/webp_node_enc.wasm';
import webpDec from '../../codecs/webp/dec/webp_node_dec.js';
import webpDecWasm from 'asset-url:../../codecs/webp/dec/webp_node_dec.wasm';
// AVIF
import avifEnc from '../../codecs/avif/enc/avif_node_enc.js';
import avifEncWasm from 'asset-url:../../codecs/avif/enc/avif_node_enc.wasm';
import avifDec from '../../codecs/avif/dec/avif_node_dec.js';
import avifDecWasm from 'asset-url:../../codecs/avif/dec/avif_node_dec.wasm';
// JXL
import jxlEnc from '../../codecs/jxl/enc/jxl_node_enc.js';
import jxlEncWasm from 'asset-url:../../codecs/jxl/enc/jxl_node_enc.wasm';
import jxlDec from '../../codecs/jxl/dec/jxl_node_dec.js';
import jxlDecWasm from 'asset-url:../../codecs/jxl/dec/jxl_node_dec.wasm';
// WP2
import wp2Enc from '../../codecs/wp2/enc/wp2_node_enc.js';
import wp2EncWasm from 'asset-url:../../codecs/wp2/enc/wp2_node_enc.wasm';
import wp2Dec from '../../codecs/wp2/dec/wp2_node_dec.js';
import wp2DecWasm from 'asset-url:../../codecs/wp2/dec/wp2_node_dec.wasm';
// PNG
import * as pngEncDec from '../../codecs/png/pkg/squoosh_png.js';
import pngEncDecWasm from 'asset-url:../../codecs/png/pkg/squoosh_png_bg.wasm';
const pngEncDecPromise = pngEncDec.default(
fsp.readFile(pathify(pngEncDecWasm)),
);
// OxiPNG
import * as oxipng from '../../codecs/oxipng/pkg/squoosh_oxipng.js';
import oxipngWasm from 'asset-url:../../codecs/oxipng/pkg/squoosh_oxipng_bg.wasm';
const oxipngPromise = oxipng.default(fsp.readFile(pathify(oxipngWasm)));
// Resize
import * as resize from '../../codecs/resize/pkg/squoosh_resize.js';
import resizeWasm from 'asset-url:../../codecs/resize/pkg/squoosh_resize_bg.wasm';
const resizePromise = resize.default(fsp.readFile(pathify(resizeWasm)));
// rotate
import rotateWasm from 'asset-url:../../codecs/rotate/rotate.wasm';
// ImageQuant
import imageQuant from '../../codecs/imagequant/imagequant_node.js';
import imageQuantWasm from 'asset-url:../../codecs/imagequant/imagequant_node.wasm';
const imageQuantPromise = instantiateEmscriptenWasm(imageQuant, imageQuantWasm);
// Our decoders currently rely on a `ImageData` global.
import ImageData from './image_data.js';
globalThis.ImageData = ImageData;
function resizeNameToIndex(name) {
switch (name) {
case 'triangle':
return 0;
case 'catrom':
return 1;
case 'mitchell':
return 2;
case 'lanczos3':
return 3;
default:
throw Error(`Unknown resize algorithm "${name}"`);
}
}
function resizeWithAspect({
input_width,
input_height,
target_width,
target_height,
}) {
if (!target_width && !target_height) {
throw Error('Need to specify at least width or height when resizing');
}
if (target_width && target_height) {
return { width: target_width, height: target_height };
}
if (!target_width) {
return {
width: Math.round((input_width / input_height) * target_height),
height: target_height,
};
}
if (!target_height) {
return {
width: target_width,
height: Math.round((input_height / input_width) * target_width),
};
}
}
export const preprocessors = {
resize: {
name: 'Resize',
description: 'Resize the image before compressing',
instantiate: async () => {
await resizePromise;
return (
buffer,
input_width,
input_height,
{ width, height, method, premultiply, linearRGB },
) => {
({ width, height } = resizeWithAspect({
input_width,
input_height,
target_width: width,
target_height: height,
}));
return new ImageData(
resize.resize(
buffer,
input_width,
input_height,
width,
height,
resizeNameToIndex(method),
premultiply,
linearRGB,
),
width,
height,
);
};
},
defaultOptions: {
method: 'lanczos3',
fitMethod: 'stretch',
premultiply: true,
linearRGB: true,
},
},
// // TODO: Need to handle SVGs and HQX
quant: {
name: 'ImageQuant',
description: 'Reduce the number of colors used (aka. paletting)',
instantiate: async () => {
const imageQuant = await imageQuantPromise;
return (buffer, width, height, { numColors, dither }) =>
new ImageData(
imageQuant.quantize(buffer, width, height, numColors, dither),
width,
height,
);
},
defaultOptions: {
numColors: 255,
dither: 1.0,
},
},
rotate: {
name: 'Rotate',
description: 'Rotate image',
instantiate: async () => {
return async (buffer, width, height, { numRotations }) => {
const degrees = (numRotations * 90) % 360;
const sameDimensions = degrees == 0 || degrees == 180;
const size = width * height * 4;
const { instance } = await WebAssembly.instantiate(
await fsp.readFile(pathify(rotateWasm)),
);
const { memory } = instance.exports;
const additionalPagesNeeded = Math.ceil(
(size * 2 - memory.buffer.byteLength + 8) / (64 * 1024),
);
if (additionalPagesNeeded > 0) {
memory.grow(additionalPagesNeeded);
}
const view = new Uint8ClampedArray(memory.buffer);
view.set(buffer, 8);
instance.exports.rotate(width, height, degrees);
return new ImageData(
view.slice(size + 8, size * 2 + 8),
sameDimensions ? width : height,
sameDimensions ? height : width,
);
};
},
defaultOptions: {
numRotations: 0,
},
},
};
export const codecs = {
mozjpeg: {
name: 'MozJPEG',
extension: 'jpg',
detectors: [/^\xFF\xD8\xFF/],
dec: () => instantiateEmscriptenWasm(mozDec, mozDecWasm),
enc: () => instantiateEmscriptenWasm(mozEnc, mozEncWasm),
defaultEncoderOptions: {
quality: 75,
baseline: false,
arithmetic: false,
progressive: true,
optimize_coding: true,
smoothing: 0,
color_space: 3 /*YCbCr*/,
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,
},
autoOptimize: {
option: 'quality',
min: 0,
max: 100,
},
},
webp: {
name: 'WebP',
extension: 'webp',
detectors: [/^RIFF....WEBPVP8[LX ]/],
dec: () => instantiateEmscriptenWasm(webpDec, webpDecWasm),
enc: () => instantiateEmscriptenWasm(webpEnc, webpEncWasm),
defaultEncoderOptions: {
quality: 75,
target_size: 0,
target_PSNR: 0,
method: 4,
sns_strength: 50,
filter_strength: 60,
filter_sharpness: 0,
filter_type: 1,
partitions: 0,
segments: 4,
pass: 1,
show_compressed: 0,
preprocessing: 0,
autofilter: 0,
partition_limit: 0,
alpha_compression: 1,
alpha_filtering: 1,
alpha_quality: 100,
lossless: 0,
exact: 0,
image_hint: 0,
emulate_jpeg_size: 0,
thread_level: 0,
low_memory: 0,
near_lossless: 100,
use_delta_palette: 0,
use_sharp_yuv: 0,
},
autoOptimize: {
option: 'quality',
min: 0,
max: 100,
},
},
avif: {
name: 'AVIF',
extension: 'avif',
detectors: [/^\x00\x00\x00 ftypavif\x00\x00\x00\x00/],
dec: () => instantiateEmscriptenWasm(avifDec, avifDecWasm),
enc: () => instantiateEmscriptenWasm(avifEnc, avifEncWasm),
defaultEncoderOptions: {
minQuantizer: 33,
maxQuantizer: 63,
minQuantizerAlpha: 33,
maxQuantizerAlpha: 63,
tileColsLog2: 0,
tileRowsLog2: 0,
speed: 8,
subsample: 1,
},
autoOptimize: {
option: 'maxQuantizer',
min: 0,
max: 62,
},
},
jxl: {
name: 'JPEG-XL',
extension: 'jxl',
detectors: [/^\xff\x0a/],
dec: () => instantiateEmscriptenWasm(jxlDec, jxlDecWasm),
enc: () => instantiateEmscriptenWasm(jxlEnc, jxlEncWasm),
defaultEncoderOptions: {
speed: 4,
quality: 75,
progressive: false,
epf: -1,
nearLossless: 0,
lossyPalette: false,
},
autoOptimize: {
option: 'quality',
min: 0,
max: 100,
},
},
wp2: {
name: 'WebP2',
extension: 'wp2',
detectors: [/^\xF4\xFF\x6F/],
dec: () => instantiateEmscriptenWasm(wp2Dec, wp2DecWasm),
enc: () => instantiateEmscriptenWasm(wp2Enc, wp2EncWasm),
defaultEncoderOptions: {
quality: 75,
alpha_quality: 75,
effort: 5,
pass: 1,
sns: 50,
uv_mode: 0 /*UVMode.UVModeAuto*/,
csp_type: 0 /*Csp.kYCoCg*/,
error_diffusion: 0,
use_random_matrix: false,
},
autoOptimize: {
option: 'quality',
min: 0,
max: 100,
},
},
oxipng: {
name: 'OxiPNG',
extension: 'png',
detectors: [/^\x89PNG\x0D\x0A\x1A\x0A/],
dec: async () => {
await pngEncDecPromise;
return { decode: pngEncDec.decode };
},
enc: async () => {
await pngEncDecPromise;
await oxipngPromise;
return {
encode: (buffer, width, height, opts) => {
const simplePng = pngEncDec.encode(new Uint8Array(buffer), width, height);
return oxipng.optimise(simplePng, opts.level);
},
};
},
defaultEncoderOptions: {
level: 2,
},
autoOptimize: {
option: 'level',
min: 6,
max: 1,
},
},
};

View File

@@ -0,0 +1,16 @@
import { fileURLToPath } from 'url';
export function pathify(path) {
if (path.startsWith('file://')) {
path = fileURLToPath(path);
}
return path;
}
export function instantiateEmscriptenWasm(factory, path) {
return factory({
locateFile() {
return pathify(path);
},
});
}

7
cli/src/image_data.js Normal file
View File

@@ -0,0 +1,7 @@
export default class ImageData {
constructor(data, width, height) {
this.data = data;
this.width = width;
this.height = height;
}
}

362
cli/src/index.js Normal file
View File

@@ -0,0 +1,362 @@
import { program } from 'commander';
import JSON5 from 'json5';
import { isMainThread } from 'worker_threads';
import { cpus } from 'os';
import { extname, join, basename } from 'path';
import { promises as fsp } from 'fs';
import { resolve as resolvePath } from 'path';
import { version } from 'json:../package.json';
import ora from 'ora';
import kleur from 'kleur';
import { codecs as supportedFormats, preprocessors } from './codecs.js';
import WorkerPool from './worker_pool.js';
import { autoOptimize } from './auto-optimizer.js';
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];
}
async function decodeFile(file) {
const buffer = await fsp.readFile(file);
const firstChunk = buffer.slice(0, 16);
const firstChunkString = Array.from(firstChunk)
.map((v) => String.fromCodePoint(v))
.join('');
const key = Object.entries(supportedFormats).find(([name, { detectors }]) =>
detectors.some((detector) => detector.exec(firstChunkString)),
)?.[0];
if (!key) {
throw Error(`${file} has an unsupported format`);
}
const rgba = (await supportedFormats[key].dec()).decode(
new Uint8Array(buffer),
);
return {
file,
bitmap: rgba,
size: buffer.length,
};
}
async function preprocessImage({ preprocessorName, options, file }) {
const preprocessor = await preprocessors[preprocessorName].instantiate();
file.bitmap = await preprocessor(
file.bitmap.data,
file.bitmap.width,
file.bitmap.height,
options,
);
return file;
}
async function encodeFile({
file,
size,
bitmap: bitmapIn,
outputFile,
encName,
encConfig,
optimizerButteraugliTarget,
maxOptimizerRounds,
}) {
let out, infoText;
const encoder = await supportedFormats[encName].enc();
if (encConfig === 'auto') {
const optionToOptimize = supportedFormats[encName].autoOptimize.option;
const decoder = await supportedFormats[encName].dec();
const encode = (bitmapIn, quality) =>
encoder.encode(
bitmapIn.data,
bitmapIn.width,
bitmapIn.height,
Object.assign({}, supportedFormats[encName].defaultEncoderOptions, {
[optionToOptimize]: quality,
}),
);
const decode = (binary) => decoder.decode(binary);
const { bitmap, binary, quality } = await autoOptimize(
bitmapIn,
encode,
decode,
{
min: supportedFormats[encName].autoOptimize.min,
max: supportedFormats[encName].autoOptimize.max,
butteraugliDistanceGoal: optimizerButteraugliTarget,
maxRounds: maxOptimizerRounds,
},
);
out = binary;
const opts = {
// 5 significant digits is enough
[optionToOptimize]: Math.round(quality * 10000) / 10000,
};
infoText = ` using --${encName} '${JSON5.stringify(opts)}'`;
} else {
out = encoder.encode(
bitmapIn.data.buffer,
bitmapIn.width,
bitmapIn.height,
encConfig,
);
}
await fsp.writeFile(outputFile, out);
return {
infoText,
inputSize: size,
inputFile: file,
outputFile,
outputSize: out.length,
};
}
// both decoding and encoding go through the worker pool
function handleJob(params) {
const { operation } = params;
switch (operation) {
case 'encode':
return encodeFile(params);
case 'decode':
return decodeFile(params.file);
case 'preprocess':
return preprocessImage(params);
default:
throw Error(`Invalid job "${operation}"`);
}
}
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 [filename, result] of results.entries()) {
out += `\n ${kleur.cyan(filename)}: ${prettyPrintSize(result.size)}`;
for (const { outputFile, outputSize, infoText } of result.outputs) {
const name = (program.suffix + extname(outputFile)).padEnd(5);
out += `\n ${kleur.dim('└')} ${kleur.cyan(name)}${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 path of paths) {
const files = (await fsp.lstat(path)).isDirectory()
? (await fsp.readdir(path)).map(file => join(path, file))
: [path];
for (const file of files) {
try {
await fsp.stat(file);
} catch (err) {
if (err.code === 'ENOENT') {
console.warn(
`Warning: Input file does not exist: ${resolvePath(file)}`,
);
continue;
} else {
throw err;
}
}
validFiles.push(file);
}
}
return validFiles;
}
async function processFiles(files) {
files = await getInputFiles(files);
const parallelism = cpus().length;
const results = new Map();
const progress = progressTracker(results);
progress.setStatus('Decoding...');
progress.totalOffset = files.length;
progress.setProgress(0, files.length);
const workerPool = new WorkerPool(parallelism, __filename);
// Create output directory
await fsp.mkdir(program.outputDir, { recursive: true });
let decoded = 0;
let decodedFiles = await Promise.all(
files.map(async (file) => {
const result = await workerPool.dispatchJob({
operation: 'decode',
file,
});
results.set(file, {
file: result.file,
size: result.size,
outputs: [],
});
progress.setProgress(++decoded, files.length);
return result;
}),
);
for (const [preprocessorName, value] of Object.entries(preprocessors)) {
if (!program[preprocessorName]) {
continue;
}
const preprocessorParam = program[preprocessorName];
const preprocessorOptions = Object.assign(
{},
value.defaultOptions,
JSON5.parse(preprocessorParam),
);
decodedFiles = await Promise.all(
decodedFiles.map(async (file) => {
return workerPool.dispatchJob({
file,
operation: 'preprocess',
preprocessorName,
options: preprocessorOptions,
});
}),
);
}
progress.progressOffset = decoded;
progress.setStatus('Encoding ' + kleur.dim(`(${parallelism} threads)`));
progress.setProgress(0, files.length);
const jobs = [];
let jobsStarted = 0;
let jobsFinished = 0;
for (const { file, bitmap, size } of decodedFiles) {
const ext = extname(file);
const base = basename(file, ext) + program.suffix;
for (const [encName, value] of Object.entries(supportedFormats)) {
if (!program[encName]) {
continue;
}
const encParam =
typeof program[encName] === 'string' ? program[encName] : '{}';
const encConfig =
encParam.toLowerCase() === 'auto'
? 'auto'
: Object.assign(
{},
value.defaultEncoderOptions,
JSON5.parse(encParam),
);
const outputFile = join(program.outputDir, `${base}.${value.extension}`);
jobsStarted++;
const p = workerPool
.dispatchJob({
operation: 'encode',
file,
size,
bitmap,
outputFile,
encName,
encConfig,
optimizerButteraugliTarget: Number(
program.optimizerButteraugliTarget,
),
maxOptimizerRounds: Number(program.maxOptimizerRounds),
})
.then((output) => {
jobsFinished++;
results.get(file).outputs.push(output);
progress.setProgress(jobsFinished, jobsStarted);
});
jobs.push(p);
}
}
// update the progress to account for multi-format
progress.setProgress(jobsFinished, jobsStarted);
// Wait for all jobs to finish
await workerPool.join();
await Promise.all(jobs);
progress.finish('Squoosh results:');
}
if (isMainThread) {
program
.name('squoosh-cli')
.version(version)
.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(supportedFormats)) {
program.option(
`--${key} [config]`,
`Use ${value.name} to generate a .${value.extension} file with the given configuration`,
);
}
program.parse(process.argv);
} else {
WorkerPool.useThisThreadAsWorker(handleJob);
}

94
cli/src/worker_pool.js Normal file
View File

@@ -0,0 +1,94 @@
import { Worker, parentPort } from 'worker_threads';
import { TransformStream } from 'web-streams-polyfill';
function uuid() {
return Array.from({ length: 16 }, () =>
Math.floor(Math.random() * 256).toString(16),
).join('');
}
function jobPromise(worker, msg) {
return new Promise((resolve) => {
const id = uuid();
worker.postMessage({ msg, id });
worker.on('message', function f({ result, id: rid }) {
if (rid !== id) {
return;
}
worker.off('message', f);
resolve(result);
});
worker.on('error', (error) => console.error('Worker error: ', error));
});
}
export default class WorkerPool {
constructor(numWorkers, workerFile) {
this.numWorkers = numWorkers;
this.jobQueue = new TransformStream();
this.workerQueue = new TransformStream();
const writer = this.workerQueue.writable.getWriter();
for (let i = 0; i < numWorkers; i++) {
writer.write(new Worker(workerFile));
}
writer.releaseLock();
this.done = this._readLoop();
}
async _readLoop() {
const reader = this.jobQueue.readable.getReader();
while (true) {
const { value, done } = await reader.read();
if (done) {
await this._terminateAll();
return;
}
const { msg, resolve } = value;
const worker = await this._nextWorker();
jobPromise(worker, msg).then((result) => {
resolve(result);
const writer = this.workerQueue.writable.getWriter();
writer.write(worker);
writer.releaseLock();
});
}
}
async _nextWorker() {
const reader = this.workerQueue.readable.getReader();
const { value, done } = await reader.read();
reader.releaseLock();
return value;
}
async _terminateAll() {
for (let n = 0; n < this.numWorkers; n++) {
const worker = await this._nextWorker();
worker.terminate();
}
this.workerQueue.writable.close();
}
async join() {
this.jobQueue.writable.getWriter().close();
await this.done;
}
dispatchJob(msg) {
return new Promise((resolve) => {
const writer = this.jobQueue.writable.getWriter();
writer.write({ msg, resolve });
writer.releaseLock();
});
}
static useThisThreadAsWorker(cb) {
parentPort.on('message', async (data) => {
const { msg, id } = data;
const result = await cb(msg);
parentPort.postMessage({ result, id });
});
}
}

19
client-tsconfig.json Normal file
View File

@@ -0,0 +1,19 @@
{
"extends": "./generic-tsconfig.json",
"compilerOptions": {
"lib": ["esnext", "dom", "dom.iterable"],
"types": []
},
"include": [
"src/features/**/client/**/*",
"src/features/**/shared/**/*",
"src/features/client-utils/**/*",
"src/shared/**/*",
"src/client/**/*",
// Not really clean, but we need these to access the type of the functions
// for comlink
"src/features/**/worker/**/*",
"src/features-worker/**/*",
"src/features/worker-utils/**/*"
]
}

16
codecs/README.md Normal file
View File

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

91
codecs/avif/Makefile Normal file
View File

@@ -0,0 +1,91 @@
CODEC_URL = https://github.com/AOMediaCodec/libavif/archive/v0.9.0.tar.gz
CODEC_PACKAGE = node_modules/libavif.tar.gz
LIBAOM_URL = https://aomedia.googlesource.com/aom/+archive/v2.0.2.tar.gz
LIBAOM_PACKAGE = node_modules/libaom.tar.gz
export CODEC_DIR = node_modules/libavif
export BUILD_DIR = node_modules/build
export LIBAOM_DIR = node_modules/libaom
OUT_ENC_JS = enc/avif_enc.js
OUT_NODE_ENC_JS = enc/avif_node_enc.js
OUT_ENC_MT_JS = enc/avif_enc_mt.js
OUT_DEC_JS = dec/avif_dec.js
OUT_NODE_DEC_JS = dec/avif_node_dec.js
OUT_ENC_CPP = enc/avif_enc.cpp
OUT_ENC_CPP = enc/avif_enc.cpp
OUT_DEC_CPP = dec/avif_dec.cpp
ENVIRONMENT = worker
HELPER_MAKEFLAGS := -f helper.Makefile
export CFLAGS+=-g
export CXXFLAGS+=-g
export LDFLAGS+=-g
.PHONY: all clean
all: $(OUT_ENC_JS) $(OUT_DEC_JS) $(OUT_ENC_MT_JS) $(OUT_NODE_ENC_JS) $(OUT_NODE_DEC_JS)
$(OUT_NODE_ENC_JS): ENVIRONMENT=node
$(OUT_NODE_ENC_JS) $(OUT_ENC_JS): $(OUT_ENC_CPP) $(CODEC_DIR)/CMakeLists.txt $(LIBAOM_DIR)/CMakeLists.txt
$(MAKE) \
$(HELPER_MAKEFLAGS) \
OUT_JS=$@ \
OUT_CPP=$< \
LIBAOM_FLAGS="\
-DCONFIG_AV1_DECODER=0 \
-DCONFIG_MULTITHREAD=0 \
-DCONFIG_AV1_HIGHBITDEPTH=0 \
" \
ENVIRONMENT=$(ENVIRONMENT) \
LIBAVIF_FLAGS="-DAVIF_CODEC_AOM_DECODE=0"
$(OUT_ENC_MT_JS): $(OUT_ENC_CPP) $(CODEC_DIR)/CMakeLists.txt $(LIBAOM_DIR)/CMakeLists.txt
$(MAKE) \
$(HELPER_MAKEFLAGS) \
OUT_JS=$@ \
OUT_CPP=$< \
LIBAOM_FLAGS="\
-DCONFIG_AV1_DECODER=0 \
-DCONFIG_AV1_HIGHBITDEPTH=0 \
" \
ENVIRONMENT=$(ENVIRONMENT) \
LIBAVIF_FLAGS="-DAVIF_CODEC_AOM_DECODE=0" \
OUT_FLAGS="-pthread"
$(OUT_NODE_DEC_JS): ENVIRONMENT=node
$(OUT_NODE_DEC_JS) $(OUT_DEC_JS): $(OUT_DEC_CPP) $(CODEC_DIR)/CMakeLists.txt $(LIBAOM_DIR)/CMakeLists.txt
$(MAKE) \
$(HELPER_MAKEFLAGS) \
OUT_JS=$@ \
OUT_CPP=$< \
LIBAOM_FLAGS="\
-DCONFIG_AV1_ENCODER=0 \
-DCONFIG_MULTITHREAD=0 \
" \
ENVIRONMENT=$(ENVIRONMENT) \
LIBAVIF_FLAGS="-DAVIF_CODEC_AOM_ENCODE=0"
$(CODEC_PACKAGE):
mkdir -p $(@D)
curl -sL $(CODEC_URL) -o $@
$(LIBAOM_PACKAGE):
mkdir -p $(@D)
curl -sL $(LIBAOM_URL) -o $@
$(CODEC_DIR)/CMakeLists.txt: $(CODEC_PACKAGE)
mkdir -p $(@D)
tar xzm --strip 1 -C $(@D) -f $(CODEC_PACKAGE)
$(LIBAOM_DIR)/CMakeLists.txt: $(LIBAOM_PACKAGE)
mkdir -p $(@D)
tar xzm -C $(@D) -f $(LIBAOM_PACKAGE)
clean:
$(MAKE) $(HELPER_MAKEFLAGS) OUT_JS=$(OUT_ENC_JS) clean
$(MAKE) $(HELPER_MAKEFLAGS) OUT_JS=$(OUT_ENC_MT_JS) clean
$(MAKE) $(HELPER_MAKEFLAGS) OUT_JS=$(OUT_DEC_JS) clean

14
codecs/avif/dec/README.md Normal file
View File

@@ -0,0 +1,14 @@
# AVIF decoder
- Source: <https://github.com/AOMediaCodec/libavif>
- Version: v0.5.4
## Example
See `example.html`
## API
### `RawImage decode(std::string buffer)`
Decodes the given avif buffer into raw RGBA. `RawImage` is a class with 3 fields: `buffer`, `width`, and `height`.

View File

@@ -0,0 +1,48 @@
#include <emscripten/bind.h>
#include <emscripten/val.h>
#include "avif/avif.h"
using namespace emscripten;
thread_local const val Uint8ClampedArray = val::global("Uint8ClampedArray");
thread_local const val ImageData = val::global("ImageData");
val decode(std::string avifimage) {
avifImage* image = avifImageCreateEmpty();
avifDecoder* decoder = avifDecoderCreate();
avifResult decodeResult =
avifDecoderReadMemory(decoder, image, (uint8_t*)avifimage.c_str(), avifimage.length());
// image is an independent copy of decoded data, decoder may be destroyed here
avifDecoderDestroy(decoder);
val result = val::null();
if (decodeResult == AVIF_RESULT_OK) {
// Convert to interleaved RGB(A)/BGR(A) using a libavif-allocated buffer.
avifRGBImage rgb;
avifRGBImageSetDefaults(&rgb,
image); // Defaults to AVIF_RGB_FORMAT_RGBA which is what we want.
rgb.depth = 8; // Does not need to match image->depth. We always want 8-bit pixels.
avifRGBImageAllocatePixels(&rgb);
avifImageYUVToRGB(image, &rgb);
// We want to create a *copy* of the decoded data to be owned by the JavaScript side.
// For that, we perform `new Uint8Array(wasmMemBuffer, wasmPtr, wasmSize).slice()`:
result = ImageData.new_(
Uint8ClampedArray.new_(typed_memory_view(rgb.rowBytes * rgb.height, rgb.pixels)), rgb.width,
rgb.height);
// Now we can safely free the RGB pixels:
avifRGBImageFreePixels(&rgb);
}
// Image has been converted to RGB, we don't need the original anymore.
avifImageDestroy(image);
return result;
}
EMSCRIPTEN_BINDINGS(my_module) {
function("decode", &decode);
}

7
codecs/avif/dec/avif_dec.d.ts vendored Normal file
View File

@@ -0,0 +1,7 @@
export interface AVIFModule extends EmscriptenWasm.Module {
decode(data: BufferSource): ImageData | null;
}
declare var moduleFactory: EmscriptenWasm.ModuleFactory<AVIFModule>;
export default moduleFactory;

3394
codecs/avif/dec/avif_dec.js generated Normal file

File diff suppressed because it is too large Load Diff

BIN
codecs/avif/dec/avif_dec.wasm Executable file

Binary file not shown.

2808
codecs/avif/dec/avif_node_dec.js generated Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

37
codecs/avif/enc/README.md Normal file
View File

@@ -0,0 +1,37 @@
# AVIF encoder
- Source: <https://github.com/AOMediaCodec/libavif>
- Version: v0.5.4
## Example
Run example.js
## API
### `Uint8Array encode(std::string image_in, int image_width, int image_height, AvifOptions opts)`
Encodes the given image with given dimension to AVIF. Options looks like this:
```c++
struct AvifOptions {
// 0 = lossless
// 63 = worst quality
int minQuantizer;
int maxQuantizer;
// [0 - 6]
// Creates 2^n tiles in that dimension
int tileRowsLog2;
int tileColsLog2;
// 0 = slowest
// 10 = fastest
int speed;
// 0 = 4:2:0
// 1 = 4:2:2
// 2 = 4:4:4
int subsample;
};
```

View File

@@ -0,0 +1,104 @@
#include <emscripten/bind.h>
#include <emscripten/threading.h>
#include <emscripten/val.h>
#include "avif/avif.h"
using namespace emscripten;
struct AvifOptions {
// [0 - 63]
// 0 = lossless
// 63 = worst quality
int minQuantizer;
int maxQuantizer;
int minQuantizerAlpha;
int maxQuantizerAlpha;
// [0 - 6]
// Creates 2^n tiles in that dimension
int tileRowsLog2;
int tileColsLog2;
// [0 - 10]
// 0 = slowest
// 10 = fastest
int speed;
// 0 = 4:0:0
// 1 = 4:2:0
// 2 = 4:2:2
// 3 = 4:4:4
int subsample;
};
thread_local const val Uint8Array = val::global("Uint8Array");
val encode(std::string buffer, int width, int height, AvifOptions options) {
avifRWData output = AVIF_DATA_EMPTY;
int depth = 8;
avifPixelFormat format;
switch (options.subsample) {
case 0:
format = AVIF_PIXEL_FORMAT_YUV400;
break;
case 1:
format = AVIF_PIXEL_FORMAT_YUV420;
break;
case 2:
format = AVIF_PIXEL_FORMAT_YUV422;
break;
case 3:
format = AVIF_PIXEL_FORMAT_YUV444;
break;
}
avifImage* image = avifImageCreate(width, height, depth, format);
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;
} else {
image->matrixCoefficients = AVIF_MATRIX_COEFFICIENTS_BT709;
}
uint8_t* rgba = (uint8_t*)buffer.c_str();
avifRGBImage srcRGB;
avifRGBImageSetDefaults(&srcRGB, image);
srcRGB.pixels = rgba;
srcRGB.rowBytes = width * 4;
avifImageRGBToYUV(image, &srcRGB);
avifEncoder* encoder = avifEncoderCreate();
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->tileColsLog2 = options.tileColsLog2;
encoder->speed = options.speed;
avifResult encodeResult = avifEncoderWrite(encoder, image, &output);
auto js_result = val::null();
if (encodeResult == AVIF_RESULT_OK) {
js_result = Uint8Array.new_(typed_memory_view(output.size, output.data));
}
avifImageDestroy(image);
avifEncoderDestroy(encoder);
avifRWDataFree(&output);
return js_result;
}
EMSCRIPTEN_BINDINGS(my_module) {
value_object<AvifOptions>("AvifOptions")
.field("minQuantizer", &AvifOptions::minQuantizer)
.field("maxQuantizer", &AvifOptions::maxQuantizer)
.field("minQuantizerAlpha", &AvifOptions::minQuantizerAlpha)
.field("maxQuantizerAlpha", &AvifOptions::maxQuantizerAlpha)
.field("tileRowsLog2", &AvifOptions::tileRowsLog2)
.field("tileColsLog2", &AvifOptions::tileColsLog2)
.field("speed", &AvifOptions::speed)
.field("subsample", &AvifOptions::subsample);
function("encode", &encode);
}

23
codecs/avif/enc/avif_enc.d.ts vendored Normal file
View File

@@ -0,0 +1,23 @@
export interface EncodeOptions {
minQuantizer: number;
maxQuantizer: number;
minQuantizerAlpha: number;
maxQuantizerAlpha: number;
tileRowsLog2: number;
tileColsLog2: number;
speed: number;
subsample: number;
}
export interface AVIFModule extends EmscriptenWasm.Module {
encode(
data: BufferSource,
width: number,
height: number,
options: EncodeOptions,
): Uint8Array | null;
}
declare var moduleFactory: EmscriptenWasm.ModuleFactory<AVIFModule>;
export default moduleFactory;

3603
codecs/avif/enc/avif_enc.js generated Normal file

File diff suppressed because it is too large Load Diff

BIN
codecs/avif/enc/avif_enc.wasm Executable file

Binary file not shown.

1
codecs/avif/enc/avif_enc_mt.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
export { default } from './avif_enc';

5693
codecs/avif/enc/avif_enc_mt.js generated Normal file

File diff suppressed because it is too large Load Diff

BIN
codecs/avif/enc/avif_enc_mt.wasm Executable file

Binary file not shown.

169
codecs/avif/enc/avif_enc_mt.worker.js generated Normal file
View File

@@ -0,0 +1,169 @@
/**
* @license
* Copyright 2015 The Emscripten Authors
* SPDX-License-Identifier: MIT
*/
// Pthread Web Worker startup routine:
// This is the entry point file that is loaded first by each Web Worker
// that executes pthreads on the Emscripten application.
// Thread-local:
var threadInfoStruct = 0; // Info area for this thread in Emscripten HEAP (shared). If zero, this worker is not currently hosting an executing pthread.
var selfThreadId = 0; // The ID of this thread. 0 if not hosting a pthread.
var parentThreadId = 0; // The ID of the parent pthread that launched this thread.
var initializedJS = false; // Guard variable for one-time init of the JS state (currently only embind types registration)
var Module = {};
function assert(condition, text) {
if (!condition) abort('Assertion failed: ' + text);
}
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});
}
// We don't need out() for now, but may need to add it if we want to use it
// here. Or, if this code all moves into the main JS, that problem will go
// away. (For now, adding it here increases code size for no benefit.)
var out = function() {
throw 'out() is not defined in worker.js.';
}
var err = threadPrintErr;
this.alert = threadAlert;
Module['instantiateWasm'] = function(info, receiveInstance) {
// Instantiate from the module posted from the main thread.
// We can just use sync instantiation in the worker.
var instance = new WebAssembly.Instance(Module['wasmModule'], info);
// We don't need the module anymore; new threads will be spawned from the main thread.
Module['wasmModule'] = null;
receiveInstance(instance); // The second 'module' parameter is intentionally null here, we don't need to keep a ref to the Module object from here.
return instance.exports;
};
this.onmessage = function(e) {
try {
if (e.data.cmd === 'load') { // Preload command that is called once per worker to parse and load the Emscripten code.
// Module and memory were sent from main thread
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') {
// This worker was idle, and now should start executing its pthread entry
// point.
// performance.now() is specced to return a wallclock time in msecs since
// that Web Worker/main thread launched. However for pthreads this can
// cause subtle problems in emscripten_get_now() as this essentially
// would measure time from pthread_create(), meaning that the clocks
// between each threads would be wildly out of sync. Therefore sync all
// pthreads to the clock on the main browser thread, so that different
// threads see a somewhat coherent clock across each of them
// (+/- 0.1msecs in testing).
Module['__performance_now_clock_drift'] = performance.now() - e.data.time;
threadInfoStruct = e.data.threadInfoStruct;
// Pass the thread address inside the asm.js scope to store it for fast access that avoids the need for a FFI out.
Module['registerPthreadPtr'](threadInfoStruct, /*isMainBrowserThread=*/0, /*isMainRuntimeThread=*/0);
selfThreadId = e.data.selfThreadId;
parentThreadId = e.data.parentThreadId;
// Establish the stack frame for this thread in global scope
// The stack grows downwards
var max = e.data.stackBase;
var top = e.data.stackBase + e.data.stackSize;
assert(threadInfoStruct);
assert(selfThreadId);
assert(parentThreadId);
assert(top != 0);
assert(max != 0);
assert(top > max);
// Also call inside JS module to set up the stack frame for this pthread in JS module scope
Module['establishStackSpace'](top, max);
Module['_emscripten_tls_init']();
Module['writeStackCookie']();
Module['PThread'].receiveObjectTransfer(e.data);
Module['PThread'].setThreadStatus(Module['_pthread_self'](), 1/*EM_THREAD_STATUS_RUNNING*/);
// Embind must initialize itself on all threads, as it generates support JS.
// We only do this once per worker since they get reused
if (!initializedJS) {
Module['___embind_register_native_and_builtin_types']();
initializedJS = true;
}
try {
// pthread entry points are always of signature 'void *ThreadMain(void *arg)'
// Native codebases sometimes spawn threads with other thread entry point signatures,
// such as void ThreadMain(void *arg), void *ThreadMain(), or void ThreadMain().
// That is not acceptable per C/C++ specification, but x86 compiler ABI extensions
// enable that to work. If you find the following line to crash, either change the signature
// to "proper" void *ThreadMain(void *arg) form, or try linking with the Emscripten linker
// flag -s EMULATE_FUNCTION_POINTER_CASTS=1 to add in emulation for this x86 ABI extension.
var result = Module['dynCall']('ii', e.data.start_routine, [e.data.arg]);
Module['checkStackCookie']();
// The thread might have finished without calling pthread_exit(). If so, then perform the exit operation ourselves.
// (This is a no-op if explicit pthread_exit() had been called prior.)
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); // Mark the thread as no longer running.
if (typeof(Module['_emscripten_futex_wake']) !== "function") {
err("Thread Initialisation failed.");
throw ex;
}
Module['_emscripten_futex_wake'](threadInfoStruct + 0 /*C_STRUCTS.pthread.threadStatus*/, 0x7FFFFFFF/*INT_MAX*/); // Wake all threads waiting on this thread to finish.
if (!(ex instanceof Module['ExitStatus'])) throw ex;
} else {
// else e == 'unwind', and we should fall through here and keep the pthread alive for asynchronous events.
err('Pthread 0x' + threadInfoStruct.toString(16) + ' completed its pthread main entry point with an unwind, keeping the pthread worker alive for asynchronous operation.');
}
}
} else if (e.data.cmd === 'cancel') { // Main thread is asking for a pthread_cancel() on this thread.
if (threadInfoStruct) {
Module['PThread'].threadCancel();
}
} else if (e.data.target === 'setimmediate') {
// no-op
} else if (e.data.cmd === 'processThreadQueue') {
if (threadInfoStruct) { // If this thread is actually running?
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;
}
};

3024
codecs/avif/enc/avif_node_enc.js generated Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@@ -0,0 +1,77 @@
# This is a helper Makefile for building LibAVIF + LibAOM with given params.
#
# Params that must be supplied by the caller:
# $(CODEC_DIR)
# $(LIBAOM_DIR)
# $(BUILD_DIR)
# $(OUT_JS)
# $(OUT_CPP)
# $(LIBAOM_FLAGS)
# $(LIBAVIF_FLAGS)
# $(ENVIRONMENT)
OUT_BUILD_DIR := $(BUILD_DIR)/$(basename $(OUT_JS))
CODEC_BUILD_DIR := $(OUT_BUILD_DIR)/libavif
CODEC_OUT := $(CODEC_BUILD_DIR)/libavif.a
LIBAOM_BUILD_DIR := $(OUT_BUILD_DIR)/libaom
LIBAOM_OUT := $(LIBAOM_BUILD_DIR)/libaom.a
OUT_WASM = $(OUT_JS:.js=.wasm)
OUT_WORKER=$(OUT_JS:.js=.worker.js)
.PHONY: all clean
all: $(OUT_JS)
$(OUT_JS): $(OUT_CPP) $(LIBAOM_OUT) $(CODEC_OUT)
$(CXX) \
-I $(CODEC_DIR)/include \
$(CXXFLAGS) \
$(LDFLAGS) \
$(OUT_FLAGS) \
--bind \
-s ALLOW_MEMORY_GROWTH=1 \
-s MODULARIZE=1 \
-s TEXTDECODER=2 \
-s ENVIRONMENT=$(ENVIRONMENT) \
-s EXPORT_ES6=1 \
-s EXPORT_NAME="$(basename $(@F))" \
-o $@ \
$+
$(CODEC_OUT): $(CODEC_DIR)/CMakeLists.txt $(LIBAOM_OUT)
emcmake cmake \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DBUILD_SHARED_LIBS=0 \
-DAVIF_CODEC_AOM=1 \
-DAOM_LIBRARY=$(LIBAOM_OUT) \
-DAOM_INCLUDE_DIR=$(LIBAOM_DIR) \
$(LIBAVIF_FLAGS) \
-B $(CODEC_BUILD_DIR) \
$(CODEC_DIR) && \
$(MAKE) -C $(CODEC_BUILD_DIR)
$(LIBAOM_OUT): $(LIBAOM_DIR)/CMakeLists.txt
emcmake cmake \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DENABLE_CCACHE=0 \
-DAOM_TARGET_CPU=generic \
-DENABLE_DOCS=0 \
-DENABLE_TESTS=0 \
-DENABLE_EXAMPLES=0 \
-DENABLE_TOOLS=0 \
-DCONFIG_ACCOUNTING=1 \
-DCONFIG_INSPECTION=0 \
-DCONFIG_RUNTIME_CPU_DETECT=0 \
-DCONFIG_WEBM_IO=0 \
$(LIBAOM_FLAGS) \
-B $(LIBAOM_BUILD_DIR) \
$(LIBAOM_DIR) && \
$(MAKE) -C $(LIBAOM_BUILD_DIR)
clean:
$(RM) $(OUT_JS) $(OUT_WASM) $(OUT_WORKER)
$(MAKE) -C $(CODEC_BUILD_DIR) clean
$(MAKE) -C $(LIBAOM_BUILD_DIR) clean

6
codecs/avif/package.json Normal file
View File

@@ -0,0 +1,6 @@
{
"name": "avif",
"scripts": {
"build": "../build-cpp.sh"
}
}

3
codecs/build-cpp.sh Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/sh -e
docker build -t squoosh-cpp - < ../cpp.Dockerfile
docker run -it --rm -v $PWD:/src squoosh-cpp "$@"

10
codecs/build-rust.sh Executable file
View File

@@ -0,0 +1,10 @@
set -e
if [ ! -z "$RUST_IMG" ]
then
# Get part after ":" (https://stackoverflow.com/a/15149278/439965).
IMG_SUFFIX=-${RUST_IMG#*:}
fi
IMG_NAME=squoosh-rust$IMG_SUFFIX
docker build -t $IMG_NAME --build-arg RUST_IMG - < ../rust.Dockerfile
docker run -it --rm -v $PWD:/src $IMG_NAME "$@"

9
codecs/cpp.Dockerfile Normal file
View File

@@ -0,0 +1,9 @@
FROM emscripten/emsdk:2.0.8
RUN apt-get update && apt-get install -qqy autoconf libtool pkg-config
ENV CFLAGS "-O3 -flto -s FILESYSTEM=0"
ENV CXXFLAGS "${CFLAGS} -std=c++17"
ENV LDFLAGS "${CFLAGS} -s PTHREAD_POOL_SIZE=navigator.hardwareConcurrency"
# Build and cache standard libraries with these flags
RUN emcc ${CXXFLAGS} --bind -xc++ /dev/null -o /dev/null
WORKDIR /src
CMD ["sh", "-c", "emmake make -j`nproc`"]

BIN
codecs/example.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 MiB

BIN
codecs/example.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

BIN
codecs/example_palette.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 239 KiB

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

@@ -0,0 +1 @@
/target

286
codecs/hqx/Cargo.lock generated Normal file
View File

@@ -0,0 +1,286 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "bumpalo"
version = "3.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820"
[[package]]
name = "cfg-if"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
[[package]]
name = "console_error_panic_hook"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8d976903543e0c48546a91908f21588a680a8c8f984df9a5d69feccb2b2a211"
dependencies = [
"cfg-if",
"wasm-bindgen",
]
[[package]]
name = "futures"
version = "0.1.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b980f2816d6ee8673b6517b52cb0e808a180efc92e5c19d02cdda79066703ef"
[[package]]
name = "hqx"
version = "0.1.0"
source = "git+https://github.com/CryZe/wasmboy-rs?tag=v0.1.3#d7cbae67906796928c8e451b186f3c653924beb8"
dependencies = [
"lazy_static",
]
[[package]]
name = "js-sys"
version = "0.3.42"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "52732a3d3ad72c58ad2dc70624f9c17b46ecd0943b9a4f1ee37c4c18c5d983e2"
dependencies = [
"wasm-bindgen",
]
[[package]]
name = "lazy_static"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
version = "0.2.73"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd7d4bd64732af4bf3a67f367c27df8520ad7e230c5817b8ff485864d80242b9"
[[package]]
name = "log"
version = "0.4.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b"
dependencies = [
"cfg-if",
]
[[package]]
name = "memory_units"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3"
[[package]]
name = "proc-macro2"
version = "0.4.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
dependencies = [
"unicode-xid 0.1.0",
]
[[package]]
name = "proc-macro2"
version = "1.0.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04f5f085b5d71e2188cb8271e5da0161ad52c3f227a661a3c135fdf28e258b12"
dependencies = [
"unicode-xid 0.2.1",
]
[[package]]
name = "quote"
version = "0.6.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1"
dependencies = [
"proc-macro2 0.4.30",
]
[[package]]
name = "quote"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37"
dependencies = [
"proc-macro2 1.0.19",
]
[[package]]
name = "scoped-tls"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2"
[[package]]
name = "squooshhqx"
version = "0.1.0"
dependencies = [
"cfg-if",
"console_error_panic_hook",
"hqx",
"wasm-bindgen",
"wasm-bindgen-test",
"wee_alloc",
]
[[package]]
name = "syn"
version = "1.0.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb7f4c519df8c117855e19dd8cc851e89eb746fe7a73f0157e0d95fdec5369b0"
dependencies = [
"proc-macro2 1.0.19",
"quote 1.0.7",
"unicode-xid 0.2.1",
]
[[package]]
name = "unicode-xid"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
[[package]]
name = "unicode-xid"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
[[package]]
name = "wasm-bindgen"
version = "0.2.65"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3edbcc9536ab7eababcc6d2374a0b7bfe13a2b6d562c5e07f370456b1a8f33d"
dependencies = [
"cfg-if",
"wasm-bindgen-macro",
]
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.65"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89ed2fb8c84bfad20ea66b26a3743f3e7ba8735a69fe7d95118c33ec8fc1244d"
dependencies = [
"bumpalo",
"lazy_static",
"log",
"proc-macro2 1.0.19",
"quote 1.0.7",
"syn",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-futures"
version = "0.3.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "83420b37346c311b9ed822af41ec2e82839bfe99867ec6c54e2da43b7538771c"
dependencies = [
"cfg-if",
"futures",
"js-sys",
"wasm-bindgen",
"web-sys",
]
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.65"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb071268b031a64d92fc6cf691715ca5a40950694d8f683c5bb43db7c730929e"
dependencies = [
"quote 1.0.7",
"wasm-bindgen-macro-support",
]
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.65"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf592c807080719d1ff2f245a687cbadb3ed28b2077ed7084b47aba8b691f2c6"
dependencies = [
"proc-macro2 1.0.19",
"quote 1.0.7",
"syn",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.65"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b6c0220ded549d63860c78c38f3bcc558d1ca3f4efa74942c536ddbbb55e87"
[[package]]
name = "wasm-bindgen-test"
version = "0.2.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2d9693b63a742d481c7f80587e057920e568317b2806988c59cd71618bc26c1"
dependencies = [
"console_error_panic_hook",
"futures",
"js-sys",
"scoped-tls",
"wasm-bindgen",
"wasm-bindgen-futures",
"wasm-bindgen-test-macro",
]
[[package]]
name = "wasm-bindgen-test-macro"
version = "0.2.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0789dac148a8840bbcf9efe13905463b733fa96543bfbf263790535c11af7ba5"
dependencies = [
"proc-macro2 0.4.30",
"quote 0.6.13",
]
[[package]]
name = "web-sys"
version = "0.3.42"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8be2398f326b7ba09815d0b403095f34dd708579220d099caae89be0b32137b2"
dependencies = [
"js-sys",
"wasm-bindgen",
]
[[package]]
name = "wee_alloc"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e"
dependencies = [
"cfg-if",
"libc",
"memory_units",
"winapi",
]
[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
dependencies = [
"winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"

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

@@ -0,0 +1,37 @@
[package]
name = "squooshhqx"
version = "0.1.0"
authors = ["Surma <surma@surma.link>"]
[lib]
crate-type = ["cdylib"]
[features]
default = ["console_error_panic_hook", "wee_alloc"]
[dependencies]
cfg-if = "0.1.2"
wasm-bindgen = "0.2.38"
# lazy_static = "1.0.0"
hqx = {git = "https://github.com/CryZe/wasmboy-rs", tag="v0.1.3"}
# The `console_error_panic_hook` crate provides better debugging of panics by
# logging them with `console.error`. This is great for development, but requires
# all the `std::fmt` and `std::panicking` infrastructure, so isn't great for
# code size when deploying.
console_error_panic_hook = { version = "0.1.1", optional = true }
# `wee_alloc` is a tiny allocator for wasm that is only ~1K in code size
# compared to the default allocator's ~10K. It is slower than the default
# allocator, however.
#
# Unfortunately, `wee_alloc` requires nightly Rust when targeting wasm for now.
wee_alloc = { version = "0.4.2", optional = true }
[dev-dependencies]
wasm-bindgen-test = "0.2"
[profile.release]
# Tell `rustc` to optimize for small code size.
opt-level = "s"
lto = true

201
codecs/hqx/LICENSE.codec.md Normal file
View File

@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

5
codecs/hqx/README.md Normal file
View File

@@ -0,0 +1,5 @@
# HQX
- Source: <https://github.com/CryZe/wasmboy-rs>
- Version: v0.1.2
- License: Apache 2.0

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

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

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

@@ -0,0 +1,6 @@
{
"name": "hqx",
"scripts": {
"build": "../build-rust.sh"
}
}

5
codecs/hqx/pkg/README.md Normal file
View File

@@ -0,0 +1,5 @@
# HQX
- Source: <https://github.com/CryZe/wasmboy-rs>
- Version: v0.1.2
- License: Apache 2.0

View File

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

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

@@ -0,0 +1,30 @@
/* tslint:disable */
/* eslint-disable */
/**
* @param {Uint32Array} input_image
* @param {number} input_width
* @param {number} input_height
* @param {number} factor
* @returns {Uint32Array}
*/
export function resize(input_image: Uint32Array, input_width: number, input_height: number, factor: number): Uint32Array;
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
export interface InitOutput {
readonly memory: WebAssembly.Memory;
readonly resize: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
readonly __wbindgen_malloc: (a: number) => number;
readonly __wbindgen_free: (a: number, b: number) => void;
}
/**
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
* for everything else, calls `WebAssembly.instantiate` directly.
*
* @param {InitInput | Promise<InitInput>} module_or_path
*
* @returns {Promise<InitOutput>}
*/
export default function init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;

108
codecs/hqx/pkg/squooshhqx.js generated Normal file
View File

@@ -0,0 +1,108 @@
let wasm;
let cachegetUint32Memory0 = null;
function getUint32Memory0() {
if (cachegetUint32Memory0 === null || cachegetUint32Memory0.buffer !== wasm.memory.buffer) {
cachegetUint32Memory0 = new Uint32Array(wasm.memory.buffer);
}
return cachegetUint32Memory0;
}
let WASM_VECTOR_LEN = 0;
function passArray32ToWasm0(arg, malloc) {
const ptr = malloc(arg.length * 4);
getUint32Memory0().set(arg, ptr / 4);
WASM_VECTOR_LEN = arg.length;
return ptr;
}
let cachegetInt32Memory0 = null;
function getInt32Memory0() {
if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {
cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);
}
return cachegetInt32Memory0;
}
function getArrayU32FromWasm0(ptr, len) {
return getUint32Memory0().subarray(ptr / 4, ptr / 4 + len);
}
/**
* @param {Uint32Array} input_image
* @param {number} input_width
* @param {number} input_height
* @param {number} factor
* @returns {Uint32Array}
*/
export function resize(input_image, input_width, input_height, factor) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
var ptr0 = passArray32ToWasm0(input_image, wasm.__wbindgen_malloc);
var len0 = WASM_VECTOR_LEN;
wasm.resize(retptr, ptr0, len0, input_width, input_height, factor);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v1 = getArrayU32FromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 4);
return v1;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
async function load(module, imports) {
if (typeof Response === 'function' && module instanceof Response) {
if (typeof WebAssembly.instantiateStreaming === 'function') {
try {
return await WebAssembly.instantiateStreaming(module, imports);
} catch (e) {
if (module.headers.get('Content-Type') != 'application/wasm') {
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
} else {
throw e;
}
}
}
const bytes = await module.arrayBuffer();
return await WebAssembly.instantiate(bytes, imports);
} else {
const instance = await WebAssembly.instantiate(module, imports);
if (instance instanceof WebAssembly.Instance) {
return { instance, module };
} else {
return instance;
}
}
}
async function init(input) {
if (typeof input === 'undefined') {
input = new URL('squooshhqx_bg.wasm', import.meta.url);
}
const imports = {};
if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
input = fetch(input);
}
const { instance, module } = await load(await input, imports);
wasm = instance.exports;
init.__wbindgen_wasm_module = module;
return wasm;
}
export default init;

Binary file not shown.

55
codecs/hqx/src/lib.rs Normal file
View File

@@ -0,0 +1,55 @@
extern crate cfg_if;
extern crate hqx;
extern crate wasm_bindgen;
mod utils;
use cfg_if::cfg_if;
use wasm_bindgen::prelude::*;
cfg_if! {
// When the `wee_alloc` feature is enabled, use `wee_alloc` as the global
// allocator.
if #[cfg(feature = "wee_alloc")] {
extern crate wee_alloc;
#[global_allocator]
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;
}
}
#[wasm_bindgen]
#[no_mangle]
pub fn resize(
input_image: Vec<u32>,
input_width: usize,
input_height: usize,
factor: usize,
) -> Vec<u32> {
let num_output_pixels = input_width * input_height * factor * factor;
let mut output_image = Vec::<u32>::with_capacity(num_output_pixels * 4);
output_image.resize(num_output_pixels, 0);
match factor {
2 => hqx::hq2x(
input_image.as_slice(),
output_image.as_mut_slice(),
input_width,
input_height,
),
3 => hqx::hq3x(
input_image.as_slice(),
output_image.as_mut_slice(),
input_width,
input_height,
),
4 => hqx::hq4x(
input_image.as_slice(),
output_image.as_mut_slice(),
input_width,
input_height,
),
_ => unreachable!(),
};
return output_image;
}

17
codecs/hqx/src/utils.rs Normal file
View File

@@ -0,0 +1,17 @@
use cfg_if::cfg_if;
cfg_if! {
// When the `console_error_panic_hook` feature is enabled, we can call the
// `set_panic_hook` function at least once during initialization, and then
// we will get better error messages if our code ever panics.
//
// For more details see
// https://github.com/rustwasm/console_error_panic_hook#readme
if #[cfg(feature = "console_error_panic_hook")] {
extern crate console_error_panic_hook;
pub use self::console_error_panic_hook::set_once as set_panic_hook;
} else {
#[inline]
pub fn set_panic_hook() {}
}
}

View File

@@ -0,0 +1,641 @@
libimagequant is derived from code by Jef Poskanzer and Greg Roelofs
licensed under pngquant's original license (at the end of this file),
and contains extensive changes and additions by Kornel Lesiński
licensed under GPL v3 or later.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
libimagequant © 2009-2018 by Kornel Lesiński.
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
© 1989, 1991 by Jef Poskanzer.
© 1997, 2000, 2002 by Greg Roelofs.
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted, provided
that the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation. This software is provided "as is" without express or
implied warranty.

View File

@@ -0,0 +1,45 @@
CODEC_URL := https://github.com/ImageOptim/libimagequant/archive/2.12.1.tar.gz
CODEC_DIR := node_modules/libimagequant
CODEC_OUT_RELATIVE := libimagequant.a
CODEC_OUT := $(addprefix $(CODEC_DIR)/, $(CODEC_OUT_RELATIVE))
OUT_JS := imagequant.js imagequant_node.js
OUT_WASM := $(OUT_JS:.js=.wasm)
ENVIRONMENT = worker
.PHONY: all clean
all: $(OUT_JS)
imagequant_node.js: ENVIRONMENT=node
$(OUT_JS): $(CODEC_OUT)
$(CXX) \
-I $(CODEC_DIR) \
${CXXFLAGS} \
${LDFLAGS} \
--bind \
--closure 1 \
-s ALLOW_MEMORY_GROWTH=1 \
-s MODULARIZE=1 \
-s TEXTDECODER=2 \
-s ENVIRONMENT=$(ENVIRONMENT) \
-s EXPORT_ES6=1 \
-o $@ \
$+ \
imagequant.cpp
$(CODEC_OUT): $(CODEC_DIR)/config.mk
$(MAKE) -C $(CODEC_DIR) $(CODEC_OUT_RELATIVE)
$(CODEC_DIR)/config.mk: $(CODEC_DIR)/configure
cd $(CODEC_DIR) && ./configure \
--disable-sse
$(CODEC_DIR)/configure: $(CODEC_DIR)
$(CODEC_DIR):
mkdir -p $@
curl -sL $(CODEC_URL) | tar xz --strip 1 -C $@
clean:
$(RM) $(OUT_JS) $(OUT_WASM)
$(MAKE) -C $(CODEC_DIR) clean

View File

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

View File

@@ -0,0 +1,52 @@
<!DOCTYPE html>
<style>
canvas {
image-rendering: pixelated;
}
</style>
<script type="module">
import imagequant from './imagequant.js';
async function loadImage(src) {
// Load image
const img = document.createElement('img');
img.src = src;
await new Promise((resolve) => (img.onload = resolve));
// 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 imagequant();
console.log('Version:', module.version().toString(16));
const image = await loadImage('../example.png');
const rawImage = module.quantize(
image.data,
image.width,
image.height,
256,
1.0,
);
console.log('done');
const imageData = new ImageData(
new Uint8ClampedArray(rawImage.buffer),
image.width,
image.height,
);
const canvas = document.createElement('canvas');
canvas.width = image.width;
canvas.height = image.height;
const ctx = canvas.getContext('2d');
ctx.putImageData(imageData, 0, 0);
document.body.appendChild(canvas);
}
main();
</script>

View File

@@ -0,0 +1,216 @@
#include <emscripten/bind.h>
#include <emscripten/val.h>
#include <inttypes.h>
#include <limits.h>
#include <math.h>
#include <stdlib.h>
#include "libimagequant.h"
using namespace emscripten;
int version() {
return (((LIQ_VERSION / 10000) % 100) << 16) | (((LIQ_VERSION / 100) % 100) << 8) |
(((LIQ_VERSION / 1) % 100) << 0);
}
thread_local const val Uint8ClampedArray = val::global("Uint8ClampedArray");
#define liq_ptr(T) std::unique_ptr<T, std::integral_constant<decltype(&T##_destroy), T##_destroy>>
using liq_attr_ptr = liq_ptr(liq_attr);
using liq_image_ptr = liq_ptr(liq_image);
using liq_result_ptr = liq_ptr(liq_result);
liq_result_ptr liq_image_quantize(liq_image* image, liq_attr* attr) {
liq_result* res = nullptr;
liq_image_quantize(image, attr, &res);
return liq_result_ptr(res);
}
val quantize(std::string rawimage,
int image_width,
int image_height,
int num_colors,
float dithering) {
auto image_buffer = (const liq_color*)rawimage.c_str();
int size = image_width * image_height;
liq_attr_ptr attr(liq_attr_create());
liq_image_ptr image(
liq_image_create_rgba(attr.get(), image_buffer, image_width, image_height, 0));
liq_set_max_colors(attr.get(), num_colors);
auto res = liq_image_quantize(image.get(), attr.get());
liq_set_dithering_level(res.get(), dithering);
std::vector<uint8_t> image8bit(size);
std::vector<liq_color> result(size);
liq_write_remapped_image(res.get(), image.get(), image8bit.data(), image8bit.size());
auto pal = liq_get_palette(res.get());
// Turn palletted image back into an RGBA image
for (int i = 0; i < size; i++) {
result[i] = pal->entries[image8bit[i]];
}
return Uint8ClampedArray.new_(
typed_memory_view(result.size() * sizeof(liq_color), (const uint8_t*)result.data()));
}
const liq_color zx_colors[] = {
{.r = 0, .g = 0, .b = 0, .a = 255}, // regular black
{.r = 0, .g = 0, .b = 215, .a = 255}, // regular blue
{.r = 215, .g = 0, .b = 0, .a = 255}, // regular red
{.r = 215, .g = 0, .b = 215, .a = 255}, // regular magenta
{.r = 0, .g = 215, .b = 0, .a = 255}, // regular green
{.r = 0, .g = 215, .b = 215, .a = 255}, // regular cyan
{.r = 215, .g = 215, .b = 0, .a = 255}, // regular yellow
{.r = 215, .g = 215, .b = 215, .a = 255}, // regular white
{.r = 0, .g = 0, .b = 255, .a = 255}, // bright blue
{.r = 255, .g = 0, .b = 0, .a = 255}, // bright red
{.r = 255, .g = 0, .b = 255, .a = 255}, // bright magenta
{.r = 0, .g = 255, .b = 0, .a = 255}, // bright green
{.r = 0, .g = 255, .b = 255, .a = 255}, // bright cyan
{.r = 255, .g = 255, .b = 0, .a = 255}, // bright yellow
{.r = 255, .g = 255, .b = 255, .a = 255} // bright white
};
/**
* The ZX has one bit per pixel, but can assign two colours to an 8x8 block. The
* two colours must both be 'regular' or 'bright'. Black exists as both regular
* and bright.
*/
val zx_quantize(std::string rawimage, int image_width, int image_height, float dithering) {
auto image_buffer = (const liq_color*)rawimage.c_str();
int size = image_width * image_height;
liq_color block[8 * 8];
uint8_t image8bit[8 * 8];
std::vector<liq_color> result(size);
// For each 8x8 grid
for (int block_start_y = 0; block_start_y < image_height; block_start_y += 8) {
for (int block_start_x = 0; block_start_x < image_width; block_start_x += 8) {
int color_popularity[15] = {0};
int block_index = 0;
int block_width = 8;
int block_height = 8;
// If the block hangs off the right/bottom of the image dimensions, make
// it smaller to fit.
if (block_start_y + block_height > image_height) {
block_height = image_height - block_start_y;
}
if (block_start_x + block_width > image_width) {
block_width = image_width - block_start_x;
}
// For each pixel in that block:
for (int y = block_start_y; y < block_start_y + block_height; y++) {
for (int x = block_start_x; x < block_start_x + block_width; x++) {
int pixel_start = (y * image_width) + x;
int smallest_distance = INT_MAX;
int winning_index = -1;
// Copy pixel data for quantizing later
block[block_index++] = image_buffer[pixel_start];
// Which zx color is this pixel closest to?
for (int color_index = 0; color_index < 15; color_index++) {
liq_color color = zx_colors[color_index];
liq_color pixel = image_buffer[pixel_start];
// Using Euclidean distance. LibQuant has better methods, but it
// requires conversion to LAB, so I don't think it's worth it.
int distance =
pow(color.r - pixel.r, 2) + pow(color.g - pixel.g, 2) + pow(color.b - pixel.b, 2);
if (distance < smallest_distance) {
winning_index = color_index;
smallest_distance = distance;
}
}
color_popularity[winning_index]++;
}
}
// Get the three most popular colours for the block.
int first_color_index = 0;
int second_color_index = 0;
int third_color_index = 0;
int highest_popularity = -1;
int second_highest_popularity = -1;
int third_highest_popularity = -1;
for (int color_index = 0; color_index < 15; color_index++) {
if (color_popularity[color_index] > highest_popularity) {
// Store this as the most popular pixel, and demote the current
// values:
third_color_index = second_color_index;
third_highest_popularity = second_highest_popularity;
second_color_index = first_color_index;
second_highest_popularity = highest_popularity;
first_color_index = color_index;
highest_popularity = color_popularity[color_index];
} else if (color_popularity[color_index] > second_highest_popularity) {
third_color_index = second_color_index;
third_highest_popularity = second_highest_popularity;
second_color_index = color_index;
second_highest_popularity = color_popularity[color_index];
} else if (color_popularity[color_index] > third_highest_popularity) {
third_color_index = color_index;
third_highest_popularity = color_popularity[color_index];
}
}
// ZX images can't mix bright and regular colours, except black which
// appears in both. Resolve any conflict:
while (1) {
// If either colour is black, there's no conflict to resolve.
if (first_color_index != 0 && second_color_index != 0) {
if (first_color_index >= 8 && second_color_index < 8) {
// Make the second color bright
second_color_index = second_color_index + 7;
} else if (first_color_index < 8 && second_color_index >= 8) {
// Make the second color regular
second_color_index = second_color_index - 7;
}
}
// If, during conflict resolving, we now have two of the same colour
// (because we initially selected the bright & regular version of the
// same colour), retry again with the third most popular colour.
if (first_color_index == second_color_index) {
second_color_index = third_color_index;
} else
break;
}
// Quantize
liq_attr_ptr attr(liq_attr_create());
liq_image_ptr image(liq_image_create_rgba(attr.get(), block, block_width, block_height, 0));
liq_set_max_colors(attr.get(), 2);
liq_image_add_fixed_color(image.get(), zx_colors[first_color_index]);
liq_image_add_fixed_color(image.get(), zx_colors[second_color_index]);
auto res = liq_image_quantize(image.get(), attr.get());
liq_set_dithering_level(res.get(), dithering);
liq_write_remapped_image(res.get(), image.get(), image8bit, size);
auto pal = liq_get_palette(res.get());
// Turn palletted image back into an RGBA image, and write it into the
// full size result image.
for (int y = 0; y < block_height; y++) {
for (int x = 0; x < block_width; x++) {
int image8BitPos = y * block_width + x;
int resultStartPos = ((block_start_y + y) * image_width) + (block_start_x + x);
result[resultStartPos] = pal->entries[image8bit[image8BitPos]];
}
}
}
}
return Uint8ClampedArray.new_(
typed_memory_view(result.size() * sizeof(liq_color), (const uint8_t*)result.data()));
}
EMSCRIPTEN_BINDINGS(my_module) {
function("quantize", &quantize);
function("zx_quantize", &zx_quantize);
function("version", &version);
}

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

@@ -0,0 +1,19 @@
export interface QuantizerModule extends EmscriptenWasm.Module {
quantize(
data: BufferSource,
width: number,
height: number,
numColors: number,
dither: number,
): Uint8ClampedArray;
zx_quantize(
data: BufferSource,
width: number,
height: number,
dither: number,
): Uint8ClampedArray;
}
declare var moduleFactory: EmscriptenWasm.ModuleFactory<QuantizerModule>;
export default moduleFactory;

57
codecs/imagequant/imagequant.js generated Normal file
View File

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

BIN
codecs/imagequant/imagequant.wasm Executable file

Binary file not shown.

56
codecs/imagequant/imagequant_node.js generated Normal file
View File

@@ -0,0 +1,56 @@
var Module = (function() {
var _scriptDir = import.meta.url;
return (
function(Module) {
Module = Module || {};
var e;e||(e=typeof Module !== 'undefined' ? Module : {});var aa,r;e.ready=new Promise(function(a,b){aa=a;r=b});var t={},u;for(u in e)e.hasOwnProperty(u)&&(t[u]=e[u]);var v="",ba,ca,da,ea;v=__dirname+"/";ba=function(a){da||(da=require("fs"));ea||(ea=require("path"));a=ea.normalize(a);return da.readFileSync(a,null)};ca=function(a){a=ba(a);a.buffer||(a=new Uint8Array(a));a.buffer||w("Assertion failed: undefined");return a};1<process.argv.length&&process.argv[1].replace(/\\/g,"/");process.argv.slice(2);
process.on("uncaughtException",function(a){throw a;});process.on("unhandledRejection",w);e.inspect=function(){return"[Emscripten Module object]"};var fa=e.print||console.log.bind(console),y=e.printErr||console.warn.bind(console);for(u in t)t.hasOwnProperty(u)&&(e[u]=t[u]);t=null;var z;e.wasmBinary&&(z=e.wasmBinary);var noExitRuntime;e.noExitRuntime&&(noExitRuntime=e.noExitRuntime);"object"!==typeof WebAssembly&&w("no native wasm support detected");var A,ha=!1,ia=new TextDecoder("utf8");
function ja(a,b,c){var d=C;if(0<c){c=b+c-1;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var l=a.charCodeAt(++f);g=65536+((g&1023)<<10)|l&1023}if(127>=g){if(b>=c)break;d[b++]=g}else{if(2047>=g){if(b+1>=c)break;d[b++]=192|g>>6}else{if(65535>=g){if(b+2>=c)break;d[b++]=224|g>>12}else{if(b+3>=c)break;d[b++]=240|g>>18;d[b++]=128|g>>12&63}d[b++]=128|g>>6&63}d[b++]=128|g&63}}d[b]=0}}var ka=new TextDecoder("utf-16le");
function la(a,b){var c=a>>1;for(b=c+b/2;!(c>=b)&&D[c];)++c;return ka.decode(C.subarray(a,c<<1))}function ma(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var d=b;c=c<2*a.length?c/2:a.length;for(var f=0;f<c;++f)E[b>>1]=a.charCodeAt(f),b+=2;E[b>>1]=0;return b-d}function na(a){return 2*a.length}function oa(a,b){for(var c=0,d="";!(c>=b/4);){var f=F[a+4*c>>2];if(0==f)break;++c;65536<=f?(f-=65536,d+=String.fromCharCode(55296|f>>10,56320|f&1023)):d+=String.fromCharCode(f)}return d}
function pa(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var d=b;c=d+c-4;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var l=a.charCodeAt(++f);g=65536+((g&1023)<<10)|l&1023}F[b>>2]=g;b+=4;if(b+4>c)break}F[b>>2]=0;return b-d}function qa(a){for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);55296<=d&&57343>=d&&++c;b+=4}return b}var G,ra,C,E,D,F,I,sa,ta;
function ua(a){G=a;e.HEAP8=ra=new Int8Array(a);e.HEAP16=E=new Int16Array(a);e.HEAP32=F=new Int32Array(a);e.HEAPU8=C=new Uint8Array(a);e.HEAPU16=D=new Uint16Array(a);e.HEAPU32=I=new Uint32Array(a);e.HEAPF32=sa=new Float32Array(a);e.HEAPF64=ta=new Float64Array(a)}var va=e.INITIAL_MEMORY||16777216;e.wasmMemory?A=e.wasmMemory:A=new WebAssembly.Memory({initial:va/65536,maximum:32768});A&&(G=A.buffer);va=G.byteLength;ua(G);var J,wa=[],xa=[],ya=[],za=[];
function Aa(){var a=e.preRun.shift();wa.unshift(a)}var K=0,Ba=null,M=null;e.preloadedImages={};e.preloadedAudios={};function w(a){if(e.onAbort)e.onAbort(a);y(a);ha=!0;a=new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");r(a);throw a;}function Ca(){var a=N;return String.prototype.startsWith?a.startsWith("data:application/octet-stream;base64,"):0===a.indexOf("data:application/octet-stream;base64,")}var N="imagequant_node.wasm";
if(!Ca()){var Da=N;N=e.locateFile?e.locateFile(Da,v):v+Da}function Ea(){try{if(z)return new Uint8Array(z);if(ca)return ca(N);throw"both async and sync fetching of the wasm failed";}catch(a){w(a)}}function O(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(e);else{var c=b.J;"number"===typeof c?void 0===b.G?J.get(c)():J.get(c)(b.G):c(void 0===b.G?null:b.G)}}}
function Fa(a){switch(a){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+a);}}var Ga=void 0;function P(a){for(var b="";C[a];)b+=Ga[C[a++]];return b}var Q={},R={},S={};function Ha(a){if(void 0===a)return"_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var b=a.charCodeAt(0);return 48<=b&&57>=b?"_"+a:a}
function Ia(a,b){a=Ha(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}function Ja(a){var b=Error,c=Ia(a,function(d){this.name=a;this.message=d;d=Error(d).stack;void 0!==d&&(this.stack=this.toString()+"\n"+d.replace(/^Error(:[^\n]*)?\n/,""))});c.prototype=Object.create(b.prototype);c.prototype.constructor=c;c.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message};return c}
var Ka=void 0;function T(a){throw new Ka(a);}var La=void 0;function Ma(a,b){function c(h){h=b(h);if(h.length!==d.length)throw new La("Mismatched type converter count");for(var k=0;k<d.length;++k)U(d[k],h[k])}var d=[];d.forEach(function(h){S[h]=a});var f=Array(a.length),g=[],l=0;a.forEach(function(h,k){R.hasOwnProperty(h)?f[k]=R[h]:(g.push(h),Q.hasOwnProperty(h)||(Q[h]=[]),Q[h].push(function(){f[k]=R[h];++l;l===g.length&&c(f)}))});0===g.length&&c(f)}
function U(a,b,c){c=c||{};if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");var d=b.name;a||T('type "'+d+'" must have a positive integer typeid pointer');if(R.hasOwnProperty(a)){if(c.K)return;T("Cannot register type '"+d+"' twice")}R[a]=b;delete S[a];Q.hasOwnProperty(a)&&(b=Q[a],delete Q[a],b.forEach(function(f){f()}))}var Pa=[],V=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
function Qa(a){4<a&&0===--V[a].H&&(V[a]=void 0,Pa.push(a))}function W(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=Pa.length?Pa.pop():V.length;V[b]={H:1,value:a};return b}}function Ra(a){return this.fromWireType(I[a>>2])}function Sa(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}
function Ta(a,b){switch(b){case 2:return function(c){return this.fromWireType(sa[c>>2])};case 3:return function(c){return this.fromWireType(ta[c>>3])};default:throw new TypeError("Unknown float type: "+a);}}function Ua(a){var b=Function;if(!(b instanceof Function))throw new TypeError("new_ called with constructor type "+typeof b+" which is not a function");var c=Ia(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c}
function Va(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function Wa(a,b){var c=e;if(void 0===c[a].D){var d=c[a];c[a]=function(){c[a].D.hasOwnProperty(arguments.length)||T("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+c[a].D+")!");return c[a].D[arguments.length].apply(this,arguments)};c[a].D=[];c[a].D[d.I]=d}}
function Xa(a,b,c){e.hasOwnProperty(a)?((void 0===c||void 0!==e[a].D&&void 0!==e[a].D[c])&&T("Cannot register public name '"+a+"' twice"),Wa(a,a),e.hasOwnProperty(c)&&T("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),e[a].D[c]=b):(e[a]=b,void 0!==c&&(e[a].M=c))}function Ya(a,b){for(var c=[],d=0;d<a;d++)c.push(F[(b>>2)+d]);return c}
function Za(a,b){0<=a.indexOf("j")||w("Assertion failed: getDynCaller should only be called with i64 sigs");var c=[];return function(){c.length=arguments.length;for(var d=0;d<arguments.length;d++)c[d]=arguments[d];var f;-1!=a.indexOf("j")?f=c&&c.length?e["dynCall_"+a].apply(null,[b].concat(c)):e["dynCall_"+a].call(null,b):f=J.get(b).apply(null,c);return f}}
function $a(a,b){a=P(a);var c=-1!=a.indexOf("j")?Za(a,b):J.get(b);"function"!==typeof c&&T("unknown function pointer with signature "+a+": "+b);return c}var ab=void 0;function bb(a){a=cb(a);var b=P(a);X(a);return b}function db(a,b){function c(g){f[g]||R[g]||(S[g]?S[g].forEach(c):(d.push(g),f[g]=!0))}var d=[],f={};b.forEach(c);throw new ab(a+": "+d.map(bb).join([", "]));}
function eb(a,b,c){switch(b){case 0:return c?function(d){return ra[d]}:function(d){return C[d]};case 1:return c?function(d){return E[d>>1]}:function(d){return D[d>>1]};case 2:return c?function(d){return F[d>>2]}:function(d){return I[d>>2]};default:throw new TypeError("Unknown integer type: "+a);}}var fb={};function gb(){return"object"===typeof globalThis?globalThis:Function("return this")()}function hb(a,b){var c=R[a];void 0===c&&T(b+" has unknown type "+bb(a));return c}
for(var ib={},jb=[null,[],[]],kb=Array(256),Y=0;256>Y;++Y)kb[Y]=String.fromCharCode(Y);Ga=kb;Ka=e.BindingError=Ja("BindingError");La=e.InternalError=Ja("InternalError");e.count_emval_handles=function(){for(var a=0,b=5;b<V.length;++b)void 0!==V[b]&&++a;return a};e.get_first_emval=function(){for(var a=5;a<V.length;++a)if(void 0!==V[a])return V[a];return null};ab=e.UnboundTypeError=Ja("UnboundTypeError");xa.push({J:function(){lb()}});
var nb={o:function(){},p:function(a,b,c,d,f){var g=Fa(c);b=P(b);U(a,{name:b,fromWireType:function(l){return!!l},toWireType:function(l,h){return h?d:f},argPackAdvance:8,readValueFromPointer:function(l){if(1===c)var h=ra;else if(2===c)h=E;else if(4===c)h=F;else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(h[l>>g])},F:null})},v:function(a,b){b=P(b);U(a,{name:b,fromWireType:function(c){var d=V[c].value;Qa(c);return d},toWireType:function(c,d){return W(d)},argPackAdvance:8,
readValueFromPointer:Ra,F:null})},n:function(a,b,c){c=Fa(c);b=P(b);U(a,{name:b,fromWireType:function(d){return d},toWireType:function(d,f){if("number"!==typeof f&&"boolean"!==typeof f)throw new TypeError('Cannot convert "'+Sa(f)+'" to '+this.name);return f},argPackAdvance:8,readValueFromPointer:Ta(b,c),F:null})},e:function(a,b,c,d,f,g){var l=Ya(b,c);a=P(a);f=$a(d,f);Xa(a,function(){db("Cannot call "+a+" due to unbound types",l)},b-1);Ma(l,function(h){var k=[h[0],null].concat(h.slice(1)),m=h=a,n=f,
p=k.length;2>p&&T("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var x=null!==k[1]&&!1,B=!1,q=1;q<k.length;++q)if(null!==k[q]&&void 0===k[q].F){B=!0;break}var Na="void"!==k[0].name,H="",L="";for(q=0;q<p-2;++q)H+=(0!==q?", ":"")+"arg"+q,L+=(0!==q?", ":"")+"arg"+q+"Wired";m="return function "+Ha(m)+"("+H+") {\nif (arguments.length !== "+(p-2)+") {\nthrowBindingError('function "+m+" called with ' + arguments.length + ' arguments, expected "+(p-2)+" args!');\n}\n";
B&&(m+="var destructors = [];\n");var Oa=B?"destructors":"null";H="throwBindingError invoker fn runDestructors retType classParam".split(" ");n=[T,n,g,Va,k[0],k[1]];x&&(m+="var thisWired = classParam.toWireType("+Oa+", this);\n");for(q=0;q<p-2;++q)m+="var arg"+q+"Wired = argType"+q+".toWireType("+Oa+", arg"+q+"); // "+k[q+2].name+"\n",H.push("argType"+q),n.push(k[q+2]);x&&(L="thisWired"+(0<L.length?", ":"")+L);m+=(Na?"var rv = ":"")+"invoker(fn"+(0<L.length?", ":"")+L+");\n";if(B)m+="runDestructors(destructors);\n";
else for(q=x?1:2;q<k.length;++q)p=1===q?"thisWired":"arg"+(q-2)+"Wired",null!==k[q].F&&(m+=p+"_dtor("+p+"); // "+k[q].name+"\n",H.push(p+"_dtor"),n.push(k[q].F));Na&&(m+="var ret = retType.fromWireType(rv);\nreturn ret;\n");H.push(m+"}\n");k=Ua(H).apply(null,n);q=b-1;if(!e.hasOwnProperty(h))throw new La("Replacing nonexistant public symbol");void 0!==e[h].D&&void 0!==q?e[h].D[q]=k:(e[h]=k,e[h].I=q);return[]})},c:function(a,b,c,d,f){function g(m){return m}b=P(b);-1===f&&(f=4294967295);var l=Fa(c);
if(0===d){var h=32-8*c;g=function(m){return m<<h>>>h}}var k=-1!=b.indexOf("unsigned");U(a,{name:b,fromWireType:g,toWireType:function(m,n){if("number"!==typeof n&&"boolean"!==typeof n)throw new TypeError('Cannot convert "'+Sa(n)+'" to '+this.name);if(n<d||n>f)throw new TypeError('Passing a number "'+Sa(n)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+d+", "+f+"]!");return k?n>>>0:n|0},argPackAdvance:8,readValueFromPointer:eb(b,l,0!==d),F:null})},
b:function(a,b,c){function d(g){g>>=2;var l=I;return new f(G,l[g+1],l[g])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];c=P(c);U(a,{name:c,fromWireType:d,argPackAdvance:8,readValueFromPointer:d},{K:!0})},i:function(a,b){b=P(b);var c="std::string"===b;U(a,{name:b,fromWireType:function(d){var f=I[d>>2];if(c)for(var g=d+4,l=0;l<=f;++l){var h=d+4+l;if(l==f||0==C[h]){if(g){for(var k=g+(h-g),m=g;!(m>=k)&&C[m];)++m;g=ia.decode(C.subarray(g,m))}else g=
"";if(void 0===n)var n=g;else n+=String.fromCharCode(0),n+=g;g=h+1}}else{n=Array(f);for(l=0;l<f;++l)n[l]=String.fromCharCode(C[d+4+l]);n=n.join("")}X(d);return n},toWireType:function(d,f){f instanceof ArrayBuffer&&(f=new Uint8Array(f));var g="string"===typeof f;g||f instanceof Uint8Array||f instanceof Uint8ClampedArray||f instanceof Int8Array||T("Cannot pass non-string to std::string");var l=(c&&g?function(){for(var m=0,n=0;n<f.length;++n){var p=f.charCodeAt(n);55296<=p&&57343>=p&&(p=65536+((p&1023)<<
10)|f.charCodeAt(++n)&1023);127>=p?++m:m=2047>=p?m+2:65535>=p?m+3:m+4}return m}:function(){return f.length})(),h=mb(4+l+1);I[h>>2]=l;if(c&&g)ja(f,h+4,l+1);else if(g)for(g=0;g<l;++g){var k=f.charCodeAt(g);255<k&&(X(h),T("String has UTF-16 code units that do not fit in 8 bits"));C[h+4+g]=k}else for(g=0;g<l;++g)C[h+4+g]=f[g];null!==d&&d.push(X,h);return h},argPackAdvance:8,readValueFromPointer:Ra,F:function(d){X(d)}})},g:function(a,b,c){c=P(c);if(2===b){var d=la;var f=ma;var g=na;var l=function(){return D};
var h=1}else 4===b&&(d=oa,f=pa,g=qa,l=function(){return I},h=2);U(a,{name:c,fromWireType:function(k){for(var m=I[k>>2],n=l(),p,x=k+4,B=0;B<=m;++B){var q=k+4+B*b;if(B==m||0==n[q>>h])x=d(x,q-x),void 0===p?p=x:(p+=String.fromCharCode(0),p+=x),x=q+b}X(k);return p},toWireType:function(k,m){"string"!==typeof m&&T("Cannot pass non-string to C++ string type "+c);var n=g(m),p=mb(4+n+b);I[p>>2]=n>>h;f(m,p+4,n+b);null!==k&&k.push(X,p);return p},argPackAdvance:8,readValueFromPointer:Ra,F:function(k){X(k)}})},
q:function(a,b){b=P(b);U(a,{L:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},f:Qa,l:function(a){if(0===a)return W(gb());var b=fb[a];a=void 0===b?P(a):b;return W(gb()[a])},j:function(a){4<a&&(V[a].H+=1)},k:function(a,b,c,d){a||T("Cannot use deleted val. handle = "+a);a=V[a].value;var f=ib[b];if(!f){f="";for(var g=0;g<b;++g)f+=(0!==g?", ":"")+"arg"+g;var l="return function emval_allocator_"+b+"(constructor, argTypes, args) {\n";for(g=0;g<b;++g)l+="var argType"+g+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+
g+'], "parameter '+g+'");\nvar arg'+g+" = argType"+g+".readValueFromPointer(args);\nargs += argType"+g+"['argPackAdvance'];\n";f=(new Function("requireRegisteredType","Module","__emval_register",l+("var obj = new constructor("+f+");\nreturn __emval_register(obj);\n}\n")))(hb,e,W);ib[b]=f}return f(a,c,d)},h:function(){w()},t:function(a,b,c){C.copyWithin(a,b,b+c)},d:function(a){a>>>=0;var b=C.length;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,a+100663296);d=Math.max(16777216,
a,d);0<d%65536&&(d+=65536-d%65536);a:{try{A.grow(Math.min(2147483648,d)-G.byteLength+65535>>>16);ua(A.buffer);var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},u:function(){return 0},r:function(){},m:function(a,b,c,d){for(var f=0,g=0;g<c;g++){for(var l=F[b+8*g>>2],h=F[b+(8*g+4)>>2],k=0;k<h;k++){var m=C[l+k],n=jb[a];if(0===m||10===m){m=1===a?fa:y;var p;for(p=0;n[p]&&!(NaN<=p);)++p;p=ia.decode(n.subarray?n.subarray(0,p):new Uint8Array(n.slice(0,p)));m(p);n.length=0}else n.push(m)}f+=h}F[d>>
2]=f;return 0},a:A,s:function(){}};
(function(){function a(f){e.asm=f.exports;J=e.asm.w;K--;e.monitorRunDependencies&&e.monitorRunDependencies(K);0==K&&(null!==Ba&&(clearInterval(Ba),Ba=null),M&&(f=M,M=null,f()))}function b(f){a(f.instance)}function c(f){return Promise.resolve().then(Ea).then(function(g){return WebAssembly.instantiate(g,d)}).then(f,function(g){y("failed to asynchronously prepare wasm: "+g);w(g)})}var d={a:nb};K++;e.monitorRunDependencies&&e.monitorRunDependencies(K);if(e.instantiateWasm)try{return e.instantiateWasm(d,a)}catch(f){return y("Module.instantiateWasm callback failed with error: "+
f),!1}(function(){return z||"function"!==typeof WebAssembly.instantiateStreaming||Ca()||"function"!==typeof fetch?c(b):fetch(N,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,d).then(b,function(g){y("wasm streaming compile failed: "+g);y("falling back to ArrayBuffer instantiation");return c(b)})})})().catch(r);return{}})();
var lb=e.___wasm_call_ctors=function(){return(lb=e.___wasm_call_ctors=e.asm.x).apply(null,arguments)},mb=e._malloc=function(){return(mb=e._malloc=e.asm.y).apply(null,arguments)},X=e._free=function(){return(X=e._free=e.asm.z).apply(null,arguments)},cb=e.___getTypeName=function(){return(cb=e.___getTypeName=e.asm.A).apply(null,arguments)};e.___embind_register_native_and_builtin_types=function(){return(e.___embind_register_native_and_builtin_types=e.asm.B).apply(null,arguments)};
e.dynCall_jiji=function(){return(e.dynCall_jiji=e.asm.C).apply(null,arguments)};var Z;M=function ob(){Z||pb();Z||(M=ob)};
function pb(){function a(){if(!Z&&(Z=!0,e.calledRun=!0,!ha)){O(xa);O(ya);aa(e);if(e.onRuntimeInitialized)e.onRuntimeInitialized();if(e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;){var b=e.postRun.shift();za.unshift(b)}O(za)}}if(!(0<K)){if(e.preRun)for("function"==typeof e.preRun&&(e.preRun=[e.preRun]);e.preRun.length;)Aa();O(wa);0<K||(e.setStatus?(e.setStatus("Running..."),setTimeout(function(){setTimeout(function(){e.setStatus("")},1);a()},1)):a())}}
e.run=pb;if(e.preInit)for("function"==typeof e.preInit&&(e.preInit=[e.preInit]);0<e.preInit.length;)e.preInit.pop()();noExitRuntime=!0;pb();
return Module.ready
}
);
})();
export default Module;

Binary file not shown.

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

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

View File

@@ -0,0 +1,6 @@
{
"name": "imagequant",
"scripts": {
"build": "../build-cpp.sh"
}
}

90
codecs/jxl/Makefile Normal file
View File

@@ -0,0 +1,90 @@
CODEC_URL = https://gitlab.com/wg1/jpeg-xl.git
CODEC_VERSION = 5175d11717f3c48cf506a2c0e0afb070392ae296
CODEC_DIR = node_modules/jxl
CODEC_BUILD_ROOT := $(CODEC_DIR)/build
CODEC_MT_BUILD_DIR := $(CODEC_BUILD_ROOT)/mt
CODEC_MT_SIMD_BUILD_DIR := $(CODEC_BUILD_ROOT)/mt-simd
ENVIRONMENT = worker
OUT_JS = enc/jxl_enc.js enc/jxl_enc_mt.js enc/jxl_enc_mt_simd.js dec/jxl_dec.js enc/jxl_node_enc.js dec/jxl_node_dec.js
OUT_WASM = $(OUT_JS:.js=.wasm)
OUT_WORKER = $(OUT_JS:.js=.worker.js)
.PHONY: all clean
all: $(OUT_JS)
# Define dependencies for all variations of build artifacts.
$(filter enc/%,$(OUT_JS)): enc/jxl_enc.cpp
$(filter dec/%,$(OUT_JS)): dec/jxl_dec.cpp
enc/jxl_node_enc.js dec/jxl_node_dec.js: ENVIRONMENT = node
# For single-threaded build, we compile with threads enabled, but then just don't use them nor link them in.
enc/jxl_enc.js enc/jxl_node_enc.js enc/jxl_enc_mt.js dec/jxl_dec.js dec/jxl_node_dec.js: CODEC_BUILD_DIR:=$(CODEC_MT_BUILD_DIR)
enc/jxl_enc_mt_simd.js: CODEC_BUILD_DIR:=$(CODEC_MT_SIMD_BUILD_DIR)
enc/jxl_node_enc.js dec/jxl_node_dec.js enc/jxl_enc.js dec/jxl_dec.js: $(CODEC_MT_BUILD_DIR)/lib/libjxl.a
enc/jxl_enc_mt.js: $(CODEC_MT_BUILD_DIR)/lib/libjxl.a $(CODEC_MT_BUILD_DIR)/lib/libjxl_threads.a
enc/jxl_enc_mt_simd.js: $(CODEC_MT_SIMD_BUILD_DIR)/lib/libjxl.a $(CODEC_MT_SIMD_BUILD_DIR)/lib/libjxl_threads.a
# Compile multithreaded wrappers with -pthread.
enc/jxl_enc_mt.js enc/jxl_enc_mt_simd.js: CXXFLAGS+=-pthread
$(OUT_JS):
$(CXX) \
$(CXXFLAGS) \
$(LDFLAGS) \
-I $(CODEC_DIR) \
-I $(CODEC_DIR)/lib \
-I $(CODEC_DIR)/lib/include \
-I $(CODEC_BUILD_DIR)/lib/include \
-I $(CODEC_DIR)/third_party/highway \
-I $(CODEC_DIR)/third_party/skcms \
--bind \
--closure 1 \
-s ALLOW_MEMORY_GROWTH=1 \
-s MODULARIZE=1 \
-s TEXTDECODER=2 \
-s ENVIRONMENT=$(ENVIRONMENT) \
-s EXPORT_ES6=1 \
-s EXPORT_NAME="$(basename $(@F))" \
-o $@ \
$+ \
$(CODEC_BUILD_DIR)/third_party/brotli/libbrotlidec-static.a \
$(CODEC_BUILD_DIR)/third_party/brotli/libbrotlienc-static.a \
$(CODEC_BUILD_DIR)/third_party/brotli/libbrotlicommon-static.a \
$(CODEC_BUILD_DIR)/third_party/libskcms.a \
$(CODEC_BUILD_DIR)/third_party/highway/libhwy.a
%/lib/libjxl.a: %/Makefile
$(MAKE) -C $(<D) jxl-static
%/lib/libjxl_threads.a: %/Makefile
$(MAKE) -C $(<D) jxl_threads-static
# Enable SIMD on a SIMD build.
$(CODEC_MT_SIMD_BUILD_DIR)/Makefile: CXXFLAGS+=-msimd128
%/Makefile: $(CODEC_DIR)/CMakeLists.txt
emcmake cmake \
$(CMAKE_FLAGS) \
-DBUILD_SHARED_LIBS=0 \
-DJPEGXL_ENABLE_BENCHMARK=0 \
-DJPEGXL_ENABLE_EXAMPLES=0 \
-DBUILD_TESTING=0 \
-B $(@D) \
$(<D)
$(CODEC_DIR)/CMakeLists.txt:
$(RM) -r $(@D)
git init $(@D)
git -C $(@D) fetch $(CODEC_URL) $(CODEC_VERSION) --depth 1
git -C $(@D) checkout FETCH_HEAD
git -C $(@D) submodule update --init --depth 1 --recursive --jobs `nproc`
clean:
$(RM) $(OUT_JS) $(OUT_WASM) $(OUT_WORKER)
$(MAKE) -C $(CODEC_BUILD_DIR) clean
$(MAKE) -C $(CODEC_MT_BUILD_DIR) clean
$(MAKE) -C $(CODEC_MT_SIMD_BUILD_DIR) clean

View File

@@ -0,0 +1,99 @@
#include <emscripten/bind.h>
#include <emscripten/val.h>
#include <jxl/decode.h>
#include "lib/jxl/color_encoding_internal.h"
#include "skcms.h"
using namespace emscripten;
thread_local const val Uint8ClampedArray = val::global("Uint8ClampedArray");
thread_local const val ImageData = val::global("ImageData");
// R, G, B, A
#define COMPONENTS_PER_PIXEL 4
#ifndef JXL_DEBUG_ON_ALL_ERROR
#define JXL_DEBUG_ON_ALL_ERROR 0
#endif
#if JXL_DEBUG_ON_ALL_ERROR
#define EXPECT_TRUE(a) \
if (!(a)) { \
fprintf(stderr, "Assertion failure (%d): %s\n", __LINE__, #a); \
return val::null(); \
}
#define EXPECT_EQ(a, b) \
{ \
int a_ = a; \
int b_ = b; \
if (a_ != b_) { \
fprintf(stderr, "Assertion failure (%d): %s (%d) != %s (%d)\n", __LINE__, #a, a_, #b, b_); \
return val::null(); \
} \
}
#else
#define EXPECT_TRUE(a) \
if (!(a)) { \
return val::null(); \
}
#define EXPECT_EQ(a, b) EXPECT_TRUE((a) == (b));
#endif
val decode(std::string data) {
std::unique_ptr<JxlDecoder,
std::integral_constant<decltype(&JxlDecoderDestroy), JxlDecoderDestroy>>
dec(JxlDecoderCreate(nullptr));
EXPECT_EQ(JXL_DEC_SUCCESS,
JxlDecoderSubscribeEvents(
dec.get(), JXL_DEC_BASIC_INFO | JXL_DEC_COLOR_ENCODING | JXL_DEC_FULL_IMAGE));
auto next_in = (const uint8_t*)data.c_str();
auto avail_in = data.size();
JxlDecoderSetInput(dec.get(), next_in, avail_in);
EXPECT_EQ(JXL_DEC_BASIC_INFO, JxlDecoderProcessInput(dec.get()));
JxlBasicInfo info;
EXPECT_EQ(JXL_DEC_SUCCESS, JxlDecoderGetBasicInfo(dec.get(), &info));
size_t pixel_count = info.xsize * info.ysize;
size_t component_count = pixel_count * COMPONENTS_PER_PIXEL;
EXPECT_EQ(JXL_DEC_COLOR_ENCODING, JxlDecoderProcessInput(dec.get()));
static const JxlPixelFormat format = {COMPONENTS_PER_PIXEL, JXL_TYPE_FLOAT, JXL_LITTLE_ENDIAN, 0};
size_t icc_size;
EXPECT_EQ(JXL_DEC_SUCCESS, JxlDecoderGetICCProfileSize(dec.get(), &format,
JXL_COLOR_PROFILE_TARGET_DATA, &icc_size));
std::vector<uint8_t> icc_profile(icc_size);
EXPECT_EQ(JXL_DEC_SUCCESS,
JxlDecoderGetColorAsICCProfile(dec.get(), &format, JXL_COLOR_PROFILE_TARGET_DATA,
icc_profile.data(), icc_profile.size()));
EXPECT_EQ(JXL_DEC_NEED_IMAGE_OUT_BUFFER, JxlDecoderProcessInput(dec.get()));
size_t buffer_size;
EXPECT_EQ(JXL_DEC_SUCCESS, JxlDecoderImageOutBufferSize(dec.get(), &format, &buffer_size));
EXPECT_EQ(buffer_size, component_count * sizeof(float));
auto float_pixels = std::make_unique<float[]>(component_count);
EXPECT_EQ(JXL_DEC_SUCCESS, JxlDecoderSetImageOutBuffer(dec.get(), &format, float_pixels.get(),
component_count * sizeof(float)));
EXPECT_EQ(JXL_DEC_FULL_IMAGE, JxlDecoderProcessInput(dec.get()));
auto byte_pixels = std::make_unique<uint8_t[]>(component_count);
// Convert to sRGB.
skcms_ICCProfile jxl_profile;
EXPECT_TRUE(skcms_Parse(icc_profile.data(), icc_profile.size(), &jxl_profile));
EXPECT_TRUE(skcms_Transform(
float_pixels.get(), skcms_PixelFormat_RGBA_ffff,
info.alpha_premultiplied ? skcms_AlphaFormat_PremulAsEncoded : skcms_AlphaFormat_Unpremul,
&jxl_profile, byte_pixels.get(), skcms_PixelFormat_RGBA_8888, skcms_AlphaFormat_Unpremul,
skcms_sRGB_profile(), pixel_count));
return ImageData.new_(
Uint8ClampedArray.new_(typed_memory_view(component_count, byte_pixels.get())), info.xsize,
info.ysize);
}
EMSCRIPTEN_BINDINGS(my_module) {
function("decode", &decode);
}

7
codecs/jxl/dec/jxl_dec.d.ts vendored Normal file
View File

@@ -0,0 +1,7 @@
export interface JXLModule extends EmscriptenWasm.Module {
decode(data: BufferSource): ImageData | null;
}
declare var moduleFactory: EmscriptenWasm.ModuleFactory<JXLModule>;
export default moduleFactory;

58
codecs/jxl/dec/jxl_dec.js generated Normal file
View File

@@ -0,0 +1,58 @@
var jxl_dec = (function() {
var _scriptDir = import.meta.url;
return (
function(jxl_dec) {
jxl_dec = jxl_dec || {};
var e;e||(e=typeof jxl_dec !== 'undefined' ? jxl_dec : {});var aa,ba;e.ready=new Promise(function(a,b){aa=a;ba=b});var r={},t;for(t in e)e.hasOwnProperty(t)&&(r[t]=e[t]);var ca="./this.program",u="",da;u=self.location.href;_scriptDir&&(u=_scriptDir);0!==u.indexOf("blob:")?u=u.substr(0,u.lastIndexOf("/")+1):u="";da=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)};
var ea=e.print||console.log.bind(console),v=e.printErr||console.warn.bind(console);for(t in r)r.hasOwnProperty(t)&&(e[t]=r[t]);r=null;e.thisProgram&&(ca=e.thisProgram);var w;e.wasmBinary&&(w=e.wasmBinary);var noExitRuntime;e.noExitRuntime&&(noExitRuntime=e.noExitRuntime);"object"!==typeof WebAssembly&&y("no native wasm support detected");var z,fa=!1,ha=new TextDecoder("utf8");
function ia(a,b,c){var d=A;if(0<c){c=b+c-1;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var l=a.charCodeAt(++f);g=65536+((g&1023)<<10)|l&1023}if(127>=g){if(b>=c)break;d[b++]=g}else{if(2047>=g){if(b+1>=c)break;d[b++]=192|g>>6}else{if(65535>=g){if(b+2>=c)break;d[b++]=224|g>>12}else{if(b+3>=c)break;d[b++]=240|g>>18;d[b++]=128|g>>12&63}d[b++]=128|g>>6&63}d[b++]=128|g&63}}d[b]=0}}var ja=new TextDecoder("utf-16le");
function ka(a,b){var c=a>>1;for(b=c+b/2;!(c>=b)&&B[c];)++c;return ja.decode(A.subarray(a,c<<1))}function la(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var d=b;c=c<2*a.length?c/2:a.length;for(var f=0;f<c;++f)D[b>>1]=a.charCodeAt(f),b+=2;D[b>>1]=0;return b-d}function ma(a){return 2*a.length}function na(a,b){for(var c=0,d="";!(c>=b/4);){var f=E[a+4*c>>2];if(0==f)break;++c;65536<=f?(f-=65536,d+=String.fromCharCode(55296|f>>10,56320|f&1023)):d+=String.fromCharCode(f)}return d}
function oa(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var d=b;c=d+c-4;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var l=a.charCodeAt(++f);g=65536+((g&1023)<<10)|l&1023}E[b>>2]=g;b+=4;if(b+4>c)break}E[b>>2]=0;return b-d}function pa(a){for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);55296<=d&&57343>=d&&++c;b+=4}return b}var F,G,A,D,B,E,H,qa,ra;
function sa(a){F=a;e.HEAP8=G=new Int8Array(a);e.HEAP16=D=new Int16Array(a);e.HEAP32=E=new Int32Array(a);e.HEAPU8=A=new Uint8Array(a);e.HEAPU16=B=new Uint16Array(a);e.HEAPU32=H=new Uint32Array(a);e.HEAPF32=qa=new Float32Array(a);e.HEAPF64=ra=new Float64Array(a)}var ta=e.INITIAL_MEMORY||16777216;e.wasmMemory?z=e.wasmMemory:z=new WebAssembly.Memory({initial:ta/65536,maximum:32768});z&&(F=z.buffer);ta=F.byteLength;sa(F);var J,ua=[],va=[],wa=[],xa=[];
function ya(){var a=e.preRun.shift();ua.unshift(a)}var K=0,za=null,L=null;e.preloadedImages={};e.preloadedAudios={};function y(a){if(e.onAbort)e.onAbort(a);v(a);fa=!0;a=new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");ba(a);throw a;}function Aa(){var a=N;return String.prototype.startsWith?a.startsWith("data:application/octet-stream;base64,"):0===a.indexOf("data:application/octet-stream;base64,")}var N="jxl_dec.wasm";
if(!Aa()){var Ba=N;N=e.locateFile?e.locateFile(Ba,u):u+Ba}function Ca(){try{if(w)return new Uint8Array(w);if(da)return da(N);throw"both async and sync fetching of the wasm failed";}catch(a){y(a)}}function Da(){return w||"function"!==typeof fetch?Promise.resolve().then(Ca):fetch(N,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+N+"'";return a.arrayBuffer()}).catch(function(){return Ca()})}
function O(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(e);else{var c=b.L;"number"===typeof c?void 0===b.I?J.get(c)():J.get(c)(b.I):c(void 0===b.I?null:b.I)}}}function Ea(a){switch(a){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+a);}}var Fa=void 0;function P(a){for(var b="";A[a];)b+=Fa[A[a++]];return b}var Q={},R={},S={};
function Ga(a){if(void 0===a)return"_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var b=a.charCodeAt(0);return 48<=b&&57>=b?"_"+a:a}function Ha(a,b){a=Ga(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}
function Ia(a){var b=Error,c=Ha(a,function(d){this.name=a;this.message=d;d=Error(d).stack;void 0!==d&&(this.stack=this.toString()+"\n"+d.replace(/^Error(:[^\n]*)?\n/,""))});c.prototype=Object.create(b.prototype);c.prototype.constructor=c;c.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message};return c}var Ja=void 0;function T(a){throw new Ja(a);}var Ka=void 0;
function La(a,b){function c(h){h=b(h);if(h.length!==d.length)throw new Ka("Mismatched type converter count");for(var p=0;p<d.length;++p)U(d[p],h[p])}var d=[];d.forEach(function(h){S[h]=a});var f=Array(a.length),g=[],l=0;a.forEach(function(h,p){R.hasOwnProperty(h)?f[p]=R[h]:(g.push(h),Q.hasOwnProperty(h)||(Q[h]=[]),Q[h].push(function(){f[p]=R[h];++l;l===g.length&&c(f)}))});0===g.length&&c(f)}
function U(a,b,c){c=c||{};if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");var d=b.name;a||T('type "'+d+'" must have a positive integer typeid pointer');if(R.hasOwnProperty(a)){if(c.M)return;T("Cannot register type '"+d+"' twice")}R[a]=b;delete S[a];Q.hasOwnProperty(a)&&(b=Q[a],delete Q[a],b.forEach(function(f){f()}))}var Ma=[],V=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
function Na(a){4<a&&0===--V[a].J&&(V[a]=void 0,Ma.push(a))}function W(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=Ma.length?Ma.pop():V.length;V[b]={J:1,value:a};return b}}function Oa(a){return this.fromWireType(H[a>>2])}function Ra(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}
function Sa(a,b){switch(b){case 2:return function(c){return this.fromWireType(qa[c>>2])};case 3:return function(c){return this.fromWireType(ra[c>>3])};default:throw new TypeError("Unknown float type: "+a);}}function Ta(a){var b=Function;if(!(b instanceof Function))throw new TypeError("new_ called with constructor type "+typeof b+" which is not a function");var c=Ha(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c}
function Ua(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function Va(a,b){var c=e;if(void 0===c[a].G){var d=c[a];c[a]=function(){c[a].G.hasOwnProperty(arguments.length)||T("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+c[a].G+")!");return c[a].G[arguments.length].apply(this,arguments)};c[a].G=[];c[a].G[d.K]=d}}
function Wa(a,b,c){e.hasOwnProperty(a)?((void 0===c||void 0!==e[a].G&&void 0!==e[a].G[c])&&T("Cannot register public name '"+a+"' twice"),Va(a,a),e.hasOwnProperty(c)&&T("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),e[a].G[c]=b):(e[a]=b,void 0!==c&&(e[a].O=c))}function Xa(a,b){for(var c=[],d=0;d<a;d++)c.push(E[(b>>2)+d]);return c}
function Ya(a,b){0<=a.indexOf("j")||y("Assertion failed: getDynCaller should only be called with i64 sigs");var c=[];return function(){c.length=arguments.length;for(var d=0;d<arguments.length;d++)c[d]=arguments[d];var f;-1!=a.indexOf("j")?f=c&&c.length?e["dynCall_"+a].apply(null,[b].concat(c)):e["dynCall_"+a].call(null,b):f=J.get(b).apply(null,c);return f}}
function Za(a,b){a=P(a);var c=-1!=a.indexOf("j")?Ya(a,b):J.get(b);"function"!==typeof c&&T("unknown function pointer with signature "+a+": "+b);return c}var $a=void 0;function ab(a){a=bb(a);var b=P(a);X(a);return b}function cb(a,b){function c(g){f[g]||R[g]||(S[g]?S[g].forEach(c):(d.push(g),f[g]=!0))}var d=[],f={};b.forEach(c);throw new $a(a+": "+d.map(ab).join([", "]));}
function db(a,b,c){switch(b){case 0:return c?function(d){return G[d]}:function(d){return A[d]};case 1:return c?function(d){return D[d>>1]}:function(d){return B[d>>1]};case 2:return c?function(d){return E[d>>2]}:function(d){return H[d>>2]};default:throw new TypeError("Unknown integer type: "+a);}}var eb={};function fb(){return"object"===typeof globalThis?globalThis:Function("return this")()}function gb(a,b){var c=R[a];void 0===c&&T(b+" has unknown type "+ab(a));return c}var hb={},ib={};
function jb(){if(!kb){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"===typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:ca||"./this.program"},b;for(b in ib)a[b]=ib[b];var c=[];for(b in a)c.push(b+"="+a[b]);kb=c}return kb}for(var kb,lb=[null,[],[]],mb=Array(256),Y=0;256>Y;++Y)mb[Y]=String.fromCharCode(Y);Fa=mb;Ja=e.BindingError=Ia("BindingError");Ka=e.InternalError=Ia("InternalError");
e.count_emval_handles=function(){for(var a=0,b=5;b<V.length;++b)void 0!==V[b]&&++a;return a};e.get_first_emval=function(){for(var a=5;a<V.length;++a)if(void 0!==V[a])return V[a];return null};$a=e.UnboundTypeError=Ia("UnboundTypeError");va.push({L:function(){nb()}});
var pb={h:function(){},o:function(a,b,c,d,f){var g=Ea(c);b=P(b);U(a,{name:b,fromWireType:function(l){return!!l},toWireType:function(l,h){return h?d:f},argPackAdvance:8,readValueFromPointer:function(l){if(1===c)var h=G;else if(2===c)h=D;else if(4===c)h=E;else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(h[l>>g])},H:null})},x:function(a,b){b=P(b);U(a,{name:b,fromWireType:function(c){var d=V[c].value;Na(c);return d},toWireType:function(c,d){return W(d)},argPackAdvance:8,
readValueFromPointer:Oa,H:null})},n:function(a,b,c){c=Ea(c);b=P(b);U(a,{name:b,fromWireType:function(d){return d},toWireType:function(d,f){if("number"!==typeof f&&"boolean"!==typeof f)throw new TypeError('Cannot convert "'+Ra(f)+'" to '+this.name);return f},argPackAdvance:8,readValueFromPointer:Sa(b,c),H:null})},q:function(a,b,c,d,f,g){var l=Xa(b,c);a=P(a);f=Za(d,f);Wa(a,function(){cb("Cannot call "+a+" due to unbound types",l)},b-1);La(l,function(h){var p=a,k=a;h=[h[0],null].concat(h.slice(1));var m=
f,q=h.length;2>q&&T("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var x=null!==h[1]&&!1,C=!1,n=1;n<h.length;++n)if(null!==h[n]&&void 0===h[n].H){C=!0;break}var Pa="void"!==h[0].name,I="",M="";for(n=0;n<q-2;++n)I+=(0!==n?", ":"")+"arg"+n,M+=(0!==n?", ":"")+"arg"+n+"Wired";k="return function "+Ga(k)+"("+I+") {\nif (arguments.length !== "+(q-2)+") {\nthrowBindingError('function "+k+" called with ' + arguments.length + ' arguments, expected "+(q-2)+" args!');\n}\n";
C&&(k+="var destructors = [];\n");var Qa=C?"destructors":"null";I="throwBindingError invoker fn runDestructors retType classParam".split(" ");m=[T,m,g,Ua,h[0],h[1]];x&&(k+="var thisWired = classParam.toWireType("+Qa+", this);\n");for(n=0;n<q-2;++n)k+="var arg"+n+"Wired = argType"+n+".toWireType("+Qa+", arg"+n+"); // "+h[n+2].name+"\n",I.push("argType"+n),m.push(h[n+2]);x&&(M="thisWired"+(0<M.length?", ":"")+M);k+=(Pa?"var rv = ":"")+"invoker(fn"+(0<M.length?", ":"")+M+");\n";if(C)k+="runDestructors(destructors);\n";
else for(n=x?1:2;n<h.length;++n)q=1===n?"thisWired":"arg"+(n-2)+"Wired",null!==h[n].H&&(k+=q+"_dtor("+q+"); // "+h[n].name+"\n",I.push(q+"_dtor"),m.push(h[n].H));Pa&&(k+="var ret = retType.fromWireType(rv);\nreturn ret;\n");I.push(k+"}\n");h=Ta(I).apply(null,m);n=b-1;if(!e.hasOwnProperty(p))throw new Ka("Replacing nonexistant public symbol");void 0!==e[p].G&&void 0!==n?e[p].G[n]=h:(e[p]=h,e[p].K=n);return[]})},d:function(a,b,c,d,f){function g(k){return k}b=P(b);-1===f&&(f=4294967295);var l=Ea(c);
if(0===d){var h=32-8*c;g=function(k){return k<<h>>>h}}var p=-1!=b.indexOf("unsigned");U(a,{name:b,fromWireType:g,toWireType:function(k,m){if("number"!==typeof m&&"boolean"!==typeof m)throw new TypeError('Cannot convert "'+Ra(m)+'" to '+this.name);if(m<d||m>f)throw new TypeError('Passing a number "'+Ra(m)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+d+", "+f+"]!");return p?m>>>0:m|0},argPackAdvance:8,readValueFromPointer:db(b,l,0!==d),H:null})},
c:function(a,b,c){function d(g){g>>=2;var l=H;return new f(F,l[g+1],l[g])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];c=P(c);U(a,{name:c,fromWireType:d,argPackAdvance:8,readValueFromPointer:d},{M:!0})},j:function(a,b){b=P(b);var c="std::string"===b;U(a,{name:b,fromWireType:function(d){var f=H[d>>2];if(c)for(var g=d+4,l=0;l<=f;++l){var h=d+4+l;if(l==f||0==A[h]){if(g){for(var p=g+(h-g),k=g;!(k>=p)&&A[k];)++k;g=ha.decode(A.subarray(g,k))}else g=
"";if(void 0===m)var m=g;else m+=String.fromCharCode(0),m+=g;g=h+1}}else{m=Array(f);for(l=0;l<f;++l)m[l]=String.fromCharCode(A[d+4+l]);m=m.join("")}X(d);return m},toWireType:function(d,f){f instanceof ArrayBuffer&&(f=new Uint8Array(f));var g="string"===typeof f;g||f instanceof Uint8Array||f instanceof Uint8ClampedArray||f instanceof Int8Array||T("Cannot pass non-string to std::string");var l=(c&&g?function(){for(var k=0,m=0;m<f.length;++m){var q=f.charCodeAt(m);55296<=q&&57343>=q&&(q=65536+((q&1023)<<
10)|f.charCodeAt(++m)&1023);127>=q?++k:k=2047>=q?k+2:65535>=q?k+3:k+4}return k}:function(){return f.length})(),h=ob(4+l+1);H[h>>2]=l;if(c&&g)ia(f,h+4,l+1);else if(g)for(g=0;g<l;++g){var p=f.charCodeAt(g);255<p&&(X(h),T("String has UTF-16 code units that do not fit in 8 bits"));A[h+4+g]=p}else for(g=0;g<l;++g)A[h+4+g]=f[g];null!==d&&d.push(X,h);return h},argPackAdvance:8,readValueFromPointer:Oa,H:function(d){X(d)}})},i:function(a,b,c){c=P(c);if(2===b){var d=ka;var f=la;var g=ma;var l=function(){return B};
var h=1}else 4===b&&(d=na,f=oa,g=pa,l=function(){return H},h=2);U(a,{name:c,fromWireType:function(p){for(var k=H[p>>2],m=l(),q,x=p+4,C=0;C<=k;++C){var n=p+4+C*b;if(C==k||0==m[n>>h])x=d(x,n-x),void 0===q?q=x:(q+=String.fromCharCode(0),q+=x),x=n+b}X(p);return q},toWireType:function(p,k){"string"!==typeof k&&T("Cannot pass non-string to C++ string type "+c);var m=g(k),q=ob(4+m+b);H[q>>2]=m>>h;f(k,q+4,m+b);null!==p&&p.push(X,q);return q},argPackAdvance:8,readValueFromPointer:Oa,H:function(p){X(p)}})},
p:function(a,b){b=P(b);U(a,{N:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},f:Na,g:function(a){if(0===a)return W(fb());var b=eb[a];a=void 0===b?P(a):b;return W(fb()[a])},k:function(a){4<a&&(V[a].J+=1)},l:function(a,b,c,d){a||T("Cannot use deleted val. handle = "+a);a=V[a].value;var f=hb[b];if(!f){f="";for(var g=0;g<b;++g)f+=(0!==g?", ":"")+"arg"+g;var l="return function emval_allocator_"+b+"(constructor, argTypes, args) {\n";for(g=0;g<b;++g)l+="var argType"+g+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+
g+'], "parameter '+g+'");\nvar arg'+g+" = argType"+g+".readValueFromPointer(args);\nargs += argType"+g+"['argPackAdvance'];\n";f=(new Function("requireRegisteredType","Module","__emval_register",l+("var obj = new constructor("+f+");\nreturn __emval_register(obj);\n}\n")))(gb,e,W);hb[b]=f}return f(a,c,d)},b:function(){y()},t:function(a,b,c){A.copyWithin(a,b,b+c)},e:function(a){a>>>=0;var b=A.length;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,a+100663296);d=Math.max(16777216,
a,d);0<d%65536&&(d+=65536-d%65536);a:{try{z.grow(Math.min(2147483648,d)-F.byteLength+65535>>>16);sa(z.buffer);var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},u:function(a,b){var c=0;jb().forEach(function(d,f){var g=b+c;f=E[a+4*f>>2]=g;for(g=0;g<d.length;++g)G[f++>>0]=d.charCodeAt(g);G[f>>0]=0;c+=d.length+1});return 0},v:function(a,b){var c=jb();E[a>>2]=c.length;var d=0;c.forEach(function(f){d+=f.length+1});E[b>>2]=d;return 0},w:function(){return 0},r:function(){},m:function(a,b,c,d){for(var f=
0,g=0;g<c;g++){for(var l=E[b+8*g>>2],h=E[b+(8*g+4)>>2],p=0;p<h;p++){var k=A[l+p],m=lb[a];if(0===k||10===k){for(k=0;m[k]&&!(NaN<=k);)++k;k=ha.decode(m.subarray?m.subarray(0,k):new Uint8Array(m.slice(0,k)));(1===a?ea:v)(k);m.length=0}else m.push(k)}f+=h}E[d>>2]=f;return 0},a:z,s:function(){}};
(function(){function a(f){e.asm=f.exports;J=e.asm.y;K--;e.monitorRunDependencies&&e.monitorRunDependencies(K);0==K&&(null!==za&&(clearInterval(za),za=null),L&&(f=L,L=null,f()))}function b(f){a(f.instance)}function c(f){return Da().then(function(g){return WebAssembly.instantiate(g,d)}).then(f,function(g){v("failed to asynchronously prepare wasm: "+g);y(g)})}var d={a:pb};K++;e.monitorRunDependencies&&e.monitorRunDependencies(K);if(e.instantiateWasm)try{return e.instantiateWasm(d,a)}catch(f){return v("Module.instantiateWasm callback failed with error: "+
f),!1}(function(){return w||"function"!==typeof WebAssembly.instantiateStreaming||Aa()||"function"!==typeof fetch?c(b):fetch(N,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,d).then(b,function(g){v("wasm streaming compile failed: "+g);v("falling back to ArrayBuffer instantiation");return c(b)})})})().catch(ba);return{}})();
var nb=e.___wasm_call_ctors=function(){return(nb=e.___wasm_call_ctors=e.asm.z).apply(null,arguments)},ob=e._malloc=function(){return(ob=e._malloc=e.asm.A).apply(null,arguments)},X=e._free=function(){return(X=e._free=e.asm.B).apply(null,arguments)},bb=e.___getTypeName=function(){return(bb=e.___getTypeName=e.asm.C).apply(null,arguments)};e.___embind_register_native_and_builtin_types=function(){return(e.___embind_register_native_and_builtin_types=e.asm.D).apply(null,arguments)};
e.dynCall_iiji=function(){return(e.dynCall_iiji=e.asm.E).apply(null,arguments)};e.dynCall_jiji=function(){return(e.dynCall_jiji=e.asm.F).apply(null,arguments)};var Z;L=function qb(){Z||rb();Z||(L=qb)};
function rb(){function a(){if(!Z&&(Z=!0,e.calledRun=!0,!fa)){O(va);O(wa);aa(e);if(e.onRuntimeInitialized)e.onRuntimeInitialized();if(e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;){var b=e.postRun.shift();xa.unshift(b)}O(xa)}}if(!(0<K)){if(e.preRun)for("function"==typeof e.preRun&&(e.preRun=[e.preRun]);e.preRun.length;)ya();O(ua);0<K||(e.setStatus?(e.setStatus("Running..."),setTimeout(function(){setTimeout(function(){e.setStatus("")},1);a()},1)):a())}}
e.run=rb;if(e.preInit)for("function"==typeof e.preInit&&(e.preInit=[e.preInit]);0<e.preInit.length;)e.preInit.pop()();noExitRuntime=!0;rb();
return jxl_dec.ready
}
);
})();
export default jxl_dec;

BIN
codecs/jxl/dec/jxl_dec.wasm Executable file

Binary file not shown.

58
codecs/jxl/dec/jxl_node_dec.js generated Normal file
View File

@@ -0,0 +1,58 @@
var jxl_node_dec = (function() {
var _scriptDir = import.meta.url;
return (
function(jxl_node_dec) {
jxl_node_dec = jxl_node_dec || {};
var e;e||(e=typeof jxl_node_dec !== 'undefined' ? jxl_node_dec : {});var aa,r;e.ready=new Promise(function(a,b){aa=a;r=b});var t={},u;for(u in e)e.hasOwnProperty(u)&&(t[u]=e[u]);var ba="./this.program",ca="",da,ea,fa,ha;ca=__dirname+"/";da=function(a){fa||(fa=require("fs"));ha||(ha=require("path"));a=ha.normalize(a);return fa.readFileSync(a,null)};ea=function(a){a=da(a);a.buffer||(a=new Uint8Array(a));a.buffer||v("Assertion failed: undefined");return a};
1<process.argv.length&&(ba=process.argv[1].replace(/\\/g,"/"));process.argv.slice(2);process.on("uncaughtException",function(a){throw a;});process.on("unhandledRejection",v);e.inspect=function(){return"[Emscripten Module object]"};var ia=e.print||console.log.bind(console),w=e.printErr||console.warn.bind(console);for(u in t)t.hasOwnProperty(u)&&(e[u]=t[u]);t=null;e.thisProgram&&(ba=e.thisProgram);var y;e.wasmBinary&&(y=e.wasmBinary);var noExitRuntime;e.noExitRuntime&&(noExitRuntime=e.noExitRuntime);
"object"!==typeof WebAssembly&&v("no native wasm support detected");var z,ja=!1,ka=new TextDecoder("utf8");
function la(a,b,c){var d=A;if(0<c){c=b+c-1;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var l=a.charCodeAt(++f);g=65536+((g&1023)<<10)|l&1023}if(127>=g){if(b>=c)break;d[b++]=g}else{if(2047>=g){if(b+1>=c)break;d[b++]=192|g>>6}else{if(65535>=g){if(b+2>=c)break;d[b++]=224|g>>12}else{if(b+3>=c)break;d[b++]=240|g>>18;d[b++]=128|g>>12&63}d[b++]=128|g>>6&63}d[b++]=128|g&63}}d[b]=0}}var ma=new TextDecoder("utf-16le");
function na(a,b){var c=a>>1;for(b=c+b/2;!(c>=b)&&C[c];)++c;return ma.decode(A.subarray(a,c<<1))}function oa(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var d=b;c=c<2*a.length?c/2:a.length;for(var f=0;f<c;++f)D[b>>1]=a.charCodeAt(f),b+=2;D[b>>1]=0;return b-d}function pa(a){return 2*a.length}function qa(a,b){for(var c=0,d="";!(c>=b/4);){var f=E[a+4*c>>2];if(0==f)break;++c;65536<=f?(f-=65536,d+=String.fromCharCode(55296|f>>10,56320|f&1023)):d+=String.fromCharCode(f)}return d}
function ra(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var d=b;c=d+c-4;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var l=a.charCodeAt(++f);g=65536+((g&1023)<<10)|l&1023}E[b>>2]=g;b+=4;if(b+4>c)break}E[b>>2]=0;return b-d}function sa(a){for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);55296<=d&&57343>=d&&++c;b+=4}return b}var F,G,A,D,C,E,I,ta,ua;
function va(a){F=a;e.HEAP8=G=new Int8Array(a);e.HEAP16=D=new Int16Array(a);e.HEAP32=E=new Int32Array(a);e.HEAPU8=A=new Uint8Array(a);e.HEAPU16=C=new Uint16Array(a);e.HEAPU32=I=new Uint32Array(a);e.HEAPF32=ta=new Float32Array(a);e.HEAPF64=ua=new Float64Array(a)}var wa=e.INITIAL_MEMORY||16777216;e.wasmMemory?z=e.wasmMemory:z=new WebAssembly.Memory({initial:wa/65536,maximum:32768});z&&(F=z.buffer);wa=F.byteLength;va(F);var J,xa=[],ya=[],za=[],Aa=[];
function Ba(){var a=e.preRun.shift();xa.unshift(a)}var K=0,Ca=null,M=null;e.preloadedImages={};e.preloadedAudios={};function v(a){if(e.onAbort)e.onAbort(a);w(a);ja=!0;a=new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");r(a);throw a;}function Da(){var a=N;return String.prototype.startsWith?a.startsWith("data:application/octet-stream;base64,"):0===a.indexOf("data:application/octet-stream;base64,")}var N="jxl_node_dec.wasm";
if(!Da()){var Ea=N;N=e.locateFile?e.locateFile(Ea,ca):ca+Ea}function Fa(){try{if(y)return new Uint8Array(y);if(ea)return ea(N);throw"both async and sync fetching of the wasm failed";}catch(a){v(a)}}function O(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(e);else{var c=b.L;"number"===typeof c?void 0===b.I?J.get(c)():J.get(c)(b.I):c(void 0===b.I?null:b.I)}}}
function Ga(a){switch(a){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+a);}}var Ha=void 0;function P(a){for(var b="";A[a];)b+=Ha[A[a++]];return b}var Q={},R={},S={};function Ia(a){if(void 0===a)return"_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var b=a.charCodeAt(0);return 48<=b&&57>=b?"_"+a:a}
function Ja(a,b){a=Ia(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}function Ka(a){var b=Error,c=Ja(a,function(d){this.name=a;this.message=d;d=Error(d).stack;void 0!==d&&(this.stack=this.toString()+"\n"+d.replace(/^Error(:[^\n]*)?\n/,""))});c.prototype=Object.create(b.prototype);c.prototype.constructor=c;c.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message};return c}
var La=void 0;function T(a){throw new La(a);}var Ma=void 0;function Na(a,b){function c(h){h=b(h);if(h.length!==d.length)throw new Ma("Mismatched type converter count");for(var k=0;k<d.length;++k)U(d[k],h[k])}var d=[];d.forEach(function(h){S[h]=a});var f=Array(a.length),g=[],l=0;a.forEach(function(h,k){R.hasOwnProperty(h)?f[k]=R[h]:(g.push(h),Q.hasOwnProperty(h)||(Q[h]=[]),Q[h].push(function(){f[k]=R[h];++l;l===g.length&&c(f)}))});0===g.length&&c(f)}
function U(a,b,c){c=c||{};if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");var d=b.name;a||T('type "'+d+'" must have a positive integer typeid pointer');if(R.hasOwnProperty(a)){if(c.M)return;T("Cannot register type '"+d+"' twice")}R[a]=b;delete S[a];Q.hasOwnProperty(a)&&(b=Q[a],delete Q[a],b.forEach(function(f){f()}))}var Oa=[],V=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
function Pa(a){4<a&&0===--V[a].J&&(V[a]=void 0,Oa.push(a))}function W(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=Oa.length?Oa.pop():V.length;V[b]={J:1,value:a};return b}}function Qa(a){return this.fromWireType(I[a>>2])}function Ta(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}
function Ua(a,b){switch(b){case 2:return function(c){return this.fromWireType(ta[c>>2])};case 3:return function(c){return this.fromWireType(ua[c>>3])};default:throw new TypeError("Unknown float type: "+a);}}function Va(a){var b=Function;if(!(b instanceof Function))throw new TypeError("new_ called with constructor type "+typeof b+" which is not a function");var c=Ja(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c}
function Wa(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function Xa(a,b){var c=e;if(void 0===c[a].G){var d=c[a];c[a]=function(){c[a].G.hasOwnProperty(arguments.length)||T("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+c[a].G+")!");return c[a].G[arguments.length].apply(this,arguments)};c[a].G=[];c[a].G[d.K]=d}}
function Ya(a,b,c){e.hasOwnProperty(a)?((void 0===c||void 0!==e[a].G&&void 0!==e[a].G[c])&&T("Cannot register public name '"+a+"' twice"),Xa(a,a),e.hasOwnProperty(c)&&T("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),e[a].G[c]=b):(e[a]=b,void 0!==c&&(e[a].O=c))}function Za(a,b){for(var c=[],d=0;d<a;d++)c.push(E[(b>>2)+d]);return c}
function $a(a,b){0<=a.indexOf("j")||v("Assertion failed: getDynCaller should only be called with i64 sigs");var c=[];return function(){c.length=arguments.length;for(var d=0;d<arguments.length;d++)c[d]=arguments[d];var f;-1!=a.indexOf("j")?f=c&&c.length?e["dynCall_"+a].apply(null,[b].concat(c)):e["dynCall_"+a].call(null,b):f=J.get(b).apply(null,c);return f}}
function ab(a,b){a=P(a);var c=-1!=a.indexOf("j")?$a(a,b):J.get(b);"function"!==typeof c&&T("unknown function pointer with signature "+a+": "+b);return c}var bb=void 0;function cb(a){a=db(a);var b=P(a);X(a);return b}function eb(a,b){function c(g){f[g]||R[g]||(S[g]?S[g].forEach(c):(d.push(g),f[g]=!0))}var d=[],f={};b.forEach(c);throw new bb(a+": "+d.map(cb).join([", "]));}
function fb(a,b,c){switch(b){case 0:return c?function(d){return G[d]}:function(d){return A[d]};case 1:return c?function(d){return D[d>>1]}:function(d){return C[d>>1]};case 2:return c?function(d){return E[d>>2]}:function(d){return I[d>>2]};default:throw new TypeError("Unknown integer type: "+a);}}var gb={};function hb(){return"object"===typeof globalThis?globalThis:Function("return this")()}function ib(a,b){var c=R[a];void 0===c&&T(b+" has unknown type "+cb(a));return c}var jb={},kb={};
function lb(){if(!mb){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"===typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:ba||"./this.program"},b;for(b in kb)a[b]=kb[b];var c=[];for(b in a)c.push(b+"="+a[b]);mb=c}return mb}for(var mb,nb=[null,[],[]],ob=Array(256),Y=0;256>Y;++Y)ob[Y]=String.fromCharCode(Y);Ha=ob;La=e.BindingError=Ka("BindingError");Ma=e.InternalError=Ka("InternalError");
e.count_emval_handles=function(){for(var a=0,b=5;b<V.length;++b)void 0!==V[b]&&++a;return a};e.get_first_emval=function(){for(var a=5;a<V.length;++a)if(void 0!==V[a])return V[a];return null};bb=e.UnboundTypeError=Ka("UnboundTypeError");ya.push({L:function(){pb()}});
var rb={h:function(){},o:function(a,b,c,d,f){var g=Ga(c);b=P(b);U(a,{name:b,fromWireType:function(l){return!!l},toWireType:function(l,h){return h?d:f},argPackAdvance:8,readValueFromPointer:function(l){if(1===c)var h=G;else if(2===c)h=D;else if(4===c)h=E;else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(h[l>>g])},H:null})},x:function(a,b){b=P(b);U(a,{name:b,fromWireType:function(c){var d=V[c].value;Pa(c);return d},toWireType:function(c,d){return W(d)},argPackAdvance:8,
readValueFromPointer:Qa,H:null})},n:function(a,b,c){c=Ga(c);b=P(b);U(a,{name:b,fromWireType:function(d){return d},toWireType:function(d,f){if("number"!==typeof f&&"boolean"!==typeof f)throw new TypeError('Cannot convert "'+Ta(f)+'" to '+this.name);return f},argPackAdvance:8,readValueFromPointer:Ua(b,c),H:null})},q:function(a,b,c,d,f,g){var l=Za(b,c);a=P(a);f=ab(d,f);Ya(a,function(){eb("Cannot call "+a+" due to unbound types",l)},b-1);Na(l,function(h){var k=[h[0],null].concat(h.slice(1)),m=h=a,n=f,
p=k.length;2>p&&T("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var x=null!==k[1]&&!1,B=!1,q=1;q<k.length;++q)if(null!==k[q]&&void 0===k[q].H){B=!0;break}var Ra="void"!==k[0].name,H="",L="";for(q=0;q<p-2;++q)H+=(0!==q?", ":"")+"arg"+q,L+=(0!==q?", ":"")+"arg"+q+"Wired";m="return function "+Ia(m)+"("+H+") {\nif (arguments.length !== "+(p-2)+") {\nthrowBindingError('function "+m+" called with ' + arguments.length + ' arguments, expected "+(p-2)+" args!');\n}\n";
B&&(m+="var destructors = [];\n");var Sa=B?"destructors":"null";H="throwBindingError invoker fn runDestructors retType classParam".split(" ");n=[T,n,g,Wa,k[0],k[1]];x&&(m+="var thisWired = classParam.toWireType("+Sa+", this);\n");for(q=0;q<p-2;++q)m+="var arg"+q+"Wired = argType"+q+".toWireType("+Sa+", arg"+q+"); // "+k[q+2].name+"\n",H.push("argType"+q),n.push(k[q+2]);x&&(L="thisWired"+(0<L.length?", ":"")+L);m+=(Ra?"var rv = ":"")+"invoker(fn"+(0<L.length?", ":"")+L+");\n";if(B)m+="runDestructors(destructors);\n";
else for(q=x?1:2;q<k.length;++q)p=1===q?"thisWired":"arg"+(q-2)+"Wired",null!==k[q].H&&(m+=p+"_dtor("+p+"); // "+k[q].name+"\n",H.push(p+"_dtor"),n.push(k[q].H));Ra&&(m+="var ret = retType.fromWireType(rv);\nreturn ret;\n");H.push(m+"}\n");k=Va(H).apply(null,n);q=b-1;if(!e.hasOwnProperty(h))throw new Ma("Replacing nonexistant public symbol");void 0!==e[h].G&&void 0!==q?e[h].G[q]=k:(e[h]=k,e[h].K=q);return[]})},d:function(a,b,c,d,f){function g(m){return m}b=P(b);-1===f&&(f=4294967295);var l=Ga(c);
if(0===d){var h=32-8*c;g=function(m){return m<<h>>>h}}var k=-1!=b.indexOf("unsigned");U(a,{name:b,fromWireType:g,toWireType:function(m,n){if("number"!==typeof n&&"boolean"!==typeof n)throw new TypeError('Cannot convert "'+Ta(n)+'" to '+this.name);if(n<d||n>f)throw new TypeError('Passing a number "'+Ta(n)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+d+", "+f+"]!");return k?n>>>0:n|0},argPackAdvance:8,readValueFromPointer:fb(b,l,0!==d),H:null})},
c:function(a,b,c){function d(g){g>>=2;var l=I;return new f(F,l[g+1],l[g])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];c=P(c);U(a,{name:c,fromWireType:d,argPackAdvance:8,readValueFromPointer:d},{M:!0})},j:function(a,b){b=P(b);var c="std::string"===b;U(a,{name:b,fromWireType:function(d){var f=I[d>>2];if(c)for(var g=d+4,l=0;l<=f;++l){var h=d+4+l;if(l==f||0==A[h]){if(g){for(var k=g+(h-g),m=g;!(m>=k)&&A[m];)++m;g=ka.decode(A.subarray(g,m))}else g=
"";if(void 0===n)var n=g;else n+=String.fromCharCode(0),n+=g;g=h+1}}else{n=Array(f);for(l=0;l<f;++l)n[l]=String.fromCharCode(A[d+4+l]);n=n.join("")}X(d);return n},toWireType:function(d,f){f instanceof ArrayBuffer&&(f=new Uint8Array(f));var g="string"===typeof f;g||f instanceof Uint8Array||f instanceof Uint8ClampedArray||f instanceof Int8Array||T("Cannot pass non-string to std::string");var l=(c&&g?function(){for(var m=0,n=0;n<f.length;++n){var p=f.charCodeAt(n);55296<=p&&57343>=p&&(p=65536+((p&1023)<<
10)|f.charCodeAt(++n)&1023);127>=p?++m:m=2047>=p?m+2:65535>=p?m+3:m+4}return m}:function(){return f.length})(),h=qb(4+l+1);I[h>>2]=l;if(c&&g)la(f,h+4,l+1);else if(g)for(g=0;g<l;++g){var k=f.charCodeAt(g);255<k&&(X(h),T("String has UTF-16 code units that do not fit in 8 bits"));A[h+4+g]=k}else for(g=0;g<l;++g)A[h+4+g]=f[g];null!==d&&d.push(X,h);return h},argPackAdvance:8,readValueFromPointer:Qa,H:function(d){X(d)}})},i:function(a,b,c){c=P(c);if(2===b){var d=na;var f=oa;var g=pa;var l=function(){return C};
var h=1}else 4===b&&(d=qa,f=ra,g=sa,l=function(){return I},h=2);U(a,{name:c,fromWireType:function(k){for(var m=I[k>>2],n=l(),p,x=k+4,B=0;B<=m;++B){var q=k+4+B*b;if(B==m||0==n[q>>h])x=d(x,q-x),void 0===p?p=x:(p+=String.fromCharCode(0),p+=x),x=q+b}X(k);return p},toWireType:function(k,m){"string"!==typeof m&&T("Cannot pass non-string to C++ string type "+c);var n=g(m),p=qb(4+n+b);I[p>>2]=n>>h;f(m,p+4,n+b);null!==k&&k.push(X,p);return p},argPackAdvance:8,readValueFromPointer:Qa,H:function(k){X(k)}})},
p:function(a,b){b=P(b);U(a,{N:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},f:Pa,g:function(a){if(0===a)return W(hb());var b=gb[a];a=void 0===b?P(a):b;return W(hb()[a])},k:function(a){4<a&&(V[a].J+=1)},l:function(a,b,c,d){a||T("Cannot use deleted val. handle = "+a);a=V[a].value;var f=jb[b];if(!f){f="";for(var g=0;g<b;++g)f+=(0!==g?", ":"")+"arg"+g;var l="return function emval_allocator_"+b+"(constructor, argTypes, args) {\n";for(g=0;g<b;++g)l+="var argType"+g+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+
g+'], "parameter '+g+'");\nvar arg'+g+" = argType"+g+".readValueFromPointer(args);\nargs += argType"+g+"['argPackAdvance'];\n";f=(new Function("requireRegisteredType","Module","__emval_register",l+("var obj = new constructor("+f+");\nreturn __emval_register(obj);\n}\n")))(ib,e,W);jb[b]=f}return f(a,c,d)},b:function(){v()},t:function(a,b,c){A.copyWithin(a,b,b+c)},e:function(a){a>>>=0;var b=A.length;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,a+100663296);d=Math.max(16777216,
a,d);0<d%65536&&(d+=65536-d%65536);a:{try{z.grow(Math.min(2147483648,d)-F.byteLength+65535>>>16);va(z.buffer);var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},u:function(a,b){var c=0;lb().forEach(function(d,f){var g=b+c;f=E[a+4*f>>2]=g;for(g=0;g<d.length;++g)G[f++>>0]=d.charCodeAt(g);G[f>>0]=0;c+=d.length+1});return 0},v:function(a,b){var c=lb();E[a>>2]=c.length;var d=0;c.forEach(function(f){d+=f.length+1});E[b>>2]=d;return 0},w:function(){return 0},r:function(){},m:function(a,b,c,d){for(var f=
0,g=0;g<c;g++){for(var l=E[b+8*g>>2],h=E[b+(8*g+4)>>2],k=0;k<h;k++){var m=A[l+k],n=nb[a];if(0===m||10===m){m=1===a?ia:w;var p;for(p=0;n[p]&&!(NaN<=p);)++p;p=ka.decode(n.subarray?n.subarray(0,p):new Uint8Array(n.slice(0,p)));m(p);n.length=0}else n.push(m)}f+=h}E[d>>2]=f;return 0},a:z,s:function(){}};
(function(){function a(f){e.asm=f.exports;J=e.asm.y;K--;e.monitorRunDependencies&&e.monitorRunDependencies(K);0==K&&(null!==Ca&&(clearInterval(Ca),Ca=null),M&&(f=M,M=null,f()))}function b(f){a(f.instance)}function c(f){return Promise.resolve().then(Fa).then(function(g){return WebAssembly.instantiate(g,d)}).then(f,function(g){w("failed to asynchronously prepare wasm: "+g);v(g)})}var d={a:rb};K++;e.monitorRunDependencies&&e.monitorRunDependencies(K);if(e.instantiateWasm)try{return e.instantiateWasm(d,
a)}catch(f){return w("Module.instantiateWasm callback failed with error: "+f),!1}(function(){return y||"function"!==typeof WebAssembly.instantiateStreaming||Da()||"function"!==typeof fetch?c(b):fetch(N,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,d).then(b,function(g){w("wasm streaming compile failed: "+g);w("falling back to ArrayBuffer instantiation");return c(b)})})})().catch(r);return{}})();
var pb=e.___wasm_call_ctors=function(){return(pb=e.___wasm_call_ctors=e.asm.z).apply(null,arguments)},qb=e._malloc=function(){return(qb=e._malloc=e.asm.A).apply(null,arguments)},X=e._free=function(){return(X=e._free=e.asm.B).apply(null,arguments)},db=e.___getTypeName=function(){return(db=e.___getTypeName=e.asm.C).apply(null,arguments)};e.___embind_register_native_and_builtin_types=function(){return(e.___embind_register_native_and_builtin_types=e.asm.D).apply(null,arguments)};
e.dynCall_iiji=function(){return(e.dynCall_iiji=e.asm.E).apply(null,arguments)};e.dynCall_jiji=function(){return(e.dynCall_jiji=e.asm.F).apply(null,arguments)};var Z;M=function sb(){Z||tb();Z||(M=sb)};
function tb(){function a(){if(!Z&&(Z=!0,e.calledRun=!0,!ja)){O(ya);O(za);aa(e);if(e.onRuntimeInitialized)e.onRuntimeInitialized();if(e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;){var b=e.postRun.shift();Aa.unshift(b)}O(Aa)}}if(!(0<K)){if(e.preRun)for("function"==typeof e.preRun&&(e.preRun=[e.preRun]);e.preRun.length;)Ba();O(xa);0<K||(e.setStatus?(e.setStatus("Running..."),setTimeout(function(){setTimeout(function(){e.setStatus("")},1);a()},1)):a())}}
e.run=tb;if(e.preInit)for("function"==typeof e.preInit&&(e.preInit=[e.preInit]);0<e.preInit.length;)e.preInit.pop()();noExitRuntime=!0;tb();
return jxl_node_dec.ready
}
);
})();
export default jxl_node_dec;

BIN
codecs/jxl/dec/jxl_node_dec.wasm Executable file

Binary file not shown.

119
codecs/jxl/enc/jxl_enc.cpp Normal file
View File

@@ -0,0 +1,119 @@
#include <emscripten/bind.h>
#include <emscripten/val.h>
#include "lib/jxl/base/thread_pool_internal.h"
#include "lib/jxl/enc_file.h"
#include "lib/jxl/external_image.h"
using namespace emscripten;
thread_local const val Uint8Array = val::global("Uint8Array");
struct JXLOptions {
// 1 = slowest
// 7 = fastest
int speed;
float quality;
bool progressive;
int epf;
int nearLossless;
bool lossyPalette;
};
val encode(std::string image, int width, int height, JXLOptions options) {
jxl::CompressParams cparams;
jxl::PassesEncoderState passes_enc_state;
jxl::CodecInOut io;
jxl::PaddedBytes bytes;
jxl::ImageBundle* main = &io.Main();
jxl::ThreadPoolInternal* pool_ptr = nullptr;
#ifdef __EMSCRIPTEN_PTHREADS__
jxl::ThreadPoolInternal pool;
pool_ptr = &pool;
#endif
cparams.epf = options.epf;
cparams.speed_tier = static_cast<jxl::SpeedTier>(options.speed);
cparams.near_lossless = options.nearLossless;
if (options.lossyPalette) {
cparams.lossy_palette = true;
cparams.palette_colors = 0;
cparams.options.predictor = jxl::Predictor::Zero;
}
float quality = options.quality;
// Quality settings roughly match libjpeg qualities.
if (quality < 7 || quality == 100) {
cparams.modular_mode = true;
// Internal modular quality to roughly match VarDCT size.
cparams.quality_pair.first = cparams.quality_pair.second =
std::min(35 + (quality - 7) * 3.0f, 100.0f);
} else {
cparams.modular_mode = false;
if (quality >= 30) {
cparams.butteraugli_distance = 0.1 + (100 - quality) * 0.09;
} else {
cparams.butteraugli_distance = 6.4 + pow(2.5, (30 - quality) / 5.0f) / 6.25f;
}
}
if (options.progressive) {
cparams.qprogressive_mode = true;
cparams.responsive = 1;
if (!cparams.modular_mode) {
cparams.progressive_dc = 1;
}
}
if (cparams.modular_mode) {
if (cparams.quality_pair.first != 100 || cparams.quality_pair.second != 100) {
cparams.color_transform = jxl::ColorTransform::kXYB;
} else {
cparams.color_transform = jxl::ColorTransform::kNone;
}
}
if (cparams.near_lossless) {
// Near-lossless assumes -R 0
cparams.responsive = 0;
cparams.modular_mode = true;
}
io.metadata.m.SetAlphaBits(8);
if (!io.metadata.size.Set(width, height)) {
return val::null();
}
uint8_t* inBuffer = (uint8_t*)image.c_str();
auto result = jxl::ConvertImage(
jxl::Span<const uint8_t>(reinterpret_cast<const uint8_t*>(image.data()), image.size()), width,
height, jxl::ColorEncoding::SRGB(/*is_gray=*/false), /*has_alpha=*/true,
/*alpha_is_premultiplied=*/false, /*bits_per_sample=*/8, /*endiannes=*/JXL_LITTLE_ENDIAN,
/*flipped_y=*/false, pool_ptr, main);
if (!result) {
return val::null();
}
auto js_result = val::null();
if (EncodeFile(cparams, &io, &passes_enc_state, &bytes, /*aux=*/nullptr, pool_ptr)) {
js_result = Uint8Array.new_(typed_memory_view(bytes.size(), bytes.data()));
}
return js_result;
}
EMSCRIPTEN_BINDINGS(my_module) {
value_object<JXLOptions>("JXLOptions")
.field("speed", &JXLOptions::speed)
.field("quality", &JXLOptions::quality)
.field("progressive", &JXLOptions::progressive)
.field("nearLossless", &JXLOptions::nearLossless)
.field("lossyPalette", &JXLOptions::lossyPalette)
.field("epf", &JXLOptions::epf);
function("encode", &encode);
}

21
codecs/jxl/enc/jxl_enc.d.ts vendored Normal file
View File

@@ -0,0 +1,21 @@
export interface EncodeOptions {
speed: number;
quality: number;
progressive: boolean;
epf: number;
nearLossless: number;
lossyPalette: boolean;
}
export interface JXLModule extends EmscriptenWasm.Module {
encode(
data: BufferSource,
width: number,
height: number,
options: EncodeOptions,
): Uint8Array | null;
}
declare var moduleFactory: EmscriptenWasm.ModuleFactory<JXLModule>;
export default moduleFactory;

71
codecs/jxl/enc/jxl_enc.js generated Normal file
View File

@@ -0,0 +1,71 @@
var jxl_enc = (function() {
var _scriptDir = import.meta.url;
return (
function(jxl_enc) {
jxl_enc = jxl_enc || {};
var f;f||(f=typeof jxl_enc !== 'undefined' ? jxl_enc : {});var aa,ba;f.ready=new Promise(function(a,b){aa=a;ba=b});var t={},w;for(w in f)f.hasOwnProperty(w)&&(t[w]=f[w]);var ca="./this.program",y="",da;y=self.location.href;_scriptDir&&(y=_scriptDir);0!==y.indexOf("blob:")?y=y.substr(0,y.lastIndexOf("/")+1):y="";da=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)};
var ea=f.print||console.log.bind(console),z=f.printErr||console.warn.bind(console);for(w in t)t.hasOwnProperty(w)&&(f[w]=t[w]);t=null;f.thisProgram&&(ca=f.thisProgram);var A;f.wasmBinary&&(A=f.wasmBinary);var noExitRuntime;f.noExitRuntime&&(noExitRuntime=f.noExitRuntime);"object"!==typeof WebAssembly&&C("no native wasm support detected");var D,fa=!1,ha=new TextDecoder("utf8");function ia(a,b){if(!a)return"";b=a+b;for(var c=a;!(c>=b)&&E[c];)++c;return ha.decode(E.subarray(a,c))}
function ja(a,b,c,d){if(0<d){d=c+d-1;for(var g=0;g<a.length;++g){var h=a.charCodeAt(g);if(55296<=h&&57343>=h){var m=a.charCodeAt(++g);h=65536+((h&1023)<<10)|m&1023}if(127>=h){if(c>=d)break;b[c++]=h}else{if(2047>=h){if(c+1>=d)break;b[c++]=192|h>>6}else{if(65535>=h){if(c+2>=d)break;b[c++]=224|h>>12}else{if(c+3>=d)break;b[c++]=240|h>>18;b[c++]=128|h>>12&63}b[c++]=128|h>>6&63}b[c++]=128|h&63}}b[c]=0}}
function ka(a){for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);55296<=d&&57343>=d&&(d=65536+((d&1023)<<10)|a.charCodeAt(++c)&1023);127>=d?++b:b=2047>=d?b+2:65535>=d?b+3:b+4}return b}var la=new TextDecoder("utf-16le");function ma(a,b){var c=a>>1;for(b=c+b/2;!(c>=b)&&F[c];)++c;return la.decode(E.subarray(a,c<<1))}function na(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var d=b;c=c<2*a.length?c/2:a.length;for(var g=0;g<c;++g)G[b>>1]=a.charCodeAt(g),b+=2;G[b>>1]=0;return b-d}
function oa(a){return 2*a.length}function pa(a,b){for(var c=0,d="";!(c>=b/4);){var g=H[a+4*c>>2];if(0==g)break;++c;65536<=g?(g-=65536,d+=String.fromCharCode(55296|g>>10,56320|g&1023)):d+=String.fromCharCode(g)}return d}function qa(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var d=b;c=d+c-4;for(var g=0;g<a.length;++g){var h=a.charCodeAt(g);if(55296<=h&&57343>=h){var m=a.charCodeAt(++g);h=65536+((h&1023)<<10)|m&1023}H[b>>2]=h;b+=4;if(b+4>c)break}H[b>>2]=0;return b-d}
function ra(a){for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);55296<=d&&57343>=d&&++c;b+=4}return b}var I,J,E,G,F,H,K,sa,ta;function ua(a){I=a;f.HEAP8=J=new Int8Array(a);f.HEAP16=G=new Int16Array(a);f.HEAP32=H=new Int32Array(a);f.HEAPU8=E=new Uint8Array(a);f.HEAPU16=F=new Uint16Array(a);f.HEAPU32=K=new Uint32Array(a);f.HEAPF32=sa=new Float32Array(a);f.HEAPF64=ta=new Float64Array(a)}var va=f.INITIAL_MEMORY||16777216;f.wasmMemory?D=f.wasmMemory:D=new WebAssembly.Memory({initial:va/65536,maximum:32768});
D&&(I=D.buffer);va=I.byteLength;ua(I);var L,wa=[],xa=[],ya=[],za=[];function Aa(){var a=f.preRun.shift();wa.unshift(a)}var M=0,Ba=null,N=null;f.preloadedImages={};f.preloadedAudios={};function C(a){if(f.onAbort)f.onAbort(a);z(a);fa=!0;a=new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");ba(a);throw a;}
function Ca(){var a=O;return String.prototype.startsWith?a.startsWith("data:application/octet-stream;base64,"):0===a.indexOf("data:application/octet-stream;base64,")}var O="jxl_enc.wasm";if(!Ca()){var Da=O;O=f.locateFile?f.locateFile(Da,y):y+Da}function Ea(){try{if(A)return new Uint8Array(A);if(da)return da(O);throw"both async and sync fetching of the wasm failed";}catch(a){C(a)}}
function Fa(){return A||"function"!==typeof fetch?Promise.resolve().then(Ea):fetch(O,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+O+"'";return a.arrayBuffer()}).catch(function(){return Ea()})}function P(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(f);else{var c=b.fa;"number"===typeof c?void 0===b.$?L.get(c)():L.get(c)(b.$):c(void 0===b.$?null:b.$)}}}
function Ga(a){this.V=a-16;this.ra=function(b){H[this.V+8>>2]=b};this.oa=function(b){H[this.V+0>>2]=b};this.pa=function(){H[this.V+4>>2]=0};this.na=function(){J[this.V+12>>0]=0};this.qa=function(){J[this.V+13>>0]=0};this.ka=function(b,c){this.ra(b);this.oa(c);this.pa();this.na();this.qa()}}function Q(){return 0<Q.ca}var Ha={};function Ia(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function Ja(a){return this.fromWireType(K[a>>2])}var R={},S={},Ka={};
function La(a){if(void 0===a)return"_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var b=a.charCodeAt(0);return 48<=b&&57>=b?"_"+a:a}function Ma(a,b){a=La(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}
function Na(a){var b=Error,c=Ma(a,function(d){this.name=a;this.message=d;d=Error(d).stack;void 0!==d&&(this.stack=this.toString()+"\n"+d.replace(/^Error(:[^\n]*)?\n/,""))});c.prototype=Object.create(b.prototype);c.prototype.constructor=c;c.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message};return c}var Oa=void 0;
function Pa(a,b,c){function d(k){k=c(k);if(k.length!==a.length)throw new Oa("Mismatched type converter count");for(var n=0;n<a.length;++n)T(a[n],k[n])}a.forEach(function(k){Ka[k]=b});var g=Array(b.length),h=[],m=0;b.forEach(function(k,n){S.hasOwnProperty(k)?g[n]=S[k]:(h.push(k),R.hasOwnProperty(k)||(R[k]=[]),R[k].push(function(){g[n]=S[k];++m;m===h.length&&d(g)}))});0===h.length&&d(g)}
function Qa(a){switch(a){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+a);}}var Ra=void 0;function U(a){for(var b="";E[a];)b+=Ra[E[a++]];return b}var Sa=void 0;function V(a){throw new Sa(a);}
function T(a,b,c){c=c||{};if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");var d=b.name;a||V('type "'+d+'" must have a positive integer typeid pointer');if(S.hasOwnProperty(a)){if(c.ja)return;V("Cannot register type '"+d+"' twice")}S[a]=b;delete Ka[a];R.hasOwnProperty(a)&&(b=R[a],delete R[a],b.forEach(function(g){g()}))}var Ta=[],X=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
function Ua(a){4<a&&0===--X[a].aa&&(X[a]=void 0,Ta.push(a))}function Va(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=Ta.length?Ta.pop():X.length;X[b]={aa:1,value:a};return b}}function Wa(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}
function Xa(a,b){switch(b){case 2:return function(c){return this.fromWireType(sa[c>>2])};case 3:return function(c){return this.fromWireType(ta[c>>3])};default:throw new TypeError("Unknown float type: "+a);}}function Ya(a){var b=Function;if(!(b instanceof Function))throw new TypeError("new_ called with constructor type "+typeof b+" which is not a function");var c=Ma(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c}
function Za(a,b){var c=f;if(void 0===c[a].S){var d=c[a];c[a]=function(){c[a].S.hasOwnProperty(arguments.length)||V("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+c[a].S+")!");return c[a].S[arguments.length].apply(this,arguments)};c[a].S=[];c[a].S[d.da]=d}}
function $a(a,b,c){f.hasOwnProperty(a)?((void 0===c||void 0!==f[a].S&&void 0!==f[a].S[c])&&V("Cannot register public name '"+a+"' twice"),Za(a,a),f.hasOwnProperty(c)&&V("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),f[a].S[c]=b):(f[a]=b,void 0!==c&&(f[a].Aa=c))}function ab(a,b){for(var c=[],d=0;d<a;d++)c.push(H[(b>>2)+d]);return c}
function bb(a,b){0<=a.indexOf("j")||C("Assertion failed: getDynCaller should only be called with i64 sigs");var c=[];return function(){c.length=arguments.length;for(var d=0;d<arguments.length;d++)c[d]=arguments[d];var g;-1!=a.indexOf("j")?g=c&&c.length?f["dynCall_"+a].apply(null,[b].concat(c)):f["dynCall_"+a].call(null,b):g=L.get(b).apply(null,c);return g}}
function Y(a,b){a=U(a);var c=-1!=a.indexOf("j")?bb(a,b):L.get(b);"function"!==typeof c&&V("unknown function pointer with signature "+a+": "+b);return c}var cb=void 0;function db(a){a=eb(a);var b=U(a);Z(a);return b}function fb(a,b){function c(h){g[h]||S[h]||(Ka[h]?Ka[h].forEach(c):(d.push(h),g[h]=!0))}var d=[],g={};b.forEach(c);throw new cb(a+": "+d.map(db).join([", "]));}
function gb(a,b,c){switch(b){case 0:return c?function(d){return J[d]}:function(d){return E[d]};case 1:return c?function(d){return G[d>>1]}:function(d){return F[d>>1]};case 2:return c?function(d){return H[d>>2]}:function(d){return K[d>>2]};default:throw new TypeError("Unknown integer type: "+a);}}var hb={};function ib(){return"object"===typeof globalThis?globalThis:Function("return this")()}function jb(a,b){var c=S[a];void 0===c&&V(b+" has unknown type "+db(a));return c}var kb={},lb={};
function mb(){if(!nb){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"===typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:ca||"./this.program"},b;for(b in lb)a[b]=lb[b];var c=[];for(b in a)c.push(b+"="+a[b]);nb=c}return nb}var nb,ob=[null,[],[]];function pb(a){return 0===a%4&&(0!==a%100||0===a%400)}function qb(a,b){for(var c=0,d=0;d<=b;c+=a[d++]);return c}
var rb=[31,29,31,30,31,30,31,31,30,31,30,31],sb=[31,28,31,30,31,30,31,31,30,31,30,31];function tb(a,b){for(a=new Date(a.getTime());0<b;){var c=a.getMonth(),d=(pb(a.getFullYear())?rb:sb)[c];if(b>d-a.getDate())b-=d-a.getDate()+1,a.setDate(1),11>c?a.setMonth(c+1):(a.setMonth(0),a.setFullYear(a.getFullYear()+1));else{a.setDate(a.getDate()+b);break}}return a}
function ub(a,b,c,d){function g(e,l,u){for(e="number"===typeof e?e.toString():e||"";e.length<l;)e=u[0]+e;return e}function h(e,l){return g(e,l,"0")}function m(e,l){function u(B){return 0>B?-1:0<B?1:0}var v;0===(v=u(e.getFullYear()-l.getFullYear()))&&0===(v=u(e.getMonth()-l.getMonth()))&&(v=u(e.getDate()-l.getDate()));return v}function k(e){switch(e.getDay()){case 0:return new Date(e.getFullYear()-1,11,29);case 1:return e;case 2:return new Date(e.getFullYear(),0,3);case 3:return new Date(e.getFullYear(),
0,2);case 4:return new Date(e.getFullYear(),0,1);case 5:return new Date(e.getFullYear()-1,11,31);case 6:return new Date(e.getFullYear()-1,11,30)}}function n(e){e=tb(new Date(e.R+1900,0,1),e.Z);var l=new Date(e.getFullYear()+1,0,4),u=k(new Date(e.getFullYear(),0,4));l=k(l);return 0>=m(u,e)?0>=m(l,e)?e.getFullYear()+1:e.getFullYear():e.getFullYear()-1}var p=H[d+40>>2];d={xa:H[d>>2],wa:H[d+4>>2],X:H[d+8>>2],W:H[d+12>>2],U:H[d+16>>2],R:H[d+20>>2],Y:H[d+24>>2],Z:H[d+28>>2],Ba:H[d+32>>2],va:H[d+36>>2],
ya:p?ia(p):""};c=ia(c);p={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var q in p)c=c.replace(new RegExp(q,"g"),p[q]);var r="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),
x="January February March April May June July August September October November December".split(" ");p={"%a":function(e){return r[e.Y].substring(0,3)},"%A":function(e){return r[e.Y]},"%b":function(e){return x[e.U].substring(0,3)},"%B":function(e){return x[e.U]},"%C":function(e){return h((e.R+1900)/100|0,2)},"%d":function(e){return h(e.W,2)},"%e":function(e){return g(e.W,2," ")},"%g":function(e){return n(e).toString().substring(2)},"%G":function(e){return n(e)},"%H":function(e){return h(e.X,2)},"%I":function(e){e=
e.X;0==e?e=12:12<e&&(e-=12);return h(e,2)},"%j":function(e){return h(e.W+qb(pb(e.R+1900)?rb:sb,e.U-1),3)},"%m":function(e){return h(e.U+1,2)},"%M":function(e){return h(e.wa,2)},"%n":function(){return"\n"},"%p":function(e){return 0<=e.X&&12>e.X?"AM":"PM"},"%S":function(e){return h(e.xa,2)},"%t":function(){return"\t"},"%u":function(e){return e.Y||7},"%U":function(e){var l=new Date(e.R+1900,0,1),u=0===l.getDay()?l:tb(l,7-l.getDay());e=new Date(e.R+1900,e.U,e.W);return 0>m(u,e)?h(Math.ceil((31-u.getDate()+
(qb(pb(e.getFullYear())?rb:sb,e.getMonth()-1)-31)+e.getDate())/7),2):0===m(u,l)?"01":"00"},"%V":function(e){var l=new Date(e.R+1901,0,4),u=k(new Date(e.R+1900,0,4));l=k(l);var v=tb(new Date(e.R+1900,0,1),e.Z);return 0>m(v,u)?"53":0>=m(l,v)?"01":h(Math.ceil((u.getFullYear()<e.R+1900?e.Z+32-u.getDate():e.Z+1-u.getDate())/7),2)},"%w":function(e){return e.Y},"%W":function(e){var l=new Date(e.R,0,1),u=1===l.getDay()?l:tb(l,0===l.getDay()?1:7-l.getDay()+1);e=new Date(e.R+1900,e.U,e.W);return 0>m(u,e)?h(Math.ceil((31-
u.getDate()+(qb(pb(e.getFullYear())?rb:sb,e.getMonth()-1)-31)+e.getDate())/7),2):0===m(u,l)?"01":"00"},"%y":function(e){return(e.R+1900).toString().substring(2)},"%Y":function(e){return e.R+1900},"%z":function(e){e=e.va;var l=0<=e;e=Math.abs(e)/60;return(l?"+":"-")+String("0000"+(e/60*100+e%60)).slice(-4)},"%Z":function(e){return e.ya},"%%":function(){return"%"}};for(q in p)0<=c.indexOf(q)&&(c=c.replace(new RegExp(q,"g"),p[q](d)));q=vb(c);if(q.length>b)return 0;J.set(q,a);return q.length-1}
Oa=f.InternalError=Na("InternalError");for(var wb=Array(256),xb=0;256>xb;++xb)wb[xb]=String.fromCharCode(xb);Ra=wb;Sa=f.BindingError=Na("BindingError");f.count_emval_handles=function(){for(var a=0,b=5;b<X.length;++b)void 0!==X[b]&&++a;return a};f.get_first_emval=function(){for(var a=5;a<X.length;++a)if(void 0!==X[a])return X[a];return null};cb=f.UnboundTypeError=Na("UnboundTypeError");function vb(a){var b=Array(ka(a)+1);ja(a,b,0,b.length);return b}xa.push({fa:function(){yb()}});
var Ab={q:function(a){return zb(a+16)+16},D:function(){},p:function(a,b,c){(new Ga(a)).ka(b,c);"uncaught_exception"in Q?Q.ca++:Q.ca=1;throw a;},m:function(a){var b=Ha[a];delete Ha[a];var c=b.la,d=b.ma,g=b.ba,h=g.map(function(m){return m.ia}).concat(g.map(function(m){return m.ta}));Pa([a],h,function(m){var k={};g.forEach(function(n,p){var q=m[p],r=n.ga,x=n.ha,e=m[p+g.length],l=n.sa,u=n.ua;k[n.ea]={read:function(v){return q.fromWireType(r(x,v))},write:function(v,B){var W=[];l(u,v,e.toWireType(W,B));
Ia(W)}}});return[{name:b.name,fromWireType:function(n){var p={},q;for(q in k)p[q]=k[q].read(n);d(n);return p},toWireType:function(n,p){for(var q in k)if(!(q in p))throw new TypeError('Missing field: "'+q+'"');var r=c();for(q in k)k[q].write(r,p[q]);null!==n&&n.push(d,r);return r},argPackAdvance:8,readValueFromPointer:Ja,T:d}]})},z:function(a,b,c,d,g){var h=Qa(c);b=U(b);T(a,{name:b,fromWireType:function(m){return!!m},toWireType:function(m,k){return k?d:g},argPackAdvance:8,readValueFromPointer:function(m){if(1===
c)var k=J;else if(2===c)k=G;else if(4===c)k=H;else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(k[m>>h])},T:null})},y:function(a,b){b=U(b);T(a,{name:b,fromWireType:function(c){var d=X[c].value;Ua(c);return d},toWireType:function(c,d){return Va(d)},argPackAdvance:8,readValueFromPointer:Ja,T:null})},j:function(a,b,c){c=Qa(c);b=U(b);T(a,{name:b,fromWireType:function(d){return d},toWireType:function(d,g){if("number"!==typeof g&&"boolean"!==typeof g)throw new TypeError('Cannot convert "'+
Wa(g)+'" to '+this.name);return g},argPackAdvance:8,readValueFromPointer:Xa(b,c),T:null})},l:function(a,b,c,d,g,h){var m=ab(b,c);a=U(a);g=Y(d,g);$a(a,function(){fb("Cannot call "+a+" due to unbound types",m)},b-1);Pa([],m,function(k){var n=a,p=a;k=[k[0],null].concat(k.slice(1));var q=g,r=k.length;2>r&&V("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var x=null!==k[1]&&!1,e=!1,l=1;l<k.length;++l)if(null!==k[l]&&void 0===k[l].T){e=!0;break}var u="void"!==k[0].name,
v="",B="";for(l=0;l<r-2;++l)v+=(0!==l?", ":"")+"arg"+l,B+=(0!==l?", ":"")+"arg"+l+"Wired";p="return function "+La(p)+"("+v+") {\nif (arguments.length !== "+(r-2)+") {\nthrowBindingError('function "+p+" called with ' + arguments.length + ' arguments, expected "+(r-2)+" args!');\n}\n";e&&(p+="var destructors = [];\n");var W=e?"destructors":"null";v="throwBindingError invoker fn runDestructors retType classParam".split(" ");q=[V,q,h,Ia,k[0],k[1]];x&&(p+="var thisWired = classParam.toWireType("+W+", this);\n");
for(l=0;l<r-2;++l)p+="var arg"+l+"Wired = argType"+l+".toWireType("+W+", arg"+l+"); // "+k[l+2].name+"\n",v.push("argType"+l),q.push(k[l+2]);x&&(B="thisWired"+(0<B.length?", ":"")+B);p+=(u?"var rv = ":"")+"invoker(fn"+(0<B.length?", ":"")+B+");\n";if(e)p+="runDestructors(destructors);\n";else for(l=x?1:2;l<k.length;++l)r=1===l?"thisWired":"arg"+(l-2)+"Wired",null!==k[l].T&&(p+=r+"_dtor("+r+"); // "+k[l].name+"\n",v.push(r+"_dtor"),q.push(k[l].T));u&&(p+="var ret = retType.fromWireType(rv);\nreturn ret;\n");
v.push(p+"}\n");k=Ya(v).apply(null,q);l=b-1;if(!f.hasOwnProperty(n))throw new Oa("Replacing nonexistant public symbol");void 0!==f[n].S&&void 0!==l?f[n].S[l]=k:(f[n]=k,f[n].da=l);return[]})},d:function(a,b,c,d,g){function h(p){return p}b=U(b);-1===g&&(g=4294967295);var m=Qa(c);if(0===d){var k=32-8*c;h=function(p){return p<<k>>>k}}var n=-1!=b.indexOf("unsigned");T(a,{name:b,fromWireType:h,toWireType:function(p,q){if("number"!==typeof q&&"boolean"!==typeof q)throw new TypeError('Cannot convert "'+Wa(q)+
'" to '+this.name);if(q<d||q>g)throw new TypeError('Passing a number "'+Wa(q)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+d+", "+g+"]!");return n?q>>>0:q|0},argPackAdvance:8,readValueFromPointer:gb(b,m,0!==d),T:null})},c:function(a,b,c){function d(h){h>>=2;var m=K;return new g(I,m[h+1],m[h])}var g=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];c=U(c);T(a,{name:c,fromWireType:d,argPackAdvance:8,
readValueFromPointer:d},{ja:!0})},k:function(a,b){b=U(b);var c="std::string"===b;T(a,{name:b,fromWireType:function(d){var g=K[d>>2];if(c)for(var h=d+4,m=0;m<=g;++m){var k=d+4+m;if(m==g||0==E[k]){h=ia(h,k-h);if(void 0===n)var n=h;else n+=String.fromCharCode(0),n+=h;h=k+1}}else{n=Array(g);for(m=0;m<g;++m)n[m]=String.fromCharCode(E[d+4+m]);n=n.join("")}Z(d);return n},toWireType:function(d,g){g instanceof ArrayBuffer&&(g=new Uint8Array(g));var h="string"===typeof g;h||g instanceof Uint8Array||g instanceof
Uint8ClampedArray||g instanceof Int8Array||V("Cannot pass non-string to std::string");var m=(c&&h?function(){return ka(g)}:function(){return g.length})(),k=zb(4+m+1);K[k>>2]=m;if(c&&h)ja(g,E,k+4,m+1);else if(h)for(h=0;h<m;++h){var n=g.charCodeAt(h);255<n&&(Z(k),V("String has UTF-16 code units that do not fit in 8 bits"));E[k+4+h]=n}else for(h=0;h<m;++h)E[k+4+h]=g[h];null!==d&&d.push(Z,k);return k},argPackAdvance:8,readValueFromPointer:Ja,T:function(d){Z(d)}})},h:function(a,b,c){c=U(c);if(2===b){var d=
ma;var g=na;var h=oa;var m=function(){return F};var k=1}else 4===b&&(d=pa,g=qa,h=ra,m=function(){return K},k=2);T(a,{name:c,fromWireType:function(n){for(var p=K[n>>2],q=m(),r,x=n+4,e=0;e<=p;++e){var l=n+4+e*b;if(e==p||0==q[l>>k])x=d(x,l-x),void 0===r?r=x:(r+=String.fromCharCode(0),r+=x),x=l+b}Z(n);return r},toWireType:function(n,p){"string"!==typeof p&&V("Cannot pass non-string to C++ string type "+c);var q=h(p),r=zb(4+q+b);K[r>>2]=q>>k;g(p,r+4,q+b);null!==n&&n.push(Z,r);return r},argPackAdvance:8,
readValueFromPointer:Ja,T:function(n){Z(n)}})},n:function(a,b,c,d,g,h){Ha[a]={name:U(b),la:Y(c,d),ma:Y(g,h),ba:[]}},f:function(a,b,c,d,g,h,m,k,n,p){Ha[a].ba.push({ea:U(b),ia:c,ga:Y(d,g),ha:h,ta:m,sa:Y(k,n),ua:p})},A:function(a,b){b=U(b);T(a,{za:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},g:Ua,C:function(a){if(0===a)return Va(ib());var b=hb[a];a=void 0===b?U(a):b;return Va(ib()[a])},B:function(a){4<a&&(X[a].aa+=1)},o:function(a,b,c,d){a||V("Cannot use deleted val. handle = "+
a);a=X[a].value;var g=kb[b];if(!g){g="";for(var h=0;h<b;++h)g+=(0!==h?", ":"")+"arg"+h;var m="return function emval_allocator_"+b+"(constructor, argTypes, args) {\n";for(h=0;h<b;++h)m+="var argType"+h+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+h+'], "parameter '+h+'");\nvar arg'+h+" = argType"+h+".readValueFromPointer(args);\nargs += argType"+h+"['argPackAdvance'];\n";g=(new Function("requireRegisteredType","Module","__emval_register",m+("var obj = new constructor("+g+");\nreturn __emval_register(obj);\n}\n")))(jb,
f,Va);kb[b]=g}return g(a,c,d)},b:function(){C()},t:function(a,b,c){E.copyWithin(a,b,b+c)},e:function(a){a>>>=0;var b=E.length;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,a+100663296);d=Math.max(16777216,a,d);0<d%65536&&(d+=65536-d%65536);a:{try{D.grow(Math.min(2147483648,d)-I.byteLength+65535>>>16);ua(D.buffer);var g=1;break a}catch(h){}g=void 0}if(g)return!0}return!1},v:function(a,b){var c=0;mb().forEach(function(d,g){var h=b+c;g=H[a+4*g>>2]=h;for(h=0;h<d.length;++h)J[g++>>
0]=d.charCodeAt(h);J[g>>0]=0;c+=d.length+1});return 0},w:function(a,b){var c=mb();H[a>>2]=c.length;var d=0;c.forEach(function(g){d+=g.length+1});H[b>>2]=d;return 0},x:function(){return 0},r:function(){},i:function(a,b,c,d){for(var g=0,h=0;h<c;h++){for(var m=H[b+8*h>>2],k=H[b+(8*h+4)>>2],n=0;n<k;n++){var p=E[m+n],q=ob[a];if(0===p||10===p){for(p=0;q[p]&&!(NaN<=p);)++p;p=ha.decode(q.subarray?q.subarray(0,p):new Uint8Array(q.slice(0,p)));(1===a?ea:z)(p);q.length=0}else q.push(p)}g+=k}H[d>>2]=g;return 0},
a:D,s:function(){},u:function(a,b,c,d){return ub(a,b,c,d)}};
(function(){function a(g){f.asm=g.exports;L=f.asm.E;M--;f.monitorRunDependencies&&f.monitorRunDependencies(M);0==M&&(null!==Ba&&(clearInterval(Ba),Ba=null),N&&(g=N,N=null,g()))}function b(g){a(g.instance)}function c(g){return Fa().then(function(h){return WebAssembly.instantiate(h,d)}).then(g,function(h){z("failed to asynchronously prepare wasm: "+h);C(h)})}var d={a:Ab};M++;f.monitorRunDependencies&&f.monitorRunDependencies(M);if(f.instantiateWasm)try{return f.instantiateWasm(d,a)}catch(g){return z("Module.instantiateWasm callback failed with error: "+
g),!1}(function(){return A||"function"!==typeof WebAssembly.instantiateStreaming||Ca()||"function"!==typeof fetch?c(b):fetch(O,{credentials:"same-origin"}).then(function(g){return WebAssembly.instantiateStreaming(g,d).then(b,function(h){z("wasm streaming compile failed: "+h);z("falling back to ArrayBuffer instantiation");return c(b)})})})().catch(ba);return{}})();
var yb=f.___wasm_call_ctors=function(){return(yb=f.___wasm_call_ctors=f.asm.F).apply(null,arguments)},zb=f._malloc=function(){return(zb=f._malloc=f.asm.G).apply(null,arguments)},Z=f._free=function(){return(Z=f._free=f.asm.H).apply(null,arguments)},eb=f.___getTypeName=function(){return(eb=f.___getTypeName=f.asm.I).apply(null,arguments)};f.___embind_register_native_and_builtin_types=function(){return(f.___embind_register_native_and_builtin_types=f.asm.J).apply(null,arguments)};
f.dynCall_viijii=function(){return(f.dynCall_viijii=f.asm.K).apply(null,arguments)};f.dynCall_iiji=function(){return(f.dynCall_iiji=f.asm.L).apply(null,arguments)};f.dynCall_jiji=function(){return(f.dynCall_jiji=f.asm.M).apply(null,arguments)};f.dynCall_iiiiiijj=function(){return(f.dynCall_iiiiiijj=f.asm.N).apply(null,arguments)};f.dynCall_iiiiij=function(){return(f.dynCall_iiiiij=f.asm.O).apply(null,arguments)};f.dynCall_iiiiijj=function(){return(f.dynCall_iiiiijj=f.asm.P).apply(null,arguments)};
var Bb;N=function Cb(){Bb||Db();Bb||(N=Cb)};
function Db(){function a(){if(!Bb&&(Bb=!0,f.calledRun=!0,!fa)){P(xa);P(ya);aa(f);if(f.onRuntimeInitialized)f.onRuntimeInitialized();if(f.postRun)for("function"==typeof f.postRun&&(f.postRun=[f.postRun]);f.postRun.length;){var b=f.postRun.shift();za.unshift(b)}P(za)}}if(!(0<M)){if(f.preRun)for("function"==typeof f.preRun&&(f.preRun=[f.preRun]);f.preRun.length;)Aa();P(wa);0<M||(f.setStatus?(f.setStatus("Running..."),setTimeout(function(){setTimeout(function(){f.setStatus("")},1);a()},1)):a())}}
f.run=Db;if(f.preInit)for("function"==typeof f.preInit&&(f.preInit=[f.preInit]);0<f.preInit.length;)f.preInit.pop()();noExitRuntime=!0;Db();
return jxl_enc.ready
}
);
})();
export default jxl_enc;

BIN
codecs/jxl/enc/jxl_enc.wasm Executable file

Binary file not shown.

1
codecs/jxl/enc/jxl_enc_mt.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
export { default } from './jxl_enc';

111
codecs/jxl/enc/jxl_enc_mt.js generated Normal file
View File

@@ -0,0 +1,111 @@
var jxl_enc_mt = (function() {
var _scriptDir = import.meta.url;
return (
function(jxl_enc_mt) {
jxl_enc_mt = jxl_enc_mt || {};
function e(){m.buffer!=n&&u(m.buffer);return aa}function v(){m.buffer!=n&&u(m.buffer);return ba}function x(){m.buffer!=n&&u(m.buffer);return ca}function ea(){m.buffer!=n&&u(m.buffer);return fa}function A(){m.buffer!=n&&u(m.buffer);return ha}function C(){m.buffer!=n&&u(m.buffer);return ia}function ja(){m.buffer!=n&&u(m.buffer);return ka}function la(){m.buffer!=n&&u(m.buffer);return ma}var D;D||(D=typeof jxl_enc_mt !== 'undefined' ? jxl_enc_mt : {});var na,oa;
D.ready=new Promise(function(a,b){na=a;oa=b});var E={},F;for(F in D)D.hasOwnProperty(F)&&(E[F]=D[F]);var pa="./this.program",G=D.ENVIRONMENT_IS_PTHREAD||!1;G&&(n=D.buffer);var H="";function qa(a){return D.locateFile?D.locateFile(a,H):H+a}var ra;H=self.location.href;_scriptDir&&(H=_scriptDir);0!==H.indexOf("blob:")?H=H.substr(0,H.lastIndexOf("/")+1):H="";ra=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)};
var sa=D.print||console.log.bind(console),J=D.printErr||console.warn.bind(console);for(F in E)E.hasOwnProperty(F)&&(D[F]=E[F]);E=null;D.thisProgram&&(pa=D.thisProgram);var ta;D.wasmBinary&&(ta=D.wasmBinary);var noExitRuntime;D.noExitRuntime&&(noExitRuntime=D.noExitRuntime);"object"!==typeof WebAssembly&&K("no native wasm support detected");var m,ua,threadInfoStruct=0,selfThreadId=0,va=!1;function wa(a,b){a||K("Assertion failed: "+b)}
function xa(a,b,c){c=b+c;for(var d="";!(b>=c);){var f=a[b++];if(!f)break;if(f&128){var g=a[b++]&63;if(192==(f&224))d+=String.fromCharCode((f&31)<<6|g);else{var l=a[b++]&63;f=224==(f&240)?(f&15)<<12|g<<6|l:(f&7)<<18|g<<12|l<<6|a[b++]&63;65536>f?d+=String.fromCharCode(f):(f-=65536,d+=String.fromCharCode(55296|f>>10,56320|f&1023))}}else d+=String.fromCharCode(f)}return d}function L(a,b){return a?xa(v(),a,b):""}
function ya(a,b,c,d){if(0<d){d=c+d-1;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var l=a.charCodeAt(++f);g=65536+((g&1023)<<10)|l&1023}if(127>=g){if(c>=d)break;b[c++]=g}else{if(2047>=g){if(c+1>=d)break;b[c++]=192|g>>6}else{if(65535>=g){if(c+2>=d)break;b[c++]=224|g>>12}else{if(c+3>=d)break;b[c++]=240|g>>18;b[c++]=128|g>>12&63}b[c++]=128|g>>6&63}b[c++]=128|g&63}}b[c]=0}}function za(a,b,c){ya(a,v(),b,c)}
function Aa(a){for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);55296<=d&&57343>=d&&(d=65536+((d&1023)<<10)|a.charCodeAt(++c)&1023);127>=d?++b:b=2047>=d?b+2:65535>=d?b+3:b+4}return b}function Ba(a,b){for(var c=0,d="";;){var f=x()[a+2*c>>1];if(0==f||c==b/2)return d;++c;d+=String.fromCharCode(f)}}function Ca(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var d=b;c=c<2*a.length?c/2:a.length;for(var f=0;f<c;++f){var g=a.charCodeAt(f);x()[b>>1]=g;b+=2}x()[b>>1]=0;return b-d}
function Da(a){return 2*a.length}function Ea(a,b){for(var c=0,d="";!(c>=b/4);){var f=A()[a+4*c>>2];if(0==f)break;++c;65536<=f?(f-=65536,d+=String.fromCharCode(55296|f>>10,56320|f&1023)):d+=String.fromCharCode(f)}return d}function Fa(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var d=b;c=d+c-4;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var l=a.charCodeAt(++f);g=65536+((g&1023)<<10)|l&1023}A()[b>>2]=g;b+=4;if(b+4>c)break}A()[b>>2]=0;return b-d}
function Ga(a){for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);55296<=d&&57343>=d&&++c;b+=4}return b}function Ha(a,b){e().set(a,b)}var n,aa,ba,ca,fa,ha,ia,ka,ma;function u(a){n=a;D.HEAP8=aa=new Int8Array(a);D.HEAP16=ca=new Int16Array(a);D.HEAP32=ha=new Int32Array(a);D.HEAPU8=ba=new Uint8Array(a);D.HEAPU16=fa=new Uint16Array(a);D.HEAPU32=ia=new Uint32Array(a);D.HEAPF32=ka=new Float32Array(a);D.HEAPF64=ma=new Float64Array(a)}var Ia=D.INITIAL_MEMORY||16777216;
if(G)m=D.wasmMemory,n=D.buffer;else if(D.wasmMemory)m=D.wasmMemory;else if(m=new WebAssembly.Memory({initial:Ia/65536,maximum:32768,shared:!0}),!(m.buffer instanceof SharedArrayBuffer))throw J("requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag"),Error("bad memory");m&&(n=m.buffer);Ia=n.byteLength;u(n);var M,Ja=[],Ka=[],La=[],Ma=[];
function Na(){var a=D.preRun.shift();Ja.unshift(a)}var N=0,Oa=null,Pa=null;D.preloadedImages={};D.preloadedAudios={};function K(a){if(D.onAbort)D.onAbort(a);G&&console.error("Pthread aborting at "+Error().stack);J(a);va=!0;a=new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");oa(a);throw a;}function Qa(){var a=O;return String.prototype.startsWith?a.startsWith("data:application/octet-stream;base64,"):0===a.indexOf("data:application/octet-stream;base64,")}var O="jxl_enc_mt.wasm";
Qa()||(O=qa(O));function Ra(){try{if(ta)return new Uint8Array(ta);if(ra)return ra(O);throw"both async and sync fetching of the wasm failed";}catch(a){K(a)}}function Sa(){return ta||"function"!==typeof fetch?Promise.resolve().then(Ra):fetch(O,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+O+"'";return a.arrayBuffer()}).catch(function(){return Ra()})}var Ua={60805:function(a,b){setTimeout(function(){Ta(a,b)},0)},60883:function(){throw"Canceled!";}};
function Va(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(D);else{var c=b.Bb;"number"===typeof c?void 0===b.Va?M.get(c)():M.get(c)(b.Va):c(void 0===b.Va?null:b.Va)}}}function Wa(a,b,c){var d;-1!=a.indexOf("j")?d=c&&c.length?D["dynCall_"+a].apply(null,[b].concat(c)):D["dynCall_"+a].call(null,b):d=M.get(b).apply(null,c);return d}D.dynCall=Wa;var P=0,Xa=0,Ya=0;function Za(a,b,c){P=a|0;Ya=b|0;Xa=c|0}D.registerPthreadPtr=Za;
function $a(a,b){if(0>=a||a>e().length||a&1||0>b)return-28;if(0==b)return 0;2147483647<=b&&(b=Infinity);var c=Atomics.load(A(),Q.rb>>2),d=0;if(c==a&&Atomics.compareExchange(A(),Q.rb>>2,c,0)==c&&(--b,d=1,0>=b))return 1;a=Atomics.notify(A(),a>>2,b);if(0<=a)return a+d;throw"Atomics.notify returned an unexpected value "+a;}D._emscripten_futex_wake=$a;
function ab(a){if(G)throw"Internal Error! cleanupThread() can only ever be called from main application thread!";if(!a)throw"Internal Error! Null pthread_ptr in cleanupThread!";A()[a+12>>2]=0;(a=Q.Oa[a])&&Q.bb(a.worker)}
var Q={ic:1,pc:{ub:0,vb:0},Ma:[],Qa:[],Jb:function(){for(var a=navigator.hardwareConcurrency,b=0;b<a;++b)Q.lb()},Kb:function(){Q.Ka=R(232);for(var a=0;58>a;++a)C()[Q.Ka/4+a]=0;A()[Q.Ka+12>>2]=Q.Ka;a=Q.Ka+156;A()[a>>2]=a;var b=R(512);for(a=0;128>a;++a)C()[b/4+a]=0;Atomics.store(C(),Q.Ka+104>>2,b);Atomics.store(C(),Q.Ka+40>>2,Q.Ka);Atomics.store(C(),Q.Ka+44>>2,42);Q.pb();Za(Q.Ka,!1,1);bb(Q.Ka)},Lb:function(){Q.pb();na(D);Q.receiveObjectTransfer=Q.Qb;Q.setThreadStatus=Q.Rb;Q.threadCancel=Q.ac;Q.threadExit=
Q.bc},pb:function(){Q.rb=cb},Oa:{},kb:[],Rb:function(){},tb:function(){for(;0<Q.kb.length;)Q.kb.pop()();G&&threadInfoStruct&&db()},bc:function(a){var b=P|0;b&&(Atomics.store(C(),b+4>>2,a),Atomics.store(C(),b+0>>2,1),Atomics.store(C(),b+60>>2,1),Atomics.store(C(),b+64>>2,0),Q.tb(),$a(b+0,2147483647),Za(0,0,0),threadInfoStruct=0,G&&postMessage({cmd:"exit"}))},ac:function(){Q.tb();Atomics.store(C(),threadInfoStruct+4>>2,-1);Atomics.store(C(),threadInfoStruct+0>>2,1);$a(threadInfoStruct+0,2147483647);
threadInfoStruct=selfThreadId=0;Za(0,0,0);postMessage({cmd:"cancelDone"})},wc:function(){for(var a in Q.Oa){var b=Q.Oa[a];b&&b.worker&&Q.bb(b.worker)}Q.Oa={};for(a=0;a<Q.Ma.length;++a){var c=Q.Ma[a];c.terminate()}Q.Ma=[];for(a=0;a<Q.Qa.length;++a)c=Q.Qa[a],b=c.La,Q.ib(b),c.terminate();Q.Qa=[]},ib:function(a){if(a){if(a.threadInfoStruct){var b=A()[a.threadInfoStruct+104>>2];A()[a.threadInfoStruct+104>>2]=0;S(b);S(a.threadInfoStruct)}a.threadInfoStruct=0;a.gb&&a.Ra&&S(a.Ra);a.Ra=0;a.worker&&(a.worker.La=
null)}},bb:function(a){delete Q.Oa[a.La.wb];Q.Ma.push(a);Q.Qa.splice(Q.Qa.indexOf(a),1);Q.ib(a.La);a.La=void 0},Qb:function(){},qb:function(a,b){a.onmessage=function(c){var d=c.data,f=d.cmd;a.La&&(Q.hb=a.La.threadInfoStruct);if(d.targetThread&&d.targetThread!=(P|0)){var g=Q.Oa[d.vc];g?g.worker.postMessage(c.data,d.transferList):console.error('Internal error! Worker sent a message "'+f+'" to target pthread '+d.targetThread+", but that thread no longer exists!")}else if("processQueuedMainThreadWork"===
f)eb();else if("spawnThread"===f)fb(c.data);else if("cleanupThread"===f)ab(d.thread);else if("killThread"===f){c=d.thread;if(G)throw"Internal Error! killThread() can only ever be called from main application thread!";if(!c)throw"Internal Error! Null pthread_ptr in killThread!";A()[c+12>>2]=0;c=Q.Oa[c];c.worker.terminate();Q.ib(c);Q.Qa.splice(Q.Qa.indexOf(c.worker),1);c.worker.La=void 0}else if("cancelThread"===f){c=d.thread;if(G)throw"Internal Error! cancelThread() can only ever be called from main application thread!";
if(!c)throw"Internal Error! Null pthread_ptr in cancelThread!";Q.Oa[c].worker.postMessage({cmd:"cancel"})}else"loaded"===f?(a.loaded=!0,b&&b(a),a.Xa&&(a.Xa(),delete a.Xa)):"print"===f?sa("Thread "+d.threadId+": "+d.text):"printErr"===f?J("Thread "+d.threadId+": "+d.text):"alert"===f?alert("Thread "+d.threadId+": "+d.text):"exit"===f?a.La&&Atomics.load(C(),a.La.wb+68>>2)&&Q.bb(a):"cancelDone"===f?Q.bb(a):"objectTransfer"!==f&&("setimmediate"===c.data.target?a.postMessage(c.data):J("worker sent an unknown command "+
f));Q.hb=void 0};a.onerror=function(c){J("pthread sent an error! "+c.filename+":"+c.lineno+": "+c.message)};a.postMessage({cmd:"load",urlOrBlob:D.mainScriptUrlOrBlob||_scriptDir,wasmMemory:m,wasmModule:ua})},lb:function(){var a=qa("jxl_enc_mt.worker.js");Q.Ma.push(new Worker(a))},Cb:function(){0==Q.Ma.length&&(Q.lb(),Q.qb(Q.Ma[0]));return 0<Q.Ma.length?Q.Ma.pop():null},jc:function(a){for(a=performance.now()+a;performance.now()<a;);}};D.establishStackSpace=function(a){gb(a)};D.getNoExitRuntime=function(){return noExitRuntime};
var hb;hb=G?function(){return performance.now()-D.__performance_now_clock_drift}:function(){return performance.now()};function ib(a,b){Q.kb.push(function(){M.get(a)(b)})}function jb(a){this.Wa=a-16;this.Wb=function(b){A()[this.Wa+8>>2]=b};this.Tb=function(b){A()[this.Wa+0>>2]=b};this.Ub=function(){A()[this.Wa+4>>2]=0};this.Sb=function(){var b=0;e()[this.Wa+12>>0]=b};this.Vb=function(){var b=0;e()[this.Wa+13>>0]=b};this.Hb=function(b,c){this.Wb(b);this.Tb(c);this.Ub();this.Sb();this.Vb()}}
function kb(){return 0<kb.xb}var lb={};function mb(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function nb(a){return this.fromWireType(C()[a>>2])}var T={},U={},ob={};function pb(a){if(void 0===a)return"_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var b=a.charCodeAt(0);return 48<=b&&57>=b?"_"+a:a}function qb(a,b){a=pb(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}
function rb(a){var b=Error,c=qb(a,function(d){this.name=a;this.message=d;d=Error(d).stack;void 0!==d&&(this.stack=this.toString()+"\n"+d.replace(/^Error(:[^\n]*)?\n/,""))});c.prototype=Object.create(b.prototype);c.prototype.constructor=c;c.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message};return c}var sb=void 0;
function tb(a,b,c){function d(k){k=c(k);if(k.length!==a.length)throw new sb("Mismatched type converter count");for(var q=0;q<a.length;++q)V(a[q],k[q])}a.forEach(function(k){ob[k]=b});var f=Array(b.length),g=[],l=0;b.forEach(function(k,q){U.hasOwnProperty(k)?f[q]=U[k]:(g.push(k),T.hasOwnProperty(k)||(T[k]=[]),T[k].push(function(){f[q]=U[k];++l;l===g.length&&d(f)}))});0===g.length&&d(f)}
function ub(a){switch(a){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+a);}}var vb=void 0;function W(a){for(var b="";v()[a];)b+=vb[v()[a++]];return b}var wb=void 0;function X(a){throw new wb(a);}
function V(a,b,c){c=c||{};if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");var d=b.name;a||X('type "'+d+'" must have a positive integer typeid pointer');if(U.hasOwnProperty(a)){if(c.Gb)return;X("Cannot register type '"+d+"' twice")}U[a]=b;delete ob[a];T.hasOwnProperty(a)&&(b=T[a],delete T[a],b.forEach(function(f){f()}))}var xb=[],Y=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
function yb(a){4<a&&0===--Y[a].jb&&(Y[a]=void 0,xb.push(a))}function zb(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=xb.length?xb.pop():Y.length;Y[b]={jb:1,value:a};return b}}function Ab(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}
function Bb(a,b){switch(b){case 2:return function(c){return this.fromWireType(ja()[c>>2])};case 3:return function(c){return this.fromWireType(la()[c>>3])};default:throw new TypeError("Unknown float type: "+a);}}function Cb(a){var b=Function;if(!(b instanceof Function))throw new TypeError("new_ called with constructor type "+typeof b+" which is not a function");var c=qb(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c}
function Db(a,b){var c=D;if(void 0===c[a].Na){var d=c[a];c[a]=function(){c[a].Na.hasOwnProperty(arguments.length)||X("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+c[a].Na+")!");return c[a].Na[arguments.length].apply(this,arguments)};c[a].Na=[];c[a].Na[d.yb]=d}}
function Eb(a,b,c){D.hasOwnProperty(a)?((void 0===c||void 0!==D[a].Na&&void 0!==D[a].Na[c])&&X("Cannot register public name '"+a+"' twice"),Db(a,a),D.hasOwnProperty(c)&&X("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),D[a].Na[c]=b):(D[a]=b,void 0!==c&&(D[a].sc=c))}function Fb(a,b){for(var c=[],d=0;d<a;d++)c.push(A()[(b>>2)+d]);return c}
function Gb(a,b){wa(0<=a.indexOf("j"),"getDynCaller should only be called with i64 sigs");var c=[];return function(){c.length=arguments.length;for(var d=0;d<arguments.length;d++)c[d]=arguments[d];return Wa(a,b,c)}}function Hb(a,b){a=W(a);var c=-1!=a.indexOf("j")?Gb(a,b):M.get(b);"function"!==typeof c&&X("unknown function pointer with signature "+a+": "+b);return c}var Ib=void 0;function Jb(a){a=Kb(a);var b=W(a);S(a);return b}
function Lb(a,b){function c(g){f[g]||U[g]||(ob[g]?ob[g].forEach(c):(d.push(g),f[g]=!0))}var d=[],f={};b.forEach(c);throw new Ib(a+": "+d.map(Jb).join([", "]));}function Mb(a,b,c){switch(b){case 0:return c?function(d){return e()[d]}:function(d){return v()[d]};case 1:return c?function(d){return x()[d>>1]}:function(d){return ea()[d>>1]};case 2:return c?function(d){return A()[d>>2]}:function(d){return C()[d>>2]};default:throw new TypeError("Unknown integer type: "+a);}}var Nb={};
function Ob(){return"object"===typeof globalThis?globalThis:Function("return this")()}function Pb(a,b){var c=U[a];void 0===c&&X(b+" has unknown type "+Jb(a));return c}var Qb={};function Rb(a,b,c){if(0>=a||a>e().length||a&1)return-28;a=Atomics.wait(A(),a>>2,b,c);if("timed-out"===a)return-73;if("not-equal"===a)return-6;if("ok"===a)return 0;throw"Atomics.wait returned an unexpected value "+a;}
function Z(a,b){for(var c=arguments.length-2,d=Sb(),f=Tb(8*c),g=f>>3,l=0;l<c;l++)la()[g+l]=arguments[2+l];c=Ub(a,c,f,b);gb(d);return c}var Vb=[],Wb=[],Xb=[0,"undefined"!==typeof document?document:0,"undefined"!==typeof window?window:0];function Yb(a){a=2<a?L(a):a;return Xb[a]||("undefined"!==typeof document?document.querySelector(a):void 0)}
function Zb(a,b,c){var d=Yb(a);if(!d)return-4;d.ab&&(A()[d.ab>>2]=b,A()[d.ab+4>>2]=c);if(d.sb||!d.lc)d.sb&&(d=d.sb),a=!1,d.$a&&d.$a.Za&&(a=d.$a.Za.getParameter(2978),a=0===a[0]&&0===a[1]&&a[2]===d.width&&a[3]===d.height),d.width=b,d.height=c,a&&d.$a.Za.viewport(0,0,b,c);else{if(d.ab){d=A()[d.ab+8>>2];a=a?L(a):"";var f=Sb(),g=Tb(12),l=0;if(a){l=Aa(a)+1;var k=R(l);za(a,k,l);l=k}A()[g>>2]=l;A()[g+4>>2]=b;A()[g+8>>2]=c;$b(0,d,657457152,0,l,g);gb(f);return 1}return-4}return 0}
function ac(a,b,c){return G?Z(2,1,a,b,c):Zb(a,b,c)}function bc(a){var b=a.getExtension("ANGLE_instanced_arrays");b&&(a.vertexAttribDivisor=function(c,d){b.vertexAttribDivisorANGLE(c,d)},a.drawArraysInstanced=function(c,d,f,g){b.drawArraysInstancedANGLE(c,d,f,g)},a.drawElementsInstanced=function(c,d,f,g,l){b.drawElementsInstancedANGLE(c,d,f,g,l)})}
function cc(a){var b=a.getExtension("OES_vertex_array_object");b&&(a.createVertexArray=function(){return b.createVertexArrayOES()},a.deleteVertexArray=function(c){b.deleteVertexArrayOES(c)},a.bindVertexArray=function(c){b.bindVertexArrayOES(c)},a.isVertexArray=function(c){return b.isVertexArrayOES(c)})}function dc(a){var b=a.getExtension("WEBGL_draw_buffers");b&&(a.drawBuffers=function(c,d){b.drawBuffersWEBGL(c,d)})}
function ec(a){a||(a=fc);if(!a.Ib){a.Ib=!0;var b=a.Za;bc(b);cc(b);dc(b);b.mc=b.getExtension("EXT_disjoint_timer_query");b.rc=b.getExtension("WEBGL_multi_draw");var c="OES_texture_float OES_texture_half_float OES_standard_derivatives OES_vertex_array_object WEBGL_compressed_texture_s3tc WEBGL_depth_texture OES_element_index_uint EXT_texture_filter_anisotropic EXT_frag_depth WEBGL_draw_buffers ANGLE_instanced_arrays OES_texture_float_linear OES_texture_half_float_linear EXT_blend_minmax EXT_shader_texture_lod EXT_texture_norm16 WEBGL_compressed_texture_pvrtc EXT_color_buffer_half_float WEBGL_color_buffer_float EXT_sRGB WEBGL_compressed_texture_etc1 EXT_disjoint_timer_query WEBGL_compressed_texture_etc WEBGL_compressed_texture_astc EXT_color_buffer_float WEBGL_compressed_texture_s3tc_srgb EXT_disjoint_timer_query_webgl2 WEBKIT_WEBGL_compressed_texture_pvrtc".split(" ");
(b.getSupportedExtensions()||[]).forEach(function(d){-1!=c.indexOf(d)&&b.getExtension(d)})}}var fc,gc=["default","low-power","high-performance"],hc={};function ic(){if(!jc){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"===typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:pa||"./this.program"},b;for(b in hc)a[b]=hc[b];var c=[];for(b in a)c.push(b+"="+a[b]);jc=c}return jc}var jc,kc=[null,[],[]];
function lc(a){return G?Z(3,1,a):0}function mc(a,b,c,d,f){if(G)return Z(4,1,a,b,c,d,f)}function nc(a,b,c,d){if(G)return Z(5,1,a,b,c,d);for(var f=0,g=0;g<c;g++){for(var l=A()[b+8*g>>2],k=A()[b+(8*g+4)>>2],q=0;q<k;q++){var t=v()[l+q],r=kc[a];0===t||10===t?((1===a?sa:J)(xa(r,0)),r.length=0):r.push(t)}f+=k}A()[d>>2]=f;return 0}
function fb(a){if(G)throw"Internal Error! spawnThread() can only ever be called from main application thread!";var b=Q.Cb();if(void 0!==b.La)throw"Internal error!";if(!a.Sa)throw"Internal error, no pthread ptr!";Q.Qa.push(b);for(var c=R(512),d=0;128>d;++d)A()[c+4*d>>2]=0;var f=a.Ra+a.Ta;d=Q.Oa[a.Sa]={worker:b,Ra:a.Ra,Ta:a.Ta,gb:a.gb,wb:a.Sa,threadInfoStruct:a.Sa};var g=d.threadInfoStruct>>2;Atomics.store(C(),g,0);Atomics.store(C(),g+1,0);Atomics.store(C(),g+2,0);Atomics.store(C(),g+17,a.mb);Atomics.store(C(),
g+26,c);Atomics.store(C(),g+12,0);Atomics.store(C(),g+10,d.threadInfoStruct);Atomics.store(C(),g+11,42);Atomics.store(C(),g+27,a.Ta);Atomics.store(C(),g+21,a.Ta);Atomics.store(C(),g+20,f);Atomics.store(C(),g+29,f);Atomics.store(C(),g+30,a.mb);Atomics.store(C(),g+32,a.ub);Atomics.store(C(),g+33,a.vb);c=oc()+40;Atomics.store(C(),g+44,c);b.La=d;var l={cmd:"run",start_routine:a.$b,arg:a.Va,threadInfoStruct:a.Sa,selfThreadId:a.Sa,parentThreadId:a.Nb,stackBase:a.Ra,stackSize:a.Ta};b.Xa=function(){l.time=
performance.now();b.postMessage(l,a.hc)};b.loaded&&(b.Xa(),delete b.Xa)}function pc(){return P|0}D._pthread_self=pc;
function qc(a,b){if(!a)return J("pthread_join attempted on a null thread pointer!"),71;if(G&&selfThreadId==a)return J("PThread "+a+" is attempting to join to itself!"),16;if(!G&&Q.Ka==a)return J("Main thread "+a+" is attempting to join to itself!"),16;if(A()[a+12>>2]!==a)return J("pthread_join attempted on thread "+a+", which does not point to a valid thread, or does not exist anymore!"),71;if(Atomics.load(C(),a+68>>2))return J("Attempted to join thread "+a+", which was already detached!"),28;for(;;){var c=
Atomics.load(C(),a+0>>2);if(1==c)return c=Atomics.load(C(),a+4>>2),b&&(A()[b>>2]=c),Atomics.store(C(),a+68>>2,1),G?postMessage({cmd:"cleanupThread",thread:a}):ab(a),0;if(G&&threadInfoStruct&&!Atomics.load(C(),threadInfoStruct+60>>2)&&2==Atomics.load(C(),threadInfoStruct+0>>2))throw"Canceled!";G||eb();Rb(a+0,c,G?100:1)}}function rc(a){return 0===a%4&&(0!==a%100||0===a%400)}function sc(a,b){for(var c=0,d=0;d<=b;c+=a[d++]);return c}
var tc=[31,29,31,30,31,30,31,31,30,31,30,31],uc=[31,28,31,30,31,30,31,31,30,31,30,31];function vc(a,b){for(a=new Date(a.getTime());0<b;){var c=a.getMonth(),d=(rc(a.getFullYear())?tc:uc)[c];if(b>d-a.getDate())b-=d-a.getDate()+1,a.setDate(1),11>c?a.setMonth(c+1):(a.setMonth(0),a.setFullYear(a.getFullYear()+1));else{a.setDate(a.getDate()+b);break}}return a}
function wc(a,b,c,d){function f(h,p,y){for(h="number"===typeof h?h.toString():h||"";h.length<p;)h=y[0]+h;return h}function g(h,p){return f(h,p,"0")}function l(h,p){function y(I){return 0>I?-1:0<I?1:0}var B;0===(B=y(h.getFullYear()-p.getFullYear()))&&0===(B=y(h.getMonth()-p.getMonth()))&&(B=y(h.getDate()-p.getDate()));return B}function k(h){switch(h.getDay()){case 0:return new Date(h.getFullYear()-1,11,29);case 1:return h;case 2:return new Date(h.getFullYear(),0,3);case 3:return new Date(h.getFullYear(),
0,2);case 4:return new Date(h.getFullYear(),0,1);case 5:return new Date(h.getFullYear()-1,11,31);case 6:return new Date(h.getFullYear()-1,11,30)}}function q(h){h=vc(new Date(h.Ja+1900,0,1),h.fb);var p=new Date(h.getFullYear()+1,0,4),y=k(new Date(h.getFullYear(),0,4));p=k(p);return 0>=l(y,h)?0>=l(p,h)?h.getFullYear()+1:h.getFullYear():h.getFullYear()-1}var t=A()[d+40>>2];d={ec:A()[d>>2],dc:A()[d+4>>2],cb:A()[d+8>>2],Ya:A()[d+12>>2],Ua:A()[d+16>>2],Ja:A()[d+20>>2],eb:A()[d+24>>2],fb:A()[d+28>>2],xc:A()[d+
32>>2],cc:A()[d+36>>2],fc:t?L(t):""};c=L(c);t={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var r in t)c=c.replace(new RegExp(r,"g"),t[r]);var w="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),
z="January February March April May June July August September October November December".split(" ");t={"%a":function(h){return w[h.eb].substring(0,3)},"%A":function(h){return w[h.eb]},"%b":function(h){return z[h.Ua].substring(0,3)},"%B":function(h){return z[h.Ua]},"%C":function(h){return g((h.Ja+1900)/100|0,2)},"%d":function(h){return g(h.Ya,2)},"%e":function(h){return f(h.Ya,2," ")},"%g":function(h){return q(h).toString().substring(2)},"%G":function(h){return q(h)},"%H":function(h){return g(h.cb,
2)},"%I":function(h){h=h.cb;0==h?h=12:12<h&&(h-=12);return g(h,2)},"%j":function(h){return g(h.Ya+sc(rc(h.Ja+1900)?tc:uc,h.Ua-1),3)},"%m":function(h){return g(h.Ua+1,2)},"%M":function(h){return g(h.dc,2)},"%n":function(){return"\n"},"%p":function(h){return 0<=h.cb&&12>h.cb?"AM":"PM"},"%S":function(h){return g(h.ec,2)},"%t":function(){return"\t"},"%u":function(h){return h.eb||7},"%U":function(h){var p=new Date(h.Ja+1900,0,1),y=0===p.getDay()?p:vc(p,7-p.getDay());h=new Date(h.Ja+1900,h.Ua,h.Ya);return 0>
l(y,h)?g(Math.ceil((31-y.getDate()+(sc(rc(h.getFullYear())?tc:uc,h.getMonth()-1)-31)+h.getDate())/7),2):0===l(y,p)?"01":"00"},"%V":function(h){var p=new Date(h.Ja+1901,0,4),y=k(new Date(h.Ja+1900,0,4));p=k(p);var B=vc(new Date(h.Ja+1900,0,1),h.fb);return 0>l(B,y)?"53":0>=l(p,B)?"01":g(Math.ceil((y.getFullYear()<h.Ja+1900?h.fb+32-y.getDate():h.fb+1-y.getDate())/7),2)},"%w":function(h){return h.eb},"%W":function(h){var p=new Date(h.Ja,0,1),y=1===p.getDay()?p:vc(p,0===p.getDay()?1:7-p.getDay()+1);h=
new Date(h.Ja+1900,h.Ua,h.Ya);return 0>l(y,h)?g(Math.ceil((31-y.getDate()+(sc(rc(h.getFullYear())?tc:uc,h.getMonth()-1)-31)+h.getDate())/7),2):0===l(y,p)?"01":"00"},"%y":function(h){return(h.Ja+1900).toString().substring(2)},"%Y":function(h){return h.Ja+1900},"%z":function(h){h=h.cc;var p=0<=h;h=Math.abs(h)/60;return(p?"+":"-")+String("0000"+(h/60*100+h%60)).slice(-4)},"%Z":function(h){return h.fc},"%%":function(){return"%"}};for(r in t)0<=c.indexOf(r)&&(c=c.replace(new RegExp(r,"g"),t[r](d)));r=
xc(c);if(r.length>b)return 0;Ha(r,a);return r.length-1}
function yc(a){if(G)return Z(6,1,a);switch(a){case 30:return 16384;case 85:return 131072;case 132:case 133:case 12:case 137:case 138:case 15:case 235:case 16:case 17:case 18:case 19:case 20:case 149:case 13:case 10:case 236:case 153:case 9:case 21:case 22:case 159:case 154:case 14:case 77:case 78:case 139:case 80:case 81:case 82:case 68:case 67:case 164:case 11:case 29:case 47:case 48:case 95:case 52:case 51:case 46:case 79:return 200809;case 27:case 246:case 127:case 128:case 23:case 24:case 160:case 161:case 181:case 182:case 242:case 183:case 184:case 243:case 244:case 245:case 165:case 178:case 179:case 49:case 50:case 168:case 169:case 175:case 170:case 171:case 172:case 97:case 76:case 32:case 173:case 35:return-1;case 176:case 177:case 7:case 155:case 8:case 157:case 125:case 126:case 92:case 93:case 129:case 130:case 131:case 94:case 91:return 1;
case 74:case 60:case 69:case 70:case 4:return 1024;case 31:case 42:case 72:return 32;case 87:case 26:case 33:return 2147483647;case 34:case 1:return 47839;case 38:case 36:return 99;case 43:case 37:return 2048;case 0:return 2097152;case 3:return 65536;case 28:return 32768;case 44:return 32767;case 75:return 16384;case 39:return 1E3;case 89:return 700;case 71:return 256;case 40:return 255;case 2:return 100;case 180:return 64;case 25:return 20;case 5:return 16;case 6:return 6;case 73:return 4;case 84:return"object"===
typeof navigator?navigator.hardwareConcurrency||1:1}A()[zc()>>2]=28;return-1}G||Q.Jb();sb=D.InternalError=rb("InternalError");for(var Ac=Array(256),Bc=0;256>Bc;++Bc)Ac[Bc]=String.fromCharCode(Bc);vb=Ac;wb=D.BindingError=rb("BindingError");D.count_emval_handles=function(){for(var a=0,b=5;b<Y.length;++b)void 0!==Y[b]&&++a;return a};D.get_first_emval=function(){for(var a=5;a<Y.length;++a)if(void 0!==Y[a])return Y[a];return null};Ib=D.UnboundTypeError=rb("UnboundTypeError");
var Cc=[null,function(a,b){if(G)return Z(1,1,a,b)},ac,lc,mc,nc,yc];function xc(a){var b=Array(Aa(a)+1);ya(a,b,0,b.length);return b}G||Ka.push({Bb:function(){Dc()}});
var Gc={i:function(a,b,c,d){K("Assertion failed: "+L(a)+", at: "+[b?L(b):"unknown filename",c,d?L(d):"unknown function"])},K:function(a){return R(a+16)+16},X:function(a,b){return ib(a,b)},I:function(a,b,c){(new jb(a)).Hb(b,c);"uncaught_exception"in kb?kb.xb++:kb.xb=1;throw a;},w:function(a){var b=lb[a];delete lb[a];var c=b.Ob,d=b.Pb,f=b.ob,g=f.map(function(l){return l.Fb}).concat(f.map(function(l){return l.Yb}));tb([a],g,function(l){var k={};f.forEach(function(q,t){var r=l[t],w=q.Db,z=q.Eb,h=l[t+
f.length],p=q.Xb,y=q.Zb;k[q.Ab]={read:function(B){return r.fromWireType(w(z,B))},write:function(B,I){var da=[];p(y,B,h.toWireType(da,I));mb(da)}}});return[{name:b.name,fromWireType:function(q){var t={},r;for(r in k)t[r]=k[r].read(q);d(q);return t},toWireType:function(q,t){for(var r in k)if(!(r in t))throw new TypeError('Missing field: "'+r+'"');var w=c();for(r in k)k[r].write(w,t[r]);null!==q&&q.push(d,w);return w},argPackAdvance:8,readValueFromPointer:nb,Pa:d}]})},S:function(a,b,c,d,f){var g=ub(c);
b=W(b);V(a,{name:b,fromWireType:function(l){return!!l},toWireType:function(l,k){return k?d:f},argPackAdvance:8,readValueFromPointer:function(l){if(1===c)var k=e();else if(2===c)k=x();else if(4===c)k=A();else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(k[l>>g])},Pa:null})},R:function(a,b){b=W(b);V(a,{name:b,fromWireType:function(c){var d=Y[c].value;yb(c);return d},toWireType:function(c,d){return zb(d)},argPackAdvance:8,readValueFromPointer:nb,Pa:null})},t:function(a,
b,c){c=ub(c);b=W(b);V(a,{name:b,fromWireType:function(d){return d},toWireType:function(d,f){if("number"!==typeof f&&"boolean"!==typeof f)throw new TypeError('Cannot convert "'+Ab(f)+'" to '+this.name);return f},argPackAdvance:8,readValueFromPointer:Bb(b,c),Pa:null})},v:function(a,b,c,d,f,g){var l=Fb(b,c);a=W(a);f=Hb(d,f);Eb(a,function(){Lb("Cannot call "+a+" due to unbound types",l)},b-1);tb([],l,function(k){var q=a,t=a;k=[k[0],null].concat(k.slice(1));var r=f,w=k.length;2>w&&X("argTypes array size mismatch! Must at least get return value and 'this' types!");
for(var z=null!==k[1]&&!1,h=!1,p=1;p<k.length;++p)if(null!==k[p]&&void 0===k[p].Pa){h=!0;break}var y="void"!==k[0].name,B="",I="";for(p=0;p<w-2;++p)B+=(0!==p?", ":"")+"arg"+p,I+=(0!==p?", ":"")+"arg"+p+"Wired";t="return function "+pb(t)+"("+B+") {\nif (arguments.length !== "+(w-2)+") {\nthrowBindingError('function "+t+" called with ' + arguments.length + ' arguments, expected "+(w-2)+" args!');\n}\n";h&&(t+="var destructors = [];\n");var da=h?"destructors":"null";B="throwBindingError invoker fn runDestructors retType classParam".split(" ");
r=[X,r,g,mb,k[0],k[1]];z&&(t+="var thisWired = classParam.toWireType("+da+", this);\n");for(p=0;p<w-2;++p)t+="var arg"+p+"Wired = argType"+p+".toWireType("+da+", arg"+p+"); // "+k[p+2].name+"\n",B.push("argType"+p),r.push(k[p+2]);z&&(I="thisWired"+(0<I.length?", ":"")+I);t+=(y?"var rv = ":"")+"invoker(fn"+(0<I.length?", ":"")+I+");\n";if(h)t+="runDestructors(destructors);\n";else for(p=z?1:2;p<k.length;++p)w=1===p?"thisWired":"arg"+(p-2)+"Wired",null!==k[p].Pa&&(t+=w+"_dtor("+w+"); // "+k[p].name+
"\n",B.push(w+"_dtor"),r.push(k[p].Pa));y&&(t+="var ret = retType.fromWireType(rv);\nreturn ret;\n");B.push(t+"}\n");k=Cb(B).apply(null,r);p=b-1;if(!D.hasOwnProperty(q))throw new sb("Replacing nonexistant public symbol");void 0!==D[q].Na&&void 0!==p?D[q].Na[p]=k:(D[q]=k,D[q].yb=p);return[]})},j:function(a,b,c,d,f){function g(t){return t}b=W(b);-1===f&&(f=4294967295);var l=ub(c);if(0===d){var k=32-8*c;g=function(t){return t<<k>>>k}}var q=-1!=b.indexOf("unsigned");V(a,{name:b,fromWireType:g,toWireType:function(t,
r){if("number"!==typeof r&&"boolean"!==typeof r)throw new TypeError('Cannot convert "'+Ab(r)+'" to '+this.name);if(r<d||r>f)throw new TypeError('Passing a number "'+Ab(r)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+d+", "+f+"]!");return q?r>>>0:r|0},argPackAdvance:8,readValueFromPointer:Mb(b,l,0!==d),Pa:null})},h:function(a,b,c){function d(g){g>>=2;var l=C();return new f(n,l[g+1],l[g])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,
Uint32Array,Float32Array,Float64Array][b];c=W(c);V(a,{name:c,fromWireType:d,argPackAdvance:8,readValueFromPointer:d},{Gb:!0})},u:function(a,b){b=W(b);var c="std::string"===b;V(a,{name:b,fromWireType:function(d){var f=C()[d>>2];if(c)for(var g=d+4,l=0;l<=f;++l){var k=d+4+l;if(l==f||0==v()[k]){g=L(g,k-g);if(void 0===q)var q=g;else q+=String.fromCharCode(0),q+=g;g=k+1}}else{q=Array(f);for(l=0;l<f;++l)q[l]=String.fromCharCode(v()[d+4+l]);q=q.join("")}S(d);return q},toWireType:function(d,f){f instanceof
ArrayBuffer&&(f=new Uint8Array(f));var g="string"===typeof f;g||f instanceof Uint8Array||f instanceof Uint8ClampedArray||f instanceof Int8Array||X("Cannot pass non-string to std::string");var l=(c&&g?function(){return Aa(f)}:function(){return f.length})(),k=R(4+l+1);C()[k>>2]=l;if(c&&g)za(f,k+4,l+1);else if(g)for(g=0;g<l;++g){var q=f.charCodeAt(g);255<q&&(S(k),X("String has UTF-16 code units that do not fit in 8 bits"));v()[k+4+g]=q}else for(g=0;g<l;++g)v()[k+4+g]=f[g];null!==d&&d.push(S,k);return k},
argPackAdvance:8,readValueFromPointer:nb,Pa:function(d){S(d)}})},q:function(a,b,c){c=W(c);if(2===b){var d=Ba;var f=Ca;var g=Da;var l=function(){return ea()};var k=1}else 4===b&&(d=Ea,f=Fa,g=Ga,l=function(){return C()},k=2);V(a,{name:c,fromWireType:function(q){for(var t=C()[q>>2],r=l(),w,z=q+4,h=0;h<=t;++h){var p=q+4+h*b;if(h==t||0==r[p>>k])z=d(z,p-z),void 0===w?w=z:(w+=String.fromCharCode(0),w+=z),z=p+b}S(q);return w},toWireType:function(q,t){"string"!==typeof t&&X("Cannot pass non-string to C++ string type "+
c);var r=g(t),w=R(4+r+b);C()[w>>2]=r>>k;f(t,w+4,r+b);null!==q&&q.push(S,w);return w},argPackAdvance:8,readValueFromPointer:nb,Pa:function(q){S(q)}})},x:function(a,b,c,d,f,g){lb[a]={name:W(b),Ob:Hb(c,d),Pb:Hb(f,g),ob:[]}},l:function(a,b,c,d,f,g,l,k,q,t){lb[a].ob.push({Ab:W(b),Fb:c,Db:Hb(d,f),Eb:g,Yb:l,Xb:Hb(k,q),Zb:t})},T:function(a,b){b=W(b);V(a,{oc:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},H:function(a,b){if(a==b)postMessage({cmd:"processQueuedMainThreadWork"});
else if(G)postMessage({targetThread:a,cmd:"processThreadQueue"});else{a=(a=Q.Oa[a])&&a.worker;if(!a)return;a.postMessage({cmd:"processThreadQueue"})}return 1},m:yb,W:function(a){if(0===a)return zb(Ob());var b=Nb[a];a=void 0===b?W(a):b;return zb(Ob()[a])},V:function(a){4<a&&(Y[a].jb+=1)},y:function(a,b,c,d){a||X("Cannot use deleted val. handle = "+a);a=Y[a].value;var f=Qb[b];if(!f){f="";for(var g=0;g<b;++g)f+=(0!==g?", ":"")+"arg"+g;var l="return function emval_allocator_"+b+"(constructor, argTypes, args) {\n";
for(g=0;g<b;++g)l+="var argType"+g+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+g+'], "parameter '+g+'");\nvar arg'+g+" = argType"+g+".readValueFromPointer(args);\nargs += argType"+g+"['argPackAdvance'];\n";f=(new Function("requireRegisteredType","Module","__emval_register",l+("var obj = new constructor("+f+");\nreturn __emval_register(obj);\n}\n")))(Pb,D,zb);Qb[b]=f}return f(a,c,d)},b:function(){K()},n:function(a,b,c){Wb.length=0;var d;for(c>>=2;d=v()[b++];)(d=105>d)&&c&1&&c++,
Wb.push(d?la()[c++>>1]:A()[c]),++c;return Ua[a].apply(null,Wb)},J:function(){},r:function(){},f:Rb,g:$a,d:hb,p:function(){return Ya|0},o:function(){return Xa|0},C:function(a,b,c){v().copyWithin(a,b,b+c)},E:function(a,b,c){Vb.length=b;c>>=3;for(var d=0;d<b;d++)Vb[d]=la()[c+d];return(0>a?Ua[-a-1]:Cc[a]).apply(null,Vb)},k:function(a){a>>>=0;var b=v().length;if(a<=b||2147483648<a)return!1;for(var c=1;4>=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,a+100663296);d=Math.max(16777216,a,d);0<d%65536&&(d+=65536-d%
65536);a:{try{m.grow(Math.min(2147483648,d)-n.byteLength+65535>>>16);u(m.buffer);var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},F:function(a,b,c){return Yb(a)?Zb(a,b,c):ac(a,b,c)},e:function(){},G:function(a,b){var c={};b>>=2;c.alpha=!!A()[b];c.depth=!!A()[b+1];c.stencil=!!A()[b+2];c.antialias=!!A()[b+3];c.premultipliedAlpha=!!A()[b+4];c.preserveDrawingBuffer=!!A()[b+5];var d=A()[b+6];c.powerPreference=gc[d];c.failIfMajorPerformanceCaveat=!!A()[b+7];c.Mb=A()[b+8];c.qc=A()[b+9];c.nb=A()[b+
10];c.zb=A()[b+11];c.tc=A()[b+12];c.uc=A()[b+13];a=Yb(a);!a||c.zb?c=0:(a=a.getContext("webgl",c))?(b=R(8),A()[b+4>>2]=P|0,d={nc:b,attributes:c,version:c.Mb,Za:a},a.canvas&&(a.canvas.$a=d),("undefined"===typeof c.nb||c.nb)&&ec(d),c=b):c=0;return c},O:function(a,b){var c=0;ic().forEach(function(d,f){var g=b+c;f=A()[a+4*f>>2]=g;for(g=0;g<d.length;++g)e()[f++>>0]=d.charCodeAt(g);e()[f>>0]=0;c+=d.length+1});return 0},P:function(a,b){var c=ic();A()[a>>2]=c.length;var d=0;c.forEach(function(f){d+=f.length+
1});A()[b>>2]=d;return 0},Q:lc,z:mc,s:nc,B:function(){Q.Kb()},a:m||D.wasmMemory,D:ib,U:function(a,b,c,d){if("undefined"===typeof SharedArrayBuffer)return J("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;if(!a)return J("pthread_create called with a null thread pointer!"),28;var f=[];if(G&&0===f.length)return Ec(687865856,a,b,c,d);var g=0,l=0,k=0,q=0;if(b){var t=A()[b>>2];t+=81920;g=A()[b+8>>2];l=0!==A()[b+12>>2];if(0===A()[b+16>>2]){var r=A()[b+20>>2],w=A()[b+
24>>2];k=b+20;q=b+24;var z=Q.hb?Q.hb:P|0;if(k||q)if(z)if(A()[z+12>>2]!==z)J("pthread_getschedparam attempted on thread "+z+", which does not point to a valid thread, or does not exist anymore!");else{var h=Atomics.load(C(),z+108+20>>2);z=Atomics.load(C(),z+108+24>>2);k&&(A()[k>>2]=h);q&&(A()[q>>2]=z)}else J("pthread_getschedparam called with a null thread pointer!");k=A()[b+20>>2];q=A()[b+24>>2];A()[b+20>>2]=r;A()[b+24>>2]=w}else k=A()[b+20>>2],q=A()[b+24>>2]}else t=2097152;(b=0==g)?g=Fc(16,t):(g-=
t,wa(0<g));r=R(232);for(w=0;58>w;++w)C()[(r>>2)+w]=0;A()[a>>2]=r;A()[r+12>>2]=r;a=r+156;A()[a>>2]=a;c={Ra:g,Ta:t,gb:b,ub:k,vb:q,mb:l,$b:c,Sa:r,Nb:P|0,Va:d,hc:f};G?(c.kc="spawnThread",postMessage(c,f)):fb(c);return 0},L:function(a,b){return qc(a,b)},c:pc,A:function(){},N:function(a,b,c,d){return wc(a,b,c,d)},M:yc};
(function(){function a(f,g){D.asm=f.exports;M=D.asm.Y;ua=g;if(!G){var l=Q.Ma.length;Q.Ma.forEach(function(k){Q.qb(k,function(){if(!--l&&(N--,D.monitorRunDependencies&&D.monitorRunDependencies(N),0==N&&(null!==Oa&&(clearInterval(Oa),Oa=null),Pa))){var q=Pa;Pa=null;q()}})})}}function b(f){a(f.instance,f.module)}function c(f){return Sa().then(function(g){return WebAssembly.instantiate(g,d)}).then(f,function(g){J("failed to asynchronously prepare wasm: "+g);K(g)})}var d={a:Gc};G||(wa(!G,"addRunDependency cannot be used in a pthread worker"),
N++,D.monitorRunDependencies&&D.monitorRunDependencies(N));if(D.instantiateWasm)try{return D.instantiateWasm(d,a)}catch(f){return J("Module.instantiateWasm callback failed with error: "+f),!1}(function(){return ta||"function"!==typeof WebAssembly.instantiateStreaming||Qa()||"function"!==typeof fetch?c(b):fetch(O,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,d).then(b,function(g){J("wasm streaming compile failed: "+g);J("falling back to ArrayBuffer instantiation");
return c(b)})})})().catch(oa);return{}})();var Dc=D.___wasm_call_ctors=function(){return(Dc=D.___wasm_call_ctors=D.asm.Z).apply(null,arguments)},R=D._malloc=function(){return(R=D._malloc=D.asm._).apply(null,arguments)},S=D._free=function(){return(S=D._free=D.asm.$).apply(null,arguments)},zc=D.___errno_location=function(){return(zc=D.___errno_location=D.asm.aa).apply(null,arguments)},Kb=D.___getTypeName=function(){return(Kb=D.___getTypeName=D.asm.ba).apply(null,arguments)};
D.___embind_register_native_and_builtin_types=function(){return(D.___embind_register_native_and_builtin_types=D.asm.ca).apply(null,arguments)};D.___em_js__initPthreadsJS=function(){return(D.___em_js__initPthreadsJS=D.asm.da).apply(null,arguments)};
var oc=D._emscripten_get_global_libc=function(){return(oc=D._emscripten_get_global_libc=D.asm.ea).apply(null,arguments)},Sb=D.stackSave=function(){return(Sb=D.stackSave=D.asm.fa).apply(null,arguments)},gb=D.stackRestore=function(){return(gb=D.stackRestore=D.asm.ga).apply(null,arguments)},Tb=D.stackAlloc=function(){return(Tb=D.stackAlloc=D.asm.ha).apply(null,arguments)},Fc=D._memalign=function(){return(Fc=D._memalign=D.asm.ia).apply(null,arguments)};
D._emscripten_main_browser_thread_id=function(){return(D._emscripten_main_browser_thread_id=D.asm.ja).apply(null,arguments)};var db=D.___pthread_tsd_run_dtors=function(){return(db=D.___pthread_tsd_run_dtors=D.asm.ka).apply(null,arguments)},eb=D._emscripten_main_thread_process_queued_calls=function(){return(eb=D._emscripten_main_thread_process_queued_calls=D.asm.la).apply(null,arguments)};
D._emscripten_current_thread_process_queued_calls=function(){return(D._emscripten_current_thread_process_queued_calls=D.asm.ma).apply(null,arguments)};var bb=D._emscripten_register_main_browser_thread_id=function(){return(bb=D._emscripten_register_main_browser_thread_id=D.asm.na).apply(null,arguments)},Ta=D._do_emscripten_dispatch_to_thread=function(){return(Ta=D._do_emscripten_dispatch_to_thread=D.asm.oa).apply(null,arguments)};
D._emscripten_async_run_in_main_thread=function(){return(D._emscripten_async_run_in_main_thread=D.asm.pa).apply(null,arguments)};D._emscripten_sync_run_in_main_thread=function(){return(D._emscripten_sync_run_in_main_thread=D.asm.qa).apply(null,arguments)};D._emscripten_sync_run_in_main_thread_0=function(){return(D._emscripten_sync_run_in_main_thread_0=D.asm.ra).apply(null,arguments)};
D._emscripten_sync_run_in_main_thread_1=function(){return(D._emscripten_sync_run_in_main_thread_1=D.asm.sa).apply(null,arguments)};D._emscripten_sync_run_in_main_thread_2=function(){return(D._emscripten_sync_run_in_main_thread_2=D.asm.ta).apply(null,arguments)};D._emscripten_sync_run_in_main_thread_xprintf_varargs=function(){return(D._emscripten_sync_run_in_main_thread_xprintf_varargs=D.asm.ua).apply(null,arguments)};
D._emscripten_sync_run_in_main_thread_3=function(){return(D._emscripten_sync_run_in_main_thread_3=D.asm.va).apply(null,arguments)};var Ec=D._emscripten_sync_run_in_main_thread_4=function(){return(Ec=D._emscripten_sync_run_in_main_thread_4=D.asm.wa).apply(null,arguments)};D._emscripten_sync_run_in_main_thread_5=function(){return(D._emscripten_sync_run_in_main_thread_5=D.asm.xa).apply(null,arguments)};
D._emscripten_sync_run_in_main_thread_6=function(){return(D._emscripten_sync_run_in_main_thread_6=D.asm.ya).apply(null,arguments)};D._emscripten_sync_run_in_main_thread_7=function(){return(D._emscripten_sync_run_in_main_thread_7=D.asm.za).apply(null,arguments)};
var Ub=D._emscripten_run_in_main_runtime_thread_js=function(){return(Ub=D._emscripten_run_in_main_runtime_thread_js=D.asm.Aa).apply(null,arguments)},$b=D.__emscripten_call_on_thread=function(){return($b=D.__emscripten_call_on_thread=D.asm.Ba).apply(null,arguments)};D._emscripten_tls_init=function(){return(D._emscripten_tls_init=D.asm.Ca).apply(null,arguments)};D.dynCall_viijii=function(){return(D.dynCall_viijii=D.asm.Da).apply(null,arguments)};
D.dynCall_iiji=function(){return(D.dynCall_iiji=D.asm.Ea).apply(null,arguments)};D.dynCall_jiji=function(){return(D.dynCall_jiji=D.asm.Fa).apply(null,arguments)};D.dynCall_iiiiiijj=function(){return(D.dynCall_iiiiiijj=D.asm.Ga).apply(null,arguments)};D.dynCall_iiiiij=function(){return(D.dynCall_iiiiij=D.asm.Ha).apply(null,arguments)};D.dynCall_iiiiijj=function(){return(D.dynCall_iiiiijj=D.asm.Ia).apply(null,arguments)};var cb=D._main_thread_futex=4639544;D.PThread=Q;D.PThread=Q;D._pthread_self=pc;
D.wasmMemory=m;D.ExitStatus=Hc;var Ic;function Hc(a){this.name="ExitStatus";this.message="Program terminated with exit("+a+")";this.status=a}Pa=function Jc(){Ic||Kc();Ic||(Pa=Jc)};
function Kc(){function a(){if(!Ic&&(Ic=!0,D.calledRun=!0,!va)){Va(Ka);G||Va(La);na(D);if(D.onRuntimeInitialized)D.onRuntimeInitialized();if(!G){if(D.postRun)for("function"==typeof D.postRun&&(D.postRun=[D.postRun]);D.postRun.length;){var b=D.postRun.shift();Ma.unshift(b)}Va(Ma)}}}if(!(0<N)){if(!G){if(D.preRun)for("function"==typeof D.preRun&&(D.preRun=[D.preRun]);D.preRun.length;)Na();Va(Ja)}0<N||(D.setStatus?(D.setStatus("Running..."),setTimeout(function(){setTimeout(function(){D.setStatus("")},
1);a()},1)):a())}}D.run=Kc;if(D.preInit)for("function"==typeof D.preInit&&(D.preInit=[D.preInit]);0<D.preInit.length;)D.preInit.pop()();G||(noExitRuntime=!0);G?Q.Lb():Kc();
return jxl_enc_mt.ready
}
);
})();
export default jxl_enc_mt;

BIN
codecs/jxl/enc/jxl_enc_mt.wasm Executable file

Binary file not shown.

1
codecs/jxl/enc/jxl_enc_mt.worker.js generated Normal file
View File

@@ -0,0 +1 @@
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(jxl_enc_mt){return jxl_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}};

1
codecs/jxl/enc/jxl_enc_mt_simd.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
export { default } from './jxl_enc';

112
codecs/jxl/enc/jxl_enc_mt_simd.js generated Normal file
View File

@@ -0,0 +1,112 @@
var jxl_enc_mt_simd = (function() {
var _scriptDir = import.meta.url;
return (
function(jxl_enc_mt_simd) {
jxl_enc_mt_simd = jxl_enc_mt_simd || {};
function e(){m.buffer!=n&&u(m.buffer);return aa}function v(){m.buffer!=n&&u(m.buffer);return ba}function x(){m.buffer!=n&&u(m.buffer);return ca}function ea(){m.buffer!=n&&u(m.buffer);return fa}function A(){m.buffer!=n&&u(m.buffer);return ha}function C(){m.buffer!=n&&u(m.buffer);return ia}function ja(){m.buffer!=n&&u(m.buffer);return ka}function la(){m.buffer!=n&&u(m.buffer);return ma}var D;D||(D=typeof jxl_enc_mt_simd !== 'undefined' ? jxl_enc_mt_simd : {});var na,oa;
D.ready=new Promise(function(a,b){na=a;oa=b});var E={},F;for(F in D)D.hasOwnProperty(F)&&(E[F]=D[F]);var pa="./this.program",G=D.ENVIRONMENT_IS_PTHREAD||!1;G&&(n=D.buffer);var H="";function qa(a){return D.locateFile?D.locateFile(a,H):H+a}var ra;H=self.location.href;_scriptDir&&(H=_scriptDir);0!==H.indexOf("blob:")?H=H.substr(0,H.lastIndexOf("/")+1):H="";ra=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)};
var sa=D.print||console.log.bind(console),J=D.printErr||console.warn.bind(console);for(F in E)E.hasOwnProperty(F)&&(D[F]=E[F]);E=null;D.thisProgram&&(pa=D.thisProgram);var ta;D.wasmBinary&&(ta=D.wasmBinary);var noExitRuntime;D.noExitRuntime&&(noExitRuntime=D.noExitRuntime);"object"!==typeof WebAssembly&&K("no native wasm support detected");var m,ua,threadInfoStruct=0,selfThreadId=0,va=!1;function wa(a,b){a||K("Assertion failed: "+b)}
function xa(a,b,c){c=b+c;for(var d="";!(b>=c);){var f=a[b++];if(!f)break;if(f&128){var g=a[b++]&63;if(192==(f&224))d+=String.fromCharCode((f&31)<<6|g);else{var l=a[b++]&63;f=224==(f&240)?(f&15)<<12|g<<6|l:(f&7)<<18|g<<12|l<<6|a[b++]&63;65536>f?d+=String.fromCharCode(f):(f-=65536,d+=String.fromCharCode(55296|f>>10,56320|f&1023))}}else d+=String.fromCharCode(f)}return d}function L(a,b){return a?xa(v(),a,b):""}
function ya(a,b,c,d){if(0<d){d=c+d-1;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var l=a.charCodeAt(++f);g=65536+((g&1023)<<10)|l&1023}if(127>=g){if(c>=d)break;b[c++]=g}else{if(2047>=g){if(c+1>=d)break;b[c++]=192|g>>6}else{if(65535>=g){if(c+2>=d)break;b[c++]=224|g>>12}else{if(c+3>=d)break;b[c++]=240|g>>18;b[c++]=128|g>>12&63}b[c++]=128|g>>6&63}b[c++]=128|g&63}}b[c]=0}}function za(a,b,c){ya(a,v(),b,c)}
function Aa(a){for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);55296<=d&&57343>=d&&(d=65536+((d&1023)<<10)|a.charCodeAt(++c)&1023);127>=d?++b:b=2047>=d?b+2:65535>=d?b+3:b+4}return b}function Ba(a,b){for(var c=0,d="";;){var f=x()[a+2*c>>1];if(0==f||c==b/2)return d;++c;d+=String.fromCharCode(f)}}function Ca(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var d=b;c=c<2*a.length?c/2:a.length;for(var f=0;f<c;++f){var g=a.charCodeAt(f);x()[b>>1]=g;b+=2}x()[b>>1]=0;return b-d}
function Da(a){return 2*a.length}function Ea(a,b){for(var c=0,d="";!(c>=b/4);){var f=A()[a+4*c>>2];if(0==f)break;++c;65536<=f?(f-=65536,d+=String.fromCharCode(55296|f>>10,56320|f&1023)):d+=String.fromCharCode(f)}return d}function Fa(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var d=b;c=d+c-4;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var l=a.charCodeAt(++f);g=65536+((g&1023)<<10)|l&1023}A()[b>>2]=g;b+=4;if(b+4>c)break}A()[b>>2]=0;return b-d}
function Ga(a){for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);55296<=d&&57343>=d&&++c;b+=4}return b}function Ha(a,b){e().set(a,b)}var n,aa,ba,ca,fa,ha,ia,ka,ma;function u(a){n=a;D.HEAP8=aa=new Int8Array(a);D.HEAP16=ca=new Int16Array(a);D.HEAP32=ha=new Int32Array(a);D.HEAPU8=ba=new Uint8Array(a);D.HEAPU16=fa=new Uint16Array(a);D.HEAPU32=ia=new Uint32Array(a);D.HEAPF32=ka=new Float32Array(a);D.HEAPF64=ma=new Float64Array(a)}var Ia=D.INITIAL_MEMORY||16777216;
if(G)m=D.wasmMemory,n=D.buffer;else if(D.wasmMemory)m=D.wasmMemory;else if(m=new WebAssembly.Memory({initial:Ia/65536,maximum:32768,shared:!0}),!(m.buffer instanceof SharedArrayBuffer))throw J("requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag"),Error("bad memory");m&&(n=m.buffer);Ia=n.byteLength;u(n);var M,Ja=[],Ka=[],La=[],Ma=[];
function Na(){var a=D.preRun.shift();Ja.unshift(a)}var N=0,Oa=null,Pa=null;D.preloadedImages={};D.preloadedAudios={};function K(a){if(D.onAbort)D.onAbort(a);G&&console.error("Pthread aborting at "+Error().stack);J(a);va=!0;a=new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");oa(a);throw a;}function Qa(){var a=O;return String.prototype.startsWith?a.startsWith("data:application/octet-stream;base64,"):0===a.indexOf("data:application/octet-stream;base64,")}var O="jxl_enc_mt_simd.wasm";
Qa()||(O=qa(O));function Ra(){try{if(ta)return new Uint8Array(ta);if(ra)return ra(O);throw"both async and sync fetching of the wasm failed";}catch(a){K(a)}}function Sa(){return ta||"function"!==typeof fetch?Promise.resolve().then(Ra):fetch(O,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+O+"'";return a.arrayBuffer()}).catch(function(){return Ra()})}var Ua={60933:function(a,b){setTimeout(function(){Ta(a,b)},0)},61011:function(){throw"Canceled!";}};
function Va(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(D);else{var c=b.Bb;"number"===typeof c?void 0===b.Va?M.get(c)():M.get(c)(b.Va):c(void 0===b.Va?null:b.Va)}}}function Wa(a,b,c){var d;-1!=a.indexOf("j")?d=c&&c.length?D["dynCall_"+a].apply(null,[b].concat(c)):D["dynCall_"+a].call(null,b):d=M.get(b).apply(null,c);return d}D.dynCall=Wa;var P=0,Xa=0,Ya=0;function Za(a,b,c){P=a|0;Ya=b|0;Xa=c|0}D.registerPthreadPtr=Za;
function $a(a,b){if(0>=a||a>e().length||a&1||0>b)return-28;if(0==b)return 0;2147483647<=b&&(b=Infinity);var c=Atomics.load(A(),Q.rb>>2),d=0;if(c==a&&Atomics.compareExchange(A(),Q.rb>>2,c,0)==c&&(--b,d=1,0>=b))return 1;a=Atomics.notify(A(),a>>2,b);if(0<=a)return a+d;throw"Atomics.notify returned an unexpected value "+a;}D._emscripten_futex_wake=$a;
function ab(a){if(G)throw"Internal Error! cleanupThread() can only ever be called from main application thread!";if(!a)throw"Internal Error! Null pthread_ptr in cleanupThread!";A()[a+12>>2]=0;(a=Q.Oa[a])&&Q.bb(a.worker)}
var Q={ic:1,pc:{ub:0,vb:0},Ma:[],Qa:[],Jb:function(){for(var a=navigator.hardwareConcurrency,b=0;b<a;++b)Q.lb()},Kb:function(){Q.Ka=R(232);for(var a=0;58>a;++a)C()[Q.Ka/4+a]=0;A()[Q.Ka+12>>2]=Q.Ka;a=Q.Ka+156;A()[a>>2]=a;var b=R(512);for(a=0;128>a;++a)C()[b/4+a]=0;Atomics.store(C(),Q.Ka+104>>2,b);Atomics.store(C(),Q.Ka+40>>2,Q.Ka);Atomics.store(C(),Q.Ka+44>>2,42);Q.pb();Za(Q.Ka,!1,1);bb(Q.Ka)},Lb:function(){Q.pb();na(D);Q.receiveObjectTransfer=Q.Qb;Q.setThreadStatus=Q.Rb;Q.threadCancel=Q.ac;Q.threadExit=
Q.bc},pb:function(){Q.rb=cb},Oa:{},kb:[],Rb:function(){},tb:function(){for(;0<Q.kb.length;)Q.kb.pop()();G&&threadInfoStruct&&db()},bc:function(a){var b=P|0;b&&(Atomics.store(C(),b+4>>2,a),Atomics.store(C(),b+0>>2,1),Atomics.store(C(),b+60>>2,1),Atomics.store(C(),b+64>>2,0),Q.tb(),$a(b+0,2147483647),Za(0,0,0),threadInfoStruct=0,G&&postMessage({cmd:"exit"}))},ac:function(){Q.tb();Atomics.store(C(),threadInfoStruct+4>>2,-1);Atomics.store(C(),threadInfoStruct+0>>2,1);$a(threadInfoStruct+0,2147483647);
threadInfoStruct=selfThreadId=0;Za(0,0,0);postMessage({cmd:"cancelDone"})},wc:function(){for(var a in Q.Oa){var b=Q.Oa[a];b&&b.worker&&Q.bb(b.worker)}Q.Oa={};for(a=0;a<Q.Ma.length;++a){var c=Q.Ma[a];c.terminate()}Q.Ma=[];for(a=0;a<Q.Qa.length;++a)c=Q.Qa[a],b=c.La,Q.ib(b),c.terminate();Q.Qa=[]},ib:function(a){if(a){if(a.threadInfoStruct){var b=A()[a.threadInfoStruct+104>>2];A()[a.threadInfoStruct+104>>2]=0;S(b);S(a.threadInfoStruct)}a.threadInfoStruct=0;a.gb&&a.Ra&&S(a.Ra);a.Ra=0;a.worker&&(a.worker.La=
null)}},bb:function(a){delete Q.Oa[a.La.wb];Q.Ma.push(a);Q.Qa.splice(Q.Qa.indexOf(a),1);Q.ib(a.La);a.La=void 0},Qb:function(){},qb:function(a,b){a.onmessage=function(c){var d=c.data,f=d.cmd;a.La&&(Q.hb=a.La.threadInfoStruct);if(d.targetThread&&d.targetThread!=(P|0)){var g=Q.Oa[d.vc];g?g.worker.postMessage(c.data,d.transferList):console.error('Internal error! Worker sent a message "'+f+'" to target pthread '+d.targetThread+", but that thread no longer exists!")}else if("processQueuedMainThreadWork"===
f)eb();else if("spawnThread"===f)fb(c.data);else if("cleanupThread"===f)ab(d.thread);else if("killThread"===f){c=d.thread;if(G)throw"Internal Error! killThread() can only ever be called from main application thread!";if(!c)throw"Internal Error! Null pthread_ptr in killThread!";A()[c+12>>2]=0;c=Q.Oa[c];c.worker.terminate();Q.ib(c);Q.Qa.splice(Q.Qa.indexOf(c.worker),1);c.worker.La=void 0}else if("cancelThread"===f){c=d.thread;if(G)throw"Internal Error! cancelThread() can only ever be called from main application thread!";
if(!c)throw"Internal Error! Null pthread_ptr in cancelThread!";Q.Oa[c].worker.postMessage({cmd:"cancel"})}else"loaded"===f?(a.loaded=!0,b&&b(a),a.Xa&&(a.Xa(),delete a.Xa)):"print"===f?sa("Thread "+d.threadId+": "+d.text):"printErr"===f?J("Thread "+d.threadId+": "+d.text):"alert"===f?alert("Thread "+d.threadId+": "+d.text):"exit"===f?a.La&&Atomics.load(C(),a.La.wb+68>>2)&&Q.bb(a):"cancelDone"===f?Q.bb(a):"objectTransfer"!==f&&("setimmediate"===c.data.target?a.postMessage(c.data):J("worker sent an unknown command "+
f));Q.hb=void 0};a.onerror=function(c){J("pthread sent an error! "+c.filename+":"+c.lineno+": "+c.message)};a.postMessage({cmd:"load",urlOrBlob:D.mainScriptUrlOrBlob||_scriptDir,wasmMemory:m,wasmModule:ua})},lb:function(){var a=qa("jxl_enc_mt_simd.worker.js");Q.Ma.push(new Worker(a))},Cb:function(){0==Q.Ma.length&&(Q.lb(),Q.qb(Q.Ma[0]));return 0<Q.Ma.length?Q.Ma.pop():null},jc:function(a){for(a=performance.now()+a;performance.now()<a;);}};D.establishStackSpace=function(a){gb(a)};
D.getNoExitRuntime=function(){return noExitRuntime};var hb;hb=G?function(){return performance.now()-D.__performance_now_clock_drift}:function(){return performance.now()};function ib(a,b){Q.kb.push(function(){M.get(a)(b)})}
function jb(a){this.Wa=a-16;this.Wb=function(b){A()[this.Wa+8>>2]=b};this.Tb=function(b){A()[this.Wa+0>>2]=b};this.Ub=function(){A()[this.Wa+4>>2]=0};this.Sb=function(){var b=0;e()[this.Wa+12>>0]=b};this.Vb=function(){var b=0;e()[this.Wa+13>>0]=b};this.Hb=function(b,c){this.Wb(b);this.Tb(c);this.Ub();this.Sb();this.Vb()}}function kb(){return 0<kb.xb}var lb={};function mb(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function nb(a){return this.fromWireType(C()[a>>2])}var T={},U={},ob={};
function pb(a){if(void 0===a)return"_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var b=a.charCodeAt(0);return 48<=b&&57>=b?"_"+a:a}function qb(a,b){a=pb(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}
function rb(a){var b=Error,c=qb(a,function(d){this.name=a;this.message=d;d=Error(d).stack;void 0!==d&&(this.stack=this.toString()+"\n"+d.replace(/^Error(:[^\n]*)?\n/,""))});c.prototype=Object.create(b.prototype);c.prototype.constructor=c;c.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message};return c}var sb=void 0;
function tb(a,b,c){function d(k){k=c(k);if(k.length!==a.length)throw new sb("Mismatched type converter count");for(var q=0;q<a.length;++q)V(a[q],k[q])}a.forEach(function(k){ob[k]=b});var f=Array(b.length),g=[],l=0;b.forEach(function(k,q){U.hasOwnProperty(k)?f[q]=U[k]:(g.push(k),T.hasOwnProperty(k)||(T[k]=[]),T[k].push(function(){f[q]=U[k];++l;l===g.length&&d(f)}))});0===g.length&&d(f)}
function ub(a){switch(a){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+a);}}var vb=void 0;function W(a){for(var b="";v()[a];)b+=vb[v()[a++]];return b}var wb=void 0;function X(a){throw new wb(a);}
function V(a,b,c){c=c||{};if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");var d=b.name;a||X('type "'+d+'" must have a positive integer typeid pointer');if(U.hasOwnProperty(a)){if(c.Gb)return;X("Cannot register type '"+d+"' twice")}U[a]=b;delete ob[a];T.hasOwnProperty(a)&&(b=T[a],delete T[a],b.forEach(function(f){f()}))}var xb=[],Y=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
function yb(a){4<a&&0===--Y[a].jb&&(Y[a]=void 0,xb.push(a))}function zb(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=xb.length?xb.pop():Y.length;Y[b]={jb:1,value:a};return b}}function Ab(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}
function Bb(a,b){switch(b){case 2:return function(c){return this.fromWireType(ja()[c>>2])};case 3:return function(c){return this.fromWireType(la()[c>>3])};default:throw new TypeError("Unknown float type: "+a);}}function Cb(a){var b=Function;if(!(b instanceof Function))throw new TypeError("new_ called with constructor type "+typeof b+" which is not a function");var c=qb(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c}
function Db(a,b){var c=D;if(void 0===c[a].Na){var d=c[a];c[a]=function(){c[a].Na.hasOwnProperty(arguments.length)||X("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+c[a].Na+")!");return c[a].Na[arguments.length].apply(this,arguments)};c[a].Na=[];c[a].Na[d.yb]=d}}
function Eb(a,b,c){D.hasOwnProperty(a)?((void 0===c||void 0!==D[a].Na&&void 0!==D[a].Na[c])&&X("Cannot register public name '"+a+"' twice"),Db(a,a),D.hasOwnProperty(c)&&X("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),D[a].Na[c]=b):(D[a]=b,void 0!==c&&(D[a].sc=c))}function Fb(a,b){for(var c=[],d=0;d<a;d++)c.push(A()[(b>>2)+d]);return c}
function Gb(a,b){wa(0<=a.indexOf("j"),"getDynCaller should only be called with i64 sigs");var c=[];return function(){c.length=arguments.length;for(var d=0;d<arguments.length;d++)c[d]=arguments[d];return Wa(a,b,c)}}function Hb(a,b){a=W(a);var c=-1!=a.indexOf("j")?Gb(a,b):M.get(b);"function"!==typeof c&&X("unknown function pointer with signature "+a+": "+b);return c}var Ib=void 0;function Jb(a){a=Kb(a);var b=W(a);S(a);return b}
function Lb(a,b){function c(g){f[g]||U[g]||(ob[g]?ob[g].forEach(c):(d.push(g),f[g]=!0))}var d=[],f={};b.forEach(c);throw new Ib(a+": "+d.map(Jb).join([", "]));}function Mb(a,b,c){switch(b){case 0:return c?function(d){return e()[d]}:function(d){return v()[d]};case 1:return c?function(d){return x()[d>>1]}:function(d){return ea()[d>>1]};case 2:return c?function(d){return A()[d>>2]}:function(d){return C()[d>>2]};default:throw new TypeError("Unknown integer type: "+a);}}var Nb={};
function Ob(){return"object"===typeof globalThis?globalThis:Function("return this")()}function Pb(a,b){var c=U[a];void 0===c&&X(b+" has unknown type "+Jb(a));return c}var Qb={};function Rb(a,b,c){if(0>=a||a>e().length||a&1)return-28;a=Atomics.wait(A(),a>>2,b,c);if("timed-out"===a)return-73;if("not-equal"===a)return-6;if("ok"===a)return 0;throw"Atomics.wait returned an unexpected value "+a;}
function Z(a,b){for(var c=arguments.length-2,d=Sb(),f=Tb(8*c),g=f>>3,l=0;l<c;l++)la()[g+l]=arguments[2+l];c=Ub(a,c,f,b);gb(d);return c}var Vb=[],Wb=[],Xb=[0,"undefined"!==typeof document?document:0,"undefined"!==typeof window?window:0];function Yb(a){a=2<a?L(a):a;return Xb[a]||("undefined"!==typeof document?document.querySelector(a):void 0)}
function Zb(a,b,c){var d=Yb(a);if(!d)return-4;d.ab&&(A()[d.ab>>2]=b,A()[d.ab+4>>2]=c);if(d.sb||!d.lc)d.sb&&(d=d.sb),a=!1,d.$a&&d.$a.Za&&(a=d.$a.Za.getParameter(2978),a=0===a[0]&&0===a[1]&&a[2]===d.width&&a[3]===d.height),d.width=b,d.height=c,a&&d.$a.Za.viewport(0,0,b,c);else{if(d.ab){d=A()[d.ab+8>>2];a=a?L(a):"";var f=Sb(),g=Tb(12),l=0;if(a){l=Aa(a)+1;var k=R(l);za(a,k,l);l=k}A()[g>>2]=l;A()[g+4>>2]=b;A()[g+8>>2]=c;$b(0,d,657457152,0,l,g);gb(f);return 1}return-4}return 0}
function ac(a,b,c){return G?Z(2,1,a,b,c):Zb(a,b,c)}function bc(a){var b=a.getExtension("ANGLE_instanced_arrays");b&&(a.vertexAttribDivisor=function(c,d){b.vertexAttribDivisorANGLE(c,d)},a.drawArraysInstanced=function(c,d,f,g){b.drawArraysInstancedANGLE(c,d,f,g)},a.drawElementsInstanced=function(c,d,f,g,l){b.drawElementsInstancedANGLE(c,d,f,g,l)})}
function cc(a){var b=a.getExtension("OES_vertex_array_object");b&&(a.createVertexArray=function(){return b.createVertexArrayOES()},a.deleteVertexArray=function(c){b.deleteVertexArrayOES(c)},a.bindVertexArray=function(c){b.bindVertexArrayOES(c)},a.isVertexArray=function(c){return b.isVertexArrayOES(c)})}function dc(a){var b=a.getExtension("WEBGL_draw_buffers");b&&(a.drawBuffers=function(c,d){b.drawBuffersWEBGL(c,d)})}
function ec(a){a||(a=fc);if(!a.Ib){a.Ib=!0;var b=a.Za;bc(b);cc(b);dc(b);b.mc=b.getExtension("EXT_disjoint_timer_query");b.rc=b.getExtension("WEBGL_multi_draw");var c="OES_texture_float OES_texture_half_float OES_standard_derivatives OES_vertex_array_object WEBGL_compressed_texture_s3tc WEBGL_depth_texture OES_element_index_uint EXT_texture_filter_anisotropic EXT_frag_depth WEBGL_draw_buffers ANGLE_instanced_arrays OES_texture_float_linear OES_texture_half_float_linear EXT_blend_minmax EXT_shader_texture_lod EXT_texture_norm16 WEBGL_compressed_texture_pvrtc EXT_color_buffer_half_float WEBGL_color_buffer_float EXT_sRGB WEBGL_compressed_texture_etc1 EXT_disjoint_timer_query WEBGL_compressed_texture_etc WEBGL_compressed_texture_astc EXT_color_buffer_float WEBGL_compressed_texture_s3tc_srgb EXT_disjoint_timer_query_webgl2 WEBKIT_WEBGL_compressed_texture_pvrtc".split(" ");
(b.getSupportedExtensions()||[]).forEach(function(d){-1!=c.indexOf(d)&&b.getExtension(d)})}}var fc,gc=["default","low-power","high-performance"],hc={};function ic(){if(!jc){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"===typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:pa||"./this.program"},b;for(b in hc)a[b]=hc[b];var c=[];for(b in a)c.push(b+"="+a[b]);jc=c}return jc}var jc,kc=[null,[],[]];
function lc(a){return G?Z(3,1,a):0}function mc(a,b,c,d,f){if(G)return Z(4,1,a,b,c,d,f)}function nc(a,b,c,d){if(G)return Z(5,1,a,b,c,d);for(var f=0,g=0;g<c;g++){for(var l=A()[b+8*g>>2],k=A()[b+(8*g+4)>>2],q=0;q<k;q++){var t=v()[l+q],r=kc[a];0===t||10===t?((1===a?sa:J)(xa(r,0)),r.length=0):r.push(t)}f+=k}A()[d>>2]=f;return 0}
function fb(a){if(G)throw"Internal Error! spawnThread() can only ever be called from main application thread!";var b=Q.Cb();if(void 0!==b.La)throw"Internal error!";if(!a.Sa)throw"Internal error, no pthread ptr!";Q.Qa.push(b);for(var c=R(512),d=0;128>d;++d)A()[c+4*d>>2]=0;var f=a.Ra+a.Ta;d=Q.Oa[a.Sa]={worker:b,Ra:a.Ra,Ta:a.Ta,gb:a.gb,wb:a.Sa,threadInfoStruct:a.Sa};var g=d.threadInfoStruct>>2;Atomics.store(C(),g,0);Atomics.store(C(),g+1,0);Atomics.store(C(),g+2,0);Atomics.store(C(),g+17,a.mb);Atomics.store(C(),
g+26,c);Atomics.store(C(),g+12,0);Atomics.store(C(),g+10,d.threadInfoStruct);Atomics.store(C(),g+11,42);Atomics.store(C(),g+27,a.Ta);Atomics.store(C(),g+21,a.Ta);Atomics.store(C(),g+20,f);Atomics.store(C(),g+29,f);Atomics.store(C(),g+30,a.mb);Atomics.store(C(),g+32,a.ub);Atomics.store(C(),g+33,a.vb);c=oc()+40;Atomics.store(C(),g+44,c);b.La=d;var l={cmd:"run",start_routine:a.$b,arg:a.Va,threadInfoStruct:a.Sa,selfThreadId:a.Sa,parentThreadId:a.Nb,stackBase:a.Ra,stackSize:a.Ta};b.Xa=function(){l.time=
performance.now();b.postMessage(l,a.hc)};b.loaded&&(b.Xa(),delete b.Xa)}function pc(){return P|0}D._pthread_self=pc;
function qc(a,b){if(!a)return J("pthread_join attempted on a null thread pointer!"),71;if(G&&selfThreadId==a)return J("PThread "+a+" is attempting to join to itself!"),16;if(!G&&Q.Ka==a)return J("Main thread "+a+" is attempting to join to itself!"),16;if(A()[a+12>>2]!==a)return J("pthread_join attempted on thread "+a+", which does not point to a valid thread, or does not exist anymore!"),71;if(Atomics.load(C(),a+68>>2))return J("Attempted to join thread "+a+", which was already detached!"),28;for(;;){var c=
Atomics.load(C(),a+0>>2);if(1==c)return c=Atomics.load(C(),a+4>>2),b&&(A()[b>>2]=c),Atomics.store(C(),a+68>>2,1),G?postMessage({cmd:"cleanupThread",thread:a}):ab(a),0;if(G&&threadInfoStruct&&!Atomics.load(C(),threadInfoStruct+60>>2)&&2==Atomics.load(C(),threadInfoStruct+0>>2))throw"Canceled!";G||eb();Rb(a+0,c,G?100:1)}}function rc(a){return 0===a%4&&(0!==a%100||0===a%400)}function sc(a,b){for(var c=0,d=0;d<=b;c+=a[d++]);return c}
var tc=[31,29,31,30,31,30,31,31,30,31,30,31],uc=[31,28,31,30,31,30,31,31,30,31,30,31];function vc(a,b){for(a=new Date(a.getTime());0<b;){var c=a.getMonth(),d=(rc(a.getFullYear())?tc:uc)[c];if(b>d-a.getDate())b-=d-a.getDate()+1,a.setDate(1),11>c?a.setMonth(c+1):(a.setMonth(0),a.setFullYear(a.getFullYear()+1));else{a.setDate(a.getDate()+b);break}}return a}
function wc(a,b,c,d){function f(h,p,y){for(h="number"===typeof h?h.toString():h||"";h.length<p;)h=y[0]+h;return h}function g(h,p){return f(h,p,"0")}function l(h,p){function y(I){return 0>I?-1:0<I?1:0}var B;0===(B=y(h.getFullYear()-p.getFullYear()))&&0===(B=y(h.getMonth()-p.getMonth()))&&(B=y(h.getDate()-p.getDate()));return B}function k(h){switch(h.getDay()){case 0:return new Date(h.getFullYear()-1,11,29);case 1:return h;case 2:return new Date(h.getFullYear(),0,3);case 3:return new Date(h.getFullYear(),
0,2);case 4:return new Date(h.getFullYear(),0,1);case 5:return new Date(h.getFullYear()-1,11,31);case 6:return new Date(h.getFullYear()-1,11,30)}}function q(h){h=vc(new Date(h.Ja+1900,0,1),h.fb);var p=new Date(h.getFullYear()+1,0,4),y=k(new Date(h.getFullYear(),0,4));p=k(p);return 0>=l(y,h)?0>=l(p,h)?h.getFullYear()+1:h.getFullYear():h.getFullYear()-1}var t=A()[d+40>>2];d={ec:A()[d>>2],dc:A()[d+4>>2],cb:A()[d+8>>2],Ya:A()[d+12>>2],Ua:A()[d+16>>2],Ja:A()[d+20>>2],eb:A()[d+24>>2],fb:A()[d+28>>2],xc:A()[d+
32>>2],cc:A()[d+36>>2],fc:t?L(t):""};c=L(c);t={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var r in t)c=c.replace(new RegExp(r,"g"),t[r]);var w="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),
z="January February March April May June July August September October November December".split(" ");t={"%a":function(h){return w[h.eb].substring(0,3)},"%A":function(h){return w[h.eb]},"%b":function(h){return z[h.Ua].substring(0,3)},"%B":function(h){return z[h.Ua]},"%C":function(h){return g((h.Ja+1900)/100|0,2)},"%d":function(h){return g(h.Ya,2)},"%e":function(h){return f(h.Ya,2," ")},"%g":function(h){return q(h).toString().substring(2)},"%G":function(h){return q(h)},"%H":function(h){return g(h.cb,
2)},"%I":function(h){h=h.cb;0==h?h=12:12<h&&(h-=12);return g(h,2)},"%j":function(h){return g(h.Ya+sc(rc(h.Ja+1900)?tc:uc,h.Ua-1),3)},"%m":function(h){return g(h.Ua+1,2)},"%M":function(h){return g(h.dc,2)},"%n":function(){return"\n"},"%p":function(h){return 0<=h.cb&&12>h.cb?"AM":"PM"},"%S":function(h){return g(h.ec,2)},"%t":function(){return"\t"},"%u":function(h){return h.eb||7},"%U":function(h){var p=new Date(h.Ja+1900,0,1),y=0===p.getDay()?p:vc(p,7-p.getDay());h=new Date(h.Ja+1900,h.Ua,h.Ya);return 0>
l(y,h)?g(Math.ceil((31-y.getDate()+(sc(rc(h.getFullYear())?tc:uc,h.getMonth()-1)-31)+h.getDate())/7),2):0===l(y,p)?"01":"00"},"%V":function(h){var p=new Date(h.Ja+1901,0,4),y=k(new Date(h.Ja+1900,0,4));p=k(p);var B=vc(new Date(h.Ja+1900,0,1),h.fb);return 0>l(B,y)?"53":0>=l(p,B)?"01":g(Math.ceil((y.getFullYear()<h.Ja+1900?h.fb+32-y.getDate():h.fb+1-y.getDate())/7),2)},"%w":function(h){return h.eb},"%W":function(h){var p=new Date(h.Ja,0,1),y=1===p.getDay()?p:vc(p,0===p.getDay()?1:7-p.getDay()+1);h=
new Date(h.Ja+1900,h.Ua,h.Ya);return 0>l(y,h)?g(Math.ceil((31-y.getDate()+(sc(rc(h.getFullYear())?tc:uc,h.getMonth()-1)-31)+h.getDate())/7),2):0===l(y,p)?"01":"00"},"%y":function(h){return(h.Ja+1900).toString().substring(2)},"%Y":function(h){return h.Ja+1900},"%z":function(h){h=h.cc;var p=0<=h;h=Math.abs(h)/60;return(p?"+":"-")+String("0000"+(h/60*100+h%60)).slice(-4)},"%Z":function(h){return h.fc},"%%":function(){return"%"}};for(r in t)0<=c.indexOf(r)&&(c=c.replace(new RegExp(r,"g"),t[r](d)));r=
xc(c);if(r.length>b)return 0;Ha(r,a);return r.length-1}
function yc(a){if(G)return Z(6,1,a);switch(a){case 30:return 16384;case 85:return 131072;case 132:case 133:case 12:case 137:case 138:case 15:case 235:case 16:case 17:case 18:case 19:case 20:case 149:case 13:case 10:case 236:case 153:case 9:case 21:case 22:case 159:case 154:case 14:case 77:case 78:case 139:case 80:case 81:case 82:case 68:case 67:case 164:case 11:case 29:case 47:case 48:case 95:case 52:case 51:case 46:case 79:return 200809;case 27:case 246:case 127:case 128:case 23:case 24:case 160:case 161:case 181:case 182:case 242:case 183:case 184:case 243:case 244:case 245:case 165:case 178:case 179:case 49:case 50:case 168:case 169:case 175:case 170:case 171:case 172:case 97:case 76:case 32:case 173:case 35:return-1;case 176:case 177:case 7:case 155:case 8:case 157:case 125:case 126:case 92:case 93:case 129:case 130:case 131:case 94:case 91:return 1;
case 74:case 60:case 69:case 70:case 4:return 1024;case 31:case 42:case 72:return 32;case 87:case 26:case 33:return 2147483647;case 34:case 1:return 47839;case 38:case 36:return 99;case 43:case 37:return 2048;case 0:return 2097152;case 3:return 65536;case 28:return 32768;case 44:return 32767;case 75:return 16384;case 39:return 1E3;case 89:return 700;case 71:return 256;case 40:return 255;case 2:return 100;case 180:return 64;case 25:return 20;case 5:return 16;case 6:return 6;case 73:return 4;case 84:return"object"===
typeof navigator?navigator.hardwareConcurrency||1:1}A()[zc()>>2]=28;return-1}G||Q.Jb();sb=D.InternalError=rb("InternalError");for(var Ac=Array(256),Bc=0;256>Bc;++Bc)Ac[Bc]=String.fromCharCode(Bc);vb=Ac;wb=D.BindingError=rb("BindingError");D.count_emval_handles=function(){for(var a=0,b=5;b<Y.length;++b)void 0!==Y[b]&&++a;return a};D.get_first_emval=function(){for(var a=5;a<Y.length;++a)if(void 0!==Y[a])return Y[a];return null};Ib=D.UnboundTypeError=rb("UnboundTypeError");
var Cc=[null,function(a,b){if(G)return Z(1,1,a,b)},ac,lc,mc,nc,yc];function xc(a){var b=Array(Aa(a)+1);ya(a,b,0,b.length);return b}G||Ka.push({Bb:function(){Dc()}});
var Gc={i:function(a,b,c,d){K("Assertion failed: "+L(a)+", at: "+[b?L(b):"unknown filename",c,d?L(d):"unknown function"])},K:function(a){return R(a+16)+16},X:function(a,b){return ib(a,b)},I:function(a,b,c){(new jb(a)).Hb(b,c);"uncaught_exception"in kb?kb.xb++:kb.xb=1;throw a;},w:function(a){var b=lb[a];delete lb[a];var c=b.Ob,d=b.Pb,f=b.ob,g=f.map(function(l){return l.Fb}).concat(f.map(function(l){return l.Yb}));tb([a],g,function(l){var k={};f.forEach(function(q,t){var r=l[t],w=q.Db,z=q.Eb,h=l[t+
f.length],p=q.Xb,y=q.Zb;k[q.Ab]={read:function(B){return r.fromWireType(w(z,B))},write:function(B,I){var da=[];p(y,B,h.toWireType(da,I));mb(da)}}});return[{name:b.name,fromWireType:function(q){var t={},r;for(r in k)t[r]=k[r].read(q);d(q);return t},toWireType:function(q,t){for(var r in k)if(!(r in t))throw new TypeError('Missing field: "'+r+'"');var w=c();for(r in k)k[r].write(w,t[r]);null!==q&&q.push(d,w);return w},argPackAdvance:8,readValueFromPointer:nb,Pa:d}]})},S:function(a,b,c,d,f){var g=ub(c);
b=W(b);V(a,{name:b,fromWireType:function(l){return!!l},toWireType:function(l,k){return k?d:f},argPackAdvance:8,readValueFromPointer:function(l){if(1===c)var k=e();else if(2===c)k=x();else if(4===c)k=A();else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(k[l>>g])},Pa:null})},R:function(a,b){b=W(b);V(a,{name:b,fromWireType:function(c){var d=Y[c].value;yb(c);return d},toWireType:function(c,d){return zb(d)},argPackAdvance:8,readValueFromPointer:nb,Pa:null})},t:function(a,
b,c){c=ub(c);b=W(b);V(a,{name:b,fromWireType:function(d){return d},toWireType:function(d,f){if("number"!==typeof f&&"boolean"!==typeof f)throw new TypeError('Cannot convert "'+Ab(f)+'" to '+this.name);return f},argPackAdvance:8,readValueFromPointer:Bb(b,c),Pa:null})},v:function(a,b,c,d,f,g){var l=Fb(b,c);a=W(a);f=Hb(d,f);Eb(a,function(){Lb("Cannot call "+a+" due to unbound types",l)},b-1);tb([],l,function(k){var q=a,t=a;k=[k[0],null].concat(k.slice(1));var r=f,w=k.length;2>w&&X("argTypes array size mismatch! Must at least get return value and 'this' types!");
for(var z=null!==k[1]&&!1,h=!1,p=1;p<k.length;++p)if(null!==k[p]&&void 0===k[p].Pa){h=!0;break}var y="void"!==k[0].name,B="",I="";for(p=0;p<w-2;++p)B+=(0!==p?", ":"")+"arg"+p,I+=(0!==p?", ":"")+"arg"+p+"Wired";t="return function "+pb(t)+"("+B+") {\nif (arguments.length !== "+(w-2)+") {\nthrowBindingError('function "+t+" called with ' + arguments.length + ' arguments, expected "+(w-2)+" args!');\n}\n";h&&(t+="var destructors = [];\n");var da=h?"destructors":"null";B="throwBindingError invoker fn runDestructors retType classParam".split(" ");
r=[X,r,g,mb,k[0],k[1]];z&&(t+="var thisWired = classParam.toWireType("+da+", this);\n");for(p=0;p<w-2;++p)t+="var arg"+p+"Wired = argType"+p+".toWireType("+da+", arg"+p+"); // "+k[p+2].name+"\n",B.push("argType"+p),r.push(k[p+2]);z&&(I="thisWired"+(0<I.length?", ":"")+I);t+=(y?"var rv = ":"")+"invoker(fn"+(0<I.length?", ":"")+I+");\n";if(h)t+="runDestructors(destructors);\n";else for(p=z?1:2;p<k.length;++p)w=1===p?"thisWired":"arg"+(p-2)+"Wired",null!==k[p].Pa&&(t+=w+"_dtor("+w+"); // "+k[p].name+
"\n",B.push(w+"_dtor"),r.push(k[p].Pa));y&&(t+="var ret = retType.fromWireType(rv);\nreturn ret;\n");B.push(t+"}\n");k=Cb(B).apply(null,r);p=b-1;if(!D.hasOwnProperty(q))throw new sb("Replacing nonexistant public symbol");void 0!==D[q].Na&&void 0!==p?D[q].Na[p]=k:(D[q]=k,D[q].yb=p);return[]})},j:function(a,b,c,d,f){function g(t){return t}b=W(b);-1===f&&(f=4294967295);var l=ub(c);if(0===d){var k=32-8*c;g=function(t){return t<<k>>>k}}var q=-1!=b.indexOf("unsigned");V(a,{name:b,fromWireType:g,toWireType:function(t,
r){if("number"!==typeof r&&"boolean"!==typeof r)throw new TypeError('Cannot convert "'+Ab(r)+'" to '+this.name);if(r<d||r>f)throw new TypeError('Passing a number "'+Ab(r)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+d+", "+f+"]!");return q?r>>>0:r|0},argPackAdvance:8,readValueFromPointer:Mb(b,l,0!==d),Pa:null})},h:function(a,b,c){function d(g){g>>=2;var l=C();return new f(n,l[g+1],l[g])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,
Uint32Array,Float32Array,Float64Array][b];c=W(c);V(a,{name:c,fromWireType:d,argPackAdvance:8,readValueFromPointer:d},{Gb:!0})},u:function(a,b){b=W(b);var c="std::string"===b;V(a,{name:b,fromWireType:function(d){var f=C()[d>>2];if(c)for(var g=d+4,l=0;l<=f;++l){var k=d+4+l;if(l==f||0==v()[k]){g=L(g,k-g);if(void 0===q)var q=g;else q+=String.fromCharCode(0),q+=g;g=k+1}}else{q=Array(f);for(l=0;l<f;++l)q[l]=String.fromCharCode(v()[d+4+l]);q=q.join("")}S(d);return q},toWireType:function(d,f){f instanceof
ArrayBuffer&&(f=new Uint8Array(f));var g="string"===typeof f;g||f instanceof Uint8Array||f instanceof Uint8ClampedArray||f instanceof Int8Array||X("Cannot pass non-string to std::string");var l=(c&&g?function(){return Aa(f)}:function(){return f.length})(),k=R(4+l+1);C()[k>>2]=l;if(c&&g)za(f,k+4,l+1);else if(g)for(g=0;g<l;++g){var q=f.charCodeAt(g);255<q&&(S(k),X("String has UTF-16 code units that do not fit in 8 bits"));v()[k+4+g]=q}else for(g=0;g<l;++g)v()[k+4+g]=f[g];null!==d&&d.push(S,k);return k},
argPackAdvance:8,readValueFromPointer:nb,Pa:function(d){S(d)}})},q:function(a,b,c){c=W(c);if(2===b){var d=Ba;var f=Ca;var g=Da;var l=function(){return ea()};var k=1}else 4===b&&(d=Ea,f=Fa,g=Ga,l=function(){return C()},k=2);V(a,{name:c,fromWireType:function(q){for(var t=C()[q>>2],r=l(),w,z=q+4,h=0;h<=t;++h){var p=q+4+h*b;if(h==t||0==r[p>>k])z=d(z,p-z),void 0===w?w=z:(w+=String.fromCharCode(0),w+=z),z=p+b}S(q);return w},toWireType:function(q,t){"string"!==typeof t&&X("Cannot pass non-string to C++ string type "+
c);var r=g(t),w=R(4+r+b);C()[w>>2]=r>>k;f(t,w+4,r+b);null!==q&&q.push(S,w);return w},argPackAdvance:8,readValueFromPointer:nb,Pa:function(q){S(q)}})},x:function(a,b,c,d,f,g){lb[a]={name:W(b),Ob:Hb(c,d),Pb:Hb(f,g),ob:[]}},l:function(a,b,c,d,f,g,l,k,q,t){lb[a].ob.push({Ab:W(b),Fb:c,Db:Hb(d,f),Eb:g,Yb:l,Xb:Hb(k,q),Zb:t})},T:function(a,b){b=W(b);V(a,{oc:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},H:function(a,b){if(a==b)postMessage({cmd:"processQueuedMainThreadWork"});
else if(G)postMessage({targetThread:a,cmd:"processThreadQueue"});else{a=(a=Q.Oa[a])&&a.worker;if(!a)return;a.postMessage({cmd:"processThreadQueue"})}return 1},m:yb,W:function(a){if(0===a)return zb(Ob());var b=Nb[a];a=void 0===b?W(a):b;return zb(Ob()[a])},V:function(a){4<a&&(Y[a].jb+=1)},y:function(a,b,c,d){a||X("Cannot use deleted val. handle = "+a);a=Y[a].value;var f=Qb[b];if(!f){f="";for(var g=0;g<b;++g)f+=(0!==g?", ":"")+"arg"+g;var l="return function emval_allocator_"+b+"(constructor, argTypes, args) {\n";
for(g=0;g<b;++g)l+="var argType"+g+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+g+'], "parameter '+g+'");\nvar arg'+g+" = argType"+g+".readValueFromPointer(args);\nargs += argType"+g+"['argPackAdvance'];\n";f=(new Function("requireRegisteredType","Module","__emval_register",l+("var obj = new constructor("+f+");\nreturn __emval_register(obj);\n}\n")))(Pb,D,zb);Qb[b]=f}return f(a,c,d)},b:function(){K()},n:function(a,b,c){Wb.length=0;var d;for(c>>=2;d=v()[b++];)(d=105>d)&&c&1&&c++,
Wb.push(d?la()[c++>>1]:A()[c]),++c;return Ua[a].apply(null,Wb)},J:function(){},r:function(){},f:Rb,g:$a,d:hb,p:function(){return Ya|0},o:function(){return Xa|0},C:function(a,b,c){v().copyWithin(a,b,b+c)},E:function(a,b,c){Vb.length=b;c>>=3;for(var d=0;d<b;d++)Vb[d]=la()[c+d];return(0>a?Ua[-a-1]:Cc[a]).apply(null,Vb)},k:function(a){a>>>=0;var b=v().length;if(a<=b||2147483648<a)return!1;for(var c=1;4>=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,a+100663296);d=Math.max(16777216,a,d);0<d%65536&&(d+=65536-d%
65536);a:{try{m.grow(Math.min(2147483648,d)-n.byteLength+65535>>>16);u(m.buffer);var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},F:function(a,b,c){return Yb(a)?Zb(a,b,c):ac(a,b,c)},e:function(){},G:function(a,b){var c={};b>>=2;c.alpha=!!A()[b];c.depth=!!A()[b+1];c.stencil=!!A()[b+2];c.antialias=!!A()[b+3];c.premultipliedAlpha=!!A()[b+4];c.preserveDrawingBuffer=!!A()[b+5];var d=A()[b+6];c.powerPreference=gc[d];c.failIfMajorPerformanceCaveat=!!A()[b+7];c.Mb=A()[b+8];c.qc=A()[b+9];c.nb=A()[b+
10];c.zb=A()[b+11];c.tc=A()[b+12];c.uc=A()[b+13];a=Yb(a);!a||c.zb?c=0:(a=a.getContext("webgl",c))?(b=R(8),A()[b+4>>2]=P|0,d={nc:b,attributes:c,version:c.Mb,Za:a},a.canvas&&(a.canvas.$a=d),("undefined"===typeof c.nb||c.nb)&&ec(d),c=b):c=0;return c},O:function(a,b){var c=0;ic().forEach(function(d,f){var g=b+c;f=A()[a+4*f>>2]=g;for(g=0;g<d.length;++g)e()[f++>>0]=d.charCodeAt(g);e()[f>>0]=0;c+=d.length+1});return 0},P:function(a,b){var c=ic();A()[a>>2]=c.length;var d=0;c.forEach(function(f){d+=f.length+
1});A()[b>>2]=d;return 0},Q:lc,z:mc,s:nc,B:function(){Q.Kb()},a:m||D.wasmMemory,D:ib,U:function(a,b,c,d){if("undefined"===typeof SharedArrayBuffer)return J("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;if(!a)return J("pthread_create called with a null thread pointer!"),28;var f=[];if(G&&0===f.length)return Ec(687865856,a,b,c,d);var g=0,l=0,k=0,q=0;if(b){var t=A()[b>>2];t+=81920;g=A()[b+8>>2];l=0!==A()[b+12>>2];if(0===A()[b+16>>2]){var r=A()[b+20>>2],w=A()[b+
24>>2];k=b+20;q=b+24;var z=Q.hb?Q.hb:P|0;if(k||q)if(z)if(A()[z+12>>2]!==z)J("pthread_getschedparam attempted on thread "+z+", which does not point to a valid thread, or does not exist anymore!");else{var h=Atomics.load(C(),z+108+20>>2);z=Atomics.load(C(),z+108+24>>2);k&&(A()[k>>2]=h);q&&(A()[q>>2]=z)}else J("pthread_getschedparam called with a null thread pointer!");k=A()[b+20>>2];q=A()[b+24>>2];A()[b+20>>2]=r;A()[b+24>>2]=w}else k=A()[b+20>>2],q=A()[b+24>>2]}else t=2097152;(b=0==g)?g=Fc(16,t):(g-=
t,wa(0<g));r=R(232);for(w=0;58>w;++w)C()[(r>>2)+w]=0;A()[a>>2]=r;A()[r+12>>2]=r;a=r+156;A()[a>>2]=a;c={Ra:g,Ta:t,gb:b,ub:k,vb:q,mb:l,$b:c,Sa:r,Nb:P|0,Va:d,hc:f};G?(c.kc="spawnThread",postMessage(c,f)):fb(c);return 0},L:function(a,b){return qc(a,b)},c:pc,A:function(){},N:function(a,b,c,d){return wc(a,b,c,d)},M:yc};
(function(){function a(f,g){D.asm=f.exports;M=D.asm.Y;ua=g;if(!G){var l=Q.Ma.length;Q.Ma.forEach(function(k){Q.qb(k,function(){if(!--l&&(N--,D.monitorRunDependencies&&D.monitorRunDependencies(N),0==N&&(null!==Oa&&(clearInterval(Oa),Oa=null),Pa))){var q=Pa;Pa=null;q()}})})}}function b(f){a(f.instance,f.module)}function c(f){return Sa().then(function(g){return WebAssembly.instantiate(g,d)}).then(f,function(g){J("failed to asynchronously prepare wasm: "+g);K(g)})}var d={a:Gc};G||(wa(!G,"addRunDependency cannot be used in a pthread worker"),
N++,D.monitorRunDependencies&&D.monitorRunDependencies(N));if(D.instantiateWasm)try{return D.instantiateWasm(d,a)}catch(f){return J("Module.instantiateWasm callback failed with error: "+f),!1}(function(){return ta||"function"!==typeof WebAssembly.instantiateStreaming||Qa()||"function"!==typeof fetch?c(b):fetch(O,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,d).then(b,function(g){J("wasm streaming compile failed: "+g);J("falling back to ArrayBuffer instantiation");
return c(b)})})})().catch(oa);return{}})();var Dc=D.___wasm_call_ctors=function(){return(Dc=D.___wasm_call_ctors=D.asm.Z).apply(null,arguments)},R=D._malloc=function(){return(R=D._malloc=D.asm._).apply(null,arguments)},S=D._free=function(){return(S=D._free=D.asm.$).apply(null,arguments)},zc=D.___errno_location=function(){return(zc=D.___errno_location=D.asm.aa).apply(null,arguments)},Kb=D.___getTypeName=function(){return(Kb=D.___getTypeName=D.asm.ba).apply(null,arguments)};
D.___embind_register_native_and_builtin_types=function(){return(D.___embind_register_native_and_builtin_types=D.asm.ca).apply(null,arguments)};D.___em_js__initPthreadsJS=function(){return(D.___em_js__initPthreadsJS=D.asm.da).apply(null,arguments)};
var oc=D._emscripten_get_global_libc=function(){return(oc=D._emscripten_get_global_libc=D.asm.ea).apply(null,arguments)},Sb=D.stackSave=function(){return(Sb=D.stackSave=D.asm.fa).apply(null,arguments)},gb=D.stackRestore=function(){return(gb=D.stackRestore=D.asm.ga).apply(null,arguments)},Tb=D.stackAlloc=function(){return(Tb=D.stackAlloc=D.asm.ha).apply(null,arguments)},Fc=D._memalign=function(){return(Fc=D._memalign=D.asm.ia).apply(null,arguments)};
D._emscripten_main_browser_thread_id=function(){return(D._emscripten_main_browser_thread_id=D.asm.ja).apply(null,arguments)};var db=D.___pthread_tsd_run_dtors=function(){return(db=D.___pthread_tsd_run_dtors=D.asm.ka).apply(null,arguments)},eb=D._emscripten_main_thread_process_queued_calls=function(){return(eb=D._emscripten_main_thread_process_queued_calls=D.asm.la).apply(null,arguments)};
D._emscripten_current_thread_process_queued_calls=function(){return(D._emscripten_current_thread_process_queued_calls=D.asm.ma).apply(null,arguments)};var bb=D._emscripten_register_main_browser_thread_id=function(){return(bb=D._emscripten_register_main_browser_thread_id=D.asm.na).apply(null,arguments)},Ta=D._do_emscripten_dispatch_to_thread=function(){return(Ta=D._do_emscripten_dispatch_to_thread=D.asm.oa).apply(null,arguments)};
D._emscripten_async_run_in_main_thread=function(){return(D._emscripten_async_run_in_main_thread=D.asm.pa).apply(null,arguments)};D._emscripten_sync_run_in_main_thread=function(){return(D._emscripten_sync_run_in_main_thread=D.asm.qa).apply(null,arguments)};D._emscripten_sync_run_in_main_thread_0=function(){return(D._emscripten_sync_run_in_main_thread_0=D.asm.ra).apply(null,arguments)};
D._emscripten_sync_run_in_main_thread_1=function(){return(D._emscripten_sync_run_in_main_thread_1=D.asm.sa).apply(null,arguments)};D._emscripten_sync_run_in_main_thread_2=function(){return(D._emscripten_sync_run_in_main_thread_2=D.asm.ta).apply(null,arguments)};D._emscripten_sync_run_in_main_thread_xprintf_varargs=function(){return(D._emscripten_sync_run_in_main_thread_xprintf_varargs=D.asm.ua).apply(null,arguments)};
D._emscripten_sync_run_in_main_thread_3=function(){return(D._emscripten_sync_run_in_main_thread_3=D.asm.va).apply(null,arguments)};var Ec=D._emscripten_sync_run_in_main_thread_4=function(){return(Ec=D._emscripten_sync_run_in_main_thread_4=D.asm.wa).apply(null,arguments)};D._emscripten_sync_run_in_main_thread_5=function(){return(D._emscripten_sync_run_in_main_thread_5=D.asm.xa).apply(null,arguments)};
D._emscripten_sync_run_in_main_thread_6=function(){return(D._emscripten_sync_run_in_main_thread_6=D.asm.ya).apply(null,arguments)};D._emscripten_sync_run_in_main_thread_7=function(){return(D._emscripten_sync_run_in_main_thread_7=D.asm.za).apply(null,arguments)};
var Ub=D._emscripten_run_in_main_runtime_thread_js=function(){return(Ub=D._emscripten_run_in_main_runtime_thread_js=D.asm.Aa).apply(null,arguments)},$b=D.__emscripten_call_on_thread=function(){return($b=D.__emscripten_call_on_thread=D.asm.Ba).apply(null,arguments)};D._emscripten_tls_init=function(){return(D._emscripten_tls_init=D.asm.Ca).apply(null,arguments)};D.dynCall_viijii=function(){return(D.dynCall_viijii=D.asm.Da).apply(null,arguments)};
D.dynCall_iiji=function(){return(D.dynCall_iiji=D.asm.Ea).apply(null,arguments)};D.dynCall_jiji=function(){return(D.dynCall_jiji=D.asm.Fa).apply(null,arguments)};D.dynCall_iiiiiijj=function(){return(D.dynCall_iiiiiijj=D.asm.Ga).apply(null,arguments)};D.dynCall_iiiiij=function(){return(D.dynCall_iiiiij=D.asm.Ha).apply(null,arguments)};D.dynCall_iiiiijj=function(){return(D.dynCall_iiiiijj=D.asm.Ia).apply(null,arguments)};var cb=D._main_thread_futex=4639672;D.PThread=Q;D.PThread=Q;D._pthread_self=pc;
D.wasmMemory=m;D.ExitStatus=Hc;var Ic;function Hc(a){this.name="ExitStatus";this.message="Program terminated with exit("+a+")";this.status=a}Pa=function Jc(){Ic||Kc();Ic||(Pa=Jc)};
function Kc(){function a(){if(!Ic&&(Ic=!0,D.calledRun=!0,!va)){Va(Ka);G||Va(La);na(D);if(D.onRuntimeInitialized)D.onRuntimeInitialized();if(!G){if(D.postRun)for("function"==typeof D.postRun&&(D.postRun=[D.postRun]);D.postRun.length;){var b=D.postRun.shift();Ma.unshift(b)}Va(Ma)}}}if(!(0<N)){if(!G){if(D.preRun)for("function"==typeof D.preRun&&(D.preRun=[D.preRun]);D.preRun.length;)Na();Va(Ja)}0<N||(D.setStatus?(D.setStatus("Running..."),setTimeout(function(){setTimeout(function(){D.setStatus("")},
1);a()},1)):a())}}D.run=Kc;if(D.preInit)for("function"==typeof D.preInit&&(D.preInit=[D.preInit]);0<D.preInit.length;)D.preInit.pop()();G||(noExitRuntime=!0);G?Q.Lb():Kc();
return jxl_enc_mt_simd.ready
}
);
})();
export default jxl_enc_mt_simd;

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