forked from external-repos/squoosh
Compare commits
107 Commits
cli-invoc-
...
web-codecs
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
128096afd9 | ||
|
|
58661078e2 | ||
|
|
cbfa503fcb | ||
|
|
96b6dc8e6e | ||
|
|
4033d1c965 | ||
|
|
f779e13bc8 | ||
|
|
2f00fe2b1b | ||
|
|
118885cd26 | ||
|
|
af80643809 | ||
|
|
1aba7b51ee | ||
|
|
b0a7b21b0b | ||
|
|
8dfe35aa77 | ||
|
|
1a891072c0 | ||
|
|
720cb98872 | ||
|
|
4e1dcb819c | ||
|
|
c36f4bebb8 | ||
|
|
c04bb54f0d | ||
|
|
4890c56abb | ||
|
|
392aced394 | ||
|
|
8bcaeb2f78 | ||
|
|
c417bd0a7a | ||
|
|
eb8204d69b | ||
|
|
25754b91b7 | ||
|
|
875c24525b | ||
|
|
50ed5febd3 | ||
|
|
10c5082499 | ||
|
|
f0fb891498 | ||
|
|
b9b6e57581 | ||
|
|
ff9dea465f | ||
|
|
912c1fac08 | ||
|
|
ad0d46de3e | ||
|
|
efc89efba5 | ||
|
|
8ed50d8f0c | ||
|
|
b50402e3b3 | ||
|
|
df65f1a112 | ||
|
|
58c09ff740 | ||
|
|
33c0c3b034 | ||
|
|
e900d33092 | ||
|
|
650c662ffa | ||
|
|
2bf0b904cd | ||
|
|
9d890a8fd6 | ||
|
|
914bff41c6 | ||
|
|
86c4271844 | ||
|
|
56beb6786a | ||
|
|
ef77da9e96 | ||
|
|
42cfbe11a1 | ||
|
|
0874a3ba52 | ||
|
|
7f6ee3204f | ||
|
|
37d778e4da | ||
|
|
8f24c9b5ce | ||
|
|
9d3401762e | ||
|
|
a783de618d | ||
|
|
659d2b8277 | ||
|
|
934ab9065a | ||
|
|
029c2ebb83 | ||
|
|
dc40f84a65 | ||
|
|
2c0dd363d4 | ||
|
|
e6916575b7 | ||
|
|
1c7486056d | ||
|
|
8e8b75684d | ||
|
|
92ade727aa | ||
|
|
6117c9dd26 | ||
|
|
a3be343959 | ||
|
|
39c6be41df | ||
|
|
5603f2d6e7 | ||
|
|
0d72f652c5 | ||
|
|
7ce0c8a4fc | ||
|
|
30528c2330 | ||
|
|
b4329c5bed | ||
|
|
5845e566da | ||
|
|
5d0c856fa0 | ||
|
|
ff25dd81f8 | ||
|
|
c7d156e8d7 | ||
|
|
02532b5a31 | ||
|
|
c5c95254f0 | ||
|
|
dfa7695a97 | ||
|
|
7095ed2f7a | ||
|
|
61a66c4ed4 | ||
|
|
c6188c8846 | ||
|
|
ae583f7581 | ||
|
|
22a948267c | ||
|
|
35f5ad6e2b | ||
|
|
34d3c13b5d | ||
|
|
dba8f097d3 | ||
|
|
36293d756b | ||
|
|
ad07584730 | ||
|
|
e260994600 | ||
|
|
f55e4cf9a8 | ||
|
|
a1ea6223ac | ||
|
|
e7e205c326 | ||
|
|
990a43b733 | ||
|
|
1a40c57876 | ||
|
|
e8afe408f1 | ||
|
|
9352569852 | ||
|
|
10d648c28d | ||
|
|
1e64e52298 | ||
|
|
733b470f1f | ||
|
|
e72dcd6c6e | ||
|
|
62b4d39128 | ||
|
|
d338e8a048 | ||
|
|
f2a947df9e | ||
|
|
3ec55b0a03 | ||
|
|
3338808f17 | ||
|
|
5bdba43b33 | ||
|
|
c63120d4ce | ||
|
|
405dd1cdfa | ||
|
|
b958d46086 |
@@ -3,9 +3,9 @@
|
||||
[Squoosh] is an image compression web app that allows you to dive into the advanced options provided
|
||||
by various image compressors.
|
||||
|
||||
# CLI
|
||||
# API & CLI
|
||||
|
||||
[Squoosh now has a CLI](https://github.com/GoogleChromeLabs/squoosh/tree/dev/cli) that allows you to compress many images at once.
|
||||
Squoosh now has [an API](https://github.com/GoogleChromeLabs/squoosh/tree/dev/libsquoosh) and [a CLI](https://github.com/GoogleChromeLabs/squoosh/tree/dev/cli) that allows you to compress many images at once.
|
||||
|
||||
# Privacy
|
||||
|
||||
@@ -30,7 +30,7 @@ npm run build
|
||||
You can run the development server with:
|
||||
|
||||
```sh
|
||||
npm start
|
||||
npm run dev
|
||||
```
|
||||
|
||||
[squoosh]: https://squoosh.app
|
||||
|
||||
@@ -33,6 +33,7 @@ Options:
|
||||
--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
|
||||
@@ -54,5 +55,5 @@ $ npx @squoosh/cli --wp2 auto test.png
|
||||
```
|
||||
|
||||
[squoosh]: https://squoosh.app
|
||||
[codecs.js]: https://github.com/GoogleChromeLabs/squoosh/blob/dev/cli/src/codecs.js
|
||||
[codecs.js]: https://github.com/GoogleChromeLabs/squoosh/blob/dev/libsquoosh/src/codecs.js
|
||||
[butteraugli]: https://github.com/google/butteraugli
|
||||
|
||||
2445
cli/package-lock.json
generated
2445
cli/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,32 +1,24 @@
|
||||
{
|
||||
"name": "@squoosh/cli",
|
||||
"version": "0.6.0",
|
||||
"version": "0.7.0",
|
||||
"description": "A CLI for Squoosh",
|
||||
"public": true,
|
||||
"type": "module",
|
||||
"bin": {
|
||||
"squoosh-cli": "build/index.js",
|
||||
"@squoosh/cli": "build/index.js"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "rollup -c"
|
||||
"squoosh-cli": "src/index.js",
|
||||
"@squoosh/cli": "src/index.js"
|
||||
},
|
||||
"files": [
|
||||
"/src/index.js"
|
||||
],
|
||||
"keywords": [],
|
||||
"author": "Google Chrome Developers <chromium-dev@google.com>",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"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"
|
||||
"@squoosh/lib": "^0.2.0",
|
||||
"commander": "^7.2.0",
|
||||
"json5": "^2.2.0",
|
||||
"kleur": "^4.1.4",
|
||||
"ora": "^5.4.0"
|
||||
}
|
||||
}
|
||||
|
||||
351
cli/src/index.js
Normal file → Executable file
351
cli/src/index.js
Normal file → Executable file
@@ -1,17 +1,13 @@
|
||||
import { program } from 'commander';
|
||||
#!/usr/bin/env node
|
||||
|
||||
import { program } from 'commander/esm.mjs';
|
||||
import JSON5 from 'json5';
|
||||
import { isMainThread } from 'worker_threads';
|
||||
import { cpus } from 'os';
|
||||
import { extname, join, basename } from 'path';
|
||||
import path 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';
|
||||
import { ImagePool, preprocessors, encoders } from '@squoosh/lib';
|
||||
|
||||
function clamp(v, min, max) {
|
||||
if (v < min) return min;
|
||||
@@ -26,114 +22,6 @@ function prettyPrintSize(size) {
|
||||
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 = {};
|
||||
@@ -163,13 +51,12 @@ function progressTracker(results) {
|
||||
};
|
||||
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,
|
||||
)}`;
|
||||
for (const result of results.values()) {
|
||||
out += `\n ${kleur.cyan(result.file)}: ${prettyPrintSize(result.size)}`;
|
||||
for (const { outputFile, size: outputSize, infoText } of result.outputs) {
|
||||
out += `\n ${kleur.dim('└')} ${kleur.cyan(
|
||||
outputFile.padEnd(5),
|
||||
)} → ${prettyPrintSize(outputSize)}`;
|
||||
const percent = ((outputSize / result.size) * 100).toPrecision(3);
|
||||
out += ` (${kleur[outputSize > result.size ? 'red' : 'green'](
|
||||
percent + '%',
|
||||
@@ -183,33 +70,38 @@ function progressTracker(results) {
|
||||
return tracker;
|
||||
}
|
||||
|
||||
async function checkInputFilesValid(files) {
|
||||
async function getInputFiles(paths) {
|
||||
const validFiles = [];
|
||||
|
||||
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;
|
||||
for (const inputPath of paths) {
|
||||
const files = (await fsp.lstat(inputPath)).isDirectory()
|
||||
? (await fsp.readdir(inputPath, {withFileTypes: true})).filter(dirent => dirent.isFile()).map(dirent => path.join(inputPath, dirent.name))
|
||||
: [inputPath];
|
||||
for (const file of files) {
|
||||
try {
|
||||
await fsp.stat(file);
|
||||
} catch (err) {
|
||||
if (err.code === 'ENOENT') {
|
||||
console.warn(
|
||||
`Warning: Input file does not exist: ${path.resolve(file)}`,
|
||||
);
|
||||
continue;
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
validFiles.push(file);
|
||||
validFiles.push(file);
|
||||
}
|
||||
}
|
||||
|
||||
return validFiles;
|
||||
}
|
||||
|
||||
async function processFiles(files) {
|
||||
files = await checkInputFilesValid(files);
|
||||
files = await getInputFiles(files);
|
||||
|
||||
const parallelism = cpus().length;
|
||||
const imagePool = new ImagePool();
|
||||
|
||||
const results = new Map();
|
||||
const progress = progressTracker(results);
|
||||
@@ -218,140 +110,123 @@ async function processFiles(files) {
|
||||
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 });
|
||||
await fsp.mkdir(program.opts().outputDir, { recursive: true });
|
||||
|
||||
let decoded = 0;
|
||||
let decodedFiles = await Promise.all(
|
||||
files.map(async (file) => {
|
||||
const result = await workerPool.dispatchJob({
|
||||
operation: 'decode',
|
||||
const image = imagePool.ingestImage(file);
|
||||
await image.decoded;
|
||||
results.set(image, {
|
||||
file,
|
||||
});
|
||||
results.set(file, {
|
||||
file: result.file,
|
||||
size: result.size,
|
||||
size: (await image.decoded).size,
|
||||
outputs: [],
|
||||
});
|
||||
progress.setProgress(++decoded, files.length);
|
||||
return result;
|
||||
return image;
|
||||
}),
|
||||
);
|
||||
|
||||
for (const [preprocessorName, value] of Object.entries(preprocessors)) {
|
||||
if (!program[preprocessorName]) {
|
||||
const preprocessOptions = {};
|
||||
|
||||
for (const preprocessorName of Object.keys(preprocessors)) {
|
||||
if (!program.opts()[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,
|
||||
});
|
||||
}),
|
||||
preprocessOptions[preprocessorName] = JSON5.parse(
|
||||
program.opts()[preprocessorName],
|
||||
);
|
||||
}
|
||||
|
||||
for (const image of decodedFiles) {
|
||||
image.preprocess(preprocessOptions);
|
||||
}
|
||||
|
||||
await Promise.all(decodedFiles.map((image) => image.decoded));
|
||||
|
||||
progress.progressOffset = decoded;
|
||||
progress.setStatus('Encoding ' + kleur.dim(`(${parallelism} threads)`));
|
||||
progress.setStatus(
|
||||
'Encoding ' + kleur.dim(`(${imagePool.workerPool.numWorkers} 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 image of decodedFiles) {
|
||||
const originalFile = results.get(image).file;
|
||||
|
||||
for (const [encName, value] of Object.entries(supportedFormats)) {
|
||||
if (!program[encName]) {
|
||||
const encodeOptions = {
|
||||
optimizerButteraugliTarget: Number(
|
||||
program.opts().optimizerButteraugliTarget,
|
||||
),
|
||||
maxOptimizerRounds: Number(program.opts().maxOptimizerRounds),
|
||||
};
|
||||
for (const encName of Object.keys(encoders)) {
|
||||
if (!program.opts()[encName]) {
|
||||
continue;
|
||||
}
|
||||
const encParam =
|
||||
typeof program[encName] === 'string' ? program[encName] : '{}';
|
||||
const encParam = program.opts()[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);
|
||||
encParam.toLowerCase() === 'auto' ? 'auto' : JSON5.parse(encParam);
|
||||
encodeOptions[encName] = encConfig;
|
||||
}
|
||||
jobsStarted++;
|
||||
const job = image.encode(encodeOptions).then(async () => {
|
||||
jobsFinished++;
|
||||
const outputPath = path.join(
|
||||
program.opts().outputDir,
|
||||
program.opts().suffix +
|
||||
path.basename(originalFile, path.extname(originalFile)),
|
||||
);
|
||||
for (const output of Object.values(image.encodedWith)) {
|
||||
const outputFile = `${outputPath}.${(await output).extension}`;
|
||||
await fsp.writeFile(outputFile, (await output).binary);
|
||||
results
|
||||
.get(image)
|
||||
.outputs.push(Object.assign(await output, { outputFile }));
|
||||
}
|
||||
progress.setProgress(jobsFinished, jobsStarted);
|
||||
});
|
||||
jobs.push(job);
|
||||
}
|
||||
|
||||
// update the progress to account for multi-format
|
||||
progress.setProgress(jobsFinished, jobsStarted);
|
||||
// Wait for all jobs to finish
|
||||
await workerPool.join();
|
||||
await Promise.all(jobs);
|
||||
await imagePool.close();
|
||||
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);
|
||||
program
|
||||
.name('squoosh-cli')
|
||||
.arguments('<files...>')
|
||||
.option('-d, --output-dir <dir>', 'Output directory', '.')
|
||||
.option('-s, --suffix <suffix>', 'Append suffix to output files', '')
|
||||
.option(
|
||||
'--max-optimizer-rounds <rounds>',
|
||||
'Maximum number of compressions to use for auto optimizations',
|
||||
'6',
|
||||
)
|
||||
.option(
|
||||
'--optimizer-butteraugli-target <butteraugli distance>',
|
||||
'Target Butteraugli distance for auto optimizer',
|
||||
'1.4',
|
||||
)
|
||||
.action(processFiles);
|
||||
|
||||
// Create a CLI option for each supported preprocessor
|
||||
for (const [key, value] of Object.entries(preprocessors)) {
|
||||
program.option(`--${key} [config]`, value.description);
|
||||
}
|
||||
// Create a CLI option for each supported encoder
|
||||
for (const [key, value] of Object.entries(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);
|
||||
// Create a CLI option for each supported preprocessor
|
||||
for (const [key, value] of Object.entries(preprocessors)) {
|
||||
program.option(`--${key} [config]`, value.description);
|
||||
}
|
||||
// Create a CLI option for each supported encoder
|
||||
for (const [key, value] of Object.entries(encoders)) {
|
||||
program.option(
|
||||
`--${key} [config]`,
|
||||
`Use ${value.name} to generate a .${value.extension} file with the given configuration`,
|
||||
);
|
||||
}
|
||||
|
||||
program.parse(process.argv);
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
CODEC_URL = https://github.com/AOMediaCodec/libavif/archive/31d7c6d1e32cf467ac24fb8c7a76c4902a4c00db.tar.gz
|
||||
# libavif and libaom versions are from
|
||||
# https://docs.google.com/document/d/1wEEA5rRU7wT54k41u3qyZIZHDCJArIMzLuzsrLAwaK8/edit
|
||||
CODEC_URL = https://github.com/AOMediaCodec/libavif/archive/1c39e772c2c0d687691dd4b589a12c323f5f767d.tar.gz
|
||||
CODEC_PACKAGE = node_modules/libavif.tar.gz
|
||||
|
||||
LIBAOM_URL = https://aomedia.googlesource.com/aom/+archive/v2.0.0.tar.gz
|
||||
LIBAOM_URL = https://aomedia.googlesource.com/aom/+archive/v3.1.0.tar.gz
|
||||
LIBAOM_PACKAGE = node_modules/libaom.tar.gz
|
||||
|
||||
export CODEC_DIR = node_modules/libavif
|
||||
@@ -25,7 +27,7 @@ HELPER_MAKEFLAGS := -f helper.Makefile
|
||||
|
||||
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): ENVIRONMENT=node
|
||||
$(OUT_NODE_ENC_JS) $(OUT_ENC_JS): $(OUT_ENC_CPP) $(CODEC_DIR)/CMakeLists.txt $(LIBAOM_DIR)/CMakeLists.txt
|
||||
$(MAKE) \
|
||||
$(HELPER_MAKEFLAGS) \
|
||||
|
||||
1322
codecs/avif/dec/avif_dec.js
generated
1322
codecs/avif/dec/avif_dec.js
generated
File diff suppressed because it is too large
Load Diff
BIN
codecs/avif/dec/avif_dec.wasm
Normal file → Executable file
BIN
codecs/avif/dec/avif_dec.wasm
Normal file → Executable file
Binary file not shown.
Binary file not shown.
@@ -9,10 +9,9 @@ struct AvifOptions {
|
||||
// [0 - 63]
|
||||
// 0 = lossless
|
||||
// 63 = worst quality
|
||||
int minQuantizer;
|
||||
int maxQuantizer;
|
||||
int minQuantizerAlpha;
|
||||
int maxQuantizerAlpha;
|
||||
int cqLevel;
|
||||
// As above, but -1 means 'use cqLevel'
|
||||
int cqAlphaLevel;
|
||||
// [0 - 6]
|
||||
// Creates 2^n tiles in that dimension
|
||||
int tileRowsLog2;
|
||||
@@ -26,6 +25,16 @@ struct AvifOptions {
|
||||
// 2 = 4:2:2
|
||||
// 3 = 4:4:4
|
||||
int subsample;
|
||||
// Extra chroma compression
|
||||
bool chromaDeltaQ;
|
||||
// 0-7
|
||||
int sharpness;
|
||||
// 0 = auto
|
||||
// 1 = PSNR
|
||||
// 2 = SSIM
|
||||
int tune;
|
||||
// 0-50
|
||||
int denoiseLevel;
|
||||
};
|
||||
|
||||
thread_local const val Uint8Array = val::global("Uint8Array");
|
||||
@@ -49,18 +58,19 @@ val encode(std::string buffer, int width, int height, AvifOptions options) {
|
||||
break;
|
||||
}
|
||||
|
||||
bool lossless = options.cqLevel == AVIF_QUANTIZER_LOSSLESS &&
|
||||
options.cqAlphaLevel <= AVIF_QUANTIZER_LOSSLESS &&
|
||||
format == AVIF_PIXEL_FORMAT_YUV444;
|
||||
|
||||
avifImage* image = avifImageCreate(width, height, depth, format);
|
||||
|
||||
if (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) {
|
||||
if (lossless) {
|
||||
image->matrixCoefficients = AVIF_MATRIX_COEFFICIENTS_IDENTITY;
|
||||
} else {
|
||||
image->matrixCoefficients = AVIF_MATRIX_COEFFICIENTS_BT709;
|
||||
image->matrixCoefficients = AVIF_MATRIX_COEFFICIENTS_BT601;
|
||||
}
|
||||
|
||||
uint8_t* rgba = (uint8_t*)buffer.c_str();
|
||||
uint8_t* rgba = reinterpret_cast<uint8_t*>(const_cast<char*>(buffer.data()));
|
||||
|
||||
avifRGBImage srcRGB;
|
||||
avifRGBImageSetDefaults(&srcRGB, image);
|
||||
@@ -69,14 +79,44 @@ val encode(std::string buffer, int width, int height, AvifOptions options) {
|
||||
avifImageRGBToYUV(image, &srcRGB);
|
||||
|
||||
avifEncoder* encoder = avifEncoderCreate();
|
||||
|
||||
if (lossless) {
|
||||
encoder->minQuantizer = AVIF_QUANTIZER_LOSSLESS;
|
||||
encoder->maxQuantizer = AVIF_QUANTIZER_LOSSLESS;
|
||||
encoder->minQuantizerAlpha = AVIF_QUANTIZER_LOSSLESS;
|
||||
encoder->maxQuantizerAlpha = AVIF_QUANTIZER_LOSSLESS;
|
||||
} else {
|
||||
encoder->minQuantizer = AVIF_QUANTIZER_BEST_QUALITY;
|
||||
encoder->maxQuantizer = AVIF_QUANTIZER_WORST_QUALITY;
|
||||
encoder->minQuantizerAlpha = AVIF_QUANTIZER_BEST_QUALITY;
|
||||
encoder->maxQuantizerAlpha = AVIF_QUANTIZER_WORST_QUALITY;
|
||||
avifEncoderSetCodecSpecificOption(encoder, "end-usage", "q");
|
||||
avifEncoderSetCodecSpecificOption(encoder, "cq-level", std::to_string(options.cqLevel).c_str());
|
||||
avifEncoderSetCodecSpecificOption(encoder, "sharpness",
|
||||
std::to_string(options.sharpness).c_str());
|
||||
|
||||
if (options.cqAlphaLevel != -1) {
|
||||
avifEncoderSetCodecSpecificOption(encoder, "alpha:cq-level",
|
||||
std::to_string(options.cqAlphaLevel).c_str());
|
||||
}
|
||||
|
||||
if (options.tune == 2 || (options.tune == 0 && options.cqLevel <= 32)) {
|
||||
avifEncoderSetCodecSpecificOption(encoder, "tune", "ssim");
|
||||
}
|
||||
|
||||
if (options.chromaDeltaQ) {
|
||||
avifEncoderSetCodecSpecificOption(encoder, "enable-chroma-deltaq", "1");
|
||||
}
|
||||
|
||||
avifEncoderSetCodecSpecificOption(encoder, "color:denoise-noise-level",
|
||||
std::to_string(options.denoiseLevel).c_str());
|
||||
}
|
||||
|
||||
encoder->maxThreads = emscripten_num_logical_cores();
|
||||
encoder->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) {
|
||||
@@ -91,13 +131,15 @@ val encode(std::string buffer, int width, int height, AvifOptions options) {
|
||||
|
||||
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("cqLevel", &AvifOptions::cqLevel)
|
||||
.field("cqAlphaLevel", &AvifOptions::cqAlphaLevel)
|
||||
.field("tileRowsLog2", &AvifOptions::tileRowsLog2)
|
||||
.field("tileColsLog2", &AvifOptions::tileColsLog2)
|
||||
.field("speed", &AvifOptions::speed)
|
||||
.field("chromaDeltaQ", &AvifOptions::chromaDeltaQ)
|
||||
.field("sharpness", &AvifOptions::sharpness)
|
||||
.field("tune", &AvifOptions::tune)
|
||||
.field("denoiseLevel", &AvifOptions::denoiseLevel)
|
||||
.field("subsample", &AvifOptions::subsample);
|
||||
|
||||
function("encode", &encode);
|
||||
|
||||
16
codecs/avif/enc/avif_enc.d.ts
vendored
16
codecs/avif/enc/avif_enc.d.ts
vendored
@@ -1,12 +1,20 @@
|
||||
export const enum AVIFTune {
|
||||
auto,
|
||||
psnr,
|
||||
ssim,
|
||||
}
|
||||
|
||||
export interface EncodeOptions {
|
||||
minQuantizer: number;
|
||||
maxQuantizer: number;
|
||||
minQuantizerAlpha: number;
|
||||
maxQuantizerAlpha: number;
|
||||
cqLevel: number;
|
||||
denoiseLevel: number;
|
||||
cqAlphaLevel: number;
|
||||
tileRowsLog2: number;
|
||||
tileColsLog2: number;
|
||||
speed: number;
|
||||
subsample: number;
|
||||
chromaDeltaQ: boolean;
|
||||
sharpness: number;
|
||||
tune: AVIFTune;
|
||||
}
|
||||
|
||||
export interface AVIFModule extends EmscriptenWasm.Module {
|
||||
|
||||
2498
codecs/avif/enc/avif_enc.js
generated
2498
codecs/avif/enc/avif_enc.js
generated
File diff suppressed because it is too large
Load Diff
BIN
codecs/avif/enc/avif_enc.wasm
Normal file → Executable file
BIN
codecs/avif/enc/avif_enc.wasm
Normal file → Executable file
Binary file not shown.
3357
codecs/avif/enc/avif_enc_mt.js
generated
3357
codecs/avif/enc/avif_enc_mt.js
generated
File diff suppressed because it is too large
Load Diff
BIN
codecs/avif/enc/avif_enc_mt.wasm
Normal file → Executable file
BIN
codecs/avif/enc/avif_enc_mt.wasm
Normal file → Executable file
Binary file not shown.
104
codecs/avif/enc/avif_enc_mt.worker.js
generated
104
codecs/avif/enc/avif_enc_mt.worker.js
generated
@@ -1,103 +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 (avif_enc_mt) {
|
||||
return avif_enc_mt.default(Module);
|
||||
})
|
||||
.then(function (instance) {
|
||||
Module = instance;
|
||||
postMessage({ cmd: 'loaded' });
|
||||
});
|
||||
} else if (e.data.cmd === 'objectTransfer') {
|
||||
Module['PThread'].receiveObjectTransfer(e.data);
|
||||
} else if (e.data.cmd === 'run') {
|
||||
Module['__performance_now_clock_drift'] = performance.now() - e.data.time;
|
||||
threadInfoStruct = e.data.threadInfoStruct;
|
||||
Module['registerPthreadPtr'](
|
||||
threadInfoStruct,
|
||||
/*isMainBrowserThread=*/ 0,
|
||||
/*isMainRuntimeThread=*/ 0,
|
||||
);
|
||||
selfThreadId = e.data.selfThreadId;
|
||||
parentThreadId = e.data.parentThreadId;
|
||||
var max = e.data.stackBase;
|
||||
var top = e.data.stackBase + e.data.stackSize;
|
||||
Module['establishStackSpace'](top, max);
|
||||
Module['_emscripten_tls_init']();
|
||||
Module['PThread'].receiveObjectTransfer(e.data);
|
||||
Module['PThread'].setThreadStatus(Module['_pthread_self'](), 1);
|
||||
if (!initializedJS) {
|
||||
Module['___embind_register_native_and_builtin_types']();
|
||||
initializedJS = true;
|
||||
}
|
||||
try {
|
||||
var result = Module['dynCall']('ii', e.data.start_routine, [
|
||||
e.data.arg,
|
||||
]);
|
||||
if (!Module['getNoExitRuntime']()) Module['PThread'].threadExit(result);
|
||||
} catch (ex) {
|
||||
if (ex === 'Canceled!') {
|
||||
Module['PThread'].threadCancel();
|
||||
} else if (ex != 'unwind') {
|
||||
Atomics.store(
|
||||
Module['HEAPU32'],
|
||||
(threadInfoStruct + 4) >> /*C_STRUCTS.pthread.threadExitCode*/ 2,
|
||||
ex instanceof Module['ExitStatus'] ? ex.status : -2,
|
||||
);
|
||||
/*A custom entry specific to Emscripten denoting that the thread crashed.*/ Atomics.store(
|
||||
Module['HEAPU32'],
|
||||
(threadInfoStruct + 0) >> /*C_STRUCTS.pthread.threadStatus*/ 2,
|
||||
1,
|
||||
);
|
||||
Module['_emscripten_futex_wake'](
|
||||
threadInfoStruct + 0,
|
||||
/*C_STRUCTS.pthread.threadStatus*/ 2147483647,
|
||||
);
|
||||
if (!(ex instanceof Module['ExitStatus'])) throw ex;
|
||||
}
|
||||
}
|
||||
} else if (e.data.cmd === 'cancel') {
|
||||
if (threadInfoStruct) {
|
||||
Module['PThread'].threadCancel();
|
||||
}
|
||||
} else if (e.data.target === 'setimmediate') {
|
||||
} else if (e.data.cmd === 'processThreadQueue') {
|
||||
if (threadInfoStruct) {
|
||||
Module['_emscripten_current_thread_process_queued_calls']();
|
||||
}
|
||||
} else {
|
||||
err('worker.js received unknown command ' + e.data.cmd);
|
||||
err(e.data);
|
||||
}
|
||||
} catch (ex) {
|
||||
err('worker.js onmessage() captured an uncaught exception: ' + ex);
|
||||
if (ex && ex.stack) err(ex.stack);
|
||||
throw ex;
|
||||
}
|
||||
};
|
||||
var threadInfoStruct=0;var selfThreadId=0;var parentThreadId=0;var initializedJS=false;var Module={};function threadPrintErr(){var text=Array.prototype.slice.call(arguments).join(" ");console.error(text)}function threadAlert(){var text=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:text,threadId:selfThreadId})}var err=threadPrintErr;this.alert=threadAlert;Module["instantiateWasm"]=function(info,receiveInstance){var instance=new WebAssembly.Instance(Module["wasmModule"],info);Module["wasmModule"]=null;receiveInstance(instance);return instance.exports};this.onmessage=function(e){try{if(e.data.cmd==="load"){Module["wasmModule"]=e.data.wasmModule;Module["wasmMemory"]=e.data.wasmMemory;Module["buffer"]=Module["wasmMemory"].buffer;Module["ENVIRONMENT_IS_PTHREAD"]=true;import(e.data.urlOrBlob).then(function(avif_enc_mt){return avif_enc_mt.default(Module)}).then(function(instance){Module=instance;postMessage({"cmd":"loaded"})})}else if(e.data.cmd==="objectTransfer"){Module["PThread"].receiveObjectTransfer(e.data)}else if(e.data.cmd==="run"){Module["__performance_now_clock_drift"]=performance.now()-e.data.time;threadInfoStruct=e.data.threadInfoStruct;Module["registerPthreadPtr"](threadInfoStruct,/*isMainBrowserThread=*/0,/*isMainRuntimeThread=*/0);selfThreadId=e.data.selfThreadId;parentThreadId=e.data.parentThreadId;var max=e.data.stackBase;var top=e.data.stackBase+e.data.stackSize;Module["establishStackSpace"](top,max);Module["_emscripten_tls_init"]();Module["PThread"].receiveObjectTransfer(e.data);Module["PThread"].setThreadStatus(Module["_pthread_self"](),1);if(!initializedJS){Module["___embind_register_native_and_builtin_types"]();initializedJS=true}try{var result=Module["dynCall"]("ii",e.data.start_routine,[e.data.arg]);if(!Module["getNoExitRuntime"]())Module["PThread"].threadExit(result)}catch(ex){if(ex==="Canceled!"){Module["PThread"].threadCancel()}else if(ex!="unwind"){Atomics.store(Module["HEAPU32"],(threadInfoStruct+4)>>/*C_STRUCTS.pthread.threadExitCode*/2,(ex instanceof Module["ExitStatus"])?ex.status:-2);/*A custom entry specific to Emscripten denoting that the thread crashed.*/Atomics.store(Module["HEAPU32"],(threadInfoStruct+0)>>/*C_STRUCTS.pthread.threadStatus*/2,1);Module["_emscripten_futex_wake"](threadInfoStruct+0,/*C_STRUCTS.pthread.threadStatus*/2147483647);if(!(ex instanceof Module["ExitStatus"]))throw ex}}}else if(e.data.cmd==="cancel"){if(threadInfoStruct){Module["PThread"].threadCancel()}}else if(e.data.target==="setimmediate"){}else if(e.data.cmd==="processThreadQueue"){if(threadInfoStruct){Module["_emscripten_current_thread_process_queued_calls"]()}}else{err("worker.js received unknown command "+e.data.cmd);err(e.data)}}catch(ex){err("worker.js onmessage() captured an uncaught exception: "+ex);if(ex&&ex.stack)err(ex.stack);throw ex}};
|
||||
|
||||
126
codecs/avif/enc/avif_node_enc.js
generated
126
codecs/avif/enc/avif_node_enc.js
generated
@@ -7,86 +7,52 @@ function(avif_node_enc) {
|
||||
avif_node_enc = avif_node_enc || {};
|
||||
|
||||
|
||||
var g;g||(g=typeof avif_node_enc !== 'undefined' ? avif_node_enc : {});var aa,ba;g.ready=new Promise(function(a,b){aa=a;ba=b});var ca={},m;for(m in g)g.hasOwnProperty(m)&&(ca[m]=g[m]);var da="",ea,fa,ha,ia;da=__dirname+"/";ea=function(a){ha||(ha=require("fs"));ia||(ia=require("path"));a=ia.normalize(a);return ha.readFileSync(a,null)};fa=function(a){a=ea(a);a.buffer||(a=new Uint8Array(a));assert(a.buffer);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",r);g.inspect=function(){return"[Emscripten Module object]"};var ja=g.print||console.log.bind(console),v=g.printErr||console.warn.bind(console);for(m in ca)ca.hasOwnProperty(m)&&(g[m]=ca[m]);ca=null;var ka=0,ma;g.wasmBinary&&(ma=g.wasmBinary);var noExitRuntime;g.noExitRuntime&&(noExitRuntime=g.noExitRuntime);"object"!==typeof WebAssembly&&r("no native wasm support detected");var x,na=!1;
|
||||
function assert(a,b){a||r("Assertion failed: "+b)}var oa=new TextDecoder("utf8");function pa(a){for(var b=0;a[b]&&!(NaN<=b);)++b;return oa.decode(a.subarray?a.subarray(0,b):new Uint8Array(a.slice(0,b)))}function qa(a,b){if(!a)return"";b=a+b;for(var c=a;!(c>=b)&&z[c];)++c;return oa.decode(z.subarray(a,c))}
|
||||
function ra(a,b,c,d){if(!(0<d))return 0;var e=c;d=c+d-1;for(var f=0;f<a.length;++f){var h=a.charCodeAt(f);if(55296<=h&&57343>=h){var k=a.charCodeAt(++f);h=65536+((h&1023)<<10)|k&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;return c-e}
|
||||
function sa(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 ta=new TextDecoder("utf-16le");function ua(a,b){var c=a>>1;for(b=c+b/2;!(c>=b)&&va[c];)++c;return ta.decode(z.subarray(a,c<<1))}function wa(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 e=0;e<c;++e)A[b>>1]=a.charCodeAt(e),b+=2;A[b>>1]=0;return b-d}
|
||||
function xa(a){return 2*a.length}function ya(a,b){for(var c=0,d="";!(c>=b/4);){var e=B[a+4*c>>2];if(0==e)break;++c;65536<=e?(e-=65536,d+=String.fromCharCode(55296|e>>10,56320|e&1023)):d+=String.fromCharCode(e)}return d}function za(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var d=b;c=d+c-4;for(var e=0;e<a.length;++e){var f=a.charCodeAt(e);if(55296<=f&&57343>=f){var h=a.charCodeAt(++e);f=65536+((f&1023)<<10)|h&1023}B[b>>2]=f;b+=4;if(b+4>c)break}B[b>>2]=0;return b-d}
|
||||
function Aa(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 C,D,z,A,va,B,F,Ba,Ca;function Da(a){C=a;g.HEAP8=D=new Int8Array(a);g.HEAP16=A=new Int16Array(a);g.HEAP32=B=new Int32Array(a);g.HEAPU8=z=new Uint8Array(a);g.HEAPU16=va=new Uint16Array(a);g.HEAPU32=F=new Uint32Array(a);g.HEAPF32=Ba=new Float32Array(a);g.HEAPF64=Ca=new Float64Array(a)}var Ea=g.INITIAL_MEMORY||16777216;g.wasmMemory?x=g.wasmMemory:x=new WebAssembly.Memory({initial:Ea/65536,maximum:32768});
|
||||
x&&(C=x.buffer);Ea=C.byteLength;Da(C);var G,Fa=[],Ga=[],Ha=[],Ia=[];function Ja(){var a=g.preRun.shift();Fa.unshift(a)}var H=0,Ka=null,La=null;g.preloadedImages={};g.preloadedAudios={};function r(a){if(g.onAbort)g.onAbort(a);v(a);na=!0;a=new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");ba(a);throw a;}
|
||||
function Ma(){var a=Na;return String.prototype.startsWith?a.startsWith("data:application/octet-stream;base64,"):0===a.indexOf("data:application/octet-stream;base64,")}var Na="avif_node_enc.wasm";if(!Ma()){var Oa=Na;Na=g.locateFile?g.locateFile(Oa,da):da+Oa}function Pa(){try{if(ma)return new Uint8Array(ma);if(fa)return fa(Na);throw"both async and sync fetching of the wasm failed";}catch(a){r(a)}}var I,Qa;
|
||||
function Ra(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(g);else{var c=b.Ma;"number"===typeof c?void 0===b.sa?G.get(c)():G.get(c)(b.sa):c(void 0===b.sa?null:b.sa)}}}function Sa(a,b){for(var c=0,d=a.length-1;0<=d;d--){var e=a[d];"."===e?a.splice(d,1):".."===e?(a.splice(d,1),c++):c&&(a.splice(d,1),c--)}if(b)for(;c;c--)a.unshift("..");return a}
|
||||
function Ta(a){var b="/"===a.charAt(0),c="/"===a.substr(-1);(a=Sa(a.split("/").filter(function(d){return!!d}),!b).join("/"))||b||(a=".");a&&c&&(a+="/");return(b?"/":"")+a}function Ua(a){var b=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(a).slice(1);a=b[0];b=b[1];if(!a&&!b)return".";b&&(b=b.substr(0,b.length-1));return a+b}function Va(a){if("/"===a)return"/";a=Ta(a);a=a.replace(/\/$/,"");var b=a.lastIndexOf("/");return-1===b?a:a.substr(b+1)}
|
||||
function Wa(){if("object"===typeof crypto&&"function"===typeof crypto.getRandomValues){var a=new Uint8Array(1);return function(){crypto.getRandomValues(a);return a[0]}}try{var b=require("crypto");return function(){return b.randomBytes(1)[0]}}catch(c){}return function(){r("randomDevice")}}
|
||||
function Xa(){for(var a="",b=!1,c=arguments.length-1;-1<=c&&!b;c--){b=0<=c?arguments[c]:"/";if("string"!==typeof b)throw new TypeError("Arguments to path.resolve must be strings");if(!b)return"";a=b+"/"+a;b="/"===b.charAt(0)}a=Sa(a.split("/").filter(function(d){return!!d}),!b).join("/");return(b?"/":"")+a||"."}var Ya=[];function Za(a,b){Ya[a]={input:[],output:[],pa:b};$a(a,ab)}
|
||||
var ab={open:function(a){var b=Ya[a.node.rdev];if(!b)throw new J(43);a.tty=b;a.seekable=!1},close:function(a){a.tty.pa.flush(a.tty)},flush:function(a){a.tty.pa.flush(a.tty)},read:function(a,b,c,d){if(!a.tty||!a.tty.pa.Ea)throw new J(60);for(var e=0,f=0;f<d;f++){try{var h=a.tty.pa.Ea(a.tty)}catch(k){throw new J(29);}if(void 0===h&&0===e)throw new J(6);if(null===h||void 0===h)break;e++;b[c+f]=h}e&&(a.node.timestamp=Date.now());return e},write:function(a,b,c,d){if(!a.tty||!a.tty.pa.ua)throw new J(60);
|
||||
try{for(var e=0;e<d;e++)a.tty.pa.ua(a.tty,b[c+e])}catch(f){throw new J(29);}d&&(a.node.timestamp=Date.now());return e}},bb={Ea:function(a){if(!a.input.length){var b=null,c=Buffer.Ka?Buffer.Ka(256):new Buffer(256),d=0;try{d=ha.readSync(process.stdin.fd,c,0,256,null)}catch(e){if(-1!=e.toString().indexOf("EOF"))d=0;else throw e;}0<d?b=c.slice(0,d).toString("utf-8"):b=null;if(!b)return null;c=Array(sa(b)+1);b=ra(b,c,0,c.length);c.length=b;a.input=c}return a.input.shift()},ua:function(a,b){null===b||10===
|
||||
b?(ja(pa(a.output)),a.output=[]):0!=b&&a.output.push(b)},flush:function(a){a.output&&0<a.output.length&&(ja(pa(a.output)),a.output=[])}},cb={ua:function(a,b){null===b||10===b?(v(pa(a.output)),a.output=[]):0!=b&&a.output.push(b)},flush:function(a){a.output&&0<a.output.length&&(v(pa(a.output)),a.output=[])}},K={ha:null,la:function(){return K.createNode(null,"/",16895,0)},createNode:function(a,b,c,d){if(24576===(c&61440)||4096===(c&61440))throw new J(63);K.ha||(K.ha={dir:{node:{ma:K.ea.ma,ja:K.ea.ja,
|
||||
lookup:K.ea.lookup,qa:K.ea.qa,rename:K.ea.rename,unlink:K.ea.unlink,rmdir:K.ea.rmdir,readdir:K.ea.readdir,symlink:K.ea.symlink},stream:{oa:K.fa.oa}},file:{node:{ma:K.ea.ma,ja:K.ea.ja},stream:{oa:K.fa.oa,read:K.fa.read,write:K.fa.write,ya:K.fa.ya,Fa:K.fa.Fa,Ha:K.fa.Ha}},link:{node:{ma:K.ea.ma,ja:K.ea.ja,readlink:K.ea.readlink},stream:{}},za:{node:{ma:K.ea.ma,ja:K.ea.ja},stream:db}});c=eb(a,b,c,d);16384===(c.mode&61440)?(c.ea=K.ha.dir.node,c.fa=K.ha.dir.stream,c.da={}):32768===(c.mode&61440)?(c.ea=
|
||||
K.ha.file.node,c.fa=K.ha.file.stream,c.ga=0,c.da=null):40960===(c.mode&61440)?(c.ea=K.ha.link.node,c.fa=K.ha.link.stream):8192===(c.mode&61440)&&(c.ea=K.ha.za.node,c.fa=K.ha.za.stream);c.timestamp=Date.now();a&&(a.da[b]=c);return c},cb:function(a){if(a.da&&a.da.subarray){for(var b=[],c=0;c<a.ga;++c)b.push(a.da[c]);return b}return a.da},eb:function(a){return a.da?a.da.subarray?a.da.subarray(0,a.ga):new Uint8Array(a.da):new Uint8Array(0)},Aa:function(a,b){var c=a.da?a.da.length:0;c>=b||(b=Math.max(b,
|
||||
c*(1048576>c?2:1.125)>>>0),0!=c&&(b=Math.max(b,256)),c=a.da,a.da=new Uint8Array(b),0<a.ga&&a.da.set(c.subarray(0,a.ga),0))},Wa:function(a,b){if(a.ga!=b)if(0==b)a.da=null,a.ga=0;else{if(!a.da||a.da.subarray){var c=a.da;a.da=new Uint8Array(b);c&&a.da.set(c.subarray(0,Math.min(b,a.ga)))}else if(a.da||(a.da=[]),a.da.length>b)a.da.length=b;else for(;a.da.length<b;)a.da.push(0);a.ga=b}},ea:{ma:function(a){var b={};b.dev=8192===(a.mode&61440)?a.id:1;b.ino=a.id;b.mode=a.mode;b.nlink=1;b.uid=0;b.gid=0;b.rdev=
|
||||
a.rdev;16384===(a.mode&61440)?b.size=4096:32768===(a.mode&61440)?b.size=a.ga:40960===(a.mode&61440)?b.size=a.link.length:b.size=0;b.atime=new Date(a.timestamp);b.mtime=new Date(a.timestamp);b.ctime=new Date(a.timestamp);b.Ja=4096;b.blocks=Math.ceil(b.size/b.Ja);return b},ja:function(a,b){void 0!==b.mode&&(a.mode=b.mode);void 0!==b.timestamp&&(a.timestamp=b.timestamp);void 0!==b.size&&K.Wa(a,b.size)},lookup:function(){throw fb[44];},qa:function(a,b,c,d){return K.createNode(a,b,c,d)},rename:function(a,
|
||||
b,c){if(16384===(a.mode&61440)){try{var d=gb(b,c)}catch(f){}if(d)for(var e in d.da)throw new J(55);}delete a.parent.da[a.name];a.name=c;b.da[c]=a;a.parent=b},unlink:function(a,b){delete a.da[b]},rmdir:function(a,b){var c=gb(a,b),d;for(d in c.da)throw new J(55);delete a.da[b]},readdir:function(a){var b=[".",".."],c;for(c in a.da)a.da.hasOwnProperty(c)&&b.push(c);return b},symlink:function(a,b,c){a=K.createNode(a,b,41471,0);a.link=c;return a},readlink:function(a){if(40960!==(a.mode&61440))throw new J(28);
|
||||
return a.link}},fa:{read:function(a,b,c,d,e){var f=a.node.da;if(e>=a.node.ga)return 0;a=Math.min(a.node.ga-e,d);if(8<a&&f.subarray)b.set(f.subarray(e,e+a),c);else for(d=0;d<a;d++)b[c+d]=f[e+d];return a},write:function(a,b,c,d,e,f){b.buffer===D.buffer&&(f=!1);if(!d)return 0;a=a.node;a.timestamp=Date.now();if(b.subarray&&(!a.da||a.da.subarray)){if(f)return a.da=b.subarray(c,c+d),a.ga=d;if(0===a.ga&&0===e)return a.da=b.slice(c,c+d),a.ga=d;if(e+d<=a.ga)return a.da.set(b.subarray(c,c+d),e),d}K.Aa(a,e+
|
||||
d);if(a.da.subarray&&b.subarray)a.da.set(b.subarray(c,c+d),e);else for(f=0;f<d;f++)a.da[e+f]=b[c+f];a.ga=Math.max(a.ga,e+d);return d},oa:function(a,b,c){1===c?b+=a.position:2===c&&32768===(a.node.mode&61440)&&(b+=a.node.ga);if(0>b)throw new J(28);return b},ya:function(a,b,c){K.Aa(a.node,b+c);a.node.ga=Math.max(a.node.ga,b+c)},Fa:function(a,b,c,d,e,f){assert(0===b);if(32768!==(a.node.mode&61440))throw new J(43);a=a.node.da;if(f&2||a.buffer!==C){if(0<d||d+c<a.length)a.subarray?a=a.subarray(d,d+c):a=
|
||||
Array.prototype.slice.call(a,d,d+c);d=!0;f=16384*Math.ceil(c/16384);for(b=hb(f);c<f;)D[b+c++]=0;c=b;if(!c)throw new J(48);D.set(a,c)}else d=!1,c=a.byteOffset;return{ib:c,bb:d}},Ha:function(a,b,c,d,e){if(32768!==(a.node.mode&61440))throw new J(43);if(e&2)return 0;K.fa.write(a,b,0,d,c,!1);return 0}}},ib=null,jb={},kb=[],lb=1,mb=null,nb=!0,ob={},J=null,fb={};
|
||||
function L(a,b){a=Xa("/",a);b=b||{};if(!a)return{path:"",node:null};var c={Da:!0,va:0},d;for(d in c)void 0===b[d]&&(b[d]=c[d]);if(8<b.va)throw new J(32);a=Sa(a.split("/").filter(function(h){return!!h}),!1);var e=ib;c="/";for(d=0;d<a.length;d++){var f=d===a.length-1;if(f&&b.parent)break;e=gb(e,a[d]);c=Ta(c+"/"+a[d]);e.ra&&(!f||f&&b.Da)&&(e=e.ra.root);if(!f||b.Ca)for(f=0;40960===(e.mode&61440);)if(e=pb(c),c=Xa(Ua(c),e),e=L(c,{va:b.va}).node,40<f++)throw new J(32);}return{path:c,node:e}}
|
||||
function qb(a){for(var b;;){if(a===a.parent)return a=a.la.Ga,b?"/"!==a[a.length-1]?a+"/"+b:a+b:a;b=b?a.name+"/"+b:a.name;a=a.parent}}function rb(a,b){for(var c=0,d=0;d<b.length;d++)c=(c<<5)-c+b.charCodeAt(d)|0;return(a+c>>>0)%mb.length}function gb(a,b){var c;if(c=(c=sb(a,"x"))?c:a.ea.lookup?0:2)throw new J(c,a);for(c=mb[rb(a.id,b)];c;c=c.Ta){var d=c.name;if(c.parent.id===a.id&&d===b)return c}return a.ea.lookup(a,b)}
|
||||
function eb(a,b,c,d){a=new tb(a,b,c,d);b=rb(a.parent.id,a.name);a.Ta=mb[b];return mb[b]=a}var ub={r:0,rs:1052672,"r+":2,w:577,wx:705,xw:705,"w+":578,"wx+":706,"xw+":706,a:1089,ax:1217,xa:1217,"a+":1090,"ax+":1218,"xa+":1218};function vb(a){var b=["r","w","rw"][a&3];a&512&&(b+="w");return b}function sb(a,b){if(nb)return 0;if(-1===b.indexOf("r")||a.mode&292){if(-1!==b.indexOf("w")&&!(a.mode&146)||-1!==b.indexOf("x")&&!(a.mode&73))return 2}else return 2;return 0}
|
||||
function wb(a,b){try{return gb(a,b),20}catch(c){}return sb(a,"wx")}function xb(a){var b=4096;for(a=a||0;a<=b;a++)if(!kb[a])return a;throw new J(33);}function yb(a,b){zb||(zb=function(){},zb.prototype={});var c=new zb,d;for(d in a)c[d]=a[d];a=c;b=xb(b);a.fd=b;return kb[b]=a}var db={open:function(a){a.fa=jb[a.node.rdev].fa;a.fa.open&&a.fa.open(a)},oa:function(){throw new J(70);}};function $a(a,b){jb[a]={fa:b}}
|
||||
function Ab(a,b){var c="/"===b,d=!b;if(c&&ib)throw new J(10);if(!c&&!d){var e=L(b,{Da:!1});b=e.path;e=e.node;if(e.ra)throw new J(10);if(16384!==(e.mode&61440))throw new J(54);}b={type:a,hb:{},Ga:b,Sa:[]};a=a.la(b);a.la=b;b.root=a;c?ib=a:e&&(e.ra=b,e.la&&e.la.Sa.push(b))}function Bb(a,b,c){var d=L(a,{parent:!0}).node;a=Va(a);if(!a||"."===a||".."===a)throw new J(28);var e=wb(d,a);if(e)throw new J(e);if(!d.ea.qa)throw new J(63);return d.ea.qa(d,a,b,c)}function M(a){Bb(a,16895,0)}
|
||||
function Cb(a,b,c){"undefined"===typeof c&&(c=b,b=438);Bb(a,b|8192,c)}function Db(a,b){if(!Xa(a))throw new J(44);var c=L(b,{parent:!0}).node;if(!c)throw new J(44);b=Va(b);var d=wb(c,b);if(d)throw new J(d);if(!c.ea.symlink)throw new J(63);c.ea.symlink(c,b,a)}function pb(a){a=L(a).node;if(!a)throw new J(44);if(!a.ea.readlink)throw new J(28);return Xa(qb(a.parent),a.ea.readlink(a))}
|
||||
function Eb(a,b,c,d){if(""===a)throw new J(44);if("string"===typeof b){var e=ub[b];if("undefined"===typeof e)throw Error("Unknown file open mode: "+b);b=e}c=b&64?("undefined"===typeof c?438:c)&4095|32768:0;if("object"===typeof a)var f=a;else{a=Ta(a);try{f=L(a,{Ca:!(b&131072)}).node}catch(k){}}e=!1;if(b&64)if(f){if(b&128)throw new J(20);}else f=Bb(a,c,0),e=!0;if(!f)throw new J(44);8192===(f.mode&61440)&&(b&=-513);if(b&65536&&16384!==(f.mode&61440))throw new J(54);if(!e&&(c=f?40960===(f.mode&61440)?
|
||||
32:16384===(f.mode&61440)&&("r"!==vb(b)||b&512)?31:sb(f,vb(b)):44))throw new J(c);if(b&512){c=f;var h;"string"===typeof c?h=L(c,{Ca:!0}).node:h=c;if(!h.ea.ja)throw new J(63);if(16384===(h.mode&61440))throw new J(31);if(32768!==(h.mode&61440))throw new J(28);if(c=sb(h,"w"))throw new J(c);h.ea.ja(h,{size:0,timestamp:Date.now()})}b&=-131713;d=yb({node:f,path:qb(f),flags:b,seekable:!0,position:0,fa:f.fa,ab:[],error:!1},d);d.fa.open&&d.fa.open(d);!g.logReadFiles||b&1||(Fb||(Fb={}),a in Fb||(Fb[a]=1,v("FS.trackingDelegate error on read file: "+
|
||||
a)));try{ob.onOpenFile&&(f=0,1!==(b&2097155)&&(f|=1),0!==(b&2097155)&&(f|=2),ob.onOpenFile(a,f))}catch(k){v("FS.trackingDelegate['onOpenFile']('"+a+"', flags) threw an exception: "+k.message)}return d}function Gb(a,b,c){if(null===a.fd)throw new J(8);if(!a.seekable||!a.fa.oa)throw new J(70);if(0!=c&&1!=c&&2!=c)throw new J(28);a.position=a.fa.oa(a,b,c);a.ab=[]}
|
||||
function Hb(){J||(J=function(a,b){this.node=b;this.Xa=function(c){this.na=c};this.Xa(a);this.message="FS error"},J.prototype=Error(),J.prototype.constructor=J,[44].forEach(function(a){fb[a]=new J(a);fb[a].stack="<generic error, no stack>"}))}var Ib;function Jb(a,b){var c=0;a&&(c|=365);b&&(c|=146);return c}
|
||||
function Kb(a,b,c){a=Ta("/dev/"+a);var d=Jb(!!b,!!c);Lb||(Lb=64);var e=Lb++<<8|0;$a(e,{open:function(f){f.seekable=!1},close:function(){c&&c.buffer&&c.buffer.length&&c(10)},read:function(f,h,k,l){for(var n=0,p=0;p<l;p++){try{var t=b()}catch(u){throw new J(29);}if(void 0===t&&0===n)throw new J(6);if(null===t||void 0===t)break;n++;h[k+p]=t}n&&(f.node.timestamp=Date.now());return n},write:function(f,h,k,l){for(var n=0;n<l;n++)try{c(h[k+n])}catch(p){throw new J(29);}l&&(f.node.timestamp=Date.now());return n}});
|
||||
Cb(a,d,e)}var Lb,N={},zb,Fb,Mb=void 0;function O(){Mb+=4;return B[Mb-4>>2]}function Q(a){a=kb[a];if(!a)throw new J(8);return a}var Nb={};function Ob(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function Pb(a){return this.fromWireType(F[a>>2])}var Qb={},R={},Rb={};function Sb(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 Tb(a,b){a=Sb(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}function Ub(a){var b=Error,c=Tb(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 Vb=void 0;function Wb(a,b,c){function d(k){k=c(k);if(k.length!==a.length)throw new Vb("Mismatched type converter count");for(var l=0;l<a.length;++l)S(a[l],k[l])}a.forEach(function(k){Rb[k]=b});var e=Array(b.length),f=[],h=0;b.forEach(function(k,l){R.hasOwnProperty(k)?e[l]=R[k]:(f.push(k),Qb.hasOwnProperty(k)||(Qb[k]=[]),Qb[k].push(function(){e[l]=R[k];++h;h===f.length&&d(e)}))});0===f.length&&d(e)}
|
||||
function Xb(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 Yb=void 0;function T(a){for(var b="";z[a];)b+=Yb[z[a++]];return b}var Zb=void 0;function U(a){throw new Zb(a);}
|
||||
function S(a,b,c){c=c||{};if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");var d=b.name;a||U('type "'+d+'" must have a positive integer typeid pointer');if(R.hasOwnProperty(a)){if(c.Qa)return;U("Cannot register type '"+d+"' twice")}R[a]=b;delete Rb[a];Qb.hasOwnProperty(a)&&(b=Qb[a],delete Qb[a],b.forEach(function(e){e()}))}var $b=[],V=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
|
||||
function ac(a){4<a&&0===--V[a].wa&&(V[a]=void 0,$b.push(a))}function bc(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=$b.length?$b.pop():V.length;V[b]={wa:1,value:a};return b}}function cc(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}
|
||||
function dc(a,b){switch(b){case 2:return function(c){return this.fromWireType(Ba[c>>2])};case 3:return function(c){return this.fromWireType(Ca[c>>3])};default:throw new TypeError("Unknown float type: "+a);}}function ec(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=Tb(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c}
|
||||
function fc(a,b){var c=g;if(void 0===c[a].ia){var d=c[a];c[a]=function(){c[a].ia.hasOwnProperty(arguments.length)||U("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+c[a].ia+")!");return c[a].ia[arguments.length].apply(this,arguments)};c[a].ia=[];c[a].ia[d.Ia]=d}}
|
||||
function gc(a,b,c){g.hasOwnProperty(a)?((void 0===c||void 0!==g[a].ia&&void 0!==g[a].ia[c])&&U("Cannot register public name '"+a+"' twice"),fc(a,a),g.hasOwnProperty(c)&&U("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),g[a].ia[c]=b):(g[a]=b,void 0!==c&&(g[a].gb=c))}function hc(a,b){for(var c=[],d=0;d<a;d++)c.push(B[(b>>2)+d]);return c}
|
||||
function ic(a,b){assert(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];var e;-1!=a.indexOf("j")?e=c&&c.length?g["dynCall_"+a].apply(null,[b].concat(c)):g["dynCall_"+a].call(null,b):e=G.get(b).apply(null,c);return e}}function jc(a,b){a=T(a);var c=-1!=a.indexOf("j")?ic(a,b):G.get(b);"function"!==typeof c&&U("unknown function pointer with signature "+a+": "+b);return c}
|
||||
var kc=void 0;function lc(a){a=mc(a);var b=T(a);W(a);return b}function nc(a,b){function c(f){e[f]||R[f]||(Rb[f]?Rb[f].forEach(c):(d.push(f),e[f]=!0))}var d=[],e={};b.forEach(c);throw new kc(a+": "+d.map(lc).join([", "]));}
|
||||
function oc(a,b,c){switch(b){case 0:return c?function(d){return D[d]}:function(d){return z[d]};case 1:return c?function(d){return A[d>>1]}:function(d){return va[d>>1]};case 2:return c?function(d){return B[d>>2]}:function(d){return F[d>>2]};default:throw new TypeError("Unknown integer type: "+a);}}var pc={};function qc(){return"object"===typeof globalThis?globalThis:Function("return this")()}function rc(a,b){var c=R[a];void 0===c&&U(b+" has unknown type "+lc(a));return c}var sc={};
|
||||
function tb(a,b,c,d){a||(a=this);this.parent=a;this.la=a.la;this.ra=null;this.id=lb++;this.name=b;this.mode=c;this.ea={};this.fa={};this.rdev=d}Object.defineProperties(tb.prototype,{read:{get:function(){return 365===(this.mode&365)},set:function(a){a?this.mode|=365:this.mode&=-366}},write:{get:function(){return 146===(this.mode&146)},set:function(a){a?this.mode|=146:this.mode&=-147}}});Hb();mb=Array(4096);Ab(K,"/");M("/tmp");M("/home");M("/home/web_user");
|
||||
(function(){M("/dev");$a(259,{read:function(){return 0},write:function(b,c,d,e){return e}});Cb("/dev/null",259);Za(1280,bb);Za(1536,cb);Cb("/dev/tty",1280);Cb("/dev/tty1",1536);var a=Wa();Kb("random",a);Kb("urandom",a);M("/dev/shm");M("/dev/shm/tmp")})();M("/proc");M("/proc/self");M("/proc/self/fd");
|
||||
Ab({la:function(){var a=eb("/proc/self","fd",16895,73);a.ea={lookup:function(b,c){var d=kb[+c];if(!d)throw new J(8);b={parent:null,la:{Ga:"fake"},ea:{readlink:function(){return d.path}}};return b.parent=b}};return a}},"/proc/self/fd");Vb=g.InternalError=Ub("InternalError");for(var tc=Array(256),uc=0;256>uc;++uc)tc[uc]=String.fromCharCode(uc);Yb=tc;Zb=g.BindingError=Ub("BindingError");g.count_emval_handles=function(){for(var a=0,b=5;b<V.length;++b)void 0!==V[b]&&++a;return a};
|
||||
g.get_first_emval=function(){for(var a=5;a<V.length;++a)if(void 0!==V[a])return V[a];return null};kc=g.UnboundTypeError=Ub("UnboundTypeError");Ga.push({Ma:function(){vc()}});
|
||||
var Fc={N:function(){},s:function(a,b,c){Mb=c;try{var d=Q(a);switch(b){case 0:var e=O();return 0>e?-28:Eb(d.path,d.flags,0,e).fd;case 1:case 2:return 0;case 3:return d.flags;case 4:return e=O(),d.flags|=e,0;case 12:return e=O(),A[e+0>>1]=2,0;case 13:case 14:return 0;case 16:case 8:return-28;case 9:return B[wc()>>2]=28,-1;default:return-28}}catch(f){return"undefined"!==typeof N&&f instanceof J||r(f),-f.na}},G:function(a,b,c){Mb=c;try{var d=Q(a);switch(b){case 21509:case 21505:return d.tty?0:-59;case 21510:case 21511:case 21512:case 21506:case 21507:case 21508:return d.tty?
|
||||
0:-59;case 21519:if(!d.tty)return-59;var e=O();return B[e>>2]=0;case 21520:return d.tty?-28:-59;case 21531:a=e=O();if(!d.fa.Ra)throw new J(59);return d.fa.Ra(d,b,a);case 21523:return d.tty?0:-59;case 21524:return d.tty?0:-59;default:r("bad ioctl syscall "+b)}}catch(f){return"undefined"!==typeof N&&f instanceof J||r(f),-f.na}},H:function(a,b,c){Mb=c;try{var d=qa(a),e=O();return Eb(d,b,e).fd}catch(f){return"undefined"!==typeof N&&f instanceof J||r(f),-f.na}},z:function(a){var b=Nb[a];delete Nb[a];var c=
|
||||
b.Ua,d=b.Va,e=b.Ba,f=e.map(function(h){return h.Pa}).concat(e.map(function(h){return h.Za}));Wb([a],f,function(h){var k={};e.forEach(function(l,n){var p=h[n],t=l.Na,u=l.Oa,w=h[n+e.length],q=l.Ya,E=l.$a;k[l.La]={read:function(y){return p.fromWireType(t(u,y))},write:function(y,P){var la=[];q(E,y,w.toWireType(la,P));Ob(la)}}});return[{name:b.name,fromWireType:function(l){var n={},p;for(p in k)n[p]=k[p].read(l);d(l);return n},toWireType:function(l,n){for(var p in k)if(!(p in n))throw new TypeError('Missing field: "'+
|
||||
p+'"');var t=c();for(p in k)k[p].write(t,n[p]);null!==l&&l.push(d,t);return t},argPackAdvance:8,readValueFromPointer:Pb,ka:d}]})},J:function(a,b,c,d,e){var f=Xb(c);b=T(b);S(a,{name:b,fromWireType:function(h){return!!h},toWireType:function(h,k){return k?d:e},argPackAdvance:8,readValueFromPointer:function(h){if(1===c)var k=D;else if(2===c)k=A;else if(4===c)k=B;else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(k[h>>f])},ka:null})},I:function(a,b){b=T(b);S(a,{name:b,fromWireType:function(c){var d=
|
||||
V[c].value;ac(c);return d},toWireType:function(c,d){return bc(d)},argPackAdvance:8,readValueFromPointer:Pb,ka:null})},v:function(a,b,c){c=Xb(c);b=T(b);S(a,{name:b,fromWireType:function(d){return d},toWireType:function(d,e){if("number"!==typeof e&&"boolean"!==typeof e)throw new TypeError('Cannot convert "'+cc(e)+'" to '+this.name);return e},argPackAdvance:8,readValueFromPointer:dc(b,c),ka:null})},y:function(a,b,c,d,e,f){var h=hc(b,c);a=T(a);e=jc(d,e);gc(a,function(){nc("Cannot call "+a+" due to unbound types",
|
||||
h)},b-1);Wb([],h,function(k){var l=[k[0],null].concat(k.slice(1)),n=k=a,p=e,t=l.length;2>t&&U("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var u=null!==l[1]&&!1,w=!1,q=1;q<l.length;++q)if(null!==l[q]&&void 0===l[q].ka){w=!0;break}var E="void"!==l[0].name,y="",P="";for(q=0;q<t-2;++q)y+=(0!==q?", ":"")+"arg"+q,P+=(0!==q?", ":"")+"arg"+q+"Wired";n="return function "+Sb(n)+"("+y+") {\nif (arguments.length !== "+(t-2)+") {\nthrowBindingError('function "+n+" called with ' + arguments.length + ' arguments, expected "+
|
||||
(t-2)+" args!');\n}\n";w&&(n+="var destructors = [];\n");var la=w?"destructors":"null";y="throwBindingError invoker fn runDestructors retType classParam".split(" ");p=[U,p,f,Ob,l[0],l[1]];u&&(n+="var thisWired = classParam.toWireType("+la+", this);\n");for(q=0;q<t-2;++q)n+="var arg"+q+"Wired = argType"+q+".toWireType("+la+", arg"+q+"); // "+l[q+2].name+"\n",y.push("argType"+q),p.push(l[q+2]);u&&(P="thisWired"+(0<P.length?", ":"")+P);n+=(E?"var rv = ":"")+"invoker(fn"+(0<P.length?", ":"")+P+");\n";
|
||||
if(w)n+="runDestructors(destructors);\n";else for(q=u?1:2;q<l.length;++q)t=1===q?"thisWired":"arg"+(q-2)+"Wired",null!==l[q].ka&&(n+=t+"_dtor("+t+"); // "+l[q].name+"\n",y.push(t+"_dtor"),p.push(l[q].ka));E&&(n+="var ret = retType.fromWireType(rv);\nreturn ret;\n");y.push(n+"}\n");l=ec(y).apply(null,p);q=b-1;if(!g.hasOwnProperty(k))throw new Vb("Replacing nonexistant public symbol");void 0!==g[k].ia&&void 0!==q?g[k].ia[q]=l:(g[k]=l,g[k].Ia=q);return[]})},i:function(a,b,c,d,e){function f(n){return n}
|
||||
b=T(b);-1===e&&(e=4294967295);var h=Xb(c);if(0===d){var k=32-8*c;f=function(n){return n<<k>>>k}}var l=-1!=b.indexOf("unsigned");S(a,{name:b,fromWireType:f,toWireType:function(n,p){if("number"!==typeof p&&"boolean"!==typeof p)throw new TypeError('Cannot convert "'+cc(p)+'" to '+this.name);if(p<d||p>e)throw new TypeError('Passing a number "'+cc(p)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+d+", "+e+"]!");return l?p>>>0:p|0},argPackAdvance:8,readValueFromPointer:oc(b,
|
||||
h,0!==d),ka:null})},f:function(a,b,c){function d(f){f>>=2;var h=F;return new e(C,h[f+1],h[f])}var e=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];c=T(c);S(a,{name:c,fromWireType:d,argPackAdvance:8,readValueFromPointer:d},{Qa:!0})},w:function(a,b){b=T(b);var c="std::string"===b;S(a,{name:b,fromWireType:function(d){var e=F[d>>2];if(c)for(var f=d+4,h=0;h<=e;++h){var k=d+4+h;if(h==e||0==z[k]){f=qa(f,k-f);if(void 0===l)var l=f;else l+=String.fromCharCode(0),
|
||||
l+=f;f=k+1}}else{l=Array(e);for(h=0;h<e;++h)l[h]=String.fromCharCode(z[d+4+h]);l=l.join("")}W(d);return l},toWireType:function(d,e){e instanceof ArrayBuffer&&(e=new Uint8Array(e));var f="string"===typeof e;f||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int8Array||U("Cannot pass non-string to std::string");var h=(c&&f?function(){return sa(e)}:function(){return e.length})(),k=hb(4+h+1);F[k>>2]=h;if(c&&f)ra(e,z,k+4,h+1);else if(f)for(f=0;f<h;++f){var l=e.charCodeAt(f);255<l&&
|
||||
(W(k),U("String has UTF-16 code units that do not fit in 8 bits"));z[k+4+f]=l}else for(f=0;f<h;++f)z[k+4+f]=e[f];null!==d&&d.push(W,k);return k},argPackAdvance:8,readValueFromPointer:Pb,ka:function(d){W(d)}})},p:function(a,b,c){c=T(c);if(2===b){var d=ua;var e=wa;var f=xa;var h=function(){return va};var k=1}else 4===b&&(d=ya,e=za,f=Aa,h=function(){return F},k=2);S(a,{name:c,fromWireType:function(l){for(var n=F[l>>2],p=h(),t,u=l+4,w=0;w<=n;++w){var q=l+4+w*b;if(w==n||0==p[q>>k])u=d(u,q-u),void 0===
|
||||
t?t=u:(t+=String.fromCharCode(0),t+=u),u=q+b}W(l);return t},toWireType:function(l,n){"string"!==typeof n&&U("Cannot pass non-string to C++ string type "+c);var p=f(n),t=hb(4+p+b);F[t>>2]=p>>k;e(n,t+4,p+b);null!==l&&l.push(W,t);return t},argPackAdvance:8,readValueFromPointer:Pb,ka:function(l){W(l)}})},A:function(a,b,c,d,e,f){Nb[a]={name:T(b),Ua:jc(c,d),Va:jc(e,f),Ba:[]}},j:function(a,b,c,d,e,f,h,k,l,n){Nb[a].Ba.push({La:T(b),Pa:c,Na:jc(d,e),Oa:f,Za:h,Ya:jc(k,l),$a:n})},K:function(a,b){b=T(b);S(a,{fb:!0,
|
||||
name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},m:ac,M:function(a){if(0===a)return bc(qc());var b=pc[a];a=void 0===b?T(a):b;return bc(qc()[a])},x:function(a){4<a&&(V[a].wa+=1)},D:function(a,b,c,d){a||U("Cannot use deleted val. handle = "+a);a=V[a].value;var e=sc[b];if(!e){e="";for(var f=0;f<b;++f)e+=(0!==f?", ":"")+"arg"+f;var h="return function emval_allocator_"+b+"(constructor, argTypes, args) {\n";for(f=0;f<b;++f)h+="var argType"+f+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+
|
||||
f+'], "parameter '+f+'");\nvar arg'+f+" = argType"+f+".readValueFromPointer(args);\nargs += argType"+f+"['argPackAdvance'];\n";e=(new Function("requireRegisteredType","Module","__emval_register",h+("var obj = new constructor("+e+");\nreturn __emval_register(obj);\n}\n")))(rc,g,bc);sc[b]=e}return e(a,c,d)},h:function(){r()},e:function(a,b){X(a,b||1);throw"longjmp";},E:function(a,b,c){z.copyWithin(a,b,b+c)},k:function(a){a>>>=0;var b=z.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{x.grow(Math.min(2147483648,d)-C.byteLength+65535>>>16);Da(x.buffer);var e=1;break a}catch(f){}e=void 0}if(e)return!0}return!1},u:function(a){try{var b=Q(a);if(null===b.fd)throw new J(8);b.ta&&(b.ta=null);try{b.fa.close&&b.fa.close(b)}catch(c){throw c;}finally{kb[b.fd]=null}b.fd=null;return 0}catch(c){return"undefined"!==typeof N&&c instanceof J||r(c),c.na}},F:function(a,b,c,d){try{a:{for(var e=Q(a),f=
|
||||
a=0;f<c;f++){var h=B[b+(8*f+4)>>2],k=e,l=B[b+8*f>>2],n=h,p=void 0,t=D;if(0>n||0>p)throw new J(28);if(null===k.fd)throw new J(8);if(1===(k.flags&2097155))throw new J(8);if(16384===(k.node.mode&61440))throw new J(31);if(!k.fa.read)throw new J(28);var u="undefined"!==typeof p;if(!u)p=k.position;else if(!k.seekable)throw new J(70);var w=k.fa.read(k,t,l,n,p);u||(k.position+=w);var q=w;if(0>q){var E=-1;break a}a+=q;if(q<h)break}E=a}B[d>>2]=E;return 0}catch(y){return"undefined"!==typeof N&&y instanceof J||
|
||||
r(y),y.na}},B:function(a,b,c,d,e){try{var f=Q(a);a=4294967296*c+(b>>>0);if(-9007199254740992>=a||9007199254740992<=a)return-61;Gb(f,a,d);Qa=[f.position>>>0,(I=f.position,1<=+Math.abs(I)?0<I?(Math.min(+Math.floor(I/4294967296),4294967295)|0)>>>0:~~+Math.ceil((I-+(~~I>>>0))/4294967296)>>>0:0)];B[e>>2]=Qa[0];B[e+4>>2]=Qa[1];f.ta&&0===a&&0===d&&(f.ta=null);return 0}catch(h){return"undefined"!==typeof N&&h instanceof J||r(h),h.na}},t:function(a,b,c,d){try{a:{for(var e=Q(a),f=a=0;f<c;f++){var h=e,k=B[b+
|
||||
8*f>>2],l=B[b+(8*f+4)>>2],n=void 0,p=D;if(0>l||0>n)throw new J(28);if(null===h.fd)throw new J(8);if(0===(h.flags&2097155))throw new J(8);if(16384===(h.node.mode&61440))throw new J(31);if(!h.fa.write)throw new J(28);h.seekable&&h.flags&1024&&Gb(h,0,2);var t="undefined"!==typeof n;if(!t)n=h.position;else if(!h.seekable)throw new J(70);var u=h.fa.write(h,p,k,l,n,void 0);t||(h.position+=u);try{if(h.path&&ob.onWriteToFile)ob.onWriteToFile(h.path)}catch(E){v("FS.trackingDelegate['onWriteToFile']('"+h.path+
|
||||
"') threw an exception: "+E.message)}var w=u;if(0>w){var q=-1;break a}a+=w}q=a}B[d>>2]=q;return 0}catch(E){return"undefined"!==typeof N&&E instanceof J||r(E),E.na}},c:function(){return ka|0},r:xc,C:yc,q:zc,l:Ac,o:Bc,g:Cc,d:Dc,n:Ec,a:x,b:function(a){ka=a|0},L:function(a){var b=Date.now()/1E3|0;a&&(B[a>>2]=b);return b}};
|
||||
(function(){function a(e){g.asm=e.exports;G=g.asm.O;H--;g.monitorRunDependencies&&g.monitorRunDependencies(H);0==H&&(null!==Ka&&(clearInterval(Ka),Ka=null),La&&(e=La,La=null,e()))}function b(e){a(e.instance)}function c(e){return Promise.resolve().then(Pa).then(function(f){return WebAssembly.instantiate(f,d)}).then(e,function(f){v("failed to asynchronously prepare wasm: "+f);r(f)})}var d={a:Fc};H++;g.monitorRunDependencies&&g.monitorRunDependencies(H);if(g.instantiateWasm)try{return g.instantiateWasm(d,
|
||||
a)}catch(e){return v("Module.instantiateWasm callback failed with error: "+e),!1}(function(){return ma||"function"!==typeof WebAssembly.instantiateStreaming||Ma()||"function"!==typeof fetch?c(b):fetch(Na,{credentials:"same-origin"}).then(function(e){return WebAssembly.instantiateStreaming(e,d).then(b,function(f){v("wasm streaming compile failed: "+f);v("falling back to ArrayBuffer instantiation");return c(b)})})})().catch(ba);return{}})();
|
||||
var vc=g.___wasm_call_ctors=function(){return(vc=g.___wasm_call_ctors=g.asm.P).apply(null,arguments)},hb=g._malloc=function(){return(hb=g._malloc=g.asm.Q).apply(null,arguments)},W=g._free=function(){return(W=g._free=g.asm.R).apply(null,arguments)},mc=g.___getTypeName=function(){return(mc=g.___getTypeName=g.asm.S).apply(null,arguments)};g.___embind_register_native_and_builtin_types=function(){return(g.___embind_register_native_and_builtin_types=g.asm.T).apply(null,arguments)};
|
||||
var wc=g.___errno_location=function(){return(wc=g.___errno_location=g.asm.U).apply(null,arguments)},Y=g.stackSave=function(){return(Y=g.stackSave=g.asm.V).apply(null,arguments)},Z=g.stackRestore=function(){return(Z=g.stackRestore=g.asm.W).apply(null,arguments)},X=g._setThrew=function(){return(X=g._setThrew=g.asm.X).apply(null,arguments)};g.dynCall_jiiiiiiiii=function(){return(g.dynCall_jiiiiiiiii=g.asm.Y).apply(null,arguments)};g.dynCall_jiji=function(){return(g.dynCall_jiji=g.asm.Z).apply(null,arguments)};
|
||||
g.dynCall_jiiiiiiii=function(){return(g.dynCall_jiiiiiiii=g.asm._).apply(null,arguments)};g.dynCall_jiiiiii=function(){return(g.dynCall_jiiiiii=g.asm.$).apply(null,arguments)};g.dynCall_jiiiii=function(){return(g.dynCall_jiiiii=g.asm.aa).apply(null,arguments)};g.dynCall_iiijii=function(){return(g.dynCall_iiijii=g.asm.ba).apply(null,arguments)};function Bc(a,b){var c=Y();try{G.get(a)(b)}catch(d){Z(c);if(d!==d+0&&"longjmp"!==d)throw d;X(1,0)}}
|
||||
function Dc(a,b,c,d,e){var f=Y();try{G.get(a)(b,c,d,e)}catch(h){Z(f);if(h!==h+0&&"longjmp"!==h)throw h;X(1,0)}}function Cc(a,b,c){var d=Y();try{G.get(a)(b,c)}catch(e){Z(d);if(e!==e+0&&"longjmp"!==e)throw e;X(1,0)}}function Ac(a,b,c,d,e,f,h,k,l){var n=Y();try{return G.get(a)(b,c,d,e,f,h,k,l)}catch(p){Z(n);if(p!==p+0&&"longjmp"!==p)throw p;X(1,0)}}function xc(a,b,c){var d=Y();try{return G.get(a)(b,c)}catch(e){Z(d);if(e!==e+0&&"longjmp"!==e)throw e;X(1,0)}}
|
||||
function zc(a,b,c,d,e){var f=Y();try{return G.get(a)(b,c,d,e)}catch(h){Z(f);if(h!==h+0&&"longjmp"!==h)throw h;X(1,0)}}function yc(a,b,c,d){var e=Y();try{return G.get(a)(b,c,d)}catch(f){Z(e);if(f!==f+0&&"longjmp"!==f)throw f;X(1,0)}}function Ec(a,b,c,d,e,f,h,k,l,n,p){var t=Y();try{G.get(a)(b,c,d,e,f,h,k,l,n,p)}catch(u){Z(t);if(u!==u+0&&"longjmp"!==u)throw u;X(1,0)}}var Gc;La=function Hc(){Gc||Ic();Gc||(La=Hc)};
|
||||
function Ic(){function a(){if(!Gc&&(Gc=!0,g.calledRun=!0,!na)){g.noFSInit||Ib||(Ib=!0,Hb(),g.stdin=g.stdin,g.stdout=g.stdout,g.stderr=g.stderr,g.stdin?Kb("stdin",g.stdin):Db("/dev/tty","/dev/stdin"),g.stdout?Kb("stdout",null,g.stdout):Db("/dev/tty","/dev/stdout"),g.stderr?Kb("stderr",null,g.stderr):Db("/dev/tty1","/dev/stderr"),Eb("/dev/stdin","r"),Eb("/dev/stdout","w"),Eb("/dev/stderr","w"));Ra(Ga);nb=!1;Ra(Ha);aa(g);if(g.onRuntimeInitialized)g.onRuntimeInitialized();if(g.postRun)for("function"==
|
||||
typeof g.postRun&&(g.postRun=[g.postRun]);g.postRun.length;){var b=g.postRun.shift();Ia.unshift(b)}Ra(Ia)}}if(!(0<H)){if(g.preRun)for("function"==typeof g.preRun&&(g.preRun=[g.preRun]);g.preRun.length;)Ja();Ra(Fa);0<H||(g.setStatus?(g.setStatus("Running..."),setTimeout(function(){setTimeout(function(){g.setStatus("")},1);a()},1)):a())}}g.run=Ic;if(g.preInit)for("function"==typeof g.preInit&&(g.preInit=[g.preInit]);0<g.preInit.length;)g.preInit.pop()();noExitRuntime=!0;Ic();
|
||||
var f;f||(f=typeof avif_node_enc !== 'undefined' ? avif_node_enc : {});var aa,ba;f.ready=new Promise(function(a,b){aa=a;ba=b});var t={},u;for(u in f)f.hasOwnProperty(u)&&(t[u]=f[u]);var ca="",da,fa,ha,ia;ca=__dirname+"/";da=function(a){ha||(ha=require("fs"));ia||(ia=require("path"));a=ia.normalize(a);return ha.readFileSync(a,null)};fa=function(a){a=da(a);a.buffer||(a=new Uint8Array(a));a.buffer||v("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",v);f.inspect=function(){return"[Emscripten Module object]"};var ja=f.print||console.log.bind(console),w=f.printErr||console.warn.bind(console);for(u in t)t.hasOwnProperty(u)&&(f[u]=t[u]);t=null;var ka=0,x;f.wasmBinary&&(x=f.wasmBinary);var noExitRuntime;f.noExitRuntime&&(noExitRuntime=f.noExitRuntime);"object"!==typeof WebAssembly&&v("no native wasm support detected");var y,la=!1,ma=new TextDecoder("utf8");
|
||||
function na(a,b,c){var d=B;if(0<c){c=b+c-1;for(var e=0;e<a.length;++e){var g=a.charCodeAt(e);if(55296<=g&&57343>=g){var h=a.charCodeAt(++e);g=65536+((g&1023)<<10)|h&1023}if(127>=g){if(b>=c)break;d[b++]=g}else{if(2047>=g){if(b+1>=c)break;d[b++]=192|g>>6}else{if(65535>=g){if(b+2>=c)break;d[b++]=224|g>>12}else{if(b+3>=c)break;d[b++]=240|g>>18;d[b++]=128|g>>12&63}d[b++]=128|g>>6&63}d[b++]=128|g&63}}d[b]=0}}var oa=new TextDecoder("utf-16le");
|
||||
function pa(a,b){var c=a>>1;for(b=c+b/2;!(c>=b)&&C[c];)++c;return oa.decode(B.subarray(a,c<<1))}function qa(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var d=b;c=c<2*a.length?c/2:a.length;for(var e=0;e<c;++e)D[b>>1]=a.charCodeAt(e),b+=2;D[b>>1]=0;return b-d}function ra(a){return 2*a.length}function sa(a,b){for(var c=0,d="";!(c>=b/4);){var e=E[a+4*c>>2];if(0==e)break;++c;65536<=e?(e-=65536,d+=String.fromCharCode(55296|e>>10,56320|e&1023)):d+=String.fromCharCode(e)}return d}
|
||||
function ta(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var d=b;c=d+c-4;for(var e=0;e<a.length;++e){var g=a.charCodeAt(e);if(55296<=g&&57343>=g){var h=a.charCodeAt(++e);g=65536+((g&1023)<<10)|h&1023}E[b>>2]=g;b+=4;if(b+4>c)break}E[b>>2]=0;return b-d}function ua(a){for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);55296<=d&&57343>=d&&++c;b+=4}return b}var F,va,B,D,C,E,G,wa,xa;
|
||||
function ya(a){F=a;f.HEAP8=va=new Int8Array(a);f.HEAP16=D=new Int16Array(a);f.HEAP32=E=new Int32Array(a);f.HEAPU8=B=new Uint8Array(a);f.HEAPU16=C=new Uint16Array(a);f.HEAPU32=G=new Uint32Array(a);f.HEAPF32=wa=new Float32Array(a);f.HEAPF64=xa=new Float64Array(a)}var za=f.INITIAL_MEMORY||16777216;f.wasmMemory?y=f.wasmMemory:y=new WebAssembly.Memory({initial:za/65536,maximum:32768});y&&(F=y.buffer);za=F.byteLength;ya(F);var H,Aa=[],Ba=[],Ca=[],Da=[];
|
||||
function Ea(){var a=f.preRun.shift();Aa.unshift(a)}var J=0,Fa=null,K=null;f.preloadedImages={};f.preloadedAudios={};function v(a){if(f.onAbort)f.onAbort(a);w(a);la=!0;a=new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");ba(a);throw a;}function Ga(){var a=L;return String.prototype.startsWith?a.startsWith("data:application/octet-stream;base64,"):0===a.indexOf("data:application/octet-stream;base64,")}var L="avif_node_enc.wasm";
|
||||
if(!Ga()){var Ha=L;L=f.locateFile?f.locateFile(Ha,ca):ca+Ha}function Ia(){try{if(x)return new Uint8Array(x);if(fa)return fa(L);throw"both async and sync fetching of the wasm failed";}catch(a){v(a)}}function M(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(f);else{var c=b.ja;"number"===typeof c?void 0===b.ea?H.get(c)():H.get(c)(b.ea):c(void 0===b.ea?null:b.ea)}}}var Ja=[null,[],[]],Ka={},N={};function La(a){for(;a.length;){var b=a.pop();a.pop()(b)}}
|
||||
function Ma(a){return this.fromWireType(G[a>>2])}var O={},P={},Na={};function Oa(a){if(void 0===a)return"_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var b=a.charCodeAt(0);return 48<=b&&57>=b?"_"+a:a}function Pa(a,b){a=Oa(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}
|
||||
function Qa(a){var b=Error,c=Pa(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 Ra=void 0;
|
||||
function Sa(a,b,c){function d(k){k=c(k);if(k.length!==a.length)throw new Ra("Mismatched type converter count");for(var l=0;l<a.length;++l)Q(a[l],k[l])}a.forEach(function(k){Na[k]=b});var e=Array(b.length),g=[],h=0;b.forEach(function(k,l){P.hasOwnProperty(k)?e[l]=P[k]:(g.push(k),O.hasOwnProperty(k)||(O[k]=[]),O[k].push(function(){e[l]=P[k];++h;h===g.length&&d(e)}))});0===g.length&&d(e)}
|
||||
function Ta(a){switch(a){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+a);}}var Ua=void 0;function R(a){for(var b="";B[a];)b+=Ua[B[a++]];return b}var Va=void 0;function S(a){throw new Va(a);}
|
||||
function Q(a,b,c){c=c||{};if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");var d=b.name;a||S('type "'+d+'" must have a positive integer typeid pointer');if(P.hasOwnProperty(a)){if(c.na)return;S("Cannot register type '"+d+"' twice")}P[a]=b;delete Na[a];O.hasOwnProperty(a)&&(b=O[a],delete O[a],b.forEach(function(e){e()}))}var Wa=[],T=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
|
||||
function Xa(a){4<a&&0===--T[a].fa&&(T[a]=void 0,Wa.push(a))}function Ya(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=Wa.length?Wa.pop():T.length;T[b]={fa:1,value:a};return b}}function Za(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}
|
||||
function $a(a,b){switch(b){case 2:return function(c){return this.fromWireType(wa[c>>2])};case 3:return function(c){return this.fromWireType(xa[c>>3])};default:throw new TypeError("Unknown float type: "+a);}}function ab(a){var b=Function;if(!(b instanceof Function))throw new TypeError("new_ called with constructor type "+typeof b+" which is not a function");var c=Pa(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c}
|
||||
function bb(a,b){var c=f;if(void 0===c[a].ba){var d=c[a];c[a]=function(){c[a].ba.hasOwnProperty(arguments.length)||S("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+c[a].ba+")!");return c[a].ba[arguments.length].apply(this,arguments)};c[a].ba=[];c[a].ba[d.ha]=d}}
|
||||
function cb(a,b,c){f.hasOwnProperty(a)?((void 0===c||void 0!==f[a].ba&&void 0!==f[a].ba[c])&&S("Cannot register public name '"+a+"' twice"),bb(a,a),f.hasOwnProperty(c)&&S("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),f[a].ba[c]=b):(f[a]=b,void 0!==c&&(f[a].wa=c))}function db(a,b){for(var c=[],d=0;d<a;d++)c.push(E[(b>>2)+d]);return c}
|
||||
function eb(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 e;-1!=a.indexOf("j")?e=c&&c.length?f["dynCall_"+a].apply(null,[b].concat(c)):f["dynCall_"+a].call(null,b):e=H.get(b).apply(null,c);return e}}
|
||||
function U(a,b){a=R(a);var c=-1!=a.indexOf("j")?eb(a,b):H.get(b);"function"!==typeof c&&S("unknown function pointer with signature "+a+": "+b);return c}var fb=void 0;function gb(a){a=hb(a);var b=R(a);W(a);return b}function ib(a,b){function c(g){e[g]||P[g]||(Na[g]?Na[g].forEach(c):(d.push(g),e[g]=!0))}var d=[],e={};b.forEach(c);throw new fb(a+": "+d.map(gb).join([", "]));}
|
||||
function jb(a,b,c){switch(b){case 0:return c?function(d){return va[d]}:function(d){return B[d]};case 1:return c?function(d){return D[d>>1]}:function(d){return C[d>>1]};case 2:return c?function(d){return E[d>>2]}:function(d){return G[d>>2]};default:throw new TypeError("Unknown integer type: "+a);}}var kb={};function lb(){return"object"===typeof globalThis?globalThis:Function("return this")()}function mb(a,b){var c=P[a];void 0===c&&S(b+" has unknown type "+gb(a));return c}var nb={};
|
||||
Ra=f.InternalError=Qa("InternalError");for(var ob=Array(256),pb=0;256>pb;++pb)ob[pb]=String.fromCharCode(pb);Ua=ob;Va=f.BindingError=Qa("BindingError");f.count_emval_handles=function(){for(var a=0,b=5;b<T.length;++b)void 0!==T[b]&&++a;return a};f.get_first_emval=function(){for(var a=5;a<T.length;++a)if(void 0!==T[a])return T[a];return null};fb=f.UnboundTypeError=Qa("UnboundTypeError");Ba.push({ja:function(){qb()}});
|
||||
var Ab={N:function(){},t:function(){return 0},G:function(){return 0},H:function(){},A:function(a){var b=N[a];delete N[a];var c=b.oa,d=b.pa,e=b.ga,g=e.map(function(h){return h.ma}).concat(e.map(function(h){return h.ra}));Sa([a],g,function(h){var k={};e.forEach(function(l,n){var m=h[n],p=l.ka,r=l.la,z=h[n+e.length],q=l.qa,ea=l.sa;k[l.ia]={read:function(A){return m.fromWireType(p(r,A))},write:function(A,I){var V=[];q(ea,A,z.toWireType(V,I));La(V)}}});return[{name:b.name,fromWireType:function(l){var n=
|
||||
{},m;for(m in k)n[m]=k[m].read(l);d(l);return n},toWireType:function(l,n){for(var m in k)if(!(m in n))throw new TypeError('Missing field: "'+m+'"');var p=c();for(m in k)k[m].write(p,n[m]);null!==l&&l.push(d,p);return p},argPackAdvance:8,readValueFromPointer:Ma,da:d}]})},J:function(a,b,c,d,e){var g=Ta(c);b=R(b);Q(a,{name:b,fromWireType:function(h){return!!h},toWireType:function(h,k){return k?d:e},argPackAdvance:8,readValueFromPointer:function(h){if(1===c)var k=va;else if(2===c)k=D;else if(4===c)k=
|
||||
E;else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(k[h>>g])},da:null})},I:function(a,b){b=R(b);Q(a,{name:b,fromWireType:function(c){var d=T[c].value;Xa(c);return d},toWireType:function(c,d){return Ya(d)},argPackAdvance:8,readValueFromPointer:Ma,da:null})},w:function(a,b,c){c=Ta(c);b=R(b);Q(a,{name:b,fromWireType:function(d){return d},toWireType:function(d,e){if("number"!==typeof e&&"boolean"!==typeof e)throw new TypeError('Cannot convert "'+Za(e)+'" to '+this.name);
|
||||
return e},argPackAdvance:8,readValueFromPointer:$a(b,c),da:null})},z:function(a,b,c,d,e,g){var h=db(b,c);a=R(a);e=U(d,e);cb(a,function(){ib("Cannot call "+a+" due to unbound types",h)},b-1);Sa([],h,function(k){var l=[k[0],null].concat(k.slice(1)),n=k=a,m=e,p=l.length;2>p&&S("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var r=null!==l[1]&&!1,z=!1,q=1;q<l.length;++q)if(null!==l[q]&&void 0===l[q].da){z=!0;break}var ea="void"!==l[0].name,A="",I="";for(q=0;q<p-2;++q)A+=
|
||||
(0!==q?", ":"")+"arg"+q,I+=(0!==q?", ":"")+"arg"+q+"Wired";n="return function "+Oa(n)+"("+A+") {\nif (arguments.length !== "+(p-2)+") {\nthrowBindingError('function "+n+" called with ' + arguments.length + ' arguments, expected "+(p-2)+" args!');\n}\n";z&&(n+="var destructors = [];\n");var V=z?"destructors":"null";A="throwBindingError invoker fn runDestructors retType classParam".split(" ");m=[S,m,g,La,l[0],l[1]];r&&(n+="var thisWired = classParam.toWireType("+V+", this);\n");for(q=0;q<p-2;++q)n+=
|
||||
"var arg"+q+"Wired = argType"+q+".toWireType("+V+", arg"+q+"); // "+l[q+2].name+"\n",A.push("argType"+q),m.push(l[q+2]);r&&(I="thisWired"+(0<I.length?", ":"")+I);n+=(ea?"var rv = ":"")+"invoker(fn"+(0<I.length?", ":"")+I+");\n";if(z)n+="runDestructors(destructors);\n";else for(q=r?1:2;q<l.length;++q)p=1===q?"thisWired":"arg"+(q-2)+"Wired",null!==l[q].da&&(n+=p+"_dtor("+p+"); // "+l[q].name+"\n",A.push(p+"_dtor"),m.push(l[q].da));ea&&(n+="var ret = retType.fromWireType(rv);\nreturn ret;\n");A.push(n+
|
||||
"}\n");l=ab(A).apply(null,m);q=b-1;if(!f.hasOwnProperty(k))throw new Ra("Replacing nonexistant public symbol");void 0!==f[k].ba&&void 0!==q?f[k].ba[q]=l:(f[k]=l,f[k].ha=q);return[]})},j:function(a,b,c,d,e){function g(n){return n}b=R(b);-1===e&&(e=4294967295);var h=Ta(c);if(0===d){var k=32-8*c;g=function(n){return n<<k>>>k}}var l=-1!=b.indexOf("unsigned");Q(a,{name:b,fromWireType:g,toWireType:function(n,m){if("number"!==typeof m&&"boolean"!==typeof m)throw new TypeError('Cannot convert "'+Za(m)+'" to '+
|
||||
this.name);if(m<d||m>e)throw new TypeError('Passing a number "'+Za(m)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+d+", "+e+"]!");return l?m>>>0:m|0},argPackAdvance:8,readValueFromPointer:jb(b,h,0!==d),da:null})},f:function(a,b,c){function d(g){g>>=2;var h=G;return new e(F,h[g+1],h[g])}var e=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];c=R(c);Q(a,{name:c,fromWireType:d,argPackAdvance:8,readValueFromPointer:d},
|
||||
{na:!0})},x:function(a,b){b=R(b);var c="std::string"===b;Q(a,{name:b,fromWireType:function(d){var e=G[d>>2];if(c)for(var g=d+4,h=0;h<=e;++h){var k=d+4+h;if(h==e||0==B[k]){if(g){for(var l=g+(k-g),n=g;!(n>=l)&&B[n];)++n;g=ma.decode(B.subarray(g,n))}else g="";if(void 0===m)var m=g;else m+=String.fromCharCode(0),m+=g;g=k+1}}else{m=Array(e);for(h=0;h<e;++h)m[h]=String.fromCharCode(B[d+4+h]);m=m.join("")}W(d);return m},toWireType:function(d,e){e instanceof ArrayBuffer&&(e=new Uint8Array(e));var g="string"===
|
||||
typeof e;g||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int8Array||S("Cannot pass non-string to std::string");var h=(c&&g?function(){for(var n=0,m=0;m<e.length;++m){var p=e.charCodeAt(m);55296<=p&&57343>=p&&(p=65536+((p&1023)<<10)|e.charCodeAt(++m)&1023);127>=p?++n:n=2047>=p?n+2:65535>=p?n+3:n+4}return n}:function(){return e.length})(),k=rb(4+h+1);G[k>>2]=h;if(c&&g)na(e,k+4,h+1);else if(g)for(g=0;g<h;++g){var l=e.charCodeAt(g);255<l&&(W(k),S("String has UTF-16 code units that do not fit in 8 bits"));
|
||||
B[k+4+g]=l}else for(g=0;g<h;++g)B[k+4+g]=e[g];null!==d&&d.push(W,k);return k},argPackAdvance:8,readValueFromPointer:Ma,da:function(d){W(d)}})},q:function(a,b,c){c=R(c);if(2===b){var d=pa;var e=qa;var g=ra;var h=function(){return C};var k=1}else 4===b&&(d=sa,e=ta,g=ua,h=function(){return G},k=2);Q(a,{name:c,fromWireType:function(l){for(var n=G[l>>2],m=h(),p,r=l+4,z=0;z<=n;++z){var q=l+4+z*b;if(z==n||0==m[q>>k])r=d(r,q-r),void 0===p?p=r:(p+=String.fromCharCode(0),p+=r),r=q+b}W(l);return p},toWireType:function(l,
|
||||
n){"string"!==typeof n&&S("Cannot pass non-string to C++ string type "+c);var m=g(n),p=rb(4+m+b);G[p>>2]=m>>k;e(n,p+4,m+b);null!==l&&l.push(W,p);return p},argPackAdvance:8,readValueFromPointer:Ma,da:function(l){W(l)}})},B:function(a,b,c,d,e,g){N[a]={name:R(b),oa:U(c,d),pa:U(e,g),ga:[]}},g:function(a,b,c,d,e,g,h,k,l,n){N[a].ga.push({ia:R(b),ma:c,ka:U(d,e),la:g,ra:h,qa:U(k,l),sa:n})},K:function(a,b){b=R(b);Q(a,{va:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},l:Xa,
|
||||
M:function(a){if(0===a)return Ya(lb());var b=kb[a];a=void 0===b?R(a):b;return Ya(lb()[a])},y:function(a){4<a&&(T[a].fa+=1)},D:function(a,b,c,d){a||S("Cannot use deleted val. handle = "+a);a=T[a].value;var e=nb[b];if(!e){e="";for(var g=0;g<b;++g)e+=(0!==g?", ":"")+"arg"+g;var h="return function emval_allocator_"+b+"(constructor, argTypes, args) {\n";for(g=0;g<b;++g)h+="var argType"+g+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+g+'], "parameter '+g+'");\nvar arg'+g+" = argType"+
|
||||
g+".readValueFromPointer(args);\nargs += argType"+g+"['argPackAdvance'];\n";e=(new Function("requireRegisteredType","Module","__emval_register",h+("var obj = new constructor("+e+");\nreturn __emval_register(obj);\n}\n")))(mb,f,Ya);nb[b]=e}return e(a,c,d)},i:function(){v()},e:function(a,b){X(a,b||1);throw"longjmp";},E:function(a,b,c){B.copyWithin(a,b,b+c)},k: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{y.grow(Math.min(2147483648,d)-F.byteLength+65535>>>16);ya(y.buffer);var e=1;break a}catch(g){}e=void 0}if(e)return!0}return!1},v:function(){return 0},F:function(a,b,c,d){a=Ka.ua(a);b=Ka.ta(a,b,c);E[d>>2]=b;return 0},C:function(){},u:function(a,b,c,d){for(var e=0,g=0;g<c;g++){for(var h=E[b+8*g>>2],k=E[b+(8*g+4)>>2],l=0;l<k;l++){var n=B[h+l],m=Ja[a];if(0===n||10===n){n=1===a?ja:w;var p;for(p=0;m[p]&&!(NaN<=p);)++p;p=ma.decode(m.subarray?m.subarray(0,p):new Uint8Array(m.slice(0,
|
||||
p)));n(p);m.length=0}else m.push(n)}e+=k}E[d>>2]=e;return 0},c:function(){return ka|0},s:sb,n:tb,r:ub,o:vb,p:wb,h:xb,d:yb,m:zb,a:y,b:function(a){ka=a|0},L:function(a){var b=Date.now()/1E3|0;a&&(E[a>>2]=b);return b}};
|
||||
(function(){function a(e){f.asm=e.exports;H=f.asm.O;J--;f.monitorRunDependencies&&f.monitorRunDependencies(J);0==J&&(null!==Fa&&(clearInterval(Fa),Fa=null),K&&(e=K,K=null,e()))}function b(e){a(e.instance)}function c(e){return Promise.resolve().then(Ia).then(function(g){return WebAssembly.instantiate(g,d)}).then(e,function(g){w("failed to asynchronously prepare wasm: "+g);v(g)})}var d={a:Ab};J++;f.monitorRunDependencies&&f.monitorRunDependencies(J);if(f.instantiateWasm)try{return f.instantiateWasm(d,
|
||||
a)}catch(e){return w("Module.instantiateWasm callback failed with error: "+e),!1}(function(){return x||"function"!==typeof WebAssembly.instantiateStreaming||Ga()||"function"!==typeof fetch?c(b):fetch(L,{credentials:"same-origin"}).then(function(e){return WebAssembly.instantiateStreaming(e,d).then(b,function(g){w("wasm streaming compile failed: "+g);w("falling back to ArrayBuffer instantiation");return c(b)})})})().catch(ba);return{}})();
|
||||
var qb=f.___wasm_call_ctors=function(){return(qb=f.___wasm_call_ctors=f.asm.P).apply(null,arguments)},rb=f._malloc=function(){return(rb=f._malloc=f.asm.Q).apply(null,arguments)},W=f._free=function(){return(W=f._free=f.asm.R).apply(null,arguments)},hb=f.___getTypeName=function(){return(hb=f.___getTypeName=f.asm.S).apply(null,arguments)};f.___embind_register_native_and_builtin_types=function(){return(f.___embind_register_native_and_builtin_types=f.asm.T).apply(null,arguments)};
|
||||
var Y=f.stackSave=function(){return(Y=f.stackSave=f.asm.U).apply(null,arguments)},Z=f.stackRestore=function(){return(Z=f.stackRestore=f.asm.V).apply(null,arguments)},X=f._setThrew=function(){return(X=f._setThrew=f.asm.W).apply(null,arguments)};f.dynCall_jiiiiiiiii=function(){return(f.dynCall_jiiiiiiiii=f.asm.X).apply(null,arguments)};f.dynCall_jiji=function(){return(f.dynCall_jiji=f.asm.Y).apply(null,arguments)};f.dynCall_jiiiiiiii=function(){return(f.dynCall_jiiiiiiii=f.asm.Z).apply(null,arguments)};
|
||||
f.dynCall_jiiiiii=function(){return(f.dynCall_jiiiiii=f.asm._).apply(null,arguments)};f.dynCall_jiiiii=function(){return(f.dynCall_jiiiii=f.asm.$).apply(null,arguments)};f.dynCall_iiijii=function(){return(f.dynCall_iiijii=f.asm.aa).apply(null,arguments)};function wb(a,b){var c=Y();try{H.get(a)(b)}catch(d){Z(c);if(d!==d+0&&"longjmp"!==d)throw d;X(1,0)}}function yb(a,b,c,d,e){var g=Y();try{H.get(a)(b,c,d,e)}catch(h){Z(g);if(h!==h+0&&"longjmp"!==h)throw h;X(1,0)}}
|
||||
function xb(a,b,c){var d=Y();try{H.get(a)(b,c)}catch(e){Z(d);if(e!==e+0&&"longjmp"!==e)throw e;X(1,0)}}function vb(a,b,c,d,e,g,h,k,l,n){var m=Y();try{return H.get(a)(b,c,d,e,g,h,k,l,n)}catch(p){Z(m);if(p!==p+0&&"longjmp"!==p)throw p;X(1,0)}}function sb(a,b,c){var d=Y();try{return H.get(a)(b,c)}catch(e){Z(d);if(e!==e+0&&"longjmp"!==e)throw e;X(1,0)}}function tb(a,b,c,d,e){var g=Y();try{return H.get(a)(b,c,d,e)}catch(h){Z(g);if(h!==h+0&&"longjmp"!==h)throw h;X(1,0)}}
|
||||
function zb(a,b,c,d,e,g,h,k,l,n,m){var p=Y();try{H.get(a)(b,c,d,e,g,h,k,l,n,m)}catch(r){Z(p);if(r!==r+0&&"longjmp"!==r)throw r;X(1,0)}}function ub(a,b,c,d,e,g,h,k,l){var n=Y();try{return H.get(a)(b,c,d,e,g,h,k,l)}catch(m){Z(n);if(m!==m+0&&"longjmp"!==m)throw m;X(1,0)}}var Bb;K=function Cb(){Bb||Db();Bb||(K=Cb)};
|
||||
function Db(){function a(){if(!Bb&&(Bb=!0,f.calledRun=!0,!la)){M(Ba);M(Ca);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();Da.unshift(b)}M(Da)}}if(!(0<J)){if(f.preRun)for("function"==typeof f.preRun&&(f.preRun=[f.preRun]);f.preRun.length;)Ea();M(Aa);0<J||(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 avif_node_enc.ready
|
||||
|
||||
Binary file not shown.
@@ -1,6 +1,6 @@
|
||||
FROM emscripten/emsdk:2.0.8
|
||||
RUN apt-get update && apt-get install -qqy autoconf libtool pkg-config
|
||||
ENV CFLAGS "-O3 -flto"
|
||||
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
|
||||
|
||||
177
codecs/hqx/Cargo.lock
generated
177
codecs/hqx/Cargo.lock
generated
@@ -4,286 +4,283 @@
|
||||
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 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wasm-bindgen 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"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.2#5f19cda24191ccc7c0c4920b6b246b4e242f377c"
|
||||
source = "git+https://github.com/CryZe/wasmboy-rs?tag=v0.1.3#d7cbae67906796928c8e451b186f3c653924beb8"
|
||||
dependencies = [
|
||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"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 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.73"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bd7d4bd64732af4bf3a67f367c27df8520ad7e230c5817b8ff485864d80242b9"
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"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 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"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 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"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 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"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 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"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 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"console_error_panic_hook 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hqx 0.1.0 (git+https://github.com/CryZe/wasmboy-rs?tag=v0.1.2)",
|
||||
"wasm-bindgen 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wasm-bindgen-test 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wee_alloc 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"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 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"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 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wasm-bindgen-macro 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"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 3.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"proc-macro2 1.0.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wasm-bindgen-shared 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"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 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"js-sys 0.3.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wasm-bindgen 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"web-sys 0.3.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"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 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wasm-bindgen-macro-support 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"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 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wasm-bindgen-backend 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wasm-bindgen-shared 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"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 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"js-sys 0.3.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wasm-bindgen 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wasm-bindgen-futures 0.3.27 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wasm-bindgen-test-macro 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"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 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"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 0.3.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wasm-bindgen 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wee_alloc"
|
||||
version = "0.4.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.73 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"memory_units 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"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 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"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"
|
||||
|
||||
[metadata]
|
||||
"checksum bumpalo 3.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820"
|
||||
"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
|
||||
"checksum console_error_panic_hook 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b8d976903543e0c48546a91908f21588a680a8c8f984df9a5d69feccb2b2a211"
|
||||
"checksum futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)" = "1b980f2816d6ee8673b6517b52cb0e808a180efc92e5c19d02cdda79066703ef"
|
||||
"checksum hqx 0.1.0 (git+https://github.com/CryZe/wasmboy-rs?tag=v0.1.2)" = "<none>"
|
||||
"checksum js-sys 0.3.42 (registry+https://github.com/rust-lang/crates.io-index)" = "52732a3d3ad72c58ad2dc70624f9c17b46ecd0943b9a4f1ee37c4c18c5d983e2"
|
||||
"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||
"checksum libc 0.2.73 (registry+https://github.com/rust-lang/crates.io-index)" = "bd7d4bd64732af4bf3a67f367c27df8520ad7e230c5817b8ff485864d80242b9"
|
||||
"checksum log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b"
|
||||
"checksum memory_units 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3"
|
||||
"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
|
||||
"checksum proc-macro2 1.0.19 (registry+https://github.com/rust-lang/crates.io-index)" = "04f5f085b5d71e2188cb8271e5da0161ad52c3f227a661a3c135fdf28e258b12"
|
||||
"checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1"
|
||||
"checksum quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37"
|
||||
"checksum scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2"
|
||||
"checksum syn 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)" = "fb7f4c519df8c117855e19dd8cc851e89eb746fe7a73f0157e0d95fdec5369b0"
|
||||
"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
|
||||
"checksum unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
|
||||
"checksum wasm-bindgen 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)" = "f3edbcc9536ab7eababcc6d2374a0b7bfe13a2b6d562c5e07f370456b1a8f33d"
|
||||
"checksum wasm-bindgen-backend 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)" = "89ed2fb8c84bfad20ea66b26a3743f3e7ba8735a69fe7d95118c33ec8fc1244d"
|
||||
"checksum wasm-bindgen-futures 0.3.27 (registry+https://github.com/rust-lang/crates.io-index)" = "83420b37346c311b9ed822af41ec2e82839bfe99867ec6c54e2da43b7538771c"
|
||||
"checksum wasm-bindgen-macro 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)" = "eb071268b031a64d92fc6cf691715ca5a40950694d8f683c5bb43db7c730929e"
|
||||
"checksum wasm-bindgen-macro-support 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)" = "cf592c807080719d1ff2f245a687cbadb3ed28b2077ed7084b47aba8b691f2c6"
|
||||
"checksum wasm-bindgen-shared 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)" = "72b6c0220ded549d63860c78c38f3bcc558d1ca3f4efa74942c536ddbbb55e87"
|
||||
"checksum wasm-bindgen-test 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)" = "a2d9693b63a742d481c7f80587e057920e568317b2806988c59cd71618bc26c1"
|
||||
"checksum wasm-bindgen-test-macro 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)" = "0789dac148a8840bbcf9efe13905463b733fa96543bfbf263790535c11af7ba5"
|
||||
"checksum web-sys 0.3.42 (registry+https://github.com/rust-lang/crates.io-index)" = "8be2398f326b7ba09815d0b403095f34dd708579220d099caae89be0b32137b2"
|
||||
"checksum wee_alloc 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e"
|
||||
"checksum winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
|
||||
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
|
||||
@@ -13,7 +13,7 @@ default = ["console_error_panic_hook", "wee_alloc"]
|
||||
cfg-if = "0.1.2"
|
||||
wasm-bindgen = "0.2.38"
|
||||
# lazy_static = "1.0.0"
|
||||
hqx = {git = "https://github.com/CryZe/wasmboy-rs", tag="v0.1.2"}
|
||||
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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hqx",
|
||||
"scripts": {
|
||||
"build": "RUST_IMG=rust:1.40 ../build-rust.sh"
|
||||
"build": "../build-rust.sh"
|
||||
}
|
||||
}
|
||||
|
||||
54
codecs/hqx/pkg/squooshhqx.d.ts
generated
vendored
54
codecs/hqx/pkg/squooshhqx.d.ts
generated
vendored
@@ -1,48 +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;
|
||||
* @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 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 resize: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
||||
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>;
|
||||
* 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>;
|
||||
|
||||
136
codecs/hqx/pkg/squooshhqx.js
generated
136
codecs/hqx/pkg/squooshhqx.js
generated
@@ -1,107 +1,103 @@
|
||||
|
||||
let wasm;
|
||||
|
||||
let cachegetUint32Memory0 = null;
|
||||
function getUint32Memory0() {
|
||||
if (
|
||||
cachegetUint32Memory0 === null ||
|
||||
cachegetUint32Memory0.buffer !== wasm.memory.buffer
|
||||
) {
|
||||
cachegetUint32Memory0 = new Uint32Array(wasm.memory.buffer);
|
||||
}
|
||||
return cachegetUint32Memory0;
|
||||
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;
|
||||
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;
|
||||
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);
|
||||
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}
|
||||
*/
|
||||
* @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) {
|
||||
var ptr0 = passArray32ToWasm0(input_image, wasm.__wbindgen_malloc);
|
||||
var len0 = WASM_VECTOR_LEN;
|
||||
wasm.resize(8, ptr0, len0, input_width, input_height, factor);
|
||||
var r0 = getInt32Memory0()[8 / 4 + 0];
|
||||
var r1 = getInt32Memory0()[8 / 4 + 1];
|
||||
var v1 = getArrayU32FromWasm0(r0, r1).slice();
|
||||
wasm.__wbindgen_free(r0, r1 * 4);
|
||||
return v1;
|
||||
var ptr0 = passArray32ToWasm0(input_image, wasm.__wbindgen_malloc);
|
||||
var len0 = WASM_VECTOR_LEN;
|
||||
wasm.resize(8, ptr0, len0, input_width, input_height, factor);
|
||||
var r0 = getInt32Memory0()[8 / 4 + 0];
|
||||
var r1 = getInt32Memory0()[8 / 4 + 1];
|
||||
var v1 = getArrayU32FromWasm0(r0, r1).slice();
|
||||
wasm.__wbindgen_free(r0, r1 * 4);
|
||||
return v1;
|
||||
}
|
||||
|
||||
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;
|
||||
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);
|
||||
const bytes = await module.arrayBuffer();
|
||||
return await WebAssembly.instantiate(bytes, imports);
|
||||
|
||||
if (instance instanceof WebAssembly.Instance) {
|
||||
return { instance, module };
|
||||
} else {
|
||||
return instance;
|
||||
|
||||
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 = import.meta.url.replace(/\.js$/, '_bg.wasm');
|
||||
}
|
||||
const imports = {};
|
||||
if (typeof input === 'undefined') {
|
||||
input = import.meta.url.replace(/\.js$/, '_bg.wasm');
|
||||
}
|
||||
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);
|
||||
if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
|
||||
input = fetch(input);
|
||||
}
|
||||
|
||||
wasm = instance.exports;
|
||||
init.__wbindgen_wasm_module = module;
|
||||
const { instance, module } = await load(await input, imports);
|
||||
|
||||
return wasm;
|
||||
wasm = instance.exports;
|
||||
init.__wbindgen_wasm_module = module;
|
||||
|
||||
return wasm;
|
||||
}
|
||||
|
||||
export default init;
|
||||
|
||||
|
||||
Binary file not shown.
@@ -8,7 +8,7 @@ ENVIRONMENT = worker
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
all: $(OUT_JS) $(OUT_NODE_JS)
|
||||
all: $(OUT_JS)
|
||||
|
||||
imagequant_node.js: ENVIRONMENT=node
|
||||
$(OUT_JS): $(CODEC_OUT)
|
||||
@@ -27,21 +27,6 @@ $(OUT_JS): $(CODEC_OUT)
|
||||
$+ \
|
||||
imagequant.cpp
|
||||
|
||||
$(CXX) \
|
||||
-I $(CODEC_DIR) \
|
||||
${CXXFLAGS} \
|
||||
${LDFLAGS} \
|
||||
--bind \
|
||||
--closure 1 \
|
||||
-s ALLOW_MEMORY_GROWTH=1 \
|
||||
-s MODULARIZE=1 \
|
||||
-s TEXTDECODER=2 \
|
||||
-s ENVIRONMENT='node' \
|
||||
-s EXPORT_ES6=1 \
|
||||
-o $@ \
|
||||
$+ \
|
||||
imagequant.cpp
|
||||
|
||||
$(CODEC_OUT): $(CODEC_DIR)/config.mk
|
||||
$(MAKE) -C $(CODEC_DIR) $(CODEC_OUT_RELATIVE)
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,5 +1,5 @@
|
||||
CODEC_URL = https://gitlab.com/wg1/jpeg-xl.git
|
||||
CODEC_VERSION = 739e6cd1305fdec5acfa47ad414189b3d3ecb6a4
|
||||
CODEC_VERSION = ab7c5e9b6795134377aa4846ceaae2c5bc504f76
|
||||
CODEC_DIR = node_modules/jxl
|
||||
CODEC_BUILD_ROOT := $(CODEC_DIR)/build
|
||||
CODEC_MT_BUILD_DIR := $(CODEC_BUILD_ROOT)/mt
|
||||
@@ -41,8 +41,6 @@ $(OUT_JS):
|
||||
-I $(CODEC_BUILD_DIR)/lib/include \
|
||||
-I $(CODEC_DIR)/third_party/highway \
|
||||
-I $(CODEC_DIR)/third_party/skcms \
|
||||
-I $(CODEC_DIR)/third_party/brunsli \
|
||||
-I $(CODEC_DIR)/third_party/brunsli/c/include \
|
||||
--bind \
|
||||
--closure 1 \
|
||||
-s ALLOW_MEMORY_GROWTH=1 \
|
||||
@@ -53,9 +51,6 @@ $(OUT_JS):
|
||||
-s EXPORT_NAME="$(basename $(@F))" \
|
||||
-o $@ \
|
||||
$+ \
|
||||
$(CODEC_BUILD_DIR)/artifacts/libbrunslienc-static.bc \
|
||||
$(CODEC_BUILD_DIR)/artifacts/libbrunslicommon-static.bc \
|
||||
$(CODEC_BUILD_DIR)/artifacts/libbrunslidec-static.bc \
|
||||
$(CODEC_BUILD_DIR)/third_party/brotli/libbrotlidec-static.a \
|
||||
$(CODEC_BUILD_DIR)/third_party/brotli/libbrotlienc-static.a \
|
||||
$(CODEC_BUILD_DIR)/third_party/brotli/libbrotlicommon-static.a \
|
||||
|
||||
@@ -52,13 +52,14 @@ val decode(std::string data) {
|
||||
|
||||
auto next_in = (const uint8_t*)data.c_str();
|
||||
auto avail_in = data.size();
|
||||
EXPECT_EQ(JXL_DEC_BASIC_INFO, JxlDecoderProcessInput(dec.get(), &next_in, &avail_in));
|
||||
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(), &next_in, &avail_in));
|
||||
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,
|
||||
@@ -68,10 +69,15 @@ val decode(std::string data) {
|
||||
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(), &next_in, &avail_in));
|
||||
EXPECT_EQ(JXL_DEC_FULL_IMAGE, JxlDecoderProcessInput(dec.get()));
|
||||
|
||||
auto byte_pixels = std::make_unique<uint8_t[]>(component_count);
|
||||
// Convert to sRGB.
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -2,8 +2,8 @@
|
||||
#include <emscripten/val.h>
|
||||
|
||||
#include "lib/jxl/base/thread_pool_internal.h"
|
||||
#include "lib/jxl/enc_external_image.h"
|
||||
#include "lib/jxl/enc_file.h"
|
||||
#include "lib/jxl/external_image.h"
|
||||
|
||||
using namespace emscripten;
|
||||
|
||||
@@ -18,6 +18,7 @@ struct JXLOptions {
|
||||
int epf;
|
||||
int nearLossless;
|
||||
bool lossyPalette;
|
||||
size_t decodingSpeedTier;
|
||||
};
|
||||
|
||||
val encode(std::string image, int width, int height, JXLOptions options) {
|
||||
@@ -35,6 +36,7 @@ val encode(std::string image, int width, int height, JXLOptions options) {
|
||||
cparams.epf = options.epf;
|
||||
cparams.speed_tier = static_cast<jxl::SpeedTier>(options.speed);
|
||||
cparams.near_lossless = options.nearLossless;
|
||||
cparams.decoding_speed_tier = options.decodingSpeedTier;
|
||||
|
||||
if (options.lossyPalette) {
|
||||
cparams.lossy_palette = true;
|
||||
@@ -42,17 +44,6 @@ val encode(std::string image, int width, int height, JXLOptions options) {
|
||||
cparams.options.predictor = jxl::Predictor::Zero;
|
||||
}
|
||||
|
||||
// Reduce memory usage of tree learning for lossless data.
|
||||
// TODO(veluca93): this is a mitigation for excessive memory usage in the JXL encoder.
|
||||
float megapixels = width * height * 0.000001;
|
||||
if (megapixels > 8) {
|
||||
cparams.options.nb_repeats = 0.1;
|
||||
} else if (megapixels > 4) {
|
||||
cparams.options.nb_repeats = 0.3;
|
||||
} else {
|
||||
// default is OK.
|
||||
}
|
||||
|
||||
float quality = options.quality;
|
||||
|
||||
// Quality settings roughly match libjpeg qualities.
|
||||
@@ -99,11 +90,11 @@ val encode(std::string image, int width, int height, JXLOptions options) {
|
||||
|
||||
uint8_t* inBuffer = (uint8_t*)image.c_str();
|
||||
|
||||
auto result = jxl::ConvertImage(
|
||||
auto result = jxl::ConvertFromExternal(
|
||||
jxl::Span<const uint8_t>(reinterpret_cast<const uint8_t*>(image.data()), image.size()), width,
|
||||
height, jxl::ColorEncoding::SRGB(/*is_gray=*/false), /*has_alpha=*/true,
|
||||
/*alpha_is_premultiplied=*/false, /*bits_per_alpha=*/8, /*bits_per_sample=*/8,
|
||||
/*big_endian=*/false, /*flipped_y=*/false, pool_ptr, main);
|
||||
/*alpha_is_premultiplied=*/false, /*bits_per_sample=*/8, /*endiannes=*/JXL_LITTLE_ENDIAN,
|
||||
/*flipped_y=*/false, pool_ptr, main);
|
||||
|
||||
if (!result) {
|
||||
return val::null();
|
||||
@@ -124,6 +115,7 @@ EMSCRIPTEN_BINDINGS(my_module) {
|
||||
.field("progressive", &JXLOptions::progressive)
|
||||
.field("nearLossless", &JXLOptions::nearLossless)
|
||||
.field("lossyPalette", &JXLOptions::lossyPalette)
|
||||
.field("decodingSpeedTier", &JXLOptions::decodingSpeedTier)
|
||||
.field("epf", &JXLOptions::epf);
|
||||
|
||||
function("encode", &encode);
|
||||
|
||||
1
codecs/jxl/enc/jxl_enc.d.ts
vendored
1
codecs/jxl/enc/jxl_enc.d.ts
vendored
@@ -5,6 +5,7 @@ export interface EncodeOptions {
|
||||
epf: number;
|
||||
nearLossless: number;
|
||||
lossyPalette: boolean;
|
||||
decodingSpeedTier: number;
|
||||
}
|
||||
|
||||
export interface JXLModule extends EmscriptenWasm.Module {
|
||||
|
||||
4
codecs/jxl/enc/jxl_enc.js
generated
4
codecs/jxl/enc/jxl_enc.js
generated
@@ -50,9 +50,9 @@ v.push(p+"}\n");k=Ya(v).apply(null,q);l=b-1;if(!f.hasOwnProperty(n))throw new Oa
|
||||
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 = "+
|
||||
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:[]}},e: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++>>
|
||||
f,Va);kb[b]=g}return g(a,c,d)},b:function(){C()},t:function(a,b,c){E.copyWithin(a,b,b+c)},f: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: "+
|
||||
|
||||
Binary file not shown.
27
codecs/jxl/enc/jxl_enc_mt.js
generated
27
codecs/jxl/enc/jxl_enc_mt.js
generated
@@ -17,7 +17,7 @@ function Da(a){return 2*a.length}function Ea(a,b){for(var c=0,d="";!(c>=b/4);){v
|
||||
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={60341:function(a,b){setTimeout(function(){Ta(a,b)},0)},60419:function(){throw"Canceled!";}};
|
||||
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={60485:function(a,b){setTimeout(function(){Ta(a,b)},0)},60563: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)}
|
||||
@@ -77,10 +77,10 @@ r){if("number"!==typeof r&&"boolean"!==typeof r)throw new TypeError('Cannot conv
|
||||
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"});
|
||||
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:[]}},k: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%
|
||||
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)},l: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+
|
||||
@@ -89,17 +89,16 @@ 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;
|
||||
(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=3060056;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)};
|
||||
D.___embind_register_native_and_builtin_types=function(){return(D.___embind_register_native_and_builtin_types=D.asm.ca).apply(null,arguments)};var oc=D._emscripten_get_global_libc=function(){return(oc=D._emscripten_get_global_libc=D.asm.da).apply(null,arguments)};D.___em_js__initPthreadsJS=function(){return(D.___em_js__initPthreadsJS=D.asm.ea).apply(null,arguments)};
|
||||
var 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=74984;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();
|
||||
|
||||
|
||||
Binary file not shown.
27
codecs/jxl/enc/jxl_enc_mt_simd.js
generated
27
codecs/jxl/enc/jxl_enc_mt_simd.js
generated
@@ -17,7 +17,7 @@ function Da(a){return 2*a.length}function Ea(a,b){for(var c=0,d="";!(c>=b/4);){v
|
||||
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={60389:function(a,b){setTimeout(function(){Ta(a,b)},0)},60467:function(){throw"Canceled!";}};
|
||||
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={60549:function(a,b){setTimeout(function(){Ta(a,b)},0)},60627: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)}
|
||||
@@ -78,10 +78,10 @@ r){if("number"!==typeof r&&"boolean"!==typeof r)throw new TypeError('Cannot conv
|
||||
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"});
|
||||
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:[]}},k: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%
|
||||
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)},l: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+
|
||||
@@ -90,17 +90,16 @@ 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;
|
||||
(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=3060104;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)};
|
||||
D.___embind_register_native_and_builtin_types=function(){return(D.___embind_register_native_and_builtin_types=D.asm.ca).apply(null,arguments)};var oc=D._emscripten_get_global_libc=function(){return(oc=D._emscripten_get_global_libc=D.asm.da).apply(null,arguments)};D.___em_js__initPthreadsJS=function(){return(D.___em_js__initPthreadsJS=D.asm.ea).apply(null,arguments)};
|
||||
var 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=75048;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();
|
||||
|
||||
|
||||
Binary file not shown.
4
codecs/jxl/enc/jxl_node_enc.js
generated
4
codecs/jxl/enc/jxl_node_enc.js
generated
@@ -50,9 +50,9 @@ v.push(q+"}\n");k=$a(v).apply(null,p);l=b-1;if(!f.hasOwnProperty(m))throw new Qa
|
||||
readValueFromPointer:d},{ka:!0})},k:function(a,b){b=V(b);var c="std::string"===b;T(a,{name:b,fromWireType:function(d){var g=J[d>>2];if(c)for(var h=d+4,n=0;n<=g;++n){var m=d+4+n;if(n==g||0==D[m]){h=ma(h,m-h);if(void 0===k)var k=h;else k+=String.fromCharCode(0),k+=h;h=m+1}}else{k=Array(g);for(n=0;n<g;++n)k[n]=String.fromCharCode(D[d+4+n]);k=k.join("")}Z(d);return k},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||W("Cannot pass non-string to std::string");var n=(c&&h?function(){return oa(g)}:function(){return g.length})(),m=Bb(4+n+1);J[m>>2]=n;if(c&&h)na(g,D,m+4,n+1);else if(h)for(h=0;h<n;++h){var k=g.charCodeAt(h);255<k&&(Z(m),W("String has UTF-16 code units that do not fit in 8 bits"));D[m+4+h]=k}else for(h=0;h<n;++h)D[m+4+h]=g[h];null!==d&&d.push(Z,m);return m},argPackAdvance:8,readValueFromPointer:La,T:function(d){Z(d)}})},h:function(a,b,c){c=V(c);if(2===b){var d=
|
||||
qa;var g=ra;var h=sa;var n=function(){return E};var m=1}else 4===b&&(d=ta,g=ua,h=va,n=function(){return J},m=2);T(a,{name:c,fromWireType:function(k){for(var q=J[k>>2],p=n(),r,x=k+4,e=0;e<=q;++e){var l=k+4+e*b;if(e==q||0==p[l>>m])x=d(x,l-x),void 0===r?r=x:(r+=String.fromCharCode(0),r+=x),x=l+b}Z(k);return r},toWireType:function(k,q){"string"!==typeof q&&W("Cannot pass non-string to C++ string type "+c);var p=h(q),r=Bb(4+p+b);J[r>>2]=p>>m;g(q,r+4,p+b);null!==k&&k.push(Z,r);return r},argPackAdvance:8,
|
||||
readValueFromPointer:La,T:function(k){Z(k)}})},n:function(a,b,c,d,g,h){Q[a]={name:V(b),ma:Y(c,d),na:Y(g,h),ba:[]}},f:function(a,b,c,d,g,h,n,m,k,q){Q[a].ba.push({fa:V(b),ja:c,ha:Y(d,g),ia:h,ua:n,ta:Y(m,k),va:q})},A:function(a,b){b=V(b);T(a,{Aa:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},g:Wa,C:function(a){if(0===a)return Xa(kb());var b=jb[a];a=void 0===b?V(a):b;return Xa(kb()[a])},B:function(a){4<a&&(X[a].aa+=1)},o:function(a,b,c,d){a||W("Cannot use deleted val. handle = "+
|
||||
readValueFromPointer:La,T:function(k){Z(k)}})},n:function(a,b,c,d,g,h){Q[a]={name:V(b),ma:Y(c,d),na:Y(g,h),ba:[]}},e:function(a,b,c,d,g,h,n,m,k,q){Q[a].ba.push({fa:V(b),ja:c,ha:Y(d,g),ia:h,ua:n,ta:Y(m,k),va:q})},A:function(a,b){b=V(b);T(a,{Aa:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},g:Wa,C:function(a){if(0===a)return Xa(kb());var b=jb[a];a=void 0===b?V(a):b;return Xa(kb()[a])},B:function(a){4<a&&(X[a].aa+=1)},o:function(a,b,c,d){a||W("Cannot use deleted val. handle = "+
|
||||
a);a=X[a].value;var g=mb[b];if(!g){g="";for(var h=0;h<b;++h)g+=(0!==h?", ":"")+"arg"+h;var n="return function emval_allocator_"+b+"(constructor, argTypes, args) {\n";for(h=0;h<b;++h)n+="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",n+("var obj = new constructor("+g+");\nreturn __emval_register(obj);\n}\n")))(lb,
|
||||
f,Xa);mb[b]=g}return g(a,c,d)},b:function(){y()},t:function(a,b,c){D.copyWithin(a,b,b+c)},e:function(a){a>>>=0;var b=D.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{C.grow(Math.min(2147483648,d)-H.byteLength+65535>>>16);ya(C.buffer);var g=1;break a}catch(h){}g=void 0}if(g)return!0}return!1},v:function(a,b){var c=0;ob().forEach(function(d,g){var h=b+c;g=G[a+4*g>>2]=h;for(h=0;h<d.length;++h)I[g++>>
|
||||
f,Xa);mb[b]=g}return g(a,c,d)},b:function(){y()},t:function(a,b,c){D.copyWithin(a,b,b+c)},f:function(a){a>>>=0;var b=D.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{C.grow(Math.min(2147483648,d)-H.byteLength+65535>>>16);ya(C.buffer);var g=1;break a}catch(h){}g=void 0}if(g)return!0}return!1},v:function(a,b){var c=0;ob().forEach(function(d,g){var h=b+c;g=G[a+4*g>>2]=h;for(h=0;h<d.length;++h)I[g++>>
|
||||
0]=d.charCodeAt(h);I[g>>0]=0;c+=d.length+1});return 0},w:function(a,b){var c=ob();G[a>>2]=c.length;var d=0;c.forEach(function(g){d+=g.length+1});G[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 n=G[b+8*h>>2],m=G[b+(8*h+4)>>2],k=0;k<m;k++){var q=D[n+k],p=qb[a];if(0===q||10===q){q=1===a?ja:z;var r;for(r=0;p[r]&&!(NaN<=r);)++r;r=la.decode(p.subarray?p.subarray(0,r):new Uint8Array(p.slice(0,r)));q(r);p.length=0}else p.push(q)}g+=m}G[d>>2]=
|
||||
g;return 0},a:C,s:function(){},u:function(a,b,c,d){return wb(a,b,c,d)}};
|
||||
(function(){function a(g){f.asm=g.exports;K=f.asm.E;L--;f.monitorRunDependencies&&f.monitorRunDependencies(L);0==L&&(null!==Fa&&(clearInterval(Fa),Fa=null),M&&(g=M,M=null,g()))}function b(g){a(g.instance)}function c(g){return Promise.resolve().then(Ia).then(function(h){return WebAssembly.instantiate(h,d)}).then(g,function(h){z("failed to asynchronously prepare wasm: "+h);y(h)})}var d={a:Cb};L++;f.monitorRunDependencies&&f.monitorRunDependencies(L);if(f.instantiateWasm)try{return f.instantiateWasm(d,
|
||||
|
||||
Binary file not shown.
@@ -46,7 +46,10 @@ $(CODEC_DIR)/Makefile: $(CODEC_DIR)/configure
|
||||
--without-turbojpeg \
|
||||
--without-simd \
|
||||
--without-arith-enc \
|
||||
--without-arith-dec
|
||||
--without-arith-dec \
|
||||
--with-build-date=squoosh
|
||||
# ^ If not provided with a dummy value, MozJPEG includes a build date in the
|
||||
# binary as part of the version string, making binaries different each time.
|
||||
|
||||
$(CODEC_DIR)/configure: $(CODEC_DIR)/configure.ac
|
||||
cd $(CODEC_DIR) && autoreconf -iv
|
||||
|
||||
Binary file not shown.
@@ -141,6 +141,7 @@ val encode(std::string image_in, int image_width, int image_height, MozJpegOptio
|
||||
jpeg_c_set_bool_param(&cinfo, JBOOLEAN_TRELLIS_EOB_OPT, opts.trellis_opt_zero);
|
||||
jpeg_c_set_bool_param(&cinfo, JBOOLEAN_TRELLIS_Q_OPT, opts.trellis_opt_table);
|
||||
jpeg_c_set_int_param(&cinfo, JINT_TRELLIS_NUM_LOOPS, opts.trellis_loops);
|
||||
jpeg_c_set_int_param(&cinfo, JINT_DC_SCAN_OPT_MODE, 0);
|
||||
|
||||
// A little hacky to build a string for this, but it means we can use
|
||||
// set_quality_ratings which does some useful heuristic stuff.
|
||||
|
||||
Binary file not shown.
Binary file not shown.
137
codecs/oxipng/Cargo.lock
generated
137
codecs/oxipng/Cargo.lock
generated
@@ -1,5 +1,7 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "adler"
|
||||
version = "0.2.3"
|
||||
@@ -20,9 +22,9 @@ checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
|
||||
|
||||
[[package]]
|
||||
name = "bit-vec"
|
||||
version = "0.6.2"
|
||||
version = "0.6.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5f0dc55f2d8a1a85650ac47858bb001b4c0dd73d79e3c455a842925e68d29cd3"
|
||||
checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
@@ -56,9 +58,9 @@ checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de"
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.62"
|
||||
version = "1.0.66"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f1770ced377336a88a67c473594ccc14eca6f4559217c34f64aac8f83d641b40"
|
||||
checksum = "4c0496836a84f8d0495758516b8621a622beb77c0fed418570e50764093ced48"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
@@ -98,9 +100,9 @@ checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
|
||||
|
||||
[[package]]
|
||||
name = "const_fn"
|
||||
version = "0.4.3"
|
||||
version = "0.4.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c478836e029dcef17fb47c89023448c64f781a046e0300e257ad8225ae59afab"
|
||||
checksum = "28b9d6de7f49e22cf97ad17fc4036ece69300032f45f78f30b4a4482cdc3f4a6"
|
||||
|
||||
[[package]]
|
||||
name = "crc"
|
||||
@@ -143,9 +145,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-epoch"
|
||||
version = "0.9.0"
|
||||
version = "0.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ec0f606a85340376eef0d6d8fec399e6d4a544d648386c6645eb6d0653b27d9f"
|
||||
checksum = "a1aaa739f95311c2c7887a76863f500026092fb1dce0161dab577e559ef3569d"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"const_fn",
|
||||
@@ -157,13 +159,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.8.0"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ec91540d98355f690a86367e566ecad2e9e579f230230eb7c21398372be73ea5"
|
||||
checksum = "02d96d1e189ef58269ebe5b97953da3274d83a93af647c2ddd6f9dab28cedb8d"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"cfg-if 1.0.0",
|
||||
"const_fn",
|
||||
"lazy_static",
|
||||
]
|
||||
|
||||
@@ -200,9 +201,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "image"
|
||||
version = "0.23.11"
|
||||
version = "0.23.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b4f0a8345b33b082aedec2f4d7d4a926b845cee184cbe78b703413066564431b"
|
||||
checksum = "7ce04077ead78e39ae8610ad26216aed811996b043d47beed5090db674f9e9b5"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"byteorder",
|
||||
@@ -215,9 +216,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "1.6.0"
|
||||
version = "1.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "55e2e4c765aa53a0424761bf9f41aa7a6ac1efa87238f59560640e27fca028f2"
|
||||
checksum = "4fb1fa934250de4de8aef298d81c729a7d33d8c239daa3a7575e6b92bfc7313b"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"hashbrown",
|
||||
@@ -226,13 +227,22 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.9.0"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b"
|
||||
checksum = "37d572918e350e82412fe766d24b15e6682fb2ed2bbe018280caa810397cb319"
|
||||
dependencies = [
|
||||
"either",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
version = "0.3.48"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc9f84f9b115ce7843d60706df1422a916680bfdfcbdb0447c5614ff9d7e4d78"
|
||||
dependencies = [
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "1.4.0"
|
||||
@@ -241,24 +251,24 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.80"
|
||||
version = "0.2.81"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4d58d1b70b004888f764dfbf6a26a3b0342a1632d33968e4a179d8011c760614"
|
||||
checksum = "1482821306169ec4d07f6aca392a4681f66c75c9918aa49641a2595db64053cb"
|
||||
|
||||
[[package]]
|
||||
name = "libdeflate-sys"
|
||||
version = "0.6.0"
|
||||
version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2f5b1582a0ebf8c55a46166c04d7c66f6bb17add3a6cbf69a082ac2219f31671"
|
||||
checksum = "4a95fa4be7085dd06a8296dcc3f399f12ab8b0309c157dcaa90669130b175b97"
|
||||
dependencies = [
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libdeflater"
|
||||
version = "0.6.0"
|
||||
version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "93edd93a53970951da84ef733a8b6e30189a8f8a9e19610f69e4cc5bb1f4d654"
|
||||
checksum = "ccc147465654929bf7b56518cc46d11701ba290f4ff94398ae3f89f1663cf60f"
|
||||
dependencies = [
|
||||
"libdeflate-sys",
|
||||
]
|
||||
@@ -274,9 +284,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "memoffset"
|
||||
version = "0.5.6"
|
||||
version = "0.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "043175f069eda7b85febe4a74abbaeff828d9f8b448515d3151a14a3542811aa"
|
||||
checksum = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
@@ -351,17 +361,11 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "13bd41f508810a131401606d54ac32a467c97172d74ba7662562ebba5ad07fa0"
|
||||
|
||||
[[package]]
|
||||
name = "oxipng"
|
||||
version = "4.0.1"
|
||||
version = "4.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9fefb26bde273c3db896a313151301a69e698a7495ee577fe2168ed7065c29c4"
|
||||
checksum = "50d0b53912a666fe2970f8ab254e283531c816aed16551ab66c52485eadb44e6"
|
||||
dependencies = [
|
||||
"bit-vec",
|
||||
"byteorder",
|
||||
@@ -390,9 +394,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "png"
|
||||
version = "0.16.7"
|
||||
version = "0.16.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dfe7f9f1c730833200b134370e1d5098964231af8450bce9b78ee3ab5278b970"
|
||||
checksum = "3c3287920cb847dee3de33d301c463fba14dda99db24214ddf93f83d3021f4c6"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"crc32fast",
|
||||
@@ -402,18 +406,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.24"
|
||||
version = "1.0.26"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71"
|
||||
checksum = "a152013215dca273577e18d2bf00fa862b89b24169fb78c4c95aeb07992c9cec"
|
||||
dependencies = [
|
||||
"unicode-xid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.7"
|
||||
version = "1.0.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37"
|
||||
checksum = "991431c3519a3f36861882da93630ce66b52918dcf1b8e2fd66b397fc96f28df"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
@@ -478,30 +482,35 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "semver-parser"
|
||||
version = "0.10.1"
|
||||
version = "0.10.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "42ef146c2ad5e5f4b037cd6ce2ebb775401729b19a82040c1beac9d36c7d1428"
|
||||
checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7"
|
||||
dependencies = [
|
||||
"pest",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "spmc"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "02a8428da277a8e3a15271d79943e80ccc2ef254e78813a166a08d65e4c3ece5"
|
||||
|
||||
[[package]]
|
||||
name = "squoosh-oxipng"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"crossbeam-channel",
|
||||
"libdeflater",
|
||||
"log",
|
||||
"once_cell",
|
||||
"oxipng",
|
||||
"rayon",
|
||||
"wasm-bindgen",
|
||||
"wasm-bindgen-rayon",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.48"
|
||||
version = "1.0.72"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cc371affeffc477f42a221a1e4297aedcea33d47d19b61455588bd9d8f6b19ac"
|
||||
checksum = "a1e8cdbefb79a9a5a65e0db8b47b723ee907b7c7f8496c76a1770b5c310bab82"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -522,19 +531,19 @@ checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.68"
|
||||
version = "0.2.73"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1ac64ead5ea5f05873d7c12b545865ca2b8d28adfc50a49b84770a3a97265d42"
|
||||
checksum = "83240549659d187488f91f33c0f8547cbfef0b2088bc470c116d1d260ef623d9"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10",
|
||||
"cfg-if 1.0.0",
|
||||
"wasm-bindgen-macro",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-backend"
|
||||
version = "0.2.68"
|
||||
version = "0.2.73"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f22b422e2a757c35a73774860af8e112bff612ce6cb604224e8e47641a9e4f68"
|
||||
checksum = "ae70622411ca953215ca6d06d3ebeb1e915f0f6613e3b495122878d7ebec7dae"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"lazy_static",
|
||||
@@ -547,9 +556,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.68"
|
||||
version = "0.2.73"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6b13312a745c08c469f0b292dd2fcd6411dba5f7160f593da6ef69b64e407038"
|
||||
checksum = "3e734d91443f177bfdb41969de821e15c516931c3c3db3d318fa1b68975d0f6f"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"wasm-bindgen-macro-support",
|
||||
@@ -557,9 +566,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro-support"
|
||||
version = "0.2.68"
|
||||
version = "0.2.73"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f249f06ef7ee334cc3b8ff031bfc11ec99d00f34d86da7498396dc1e3b1498fe"
|
||||
checksum = "d53739ff08c8a68b0fdbcd54c372b8ab800b1449ab3c9d706503bc7dd1621b2c"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -569,7 +578,19 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-shared"
|
||||
version = "0.2.68"
|
||||
name = "wasm-bindgen-rayon"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1d649a3145108d7d3fbcde896a468d1bd636791823c9921135218ad89be08307"
|
||||
checksum = "3069d2a42e7a7e3bfde668f84adb5fbc35701ca2b39b27a064cbd5ede4e78194"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"rayon",
|
||||
"spmc",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-shared"
|
||||
version = "0.2.73"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d9a543ae66aa233d14bb765ed9af4a33e81b8b58d1584cf1b47ff8cd0b9e4489"
|
||||
|
||||
@@ -12,16 +12,15 @@ wasm-opt = ["-O", "--no-validation"]
|
||||
crate-type = ["cdylib"]
|
||||
|
||||
[dependencies]
|
||||
oxipng = { version = "4.0.0", default-features = false, features = ["libdeflater"] }
|
||||
wasm-bindgen = "0.2.68"
|
||||
oxipng = { version = "4.0.3", default-features = false, features = ["libdeflater"] }
|
||||
libdeflater = { version = "0.7.1", features = ["freestanding"] }
|
||||
wasm-bindgen = "0.2.73"
|
||||
log = { version = "0.4.11", features = ["release_max_level_off"] }
|
||||
rayon = { version = "1.5.0", optional = true }
|
||||
once_cell = { version = "1.5.2", optional = true }
|
||||
crossbeam-channel = { version = "0.5.0", optional = true }
|
||||
wasm-bindgen-rayon = { version = "1.0", optional = true }
|
||||
|
||||
[profile.release]
|
||||
lto = true
|
||||
opt-level = "s"
|
||||
|
||||
[features]
|
||||
parallel = ["oxipng/parallel", "rayon", "crossbeam-channel", "once_cell"]
|
||||
parallel = ["oxipng/parallel", "wasm-bindgen-rayon"]
|
||||
|
||||
3
codecs/oxipng/build.sh
Normal file → Executable file
3
codecs/oxipng/build.sh
Normal file → Executable file
@@ -3,8 +3,7 @@
|
||||
set -e
|
||||
|
||||
rm -rf pkg,{-parallel}
|
||||
export CFLAGS="${CFLAGS} -DUNALIGNED_ACCESS_IS_FAST=1"
|
||||
wasm-pack build -t web
|
||||
RUSTFLAGS='-C target-feature=+atomics,+bulk-memory' wasm-pack build -t web -d pkg-parallel -- -Z build-std=panic_abort,std --features=parallel
|
||||
# Workaround https://github.com/rustwasm/wasm-bindgen/issues/2133:
|
||||
sed -i "s|maybe_memory:|maybe_memory?:|" pkg-parallel/squoosh_oxipng.d.ts
|
||||
rm pkg{,-parallel}/.gitignore
|
||||
|
||||
98
codecs/oxipng/pkg-parallel/snippets/wasm-bindgen-rayon-3d2df09ebec17a22/src/workerHelpers.js
generated
Normal file
98
codecs/oxipng/pkg-parallel/snippets/wasm-bindgen-rayon-3d2df09ebec17a22/src/workerHelpers.js
generated
Normal file
@@ -0,0 +1,98 @@
|
||||
/**
|
||||
* Copyright 2021 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// Note: we use `wasm_bindgen_worker_`-prefixed message types to make sure
|
||||
// we can handle bundling into other files, which might happen to have their
|
||||
// own `postMessage`/`onmessage` communication channels.
|
||||
//
|
||||
// If we didn't take that into the account, we could send much simpler signals
|
||||
// like just `0` or whatever, but the code would be less resilient.
|
||||
|
||||
function waitForMsgType(target, type) {
|
||||
return new Promise(resolve => {
|
||||
target.addEventListener('message', function onMsg({ data }) {
|
||||
if (data == null || data.type !== type) return;
|
||||
target.removeEventListener('message', onMsg);
|
||||
resolve(data);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
waitForMsgType(self, 'wasm_bindgen_worker_init').then(async data => {
|
||||
// # Note 1
|
||||
// Our JS should have been generated in
|
||||
// `[out-dir]/snippets/wasm-bindgen-rayon-[hash]/workerHelpers.js`,
|
||||
// resolve the main module via `../../..`.
|
||||
//
|
||||
// This might need updating if the generated structure changes on wasm-bindgen
|
||||
// side ever in the future, but works well with bundlers today. The whole
|
||||
// point of this crate, after all, is to abstract away unstable features
|
||||
// and temporary bugs so that you don't need to deal with them in your code.
|
||||
//
|
||||
// # Note 2
|
||||
// This could be a regular import, but then some bundlers complain about
|
||||
// circular deps.
|
||||
//
|
||||
// Dynamic import could be cheap if this file was inlined into the parent,
|
||||
// which would require us just using `../../..` in `new Worker` below,
|
||||
// but that doesn't work because wasm-pack unconditionally adds
|
||||
// "sideEffects":false (see below).
|
||||
//
|
||||
// OTOH, even though it can't be inlined, it should be still reasonably
|
||||
// cheap since the requested file is already in cache (it was loaded by
|
||||
// the main thread).
|
||||
const pkg = await import('../../..');
|
||||
await pkg.default(data.module, data.memory);
|
||||
postMessage({ type: 'wasm_bindgen_worker_ready' });
|
||||
pkg.wbg_rayon_start_worker(data.receiver);
|
||||
});
|
||||
|
||||
export async function startWorkers(module, memory, builder) {
|
||||
const workerInit = {
|
||||
type: 'wasm_bindgen_worker_init',
|
||||
module,
|
||||
memory,
|
||||
receiver: builder.receiver()
|
||||
};
|
||||
|
||||
try {
|
||||
await Promise.all(
|
||||
Array.from({ length: builder.numThreads() }, () => {
|
||||
// Self-spawn into a new Worker.
|
||||
//
|
||||
// TODO: while `new URL('...', import.meta.url) becomes a semi-standard
|
||||
// way to get asset URLs relative to the module across various bundlers
|
||||
// and browser, ideally we should switch to `import.meta.resolve`
|
||||
// once it becomes a standard.
|
||||
//
|
||||
// Note: we could use `../../..` as the URL here to inline workerHelpers.js
|
||||
// into the parent entry instead of creating another split point -
|
||||
// this would be preferable from optimization perspective -
|
||||
// however, Webpack then eliminates all message handler code
|
||||
// because wasm-pack produces "sideEffects":false in package.json
|
||||
// unconditionally.
|
||||
//
|
||||
// The only way to work around that is to have side effect code
|
||||
// in an entry point such as Worker file itself.
|
||||
const worker = new Worker(new URL('./workerHelpers.js', import.meta.url), {
|
||||
type: 'module'
|
||||
});
|
||||
worker.postMessage(workerInit);
|
||||
return waitForMsgType(worker, 'wasm_bindgen_worker_ready');
|
||||
})
|
||||
);
|
||||
builder.build();
|
||||
} finally {
|
||||
builder.free();
|
||||
}
|
||||
}
|
||||
42
codecs/oxipng/pkg-parallel/squoosh_oxipng.d.ts
generated
vendored
42
codecs/oxipng/pkg-parallel/squoosh_oxipng.d.ts
generated
vendored
@@ -3,31 +3,48 @@
|
||||
/**
|
||||
* @param {Uint8Array} data
|
||||
* @param {number} level
|
||||
* @param {boolean} interlace
|
||||
* @returns {Uint8Array}
|
||||
*/
|
||||
export function optimise(data: Uint8Array, level: number): Uint8Array;
|
||||
export function optimise(data: Uint8Array, level: number, interlace: boolean): Uint8Array;
|
||||
/**
|
||||
* @param {number} num
|
||||
* @returns {any}
|
||||
* @param {number} num_threads
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
export function worker_initializer(num: number): any;
|
||||
export function initThreadPool(num_threads: number): Promise<any>;
|
||||
/**
|
||||
* @param {number} receiver
|
||||
*/
|
||||
export function wbg_rayon_start_worker(receiver: number): void;
|
||||
/**
|
||||
*/
|
||||
export function start_main_thread(): void;
|
||||
export class wbg_rayon_PoolBuilder {
|
||||
free(): void;
|
||||
/**
|
||||
* @returns {number}
|
||||
*/
|
||||
numThreads(): number;
|
||||
/**
|
||||
* @returns {number}
|
||||
*/
|
||||
receiver(): number;
|
||||
/**
|
||||
*/
|
||||
export function start_worker_thread(): void;
|
||||
build(): void;
|
||||
}
|
||||
|
||||
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
||||
|
||||
export interface InitOutput {
|
||||
readonly optimise: (a: number, b: number, c: number, d: number) => void;
|
||||
readonly malloc: (a: number) => number;
|
||||
readonly free: (a: number) => void;
|
||||
readonly worker_initializer: (a: number) => number;
|
||||
readonly start_main_thread: () => void;
|
||||
readonly start_worker_thread: () => void;
|
||||
readonly optimise: (a: number, b: number, c: number, d: number, e: number) => void;
|
||||
readonly __wbg_wbg_rayon_poolbuilder_free: (a: number) => void;
|
||||
readonly wbg_rayon_poolbuilder_numThreads: (a: number) => number;
|
||||
readonly wbg_rayon_poolbuilder_receiver: (a: number) => number;
|
||||
readonly wbg_rayon_poolbuilder_build: (a: number) => void;
|
||||
readonly initThreadPool: (a: number) => number;
|
||||
readonly wbg_rayon_start_worker: (a: number) => void;
|
||||
readonly __wbindgen_export_0: WebAssembly.Memory;
|
||||
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
||||
readonly __wbindgen_malloc: (a: number) => number;
|
||||
readonly __wbindgen_free: (a: number, b: number) => void;
|
||||
readonly __wbindgen_start: () => void;
|
||||
@@ -43,4 +60,3 @@ export interface InitOutput {
|
||||
* @returns {Promise<InitOutput>}
|
||||
*/
|
||||
export default function init (module_or_path?: InitInput | Promise<InitInput>, maybe_memory?: WebAssembly.Memory): Promise<InitOutput>;
|
||||
|
||||
116
codecs/oxipng/pkg-parallel/squoosh_oxipng.js
generated
116
codecs/oxipng/pkg-parallel/squoosh_oxipng.js
generated
@@ -1,21 +1,6 @@
|
||||
import { startWorkers } from './snippets/wasm-bindgen-rayon-3d2df09ebec17a22/src/workerHelpers.js';
|
||||
|
||||
let wasm;
|
||||
let memory;
|
||||
|
||||
const heap = new Array(32).fill(undefined);
|
||||
|
||||
heap.push(undefined, null, true, false);
|
||||
|
||||
let heap_next = heap.length;
|
||||
|
||||
function addHeapObject(obj) {
|
||||
if (heap_next === heap.length) heap.push(heap.length + 1);
|
||||
const idx = heap_next;
|
||||
heap_next = heap[idx];
|
||||
|
||||
heap[idx] = obj;
|
||||
return idx;
|
||||
}
|
||||
|
||||
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
||||
|
||||
@@ -33,6 +18,21 @@ function getStringFromWasm0(ptr, len) {
|
||||
return cachedTextDecoder.decode(getUint8Memory0().slice(ptr, ptr + len));
|
||||
}
|
||||
|
||||
const heap = new Array(32).fill(undefined);
|
||||
|
||||
heap.push(undefined, null, true, false);
|
||||
|
||||
let heap_next = heap.length;
|
||||
|
||||
function addHeapObject(obj) {
|
||||
if (heap_next === heap.length) heap.push(heap.length + 1);
|
||||
const idx = heap_next;
|
||||
heap_next = heap[idx];
|
||||
|
||||
heap[idx] = obj;
|
||||
return idx;
|
||||
}
|
||||
|
||||
let WASM_VECTOR_LEN = 0;
|
||||
|
||||
function passArray8ToWasm0(arg, malloc) {
|
||||
@@ -56,22 +56,22 @@ function getArrayU8FromWasm0(ptr, len) {
|
||||
/**
|
||||
* @param {Uint8Array} data
|
||||
* @param {number} level
|
||||
* @param {boolean} interlace
|
||||
* @returns {Uint8Array}
|
||||
*/
|
||||
export function optimise(data, level) {
|
||||
export function optimise(data, level, interlace) {
|
||||
try {
|
||||
const retptr = wasm.__wbindgen_export_1.value - 16;
|
||||
wasm.__wbindgen_export_1.value = retptr;
|
||||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
||||
var ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
||||
var len0 = WASM_VECTOR_LEN;
|
||||
wasm.optimise(retptr, ptr0, len0, level);
|
||||
wasm.optimise(retptr, ptr0, len0, level, interlace);
|
||||
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||||
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||||
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
||||
wasm.__wbindgen_free(r0, r1 * 1);
|
||||
return v1;
|
||||
} finally {
|
||||
wasm.__wbindgen_export_1.value += 16;
|
||||
wasm.__wbindgen_add_to_stack_pointer(16);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,29 +89,66 @@ function takeObject(idx) {
|
||||
return ret;
|
||||
}
|
||||
/**
|
||||
* @param {number} num
|
||||
* @returns {any}
|
||||
* @param {number} num_threads
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
export function worker_initializer(num) {
|
||||
var ret = wasm.worker_initializer(num);
|
||||
export function initThreadPool(num_threads) {
|
||||
var ret = wasm.initThreadPool(num_threads);
|
||||
return takeObject(ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} receiver
|
||||
*/
|
||||
export function start_main_thread() {
|
||||
wasm.start_main_thread();
|
||||
export function wbg_rayon_start_worker(receiver) {
|
||||
wasm.wbg_rayon_start_worker(receiver);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
export function start_worker_thread() {
|
||||
wasm.start_worker_thread();
|
||||
export class wbg_rayon_PoolBuilder {
|
||||
|
||||
static __wrap(ptr) {
|
||||
const obj = Object.create(wbg_rayon_PoolBuilder.prototype);
|
||||
obj.ptr = ptr;
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
__destroy_into_raw() {
|
||||
const ptr = this.ptr;
|
||||
this.ptr = 0;
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
free() {
|
||||
const ptr = this.__destroy_into_raw();
|
||||
wasm.__wbg_wbg_rayon_poolbuilder_free(ptr);
|
||||
}
|
||||
/**
|
||||
* @returns {number}
|
||||
*/
|
||||
numThreads() {
|
||||
var ret = wasm.wbg_rayon_poolbuilder_numThreads(this.ptr);
|
||||
return ret >>> 0;
|
||||
}
|
||||
/**
|
||||
* @returns {number}
|
||||
*/
|
||||
receiver() {
|
||||
var ret = wasm.wbg_rayon_poolbuilder_receiver(this.ptr);
|
||||
return ret;
|
||||
}
|
||||
/**
|
||||
*/
|
||||
build() {
|
||||
wasm.wbg_rayon_poolbuilder_build(this.ptr);
|
||||
}
|
||||
}
|
||||
|
||||
async function load(module, imports, maybe_memory) {
|
||||
async function load(module, imports) {
|
||||
if (typeof Response === 'function' && module instanceof Response) {
|
||||
memory = imports.wbg.memory = new WebAssembly.Memory({initial:17,maximum:16384,shared:true});
|
||||
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
||||
try {
|
||||
return await WebAssembly.instantiateStreaming(module, imports);
|
||||
@@ -130,7 +167,6 @@ async function load(module, imports, maybe_memory) {
|
||||
return await WebAssembly.instantiate(bytes, imports);
|
||||
|
||||
} else {
|
||||
memory = imports.wbg.memory = maybe_memory;
|
||||
const instance = await WebAssembly.instantiate(module, imports);
|
||||
|
||||
if (instance instanceof WebAssembly.Instance) {
|
||||
@@ -144,10 +180,13 @@ async function load(module, imports, maybe_memory) {
|
||||
|
||||
async function init(input, maybe_memory) {
|
||||
if (typeof input === 'undefined') {
|
||||
input = import.meta.url.replace(/\.js$/, '_bg.wasm');
|
||||
input = new URL('squoosh_oxipng_bg.wasm', import.meta.url);
|
||||
}
|
||||
const imports = {};
|
||||
imports.wbg = {};
|
||||
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
||||
throw new Error(getStringFromWasm0(arg0, arg1));
|
||||
};
|
||||
imports.wbg.__wbindgen_module = function() {
|
||||
var ret = init.__wbindgen_wasm_module;
|
||||
return addHeapObject(ret);
|
||||
@@ -156,19 +195,18 @@ async function init(input, maybe_memory) {
|
||||
var ret = wasm.__wbindgen_export_0;
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbg_of_6510501edc06d65e = function(arg0, arg1) {
|
||||
var ret = Array.of(takeObject(arg0), takeObject(arg1));
|
||||
imports.wbg.__wbg_startWorkers_914655bb4d5bb5e1 = function(arg0, arg1, arg2) {
|
||||
var ret = startWorkers(takeObject(arg0), takeObject(arg1), wbg_rayon_PoolBuilder.__wrap(arg2));
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
||||
throw new Error(getStringFromWasm0(arg0, arg1));
|
||||
};
|
||||
|
||||
if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
|
||||
input = fetch(input);
|
||||
}
|
||||
|
||||
const { instance, module } = await load(await input, imports, maybe_memory);
|
||||
imports.wbg.memory = maybe_memory || new WebAssembly.Memory({initial:17,maximum:16384,shared:true});
|
||||
|
||||
const { instance, module } = await load(await input, imports);
|
||||
|
||||
wasm = instance.exports;
|
||||
init.__wbindgen_wasm_module = module;
|
||||
|
||||
Binary file not shown.
14
codecs/oxipng/pkg-parallel/squoosh_oxipng_bg.wasm.d.ts
generated
vendored
14
codecs/oxipng/pkg-parallel/squoosh_oxipng_bg.wasm.d.ts
generated
vendored
@@ -1,12 +1,14 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
export function optimise(a: number, b: number, c: number, d: number): void;
|
||||
export function malloc(a: number): number;
|
||||
export function free(a: number): void;
|
||||
export function worker_initializer(a: number): number;
|
||||
export function start_main_thread(): void;
|
||||
export function start_worker_thread(): void;
|
||||
export function optimise(a: number, b: number, c: number, d: number, e: number): void;
|
||||
export function __wbg_wbg_rayon_poolbuilder_free(a: number): void;
|
||||
export function wbg_rayon_poolbuilder_numThreads(a: number): number;
|
||||
export function wbg_rayon_poolbuilder_receiver(a: number): number;
|
||||
export function wbg_rayon_poolbuilder_build(a: number): void;
|
||||
export function initThreadPool(a: number): number;
|
||||
export function wbg_rayon_start_worker(a: number): void;
|
||||
export const __wbindgen_export_0: WebAssembly.Memory;
|
||||
export function __wbindgen_add_to_stack_pointer(a: number): number;
|
||||
export function __wbindgen_malloc(a: number): number;
|
||||
export function __wbindgen_free(a: number, b: number): void;
|
||||
export function __wbindgen_start(): void;
|
||||
|
||||
9
codecs/oxipng/pkg/squoosh_oxipng.d.ts
generated
vendored
9
codecs/oxipng/pkg/squoosh_oxipng.d.ts
generated
vendored
@@ -3,17 +3,17 @@
|
||||
/**
|
||||
* @param {Uint8Array} data
|
||||
* @param {number} level
|
||||
* @param {boolean} interlace
|
||||
* @returns {Uint8Array}
|
||||
*/
|
||||
export function optimise(data: Uint8Array, level: number): Uint8Array;
|
||||
export function optimise(data: Uint8Array, level: number, interlace: boolean): Uint8Array;
|
||||
|
||||
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
||||
|
||||
export interface InitOutput {
|
||||
readonly memory: WebAssembly.Memory;
|
||||
readonly optimise: (a: number, b: number, c: number, d: number) => void;
|
||||
readonly malloc: (a: number) => number;
|
||||
readonly free: (a: number) => void;
|
||||
readonly optimise: (a: number, b: number, c: number, d: number, e: 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;
|
||||
}
|
||||
@@ -27,4 +27,3 @@ export interface InitOutput {
|
||||
* @returns {Promise<InitOutput>}
|
||||
*/
|
||||
export default function init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;
|
||||
|
||||
16
codecs/oxipng/pkg/squoosh_oxipng.js
generated
16
codecs/oxipng/pkg/squoosh_oxipng.js
generated
@@ -40,28 +40,27 @@ function getArrayU8FromWasm0(ptr, len) {
|
||||
/**
|
||||
* @param {Uint8Array} data
|
||||
* @param {number} level
|
||||
* @param {boolean} interlace
|
||||
* @returns {Uint8Array}
|
||||
*/
|
||||
export function optimise(data, level) {
|
||||
export function optimise(data, level, interlace) {
|
||||
try {
|
||||
const retptr = wasm.__wbindgen_export_0.value - 16;
|
||||
wasm.__wbindgen_export_0.value = retptr;
|
||||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
||||
var ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
||||
var len0 = WASM_VECTOR_LEN;
|
||||
wasm.optimise(retptr, ptr0, len0, level);
|
||||
wasm.optimise(retptr, ptr0, len0, level, interlace);
|
||||
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||||
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||||
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
||||
wasm.__wbindgen_free(r0, r1 * 1);
|
||||
return v1;
|
||||
} finally {
|
||||
wasm.__wbindgen_export_0.value += 16;
|
||||
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);
|
||||
@@ -80,7 +79,6 @@ async function load(module, imports) {
|
||||
return await WebAssembly.instantiate(bytes, imports);
|
||||
|
||||
} else {
|
||||
|
||||
const instance = await WebAssembly.instantiate(module, imports);
|
||||
|
||||
if (instance instanceof WebAssembly.Instance) {
|
||||
@@ -94,7 +92,7 @@ async function load(module, imports) {
|
||||
|
||||
async function init(input) {
|
||||
if (typeof input === 'undefined') {
|
||||
input = import.meta.url.replace(/\.js$/, '_bg.wasm');
|
||||
input = new URL('squoosh_oxipng_bg.wasm', import.meta.url);
|
||||
}
|
||||
const imports = {};
|
||||
imports.wbg = {};
|
||||
@@ -106,6 +104,8 @@ async function init(input) {
|
||||
input = fetch(input);
|
||||
}
|
||||
|
||||
|
||||
|
||||
const { instance, module } = await load(await input, imports);
|
||||
|
||||
wasm = instance.exports;
|
||||
|
||||
Binary file not shown.
5
codecs/oxipng/pkg/squoosh_oxipng_bg.wasm.d.ts
generated
vendored
5
codecs/oxipng/pkg/squoosh_oxipng_bg.wasm.d.ts
generated
vendored
@@ -1,8 +1,7 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
export const memory: WebAssembly.Memory;
|
||||
export function optimise(a: number, b: number, c: number, d: number): void;
|
||||
export function malloc(a: number): number;
|
||||
export function free(a: number): void;
|
||||
export function optimise(a: number, b: number, c: number, d: number, e: number): void;
|
||||
export function __wbindgen_add_to_stack_pointer(a: number): number;
|
||||
export function __wbindgen_malloc(a: number): number;
|
||||
export function __wbindgen_free(a: number, b: number): void;
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
#[cfg(feature = "parallel")]
|
||||
pub use wasm_bindgen_rayon::init_thread_pool;
|
||||
|
||||
use oxipng::AlphaOptim;
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
mod malloc_shim;
|
||||
|
||||
#[cfg(feature = "parallel")]
|
||||
pub mod parallel;
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub fn optimise(data: &[u8], level: u8) -> Vec<u8> {
|
||||
pub fn optimise(data: &[u8], level: u8, interlace: bool) -> Vec<u8> {
|
||||
let mut options = oxipng::Options::from_preset(level);
|
||||
options.alphas.insert(AlphaOptim::Black);
|
||||
options.alphas.insert(AlphaOptim::White);
|
||||
@@ -15,6 +13,7 @@ pub fn optimise(data: &[u8], level: u8) -> Vec<u8> {
|
||||
options.alphas.insert(AlphaOptim::Down);
|
||||
options.alphas.insert(AlphaOptim::Left);
|
||||
options.alphas.insert(AlphaOptim::Right);
|
||||
options.interlace = Some(if interlace { 1 } else { 0 });
|
||||
|
||||
options.deflate = oxipng::Deflaters::Libdeflater;
|
||||
oxipng::optimize_from_memory(data, &options).unwrap_throw()
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
//! This is a module that provides `malloc` and `free` for `libdeflate`.
|
||||
//! These implementations are compatible with the standard signatures
|
||||
//! but use Rust allocator instead of including libc one as well.
|
||||
//!
|
||||
//! Rust allocator APIs requires passing size and alignment to the
|
||||
//! `dealloc` function. This is different from C API, which only
|
||||
//! expects a pointer in `free` and expects allocators to take care of
|
||||
//! storing any necessary information elsewhere.
|
||||
//!
|
||||
//! In order to simulate C API, we allocate a `size_and_data_ptr`
|
||||
//! of size `sizeof(usize) + size` where `size` is the requested number
|
||||
//! of bytes. Then, we store `size` at the beginning of the allocated
|
||||
//! chunk (within those `sizeof(usize)` bytes) and return
|
||||
//! `data_ptr = size_and_data_ptr + sizeof(usize)` to the calleer:
|
||||
//!
|
||||
//! [`size`][...actual data]
|
||||
//! -^------------------ `size_and_data_ptr`
|
||||
//! ---------^---------- `data_ptr`
|
||||
//!
|
||||
//! Then, in `free`, the caller gives us `data_ptr`. We can subtract
|
||||
//! `sizeof(usize)` back and get the original `size_and_data_ptr`.
|
||||
//! At this point we can read `size` back and call the Rust `dealloc`
|
||||
//! for the whole allocated chunk.
|
||||
//!
|
||||
//! I've raised an upstream issue to hopefully make this easier in
|
||||
//! future: https://github.com/ebiggers/libdeflate/issues/62
|
||||
|
||||
use std::alloc::*;
|
||||
use std::mem::{align_of, size_of};
|
||||
|
||||
unsafe fn layout_for(size: usize) -> Layout {
|
||||
Layout::from_size_align_unchecked(size_of::<usize>() + size, align_of::<usize>())
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn malloc(size: usize) -> *mut u8 {
|
||||
let size_and_data_ptr = alloc(layout_for(size));
|
||||
*(size_and_data_ptr as *mut usize) = size;
|
||||
size_and_data_ptr.add(size_of::<usize>())
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn free(data_ptr: *mut u8) {
|
||||
let size_and_data_ptr = data_ptr.sub(size_of::<usize>());
|
||||
let size = *(size_and_data_ptr as *const usize);
|
||||
dealloc(size_and_data_ptr, layout_for(size))
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
use crossbeam_channel::{bounded, Receiver, Sender};
|
||||
use once_cell::sync::OnceCell;
|
||||
use wasm_bindgen::prelude::*;
|
||||
use wasm_bindgen::JsValue;
|
||||
|
||||
#[wasm_bindgen]
|
||||
extern "C" {
|
||||
#[wasm_bindgen(js_namespace = Array, js_name = of)]
|
||||
fn array_of_2(a: JsValue, b: JsValue) -> JsValue;
|
||||
}
|
||||
|
||||
// This is one of the parts that work around Chromium incorrectly implementing postMessage:
|
||||
// https://bugs.chromium.org/p/chromium/issues/detail?id=1075645
|
||||
//
|
||||
// rayon::ThreadPoolBuilder (used below) executes spawn handler to populate the worker pool,
|
||||
// and then blocks the current thread until each worker unblocks its (opaque) lock.
|
||||
//
|
||||
// Normally, we could use postMessage directly inside the spawn handler to
|
||||
// post module + memory + threadPtr to each worker, and the block the current thread.
|
||||
//
|
||||
// However, that bug means that postMessage is currently delayed until the next event loop,
|
||||
// which will never spin since we block the current thread, and so the other workers will
|
||||
// never be able to unblock us.
|
||||
//
|
||||
// To work around this problem, we:
|
||||
// 1) Expose `worker_initializer` that returns module + memory pair (without threadPtr)
|
||||
// that workers can be initialised with to become native threads.
|
||||
// JavaScript can postMessage this pair in advance, and asynchronously wait for workers
|
||||
// to acknowledge the receipt.
|
||||
// 2) Create a global communication channel on the Rust side using crossbeam.
|
||||
// It will be used to send threadPtr to the pre-initialised workers
|
||||
// instead of postMessage.
|
||||
// 3) Provide a separate `start_main_thread` that expects all workers to be ready,
|
||||
// and just uses the provided channel to send `threadPtr`s using the
|
||||
// shared memory and blocks the current thread until they're all grabbed.
|
||||
// 4) Provide a `worker_initializer` that is expected to be invoked from various workers,
|
||||
// reads one `threadPtr` from the shared channel and starts running it.
|
||||
static CHANNEL: OnceCell<(Sender<rayon::ThreadBuilder>, Receiver<rayon::ThreadBuilder>)> =
|
||||
OnceCell::new();
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub fn worker_initializer(num: usize) -> JsValue {
|
||||
CHANNEL.get_or_init(|| bounded(num));
|
||||
array_of_2(wasm_bindgen::module(), wasm_bindgen::memory())
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub fn start_main_thread() {
|
||||
let (sender, _) = CHANNEL.get().unwrap();
|
||||
|
||||
rayon::ThreadPoolBuilder::new()
|
||||
.num_threads(sender.capacity().unwrap())
|
||||
.spawn_handler(|thread| Ok(sender.send(thread).unwrap_throw()))
|
||||
.build_global()
|
||||
.unwrap_throw()
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub fn start_worker_thread() {
|
||||
let (_, receiver) = CHANNEL.get().unwrap();
|
||||
receiver.recv().unwrap_throw().run()
|
||||
}
|
||||
16
codecs/png/Cargo.lock
generated
16
codecs/png/Cargo.lock
generated
@@ -18,6 +18,12 @@ version = "3.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820"
|
||||
|
||||
[[package]]
|
||||
name = "bytemuck"
|
||||
version = "1.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bed57e2090563b83ba8f83366628ce535a7584c9afa4c9fc0612a03925c6df58"
|
||||
|
||||
[[package]]
|
||||
name = "byteorder"
|
||||
version = "1.3.4"
|
||||
@@ -112,11 +118,21 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rgb"
|
||||
version = "0.8.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "287f3c3f8236abb92d8b7e36797f19159df4b58f0a658cc3fb6dd3004b1f3bd3"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "squoosh-png"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"png",
|
||||
"rgb",
|
||||
"wasm-bindgen",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
@@ -15,6 +15,7 @@ crate-type = ["cdylib"]
|
||||
png = "0.16.7"
|
||||
wasm-bindgen = "0.2.68"
|
||||
web-sys = { version = "0.3.45", features = ["ImageData"] }
|
||||
rgb = "0.8.25"
|
||||
|
||||
[profile.release]
|
||||
lto = true
|
||||
|
||||
27
codecs/png/pkg/squoosh_png.js
generated
27
codecs/png/pkg/squoosh_png.js
generated
@@ -1,6 +1,22 @@
|
||||
|
||||
let wasm;
|
||||
|
||||
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
||||
|
||||
cachedTextDecoder.decode();
|
||||
|
||||
let cachegetUint8Memory0 = null;
|
||||
function getUint8Memory0() {
|
||||
if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {
|
||||
cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
||||
}
|
||||
return cachegetUint8Memory0;
|
||||
}
|
||||
|
||||
function getStringFromWasm0(ptr, len) {
|
||||
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
||||
}
|
||||
|
||||
let cachegetUint8ClampedMemory0 = null;
|
||||
function getUint8ClampedMemory0() {
|
||||
if (cachegetUint8ClampedMemory0 === null || cachegetUint8ClampedMemory0.buffer !== wasm.memory.buffer) {
|
||||
@@ -28,14 +44,6 @@ function addHeapObject(obj) {
|
||||
return idx;
|
||||
}
|
||||
|
||||
let cachegetUint8Memory0 = null;
|
||||
function getUint8Memory0() {
|
||||
if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {
|
||||
cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
||||
}
|
||||
return cachegetUint8Memory0;
|
||||
}
|
||||
|
||||
let WASM_VECTOR_LEN = 0;
|
||||
|
||||
function passArray8ToWasm0(arg, malloc) {
|
||||
@@ -148,6 +156,9 @@ async function init(input) {
|
||||
var ret = new ImageData(v0, arg2 >>> 0, arg3 >>> 0);
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
||||
throw new Error(getStringFromWasm0(arg0, arg1));
|
||||
};
|
||||
|
||||
if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
|
||||
input = fetch(input);
|
||||
|
||||
Binary file not shown.
@@ -1,5 +1,7 @@
|
||||
use std::io::Cursor;
|
||||
|
||||
use rgb::{
|
||||
alt::{GRAY8, GRAYA8},
|
||||
AsPixels, FromSlice, RGB8, RGBA8,
|
||||
};
|
||||
use wasm_bindgen::prelude::*;
|
||||
use wasm_bindgen::Clamped;
|
||||
|
||||
@@ -18,38 +20,57 @@ extern "C" {
|
||||
) -> ImageData;
|
||||
}
|
||||
|
||||
#[wasm_bindgen(catch)]
|
||||
#[wasm_bindgen]
|
||||
pub fn encode(data: &[u8], width: u32, height: u32) -> Vec<u8> {
|
||||
let mut buffer = Cursor::new(Vec::<u8>::new());
|
||||
let mut buffer = Vec::new();
|
||||
|
||||
{
|
||||
let mut encoder = png::Encoder::new(&mut buffer, width, height);
|
||||
encoder.set_color(png::ColorType::RGBA);
|
||||
encoder.set_depth(png::BitDepth::Eight);
|
||||
let mut writer = encoder.write_header().unwrap();
|
||||
writer.write_image_data(data).unwrap();
|
||||
let mut writer = encoder.write_header().unwrap_throw();
|
||||
writer.write_image_data(data).unwrap_throw();
|
||||
}
|
||||
|
||||
buffer.into_inner()
|
||||
buffer
|
||||
}
|
||||
|
||||
#[wasm_bindgen(catch)]
|
||||
pub fn decode(data: &[u8]) -> ImageData {
|
||||
let mut decoder = png::Decoder::new(Cursor::new(data));
|
||||
// Convert pixels in-place within buffer containing source data but preallocated
|
||||
// for entire [num_pixels * sizeof(RGBA)].
|
||||
// This works because all the color types are <= RGBA by size.
|
||||
fn expand_pixels<Src: Copy>(buf: &mut [u8], to_rgba: impl Fn(Src) -> RGBA8)
|
||||
where
|
||||
[u8]: AsPixels<Src> + FromSlice<u8>,
|
||||
{
|
||||
assert!(std::mem::size_of::<Src>() <= std::mem::size_of::<RGBA8>());
|
||||
let num_pixels = buf.len() / 4;
|
||||
for i in (0..num_pixels).rev() {
|
||||
let src_pixel = buf.as_pixels()[i];
|
||||
buf.as_rgba_mut()[i] = to_rgba(src_pixel);
|
||||
}
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub fn decode(mut data: &[u8]) -> ImageData {
|
||||
let mut decoder = png::Decoder::new(&mut data);
|
||||
decoder.set_transformations(png::Transformations::EXPAND);
|
||||
let (info, mut reader) = decoder.read_info().unwrap();
|
||||
let (info, mut reader) = decoder.read_info().unwrap_throw();
|
||||
let num_pixels = (info.width * info.height) as usize;
|
||||
let mut buf = vec![0; num_pixels * 4];
|
||||
reader.next_frame(&mut buf).unwrap();
|
||||
reader.next_frame(&mut buf).unwrap_throw();
|
||||
|
||||
// Transformations::EXPAND will make sure color_type is either
|
||||
// RGBA or RGB. If it’s RGB, we need inject an alpha channel.
|
||||
if info.color_type == png::ColorType::RGB {
|
||||
for i in (0..num_pixels).rev() {
|
||||
buf[i * 4 + 0] = buf[i * 3 + 0];
|
||||
buf[i * 4 + 1] = buf[i * 3 + 1];
|
||||
buf[i * 4 + 2] = buf[i * 3 + 2];
|
||||
buf[i * 4 + 3] = 255;
|
||||
// Transformations::EXPAND will expand indexed palettes and lower-bit
|
||||
// grayscales to higher color types, but we still need to transform
|
||||
// the rest to RGBA.
|
||||
match info.color_type {
|
||||
png::ColorType::RGBA => {}
|
||||
png::ColorType::RGB => expand_pixels(&mut buf, RGB8::into),
|
||||
png::ColorType::GrayscaleAlpha => expand_pixels(&mut buf, GRAYA8::into),
|
||||
png::ColorType::Grayscale => {
|
||||
expand_pixels(&mut buf, |gray: GRAY8| GRAYA8::from(gray).into())
|
||||
}
|
||||
png::ColorType::Indexed => {
|
||||
unreachable!("Found indexed color type, but expected it to be already expanded")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
22
codecs/resize/Cargo.lock
generated
22
codecs/resize/Cargo.lock
generated
@@ -6,6 +6,12 @@ version = "3.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820"
|
||||
|
||||
[[package]]
|
||||
name = "bytemuck"
|
||||
version = "1.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "41aa2ec95ca3b5c54cf73c91acf06d24f4495d5f1b1c12506ae3483d646177ac"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "0.1.10"
|
||||
@@ -102,9 +108,21 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "resize"
|
||||
version = "0.3.1"
|
||||
version = "0.5.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b9e653e390eafbfebb2b3c5fcfbc90d801bc410d0de1f44f266ffbf2151d28aa"
|
||||
checksum = "f2a08c42ea86684dc00256494c4eb8b54707890ddac50c05060a717f29669029"
|
||||
dependencies = [
|
||||
"rgb",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rgb"
|
||||
version = "0.8.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "287f3c3f8236abb92d8b7e36797f19159df4b58f0a658cc3fb6dd3004b1f3bd3"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "scoped-tls"
|
||||
|
||||
@@ -14,7 +14,7 @@ default = ["console_error_panic_hook", "wee_alloc"]
|
||||
[dependencies]
|
||||
cfg-if = "0.1.2"
|
||||
wasm-bindgen = "0.2.38"
|
||||
resize = "0.3.0"
|
||||
resize = "0.5.5"
|
||||
|
||||
# The `console_error_panic_hook` crate provides better debugging of panics by
|
||||
# logging them with `console.error`. This is great for development, but requires
|
||||
|
||||
@@ -4,20 +4,14 @@ use std::io::Write;
|
||||
|
||||
fn main() -> std::io::Result<()> {
|
||||
let mut srgb_to_linear_lut = String::from("static SRGB_TO_LINEAR_LUT: [f32; 256] = [");
|
||||
let mut linear_to_srgb_lut = String::from("static LINEAR_TO_SRGB_LUT: [f32; 256] = [");
|
||||
for i in 0..256 {
|
||||
srgb_to_linear_lut.push_str(&format!("{0:.7}", srgb_to_linear((i as f32) / 255.0)));
|
||||
srgb_to_linear_lut.push_str(",");
|
||||
linear_to_srgb_lut.push_str(&format!("{0:.7}", linear_to_srgb((i as f32) / 255.0)));
|
||||
linear_to_srgb_lut.push_str(",");
|
||||
}
|
||||
srgb_to_linear_lut.pop().unwrap();
|
||||
linear_to_srgb_lut.pop().unwrap();
|
||||
srgb_to_linear_lut.push_str("];");
|
||||
linear_to_srgb_lut.push_str("];");
|
||||
|
||||
let mut file = std::fs::File::create("src/lut.inc")?;
|
||||
file.write_all(srgb_to_linear_lut.as_bytes())?;
|
||||
file.write_all(linear_to_srgb_lut.as_bytes())?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
70
codecs/resize/pkg/squoosh_resize.d.ts
generated
vendored
70
codecs/resize/pkg/squoosh_resize.d.ts
generated
vendored
@@ -1,60 +1,34 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* @param {Uint8Array} input_image
|
||||
* @param {number} input_width
|
||||
* @param {number} input_height
|
||||
* @param {number} output_width
|
||||
* @param {number} output_height
|
||||
* @param {number} typ_idx
|
||||
* @param {boolean} premultiply
|
||||
* @param {boolean} color_space_conversion
|
||||
* @returns {Uint8Array}
|
||||
*/
|
||||
export function resize(
|
||||
input_image: Uint8Array,
|
||||
input_width: number,
|
||||
input_height: number,
|
||||
output_width: number,
|
||||
output_height: number,
|
||||
typ_idx: number,
|
||||
premultiply: boolean,
|
||||
color_space_conversion: boolean,
|
||||
): Uint8Array;
|
||||
* @param {Uint8Array} input_image
|
||||
* @param {number} input_width
|
||||
* @param {number} input_height
|
||||
* @param {number} output_width
|
||||
* @param {number} output_height
|
||||
* @param {number} typ_idx
|
||||
* @param {boolean} premultiply
|
||||
* @param {boolean} color_space_conversion
|
||||
* @returns {Uint8Array}
|
||||
*/
|
||||
export function resize(input_image: Uint8Array, input_width: number, input_height: number, output_width: number, output_height: number, typ_idx: number, premultiply: boolean, color_space_conversion: boolean): Uint8Array;
|
||||
|
||||
export type InitInput =
|
||||
| RequestInfo
|
||||
| URL
|
||||
| Response
|
||||
| BufferSource
|
||||
| WebAssembly.Module;
|
||||
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,
|
||||
g: number,
|
||||
h: number,
|
||||
i: number,
|
||||
j: number,
|
||||
) => void;
|
||||
readonly resize: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
|
||||
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>;
|
||||
* 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>;
|
||||
|
||||
166
codecs/resize/pkg/squoosh_resize.js
generated
166
codecs/resize/pkg/squoosh_resize.js
generated
@@ -1,131 +1,107 @@
|
||||
|
||||
let wasm;
|
||||
|
||||
let cachegetUint8Memory0 = null;
|
||||
function getUint8Memory0() {
|
||||
if (
|
||||
cachegetUint8Memory0 === null ||
|
||||
cachegetUint8Memory0.buffer !== wasm.memory.buffer
|
||||
) {
|
||||
cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
||||
}
|
||||
return cachegetUint8Memory0;
|
||||
if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {
|
||||
cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
||||
}
|
||||
return cachegetUint8Memory0;
|
||||
}
|
||||
|
||||
let WASM_VECTOR_LEN = 0;
|
||||
|
||||
function passArray8ToWasm0(arg, malloc) {
|
||||
const ptr = malloc(arg.length * 1);
|
||||
getUint8Memory0().set(arg, ptr / 1);
|
||||
WASM_VECTOR_LEN = arg.length;
|
||||
return ptr;
|
||||
const ptr = malloc(arg.length * 1);
|
||||
getUint8Memory0().set(arg, ptr / 1);
|
||||
WASM_VECTOR_LEN = arg.length;
|
||||
return ptr;
|
||||
}
|
||||
|
||||
let cachegetInt32Memory0 = null;
|
||||
function getInt32Memory0() {
|
||||
if (
|
||||
cachegetInt32Memory0 === null ||
|
||||
cachegetInt32Memory0.buffer !== wasm.memory.buffer
|
||||
) {
|
||||
cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
||||
}
|
||||
return cachegetInt32Memory0;
|
||||
if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {
|
||||
cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
||||
}
|
||||
return cachegetInt32Memory0;
|
||||
}
|
||||
|
||||
function getArrayU8FromWasm0(ptr, len) {
|
||||
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
||||
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
||||
}
|
||||
/**
|
||||
* @param {Uint8Array} input_image
|
||||
* @param {number} input_width
|
||||
* @param {number} input_height
|
||||
* @param {number} output_width
|
||||
* @param {number} output_height
|
||||
* @param {number} typ_idx
|
||||
* @param {boolean} premultiply
|
||||
* @param {boolean} color_space_conversion
|
||||
* @returns {Uint8Array}
|
||||
*/
|
||||
export function resize(
|
||||
input_image,
|
||||
input_width,
|
||||
input_height,
|
||||
output_width,
|
||||
output_height,
|
||||
typ_idx,
|
||||
premultiply,
|
||||
color_space_conversion,
|
||||
) {
|
||||
var ptr0 = passArray8ToWasm0(input_image, wasm.__wbindgen_malloc);
|
||||
var len0 = WASM_VECTOR_LEN;
|
||||
wasm.resize(
|
||||
8,
|
||||
ptr0,
|
||||
len0,
|
||||
input_width,
|
||||
input_height,
|
||||
output_width,
|
||||
output_height,
|
||||
typ_idx,
|
||||
premultiply,
|
||||
color_space_conversion,
|
||||
);
|
||||
var r0 = getInt32Memory0()[8 / 4 + 0];
|
||||
var r1 = getInt32Memory0()[8 / 4 + 1];
|
||||
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
||||
wasm.__wbindgen_free(r0, r1 * 1);
|
||||
return v1;
|
||||
* @param {Uint8Array} input_image
|
||||
* @param {number} input_width
|
||||
* @param {number} input_height
|
||||
* @param {number} output_width
|
||||
* @param {number} output_height
|
||||
* @param {number} typ_idx
|
||||
* @param {boolean} premultiply
|
||||
* @param {boolean} color_space_conversion
|
||||
* @returns {Uint8Array}
|
||||
*/
|
||||
export function resize(input_image, input_width, input_height, output_width, output_height, typ_idx, premultiply, color_space_conversion) {
|
||||
var ptr0 = passArray8ToWasm0(input_image, wasm.__wbindgen_malloc);
|
||||
var len0 = WASM_VECTOR_LEN;
|
||||
wasm.resize(8, ptr0, len0, input_width, input_height, output_width, output_height, typ_idx, premultiply, color_space_conversion);
|
||||
var r0 = getInt32Memory0()[8 / 4 + 0];
|
||||
var r1 = getInt32Memory0()[8 / 4 + 1];
|
||||
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
||||
wasm.__wbindgen_free(r0, r1 * 1);
|
||||
return v1;
|
||||
}
|
||||
|
||||
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;
|
||||
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);
|
||||
const bytes = await module.arrayBuffer();
|
||||
return await WebAssembly.instantiate(bytes, imports);
|
||||
|
||||
if (instance instanceof WebAssembly.Instance) {
|
||||
return { instance, module };
|
||||
} else {
|
||||
return instance;
|
||||
|
||||
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 = import.meta.url.replace(/\.js$/, '_bg.wasm');
|
||||
}
|
||||
const imports = {};
|
||||
if (typeof input === 'undefined') {
|
||||
input = import.meta.url.replace(/\.js$/, '_bg.wasm');
|
||||
}
|
||||
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);
|
||||
if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
|
||||
input = fetch(input);
|
||||
}
|
||||
|
||||
wasm = instance.exports;
|
||||
init.__wbindgen_wasm_module = module;
|
||||
const { instance, module } = await load(await input, imports);
|
||||
|
||||
return wasm;
|
||||
wasm = instance.exports;
|
||||
init.__wbindgen_wasm_module = module;
|
||||
|
||||
return wasm;
|
||||
}
|
||||
|
||||
export default init;
|
||||
|
||||
|
||||
Binary file not shown.
@@ -5,12 +5,12 @@ extern crate wasm_bindgen;
|
||||
mod utils;
|
||||
|
||||
use cfg_if::cfg_if;
|
||||
use resize::Pixel::RGBA;
|
||||
use resize::Pixel;
|
||||
use resize::Type;
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
mod srgb;
|
||||
use srgb::Clamp;
|
||||
use srgb::{linear_to_srgb, Clamp};
|
||||
|
||||
cfg_if! {
|
||||
// When the `wee_alloc` feature is enabled, use `wee_alloc` as the global
|
||||
@@ -27,14 +27,17 @@ include!("./lut.inc");
|
||||
// If `with_space_conversion` is true, this function returns 2 functions that
|
||||
// convert from sRGB to linear RGB and vice versa. If `with_space_conversion` is
|
||||
// false, the 2 functions returned do nothing.
|
||||
fn converter_funcs(with_space_conversion: bool) -> ((fn(u8) -> f32), (fn(f32) -> u8)) {
|
||||
fn srgb_converter_funcs(with_space_conversion: bool) -> (fn(u8) -> f32, fn(f32) -> u8) {
|
||||
if with_space_conversion {
|
||||
(
|
||||
|v| SRGB_TO_LINEAR_LUT[v as usize] * 255.0,
|
||||
|v| (LINEAR_TO_SRGB_LUT[v as usize] * 255.0) as u8,
|
||||
|v| SRGB_TO_LINEAR_LUT[v as usize],
|
||||
|v| (linear_to_srgb(v) * 255.0).clamp(0.0, 255.0) as u8,
|
||||
)
|
||||
} else {
|
||||
(|v| v as f32, |v| v as u8)
|
||||
(
|
||||
|v| (v as f32) / 255.0,
|
||||
|v| (v * 255.0).clamp(0.0, 255.0) as u8,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,21 +47,18 @@ fn converter_funcs(with_space_conversion: bool) -> ((fn(u8) -> f32), (fn(f32) ->
|
||||
// false, the functions just return the channel value.
|
||||
fn alpha_multiplier_funcs(
|
||||
with_alpha_premultiplication: bool,
|
||||
) -> ((fn(f32, u8) -> u8), (fn(u8, u8) -> f32)) {
|
||||
) -> (fn(f32, f32) -> f32, fn(f32, f32) -> f32) {
|
||||
if with_alpha_premultiplication {
|
||||
(
|
||||
|v, a| (v * (a as f32) / 255.0) as u8,
|
||||
|v, a| ((v as f32) * 255.0 / (a as f32)).clamp(0.0, 255.0),
|
||||
)
|
||||
(|v, a| v * a, |v, a| v / a)
|
||||
} else {
|
||||
(|v, _a| v as u8, |v, _a| v as f32)
|
||||
(|v, _a| v, |v, _a| v)
|
||||
}
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
#[no_mangle]
|
||||
pub fn resize(
|
||||
mut input_image: Vec<u8>,
|
||||
input_image: Vec<u8>,
|
||||
input_width: usize,
|
||||
input_height: usize,
|
||||
output_width: usize,
|
||||
@@ -77,44 +77,65 @@ pub fn resize(
|
||||
let num_input_pixels = input_width * input_height;
|
||||
let num_output_pixels = output_width * output_height;
|
||||
|
||||
let (to_linear, to_color_space) = converter_funcs(color_space_conversion);
|
||||
let mut output_image = vec![0u8; num_output_pixels * 4];
|
||||
|
||||
// If both options are false, there is no preprocessing on the pixel values
|
||||
// and we can skip the loop.
|
||||
if !premultiply && !color_space_conversion {
|
||||
let mut resizer = resize::new(
|
||||
input_width,
|
||||
input_height,
|
||||
output_width,
|
||||
output_height,
|
||||
Pixel::RGBA,
|
||||
typ,
|
||||
);
|
||||
resizer.resize(input_image.as_slice(), output_image.as_mut_slice());
|
||||
return output_image;
|
||||
}
|
||||
|
||||
// Otherwise, we convert to f32 images to keep the
|
||||
// conversions as lossless and high-fidelity as possible.
|
||||
let (to_linear, to_srgb) = srgb_converter_funcs(color_space_conversion);
|
||||
let (premultiplier, demultiplier) = alpha_multiplier_funcs(premultiply);
|
||||
|
||||
// If both options are false, there is no preprocessing on the pixel valus
|
||||
// and we can skip the loop.
|
||||
if premultiply || color_space_conversion {
|
||||
for i in 0..num_input_pixels {
|
||||
for j in 0..3 {
|
||||
input_image[4 * i + j] =
|
||||
premultiplier(to_linear(input_image[4 * i + j]), input_image[4 * i + 3]);
|
||||
}
|
||||
let mut preprocessed_input_image: Vec<f32> = Vec::with_capacity(input_image.len());
|
||||
preprocessed_input_image.resize(input_image.len(), 0.0f32);
|
||||
for i in 0..num_input_pixels {
|
||||
for j in 0..3 {
|
||||
preprocessed_input_image[4 * i + j] = premultiplier(
|
||||
to_linear(input_image[4 * i + j]),
|
||||
(input_image[4 * i + 3] as f32) / 255.0,
|
||||
);
|
||||
}
|
||||
preprocessed_input_image[4 * i + 3] = (input_image[4 * i + 3] as f32) / 255.0;
|
||||
}
|
||||
|
||||
let mut unprocessed_output_image = vec![0.0f32; num_output_pixels * 4];
|
||||
|
||||
let mut resizer = resize::new(
|
||||
input_width,
|
||||
input_height,
|
||||
output_width,
|
||||
output_height,
|
||||
RGBA,
|
||||
Pixel::RGBAF32,
|
||||
typ,
|
||||
);
|
||||
let mut output_image = Vec::<u8>::with_capacity(num_output_pixels * 4);
|
||||
output_image.resize(num_output_pixels * 4, 0);
|
||||
resizer.resize(input_image.as_slice(), output_image.as_mut_slice());
|
||||
resizer.resize(
|
||||
preprocessed_input_image.as_slice(),
|
||||
unprocessed_output_image.as_mut_slice(),
|
||||
);
|
||||
|
||||
if premultiply || color_space_conversion {
|
||||
for i in 0..num_output_pixels {
|
||||
for j in 0..3 {
|
||||
// We don’t need to worry about division by zero, as division by zero
|
||||
// is well-defined on floats to return ±Inf. ±Inf is converted to 0
|
||||
// when casting to integers.
|
||||
output_image[4 * i + j] = to_color_space(demultiplier(
|
||||
output_image[4 * i + j],
|
||||
output_image[4 * i + 3],
|
||||
));
|
||||
}
|
||||
for i in 0..num_output_pixels {
|
||||
for j in 0..3 {
|
||||
output_image[4 * i + j] = to_srgb(demultiplier(
|
||||
unprocessed_output_image[4 * i + j],
|
||||
unprocessed_output_image[4 * i + 3],
|
||||
));
|
||||
}
|
||||
output_image[4 * i + 3] = (unprocessed_output_image[4 * i + 3] * 255.0)
|
||||
.round()
|
||||
.clamp(0.0, 255.0) as u8;
|
||||
}
|
||||
|
||||
return output_image;
|
||||
|
||||
@@ -7,7 +7,7 @@ using namespace butteraugli;
|
||||
|
||||
// Turns an interleaved RGBA buffer into 4 planes for each color channel
|
||||
void planarize(std::vector<ImageF>& img,
|
||||
const char* rgba,
|
||||
const uint8_t* rgba,
|
||||
int width,
|
||||
int height,
|
||||
float gamma = 2.2) {
|
||||
@@ -22,10 +22,10 @@ void planarize(std::vector<ImageF>& img,
|
||||
float* const row_b = img[2].Row(y);
|
||||
float* const row_a = img[3].Row(y);
|
||||
for (int x = 0; x < width; x++) {
|
||||
row_r[x] = 255.0 * pow(rgba[y * width * 4 + x * 4 + 0] / 255.0, gamma);
|
||||
row_g[x] = 255.0 * pow(rgba[y * width * 4 + x * 4 + 1] / 255.0, gamma);
|
||||
row_b[x] = 255.0 * pow(rgba[y * width * 4 + x * 4 + 2] / 255.0, gamma);
|
||||
row_a[x] = 255.0 * pow(rgba[y * width * 4 + x * 4 + 3] / 255.0, gamma);
|
||||
row_r[x] = 255.0 * pow(rgba[(y * width + x) * 4 + 0] / 255.0, gamma);
|
||||
row_g[x] = 255.0 * pow(rgba[(y * width + x) * 4 + 1] / 255.0, gamma);
|
||||
row_b[x] = 255.0 * pow(rgba[(y * width + x) * 4 + 2] / 255.0, gamma);
|
||||
row_a[x] = 255.0 * pow(rgba[(y * width + x) * 4 + 3] / 255.0, gamma);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -37,14 +37,14 @@ class VisDiff {
|
||||
|
||||
public:
|
||||
VisDiff(std::string ref_img, int width, int height) {
|
||||
planarize(this->ref_img, ref_img.c_str(), width, height);
|
||||
planarize(this->ref_img, (uint8_t*)ref_img.c_str(), width, height);
|
||||
this->width = width;
|
||||
this->height = height;
|
||||
}
|
||||
|
||||
double distance(std::string other_img) {
|
||||
std::vector<ImageF> img;
|
||||
planarize(img, other_img.c_str(), width, height);
|
||||
planarize(img, (uint8_t*)other_img.c_str(), width, height);
|
||||
|
||||
ImageF diffmap;
|
||||
double diffvalue;
|
||||
|
||||
128
codecs/visdif/visdif.js
generated
128
codecs/visdif/visdif.js
generated
@@ -1,80 +1,74 @@
|
||||
|
||||
var visdif = (function() {
|
||||
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
|
||||
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
|
||||
var _scriptDir = import.meta.url;
|
||||
|
||||
return (
|
||||
function(visdif) {
|
||||
visdif = visdif || {};
|
||||
|
||||
|
||||
var e;e||(e=typeof visdif !== 'undefined' ? visdif : {});var ba,ca;e.ready=new Promise(function(a,b){ba=a;ca=b});var da={},q;for(q in e)e.hasOwnProperty(q)&&(da[q]=e[q]);var ea=!1,v=!1,fa=!1,ha=!1;ea="object"===typeof window;v="function"===typeof importScripts;fa="object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node;ha=!ea&&!fa&&!v;var z="",ia,ja,ka,la;
|
||||
if(fa)z=v?require("path").dirname(z)+"/":__dirname+"/",ia=function(a,b){ka||(ka=require("fs"));la||(la=require("path"));a=la.normalize(a);return ka.readFileSync(a,b?null:"utf8")},ja=function(a){a=ia(a,!0);a.buffer||(a=new Uint8Array(a));assert(a.buffer);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",A),e.inspect=function(){return"[Emscripten Module object]"};else if(ha)"undefined"!=
|
||||
typeof read&&(ia=function(a){return read(a)}),ja=function(a){if("function"===typeof readbuffer)return new Uint8Array(readbuffer(a));a=read(a,"binary");assert("object"===typeof a);return a},"undefined"!==typeof print&&("undefined"===typeof console&&(console={}),console.log=print,console.warn=console.error="undefined"!==typeof printErr?printErr:print);else if(ea||v)v?z=self.location.href:document.currentScript&&(z=document.currentScript.src),_scriptDir&&(z=_scriptDir),0!==z.indexOf("blob:")?z=z.substr(0,
|
||||
z.lastIndexOf("/")+1):z="",ia=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.send(null);return b.responseText},v&&(ja=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)});var ma=e.print||console.log.bind(console),B=e.printErr||console.warn.bind(console);for(q in da)da.hasOwnProperty(q)&&(e[q]=da[q]);da=null;var na;e.wasmBinary&&(na=e.wasmBinary);var noExitRuntime;e.noExitRuntime&&(noExitRuntime=e.noExitRuntime);
|
||||
"object"!==typeof WebAssembly&&A("no native wasm support detected");var C,oa=new WebAssembly.Table({initial:39,maximum:39,element:"anyfunc"}),pa=!1;function assert(a,b){a||A("Assertion failed: "+b)}var qa="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0;
|
||||
function ra(a,b,c){var d=b+c;for(c=b;a[c]&&!(c>=d);)++c;if(16<c-b&&a.subarray&&qa)return qa.decode(a.subarray(b,c));for(d="";b<c;){var f=a[b++];if(f&128){var g=a[b++]&63;if(192==(f&224))d+=String.fromCharCode((f&31)<<6|g);else{var k=a[b++]&63;f=224==(f&240)?(f&15)<<12|g<<6|k:(f&7)<<18|g<<12|k<<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 sa(a,b,c){var d=D;if(0<c){c=b+c-1;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var k=a.charCodeAt(++f);g=65536+((g&1023)<<10)|k&1023}if(127>=g){if(b>=c)break;d[b++]=g}else{if(2047>=g){if(b+1>=c)break;d[b++]=192|g>>6}else{if(65535>=g){if(b+2>=c)break;d[b++]=224|g>>12}else{if(b+3>=c)break;d[b++]=240|g>>18;d[b++]=128|g>>12&63}d[b++]=128|g>>6&63}d[b++]=128|g&63}}d[b]=0}}var ta="undefined"!==typeof TextDecoder?new TextDecoder("utf-16le"):void 0;
|
||||
function ua(a,b){var c=a>>1;for(var d=c+b/2;!(c>=d)&&va[c];)++c;c<<=1;if(32<c-a&&ta)return ta.decode(D.subarray(a,c));c=0;for(d="";;){var f=E[a+2*c>>1];if(0==f||c==b/2)return d;++c;d+=String.fromCharCode(f)}}function wa(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 xa(a){return 2*a.length}
|
||||
function ya(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 za(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var d=b;c=d+c-4;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var k=a.charCodeAt(++f);g=65536+((g&1023)<<10)|k&1023}F[b>>2]=g;b+=4;if(b+4>c)break}F[b>>2]=0;return b-d}
|
||||
function Aa(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,Ba,D,E,va,F,I,Ca,Da;function Ea(a){G=a;e.HEAP8=Ba=new Int8Array(a);e.HEAP16=E=new Int16Array(a);e.HEAP32=F=new Int32Array(a);e.HEAPU8=D=new Uint8Array(a);e.HEAPU16=va=new Uint16Array(a);e.HEAPU32=I=new Uint32Array(a);e.HEAPF32=Ca=new Float32Array(a);e.HEAPF64=Da=new Float64Array(a)}var Fa=e.INITIAL_MEMORY||16777216;
|
||||
e.wasmMemory?C=e.wasmMemory:C=new WebAssembly.Memory({initial:Fa/65536,maximum:32768});C&&(G=C.buffer);Fa=G.byteLength;Ea(G);F[5836]=5266384;function Ga(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(e);else{var c=b.ia;"number"===typeof c?void 0===b.aa?e.dynCall_v(c):e.dynCall_vi(c,b.aa):c(void 0===b.aa?null:b.aa)}}}var Ha=[],Ia=[],Ja=[],Ka=[];function La(){var a=e.preRun.shift();Ha.unshift(a)}var J=0,Ma=null,Na=null;e.preloadedImages={};e.preloadedAudios={};
|
||||
function A(a){if(e.onAbort)e.onAbort(a);B(a);pa=!0;a=new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");ca(a);throw a;}function Oa(a){var b=K;return String.prototype.startsWith?b.startsWith(a):0===b.indexOf(a)}function Pa(){return Oa("data:application/octet-stream;base64,")}var K="visdif.wasm";if(!Pa()){var Qa=K;K=e.locateFile?e.locateFile(Qa,z):z+Qa}
|
||||
function Ra(){try{if(na)return new Uint8Array(na);if(ja)return ja(K);throw"both async and sync fetching of the wasm failed";}catch(a){A(a)}}function Sa(){return na||!ea&&!v||"function"!==typeof fetch||Oa("file://")?new Promise(function(a){a(Ra())}):fetch(K,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+K+"'";return a.arrayBuffer()}).catch(function(){return Ra()})}Ia.push({ia:function(){Ta()}});function Ua(){return 0<Ua.da}
|
||||
function Va(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 Wa=void 0;function L(a){for(var b="";D[a];)b+=Wa[D[a++]];return b}var M={},N={},Xa={};function Ya(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 Za(a,b){a=Ya(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}function $a(a){var b=Error,c=Za(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 O=void 0;function R(a){throw new O(a);}var ab=void 0;function bb(a){throw new ab(a);}function cb(a,b,c){function d(h){h=c(h);h.length!==a.length&&bb("Mismatched type converter count");for(var m=0;m<a.length;++m)S(a[m],h[m])}a.forEach(function(h){Xa[h]=b});var f=Array(b.length),g=[],k=0;b.forEach(function(h,m){N.hasOwnProperty(h)?f[m]=N[h]:(g.push(h),M.hasOwnProperty(h)||(M[h]=[]),M[h].push(function(){f[m]=N[h];++k;k===g.length&&d(f)}))});0===g.length&&d(f)}
|
||||
function S(a,b,c){c=c||{};if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");var d=b.name;a||R('type "'+d+'" must have a positive integer typeid pointer');if(N.hasOwnProperty(a)){if(c.la)return;R("Cannot register type '"+d+"' twice")}N[a]=b;delete Xa[a];M.hasOwnProperty(a)&&(b=M[a],delete M[a],b.forEach(function(f){f()}))}function db(a){return{count:a.count,U:a.U,W:a.W,K:a.K,L:a.L,M:a.M,N:a.N}}
|
||||
function eb(a){R(a.I.L.J.name+" instance already deleted")}var fb=!1;function gb(){}function hb(a){--a.count.value;0===a.count.value&&(a.M?a.N.T(a.M):a.L.J.T(a.K))}function ib(a){if("undefined"===typeof FinalizationGroup)return ib=function(b){return b},a;fb=new FinalizationGroup(function(b){for(var c=b.next();!c.done;c=b.next())c=c.value,c.K?hb(c):console.warn("object already deleted: "+c.K)});ib=function(b){fb.register(b,b.I,b.I);return b};gb=function(b){fb.unregister(b.I)};return ib(a)}
|
||||
var jb=void 0,kb=[];function lb(){for(;kb.length;){var a=kb.pop();a.I.U=!1;a["delete"]()}}function T(){}var mb={};function nb(a,b,c){if(void 0===a[b].P){var d=a[b];a[b]=function(){a[b].P.hasOwnProperty(arguments.length)||R("Function '"+c+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+a[b].P+")!");return a[b].P[arguments.length].apply(this,arguments)};a[b].P=[];a[b].P[d.Y]=d}}
|
||||
function ob(a,b){e.hasOwnProperty(a)?(R("Cannot register public name '"+a+"' twice"),nb(e,a,a),e.hasOwnProperty(void 0)&&R("Cannot register multiple overloads of a function with the same number of arguments (undefined)!"),e[a].P[void 0]=b):e[a]=b}function pb(a,b,c,d,f,g,k,h){this.name=a;this.constructor=b;this.V=c;this.T=d;this.O=f;this.ja=g;this.X=k;this.ha=h;this.na=[]}
|
||||
function qb(a,b,c){for(;b!==c;)b.X||R("Expected null or instance of "+c.name+", got an instance of "+b.name),a=b.X(a),b=b.O;return a}function rb(a,b){if(null===b)return this.ba&&R("null is not a valid "+this.name),0;b.I||R('Cannot pass "'+U(b)+'" as a '+this.name);b.I.K||R("Cannot pass deleted object as a pointer of type "+this.name);return qb(b.I.K,b.I.L.J,this.J)}
|
||||
function ub(a,b){if(null===b){this.ba&&R("null is not a valid "+this.name);if(this.$){var c=this.oa();null!==a&&a.push(this.T,c);return c}return 0}b.I||R('Cannot pass "'+U(b)+'" as a '+this.name);b.I.K||R("Cannot pass deleted object as a pointer of type "+this.name);!this.Z&&b.I.L.Z&&R("Cannot convert argument of type "+(b.I.N?b.I.N.name:b.I.L.name)+" to parameter type "+this.name);c=qb(b.I.K,b.I.L.J,this.J);if(this.$)switch(void 0===b.I.M&&R("Passing raw pointer to smart pointer is illegal"),this.ra){case 0:b.I.N===
|
||||
this?c=b.I.M:R("Cannot convert argument of type "+(b.I.N?b.I.N.name:b.I.L.name)+" to parameter type "+this.name);break;case 1:c=b.I.M;break;case 2:if(b.I.N===this)c=b.I.M;else{var d=b.clone();c=this.pa(c,vb(function(){d["delete"]()}));null!==a&&a.push(this.T,c)}break;default:R("Unsupporting sharing policy")}return c}
|
||||
function wb(a,b){if(null===b)return this.ba&&R("null is not a valid "+this.name),0;b.I||R('Cannot pass "'+U(b)+'" as a '+this.name);b.I.K||R("Cannot pass deleted object as a pointer of type "+this.name);b.I.L.Z&&R("Cannot convert argument of type "+b.I.L.name+" to parameter type "+this.name);return qb(b.I.K,b.I.L.J,this.J)}function xb(a){return this.fromWireType(I[a>>2])}function yb(a,b,c){if(b===c)return a;if(void 0===c.O)return null;a=yb(a,b,c.O);return null===a?null:c.ha(a)}var zb={};
|
||||
function Ab(a,b){for(void 0===b&&R("ptr should not be undefined");a.O;)b=a.X(b),a=a.O;return zb[b]}function Bb(a,b){b.L&&b.K||bb("makeClassHandle requires ptr and ptrType");!!b.N!==!!b.M&&bb("Both smartPtrType and smartPtr must be specified");b.count={value:1};return ib(Object.create(a,{I:{value:b}}))}function V(a,b,c,d){this.name=a;this.J=b;this.ba=c;this.Z=d;this.$=!1;this.T=this.pa=this.oa=this.fa=this.ra=this.ma=void 0;void 0!==b.O?this.toWireType=ub:(this.toWireType=d?rb:wb,this.R=null)}
|
||||
function Cb(a,b){e.hasOwnProperty(a)||bb("Replacing nonexistant public symbol");e[a]=b;e[a].Y=void 0}function W(a,b){a=L(a);var c=e["dynCall_"+a];for(var d=[],f=1;f<a.length;++f)d.push("a"+f);f="return function dynCall_"+(a+"_"+b)+"("+d.join(", ")+") {\n";f+=" return dynCall(rawFunction"+(d.length?", ":"")+d.join(", ")+");\n";c=(new Function("dynCall","rawFunction",f+"};\n"))(c,b);"function"!==typeof c&&R("unknown function pointer with signature "+a+": "+b);return c}var Db=void 0;
|
||||
function Eb(a){a=Fb(a);var b=L(a);X(a);return b}function Gb(a,b){function c(g){f[g]||N[g]||(Xa[g]?Xa[g].forEach(c):(d.push(g),f[g]=!0))}var d=[],f={};b.forEach(c);throw new Db(a+": "+d.map(Eb).join([", "]));}function Hb(a,b){for(var c=[],d=0;d<a;d++)c.push(F[(b>>2)+d]);return c}function Ib(a){for(;a.length;){var b=a.pop();a.pop()(b)}}
|
||||
function Jb(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=Za(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c}var Kb=[],Y=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
|
||||
function vb(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=Kb.length?Kb.pop():Y.length;Y[b]={qa:1,value:a};return b}}function U(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}function Lb(a,b){switch(b){case 2:return function(c){return this.fromWireType(Ca[c>>2])};case 3:return function(c){return this.fromWireType(Da[c>>3])};default:throw new TypeError("Unknown float type: "+a);}}
|
||||
function Mb(a,b,c){switch(b){case 0:return c?function(d){return Ba[d]}:function(d){return D[d]};case 1:return c?function(d){return E[d>>1]}:function(d){return va[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);}}for(var Nb=[null,[],[]],Ob=Array(256),Pb=0;256>Pb;++Pb)Ob[Pb]=String.fromCharCode(Pb);Wa=Ob;O=e.BindingError=$a("BindingError");ab=e.InternalError=$a("InternalError");
|
||||
T.prototype.isAliasOf=function(a){if(!(this instanceof T&&a instanceof T))return!1;var b=this.I.L.J,c=this.I.K,d=a.I.L.J;for(a=a.I.K;b.O;)c=b.X(c),b=b.O;for(;d.O;)a=d.X(a),d=d.O;return b===d&&c===a};T.prototype.clone=function(){this.I.K||eb(this);if(this.I.W)return this.I.count.value+=1,this;var a=ib(Object.create(Object.getPrototypeOf(this),{I:{value:db(this.I)}}));a.I.count.value+=1;a.I.U=!1;return a};
|
||||
T.prototype["delete"]=function(){this.I.K||eb(this);this.I.U&&!this.I.W&&R("Object already scheduled for deletion");gb(this);hb(this.I);this.I.W||(this.I.M=void 0,this.I.K=void 0)};T.prototype.isDeleted=function(){return!this.I.K};T.prototype.deleteLater=function(){this.I.K||eb(this);this.I.U&&!this.I.W&&R("Object already scheduled for deletion");kb.push(this);1===kb.length&&jb&&jb(lb);this.I.U=!0;return this};V.prototype.ka=function(a){this.fa&&(a=this.fa(a));return a};
|
||||
V.prototype.ea=function(a){this.T&&this.T(a)};V.prototype.argPackAdvance=8;V.prototype.readValueFromPointer=xb;V.prototype.deleteObject=function(a){if(null!==a)a["delete"]()};
|
||||
V.prototype.fromWireType=function(a){function b(){return this.$?Bb(this.J.V,{L:this.ma,K:c,N:this,M:a}):Bb(this.J.V,{L:this,K:a})}var c=this.ka(a);if(!c)return this.ea(a),null;var d=Ab(this.J,c);if(void 0!==d){if(0===d.I.count.value)return d.I.K=c,d.I.M=a,d.clone();d=d.clone();this.ea(a);return d}d=this.J.ja(c);d=mb[d];if(!d)return b.call(this);d=this.Z?d.ga:d.pointerType;var f=yb(c,this.J,d.J);return null===f?b.call(this):this.$?Bb(d.J.V,{L:d,K:f,N:this,M:a}):Bb(d.J.V,{L:d,K:f})};
|
||||
e.getInheritedInstanceCount=function(){return Object.keys(zb).length};e.getLiveInheritedInstances=function(){var a=[],b;for(b in zb)zb.hasOwnProperty(b)&&a.push(zb[b]);return a};e.flushPendingDeletes=lb;e.setDelayFunction=function(a){jb=a;kb.length&&jb&&jb(lb)};Db=e.UnboundTypeError=$a("UnboundTypeError");e.count_emval_handles=function(){for(var a=0,b=5;b<Y.length;++b)void 0!==Y[b]&&++a;return a};e.get_first_emval=function(){for(var a=5;a<Y.length;++a)if(void 0!==Y[a])return Y[a];return null};
|
||||
var Rb={d:function(a,b,c,d){A("Assertion failed: "+(a?ra(D,a,void 0):"")+", at: "+[b?b?ra(D,b,void 0):"":"unknown filename",c,d?d?ra(D,d,void 0):"":"unknown function"])},s:function(a){return Qb(a)},o:function(a){"uncaught_exception"in Ua?Ua.da++:Ua.da=1;throw a;},j:function(a,b,c,d,f){var g=Va(c);b=L(b);S(a,{name:b,fromWireType:function(k){return!!k},toWireType:function(k,h){return h?d:f},argPackAdvance:8,readValueFromPointer:function(k){if(1===c)var h=Ba;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[k>>g])},R:null})},n:function(a,b,c,d,f,g,k,h,m,l,n,t,u){n=L(n);g=W(f,g);h&&(h=W(k,h));l&&(l=W(m,l));u=W(t,u);var y=Ya(n);ob(y,function(){Gb("Cannot construct "+n+" due to unbound types",[d])});cb([a,b,c],d?[d]:[],function(r){r=r[0];if(d){var w=r.J;var p=w.V}else p=T.prototype;r=Za(y,function(){if(Object.getPrototypeOf(this)!==H)throw new O("Use 'new' to construct "+n);if(void 0===x.S)throw new O(n+" has no accessible constructor");var P=x.S[arguments.length];if(void 0===
|
||||
P)throw new O("Tried to invoke ctor of "+n+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(x.S).toString()+") parameters instead!");return P.apply(this,arguments)});var H=Object.create(p,{constructor:{value:r}});r.prototype=H;var x=new pb(n,r,H,u,w,g,h,l);w=new V(n,x,!0,!1);p=new V(n+"*",x,!1,!1);var Z=new V(n+" const*",x,!1,!0);mb[a]={pointerType:p,ga:Z};Cb(y,r);return[w,p,Z]})},m:function(a,b,c,d,f,g){assert(0<b);var k=Hb(b,c);f=W(d,f);var h=[g],m=[];cb([],[a],
|
||||
function(l){l=l[0];var n="constructor "+l.name;void 0===l.J.S&&(l.J.S=[]);if(void 0!==l.J.S[b-1])throw new O("Cannot register multiple constructors with identical number of parameters ("+(b-1)+") for class '"+l.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");l.J.S[b-1]=function(){Gb("Cannot construct "+l.name+" due to unbound types",k)};cb([],k,function(t){l.J.S[b-1]=function(){arguments.length!==b-1&&R(n+" called with "+arguments.length+
|
||||
" arguments, expected "+(b-1));m.length=0;h.length=b;for(var u=1;u<b;++u)h[u]=t[u].toWireType(m,arguments[u-1]);u=f.apply(null,h);Ib(m);return t[0].fromWireType(u)};return[]});return[]})},l:function(a,b,c,d,f,g,k,h){var m=Hb(c,d);b=L(b);g=W(f,g);cb([],[a],function(l){function n(){Gb("Cannot call "+t+" due to unbound types",m)}l=l[0];var t=l.name+"."+b;h&&l.J.na.push(b);var u=l.J.V,y=u[b];void 0===y||void 0===y.P&&y.className!==l.name&&y.Y===c-2?(n.Y=c-2,n.className=l.name,u[b]=n):(nb(u,b,t),u[b].P[c-
|
||||
2]=n);cb([],m,function(r){var w=t,p=l,H=g,x=r.length;2>x&&R("argTypes array size mismatch! Must at least get return value and 'this' types!");var Z=null!==r[1]&&null!==p,P=!1;for(p=1;p<r.length;++p)if(null!==r[p]&&void 0===r[p].R){P=!0;break}var sb="void"!==r[0].name,Q="",aa="";for(p=0;p<x-2;++p)Q+=(0!==p?", ":"")+"arg"+p,aa+=(0!==p?", ":"")+"arg"+p+"Wired";w="return function "+Ya(w)+"("+Q+") {\nif (arguments.length !== "+(x-2)+") {\nthrowBindingError('function "+w+" called with ' + arguments.length + ' arguments, expected "+
|
||||
(x-2)+" args!');\n}\n";P&&(w+="var destructors = [];\n");var tb=P?"destructors":"null";Q="throwBindingError invoker fn runDestructors retType classParam".split(" ");H=[R,H,k,Ib,r[0],r[1]];Z&&(w+="var thisWired = classParam.toWireType("+tb+", this);\n");for(p=0;p<x-2;++p)w+="var arg"+p+"Wired = argType"+p+".toWireType("+tb+", arg"+p+"); // "+r[p+2].name+"\n",Q.push("argType"+p),H.push(r[p+2]);Z&&(aa="thisWired"+(0<aa.length?", ":"")+aa);w+=(sb?"var rv = ":"")+"invoker(fn"+(0<aa.length?", ":"")+aa+
|
||||
");\n";if(P)w+="runDestructors(destructors);\n";else for(p=Z?1:2;p<r.length;++p)x=1===p?"thisWired":"arg"+(p-2)+"Wired",null!==r[p].R&&(w+=x+"_dtor("+x+"); // "+r[p].name+"\n",Q.push(x+"_dtor"),H.push(r[p].R));sb&&(w+="var ret = retType.fromWireType(rv);\nreturn ret;\n");Q.push(w+"}\n");r=Jb(Q).apply(null,H);void 0===u[b].P?(r.Y=c-2,u[b]=r):u[b].P[c-2]=r;return[]});return[]})},r:function(a,b){b=L(b);S(a,{name:b,fromWireType:function(c){var d=Y[c].value;4<c&&0===--Y[c].qa&&(Y[c]=void 0,Kb.push(c));
|
||||
return d},toWireType:function(c,d){return vb(d)},argPackAdvance:8,readValueFromPointer:xb,R:null})},i:function(a,b,c){c=Va(c);b=L(b);S(a,{name:b,fromWireType:function(d){return d},toWireType:function(d,f){if("number"!==typeof f&&"boolean"!==typeof f)throw new TypeError('Cannot convert "'+U(f)+'" to '+this.name);return f},argPackAdvance:8,readValueFromPointer:Lb(b,c),R:null})},b:function(a,b,c,d,f){function g(l){return l}b=L(b);-1===f&&(f=4294967295);var k=Va(c);if(0===d){var h=32-8*c;g=function(l){return l<<
|
||||
h>>>h}}var m=-1!=b.indexOf("unsigned");S(a,{name:b,fromWireType:g,toWireType:function(l,n){if("number"!==typeof n&&"boolean"!==typeof n)throw new TypeError('Cannot convert "'+U(n)+'" to '+this.name);if(n<d||n>f)throw new TypeError('Passing a number "'+U(n)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+d+", "+f+"]!");return m?n>>>0:n|0},argPackAdvance:8,readValueFromPointer:Mb(b,k,0!==d),R:null})},a:function(a,b,c){function d(g){g>>=2;var k=I;return new f(G,
|
||||
k[g+1],k[g])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];c=L(c);S(a,{name:c,fromWireType:d,argPackAdvance:8,readValueFromPointer:d},{la:!0})},g:function(a,b){b=L(b);var c="std::string"===b;S(a,{name:b,fromWireType:function(d){var f=I[d>>2];if(c)for(var g=d+4,k=0;k<=f;++k){var h=d+4+k;if(k==f||0==D[h]){g=g?ra(D,g,h-g):"";if(void 0===m)var m=g;else m+=String.fromCharCode(0),m+=g;g=h+1}}else{m=Array(f);for(k=0;k<f;++k)m[k]=String.fromCharCode(D[d+
|
||||
4+k]);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||R("Cannot pass non-string to std::string");var k=(c&&g?function(){for(var l=0,n=0;n<f.length;++n){var t=f.charCodeAt(n);55296<=t&&57343>=t&&(t=65536+((t&1023)<<10)|f.charCodeAt(++n)&1023);127>=t?++l:l=2047>=t?l+2:65535>=t?l+3:l+4}return l}:function(){return f.length})(),h=Qb(4+k+1);I[h>>
|
||||
2]=k;if(c&&g)sa(f,h+4,k+1);else if(g)for(g=0;g<k;++g){var m=f.charCodeAt(g);255<m&&(X(h),R("String has UTF-16 code units that do not fit in 8 bits"));D[h+4+g]=m}else for(g=0;g<k;++g)D[h+4+g]=f[g];null!==d&&d.push(X,h);return h},argPackAdvance:8,readValueFromPointer:xb,R:function(d){X(d)}})},f:function(a,b,c){c=L(c);if(2===b){var d=ua;var f=wa;var g=xa;var k=function(){return va};var h=1}else 4===b&&(d=ya,f=za,g=Aa,k=function(){return I},h=2);S(a,{name:c,fromWireType:function(m){for(var l=I[m>>2],
|
||||
n=k(),t,u=m+4,y=0;y<=l;++y){var r=m+4+y*b;if(y==l||0==n[r>>h])u=d(u,r-u),void 0===t?t=u:(t+=String.fromCharCode(0),t+=u),u=r+b}X(m);return t},toWireType:function(m,l){"string"!==typeof l&&R("Cannot pass non-string to C++ string type "+c);var n=g(l),t=Qb(4+n+b);I[t>>2]=n>>h;f(l,t+4,n+b);null!==m&&m.push(X,t);return t},argPackAdvance:8,readValueFromPointer:xb,R:function(m){X(m)}})},k:function(a,b){b=L(b);S(a,{sa:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},e:function(){A()},
|
||||
q:function(a,b,c){D.copyWithin(a,b,b+c)},c:function(a){a>>>=0;var b=D.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{C.grow(Math.min(2147483648,d)-G.byteLength+65535>>>16);Ea(C.buffer);var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},h:function(a,b,c,d){for(var f=0,g=0;g<c;g++){for(var k=F[b+8*g>>2],h=F[b+(8*g+4)>>2],m=0;m<h;m++){var l=D[k+m],n=Nb[a];0===l||10===l?((1===a?ma:
|
||||
B)(ra(n,0)),n.length=0):n.push(l)}f+=h}F[d>>2]=f;return 0},memory:C,p:function(){},table:oa};
|
||||
(function(){function a(f){e.asm=f.exports;J--;e.monitorRunDependencies&&e.monitorRunDependencies(J);0==J&&(null!==Ma&&(clearInterval(Ma),Ma=null),Na&&(f=Na,Na=null,f()))}function b(f){a(f.instance)}function c(f){return Sa().then(function(g){return WebAssembly.instantiate(g,d)}).then(f,function(g){B("failed to asynchronously prepare wasm: "+g);A(g)})}var d={a:Rb};J++;e.monitorRunDependencies&&e.monitorRunDependencies(J);if(e.instantiateWasm)try{return e.instantiateWasm(d,a)}catch(f){return B("Module.instantiateWasm callback failed with error: "+
|
||||
f),!1}(function(){if(na||"function"!==typeof WebAssembly.instantiateStreaming||Pa()||Oa("file://")||"function"!==typeof fetch)return c(b);fetch(K,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,d).then(b,function(g){B("wasm streaming compile failed: "+g);B("falling back to ArrayBuffer instantiation");return c(b)})})})();return{}})();
|
||||
var Ta=e.___wasm_call_ctors=function(){return(Ta=e.___wasm_call_ctors=e.asm.t).apply(null,arguments)},Qb=e._malloc=function(){return(Qb=e._malloc=e.asm.u).apply(null,arguments)},X=e._free=function(){return(X=e._free=e.asm.v).apply(null,arguments)},Fb=e.___getTypeName=function(){return(Fb=e.___getTypeName=e.asm.w).apply(null,arguments)};e.___embind_register_native_and_builtin_types=function(){return(e.___embind_register_native_and_builtin_types=e.asm.x).apply(null,arguments)};
|
||||
e.dynCall_ii=function(){return(e.dynCall_ii=e.asm.y).apply(null,arguments)};e.dynCall_vi=function(){return(e.dynCall_vi=e.asm.z).apply(null,arguments)};e.dynCall_dii=function(){return(e.dynCall_dii=e.asm.A).apply(null,arguments)};e.dynCall_iiiii=function(){return(e.dynCall_iiiii=e.asm.B).apply(null,arguments)};e.dynCall_iiii=function(){return(e.dynCall_iiii=e.asm.C).apply(null,arguments)};e.dynCall_diii=function(){return(e.dynCall_diii=e.asm.D).apply(null,arguments)};
|
||||
e.dynCall_viiiiii=function(){return(e.dynCall_viiiiii=e.asm.E).apply(null,arguments)};e.dynCall_viiiii=function(){return(e.dynCall_viiiii=e.asm.F).apply(null,arguments)};e.dynCall_viiii=function(){return(e.dynCall_viiii=e.asm.G).apply(null,arguments)};e.dynCall_jiji=function(){return(e.dynCall_jiji=e.asm.H).apply(null,arguments)};var Sb;Na=function Tb(){Sb||Ub();Sb||(Na=Tb)};
|
||||
function Ub(){function a(){if(!Sb&&(Sb=!0,e.calledRun=!0,!pa)){Ga(Ia);Ga(Ja);ba(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();Ka.unshift(b)}Ga(Ka)}}if(!(0<J)){if(e.preRun)for("function"==typeof e.preRun&&(e.preRun=[e.preRun]);e.preRun.length;)La();Ga(Ha);0<J||(e.setStatus?(e.setStatus("Running..."),setTimeout(function(){setTimeout(function(){e.setStatus("")},1);a()},1)):a())}}
|
||||
e.run=Ub;if(e.preInit)for("function"==typeof e.preInit&&(e.preInit=[e.preInit]);0<e.preInit.length;)e.preInit.pop()();noExitRuntime=!0;Ub();
|
||||
var f;f||(f=typeof visdif !== 'undefined' ? visdif : {});var ba,ca;f.ready=new Promise(function(a,b){ba=a;ca=b});var da={},q;for(q in f)f.hasOwnProperty(q)&&(da[q]=f[q]);var ea=!1,v=!1,fa=!1,ha=!1;ea="object"===typeof window;v="function"===typeof importScripts;fa="object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node;ha=!ea&&!fa&&!v;var y="",ia,ja,ka,la;
|
||||
if(fa)y=v?require("path").dirname(y)+"/":__dirname+"/",ia=function(a,b){ka||(ka=require("fs"));la||(la=require("path"));a=la.normalize(a);return ka.readFileSync(a,b?null:"utf8")},ja=function(a){a=ia(a,!0);a.buffer||(a=new Uint8Array(a));assert(a.buffer);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",A),f.inspect=function(){return"[Emscripten Module object]"};else if(ha)"undefined"!=
|
||||
typeof read&&(ia=function(a){return read(a)}),ja=function(a){if("function"===typeof readbuffer)return new Uint8Array(readbuffer(a));a=read(a,"binary");assert("object"===typeof a);return a},"undefined"!==typeof print&&("undefined"===typeof console&&(console={}),console.log=print,console.warn=console.error="undefined"!==typeof printErr?printErr:print);else if(ea||v)v?y=self.location.href:"undefined"!==typeof document&&document.currentScript&&(y=document.currentScript.src),_scriptDir&&(y=_scriptDir),
|
||||
0!==y.indexOf("blob:")?y=y.substr(0,y.lastIndexOf("/")+1):y="",ia=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.send(null);return b.responseText},v&&(ja=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)});var ma=f.print||console.log.bind(console),B=f.printErr||console.warn.bind(console);for(q in da)da.hasOwnProperty(q)&&(f[q]=da[q]);da=null;var na;f.wasmBinary&&(na=f.wasmBinary);var noExitRuntime;
|
||||
f.noExitRuntime&&(noExitRuntime=f.noExitRuntime);"object"!==typeof WebAssembly&&A("no native wasm support detected");var C,oa=!1;function assert(a,b){a||A("Assertion failed: "+b)}var pa="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0;
|
||||
function qa(a,b,c){var d=b+c;for(c=b;a[c]&&!(c>=d);)++c;if(16<c-b&&a.subarray&&pa)return pa.decode(a.subarray(b,c));for(d="";b<c;){var e=a[b++];if(e&128){var g=a[b++]&63;if(192==(e&224))d+=String.fromCharCode((e&31)<<6|g);else{var k=a[b++]&63;e=224==(e&240)?(e&15)<<12|g<<6|k:(e&7)<<18|g<<12|k<<6|a[b++]&63;65536>e?d+=String.fromCharCode(e):(e-=65536,d+=String.fromCharCode(55296|e>>10,56320|e&1023))}}else d+=String.fromCharCode(e)}return d}
|
||||
function ra(a,b,c){var d=D;if(0<c){c=b+c-1;for(var e=0;e<a.length;++e){var g=a.charCodeAt(e);if(55296<=g&&57343>=g){var k=a.charCodeAt(++e);g=65536+((g&1023)<<10)|k&1023}if(127>=g){if(b>=c)break;d[b++]=g}else{if(2047>=g){if(b+1>=c)break;d[b++]=192|g>>6}else{if(65535>=g){if(b+2>=c)break;d[b++]=224|g>>12}else{if(b+3>=c)break;d[b++]=240|g>>18;d[b++]=128|g>>12&63}d[b++]=128|g>>6&63}d[b++]=128|g&63}}d[b]=0}}var sa="undefined"!==typeof TextDecoder?new TextDecoder("utf-16le"):void 0;
|
||||
function ta(a,b){var c=a>>1;for(var d=c+b/2;!(c>=d)&&ua[c];)++c;c<<=1;if(32<c-a&&sa)return sa.decode(D.subarray(a,c));c=0;for(d="";;){var e=E[a+2*c>>1];if(0==e||c==b/2)return d;++c;d+=String.fromCharCode(e)}}function va(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 e=0;e<c;++e)E[b>>1]=a.charCodeAt(e),b+=2;E[b>>1]=0;return b-d}function wa(a){return 2*a.length}
|
||||
function xa(a,b){for(var c=0,d="";!(c>=b/4);){var e=F[a+4*c>>2];if(0==e)break;++c;65536<=e?(e-=65536,d+=String.fromCharCode(55296|e>>10,56320|e&1023)):d+=String.fromCharCode(e)}return d}function ya(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var d=b;c=d+c-4;for(var e=0;e<a.length;++e){var g=a.charCodeAt(e);if(55296<=g&&57343>=g){var k=a.charCodeAt(++e);g=65536+((g&1023)<<10)|k&1023}F[b>>2]=g;b+=4;if(b+4>c)break}F[b>>2]=0;return b-d}
|
||||
function za(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,Aa,D,E,ua,F,I,Ba,Ca;function Da(a){G=a;f.HEAP8=Aa=new Int8Array(a);f.HEAP16=E=new Int16Array(a);f.HEAP32=F=new Int32Array(a);f.HEAPU8=D=new Uint8Array(a);f.HEAPU16=ua=new Uint16Array(a);f.HEAPU32=I=new Uint32Array(a);f.HEAPF32=Ba=new Float32Array(a);f.HEAPF64=Ca=new Float64Array(a)}var Ea=f.INITIAL_MEMORY||16777216;
|
||||
f.wasmMemory?C=f.wasmMemory:C=new WebAssembly.Memory({initial:Ea/65536,maximum:32768});C&&(G=C.buffer);Ea=G.byteLength;Da(G);var Fa,Ga=[],Ha=[],Ia=[],Ja=[];function Ka(){var a=f.preRun.shift();Ga.unshift(a)}var J=0,La=null,Ma=null;f.preloadedImages={};f.preloadedAudios={};function A(a){if(f.onAbort)f.onAbort(a);B(a);oa=!0;a=new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");ca(a);throw a;}
|
||||
function Na(a){var b=K;return String.prototype.startsWith?b.startsWith(a):0===b.indexOf(a)}function Oa(){return Na("data:application/octet-stream;base64,")}var K="visdif.wasm";if(!Oa()){var Pa=K;K=f.locateFile?f.locateFile(Pa,y):y+Pa}function Qa(){try{if(na)return new Uint8Array(na);if(ja)return ja(K);throw"both async and sync fetching of the wasm failed";}catch(a){A(a)}}
|
||||
function Ra(){return na||!ea&&!v||"function"!==typeof fetch||Na("file://")?Promise.resolve().then(Qa):fetch(K,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+K+"'";return a.arrayBuffer()}).catch(function(){return Qa()})}function Sa(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(f);else{var c=b.ba;"number"===typeof c?void 0===b.V?Fa.get(c)():Fa.get(c)(b.V):c(void 0===b.V?null:b.V)}}}
|
||||
function Ta(a){this.C=a-16;this.qa=function(b){F[this.C+8>>2]=b};this.na=function(b){F[this.C+0>>2]=b};this.oa=function(){F[this.C+4>>2]=0};this.ma=function(){Aa[this.C+12>>0]=0};this.pa=function(){Aa[this.C+13>>0]=0};this.ga=function(b,c){this.qa(b);this.na(c);this.oa();this.ma();this.pa()}}function Ua(){return 0<Ua.Z}function Va(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 Wa=void 0;
|
||||
function L(a){for(var b="";D[a];)b+=Wa[D[a++]];return b}var M={},N={},Xa={};function Ya(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 Za(a,b){a=Ya(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}
|
||||
function $a(a){var b=Error,c=Za(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 O=void 0;function R(a){throw new O(a);}var ab=void 0;function bb(a){throw new ab(a);}
|
||||
function cb(a,b,c){function d(h){h=c(h);h.length!==a.length&&bb("Mismatched type converter count");for(var m=0;m<a.length;++m)S(a[m],h[m])}a.forEach(function(h){Xa[h]=b});var e=Array(b.length),g=[],k=0;b.forEach(function(h,m){N.hasOwnProperty(h)?e[m]=N[h]:(g.push(h),M.hasOwnProperty(h)||(M[h]=[]),M[h].push(function(){e[m]=N[h];++k;k===g.length&&d(e)}))});0===g.length&&d(e)}
|
||||
function S(a,b,c){c=c||{};if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");var d=b.name;a||R('type "'+d+'" must have a positive integer typeid pointer');if(N.hasOwnProperty(a)){if(c.fa)return;R("Cannot register type '"+d+"' twice")}N[a]=b;delete Xa[a];M.hasOwnProperty(a)&&(b=M[a],delete M[a],b.forEach(function(e){e()}))}function db(a){return{count:a.count,N:a.N,P:a.P,C:a.C,F:a.F,G:a.G,H:a.H}}
|
||||
function eb(a){R(a.B.F.D.name+" instance already deleted")}var fb=!1;function gb(){}function hb(a){--a.count.value;0===a.count.value&&(a.G?a.H.M(a.G):a.F.D.M(a.C))}function ib(a){if("undefined"===typeof FinalizationGroup)return ib=function(b){return b},a;fb=new FinalizationGroup(function(b){for(var c=b.next();!c.done;c=b.next())c=c.value,c.C?hb(c):console.warn("object already deleted: "+c.C)});ib=function(b){fb.register(b,b.B,b.B);return b};gb=function(b){fb.unregister(b.B)};return ib(a)}
|
||||
var jb=void 0,kb=[];function lb(){for(;kb.length;){var a=kb.pop();a.B.N=!1;a["delete"]()}}function T(){}var mb={};function nb(a,b,c){if(void 0===a[b].J){var d=a[b];a[b]=function(){a[b].J.hasOwnProperty(arguments.length)||R("Function '"+c+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+a[b].J+")!");return a[b].J[arguments.length].apply(this,arguments)};a[b].J=[];a[b].J[d.S]=d}}
|
||||
function ob(a,b){f.hasOwnProperty(a)?(R("Cannot register public name '"+a+"' twice"),nb(f,a,a),f.hasOwnProperty(void 0)&&R("Cannot register multiple overloads of a function with the same number of arguments (undefined)!"),f[a].J[void 0]=b):f[a]=b}function pb(a,b,c,d,e,g,k,h){this.name=a;this.constructor=b;this.O=c;this.M=d;this.I=e;this.da=g;this.R=k;this.aa=h;this.ia=[]}
|
||||
function qb(a,b,c){for(;b!==c;)b.R||R("Expected null or instance of "+c.name+", got an instance of "+b.name),a=b.R(a),b=b.I;return a}function rb(a,b){if(null===b)return this.W&&R("null is not a valid "+this.name),0;b.B||R('Cannot pass "'+U(b)+'" as a '+this.name);b.B.C||R("Cannot pass deleted object as a pointer of type "+this.name);return qb(b.B.C,b.B.F.D,this.D)}
|
||||
function sb(a,b){if(null===b){this.W&&R("null is not a valid "+this.name);if(this.U){var c=this.ja();null!==a&&a.push(this.M,c);return c}return 0}b.B||R('Cannot pass "'+U(b)+'" as a '+this.name);b.B.C||R("Cannot pass deleted object as a pointer of type "+this.name);!this.T&&b.B.F.T&&R("Cannot convert argument of type "+(b.B.H?b.B.H.name:b.B.F.name)+" to parameter type "+this.name);c=qb(b.B.C,b.B.F.D,this.D);if(this.U)switch(void 0===b.B.G&&R("Passing raw pointer to smart pointer is illegal"),this.ra){case 0:b.B.H===
|
||||
this?c=b.B.G:R("Cannot convert argument of type "+(b.B.H?b.B.H.name:b.B.F.name)+" to parameter type "+this.name);break;case 1:c=b.B.G;break;case 2:if(b.B.H===this)c=b.B.G;else{var d=b.clone();c=this.ka(c,vb(function(){d["delete"]()}));null!==a&&a.push(this.M,c)}break;default:R("Unsupporting sharing policy")}return c}
|
||||
function wb(a,b){if(null===b)return this.W&&R("null is not a valid "+this.name),0;b.B||R('Cannot pass "'+U(b)+'" as a '+this.name);b.B.C||R("Cannot pass deleted object as a pointer of type "+this.name);b.B.F.T&&R("Cannot convert argument of type "+b.B.F.name+" to parameter type "+this.name);return qb(b.B.C,b.B.F.D,this.D)}function xb(a){return this.fromWireType(I[a>>2])}function yb(a,b,c){if(b===c)return a;if(void 0===c.I)return null;a=yb(a,b,c.I);return null===a?null:c.aa(a)}var zb={};
|
||||
function Ab(a,b){for(void 0===b&&R("ptr should not be undefined");a.I;)b=a.R(b),a=a.I;return zb[b]}function Bb(a,b){b.F&&b.C||bb("makeClassHandle requires ptr and ptrType");!!b.H!==!!b.G&&bb("Both smartPtrType and smartPtr must be specified");b.count={value:1};return ib(Object.create(a,{B:{value:b}}))}function V(a,b,c,d){this.name=a;this.D=b;this.W=c;this.T=d;this.U=!1;this.M=this.ka=this.ja=this.Y=this.ra=this.ha=void 0;void 0!==b.I?this.toWireType=sb:(this.toWireType=d?rb:wb,this.K=null)}
|
||||
function Cb(a,b){f.hasOwnProperty(a)||bb("Replacing nonexistant public symbol");f[a]=b;f[a].S=void 0}function Db(a,b){assert(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];var e;-1!=a.indexOf("j")?e=c&&c.length?f["dynCall_"+a].apply(null,[b].concat(c)):f["dynCall_"+a].call(null,b):e=Fa.get(b).apply(null,c);return e}}
|
||||
function W(a,b){a=L(a);var c=-1!=a.indexOf("j")?Db(a,b):Fa.get(b);"function"!==typeof c&&R("unknown function pointer with signature "+a+": "+b);return c}var Eb=void 0;function Fb(a){a=Gb(a);var b=L(a);X(a);return b}function Hb(a,b){function c(g){e[g]||N[g]||(Xa[g]?Xa[g].forEach(c):(d.push(g),e[g]=!0))}var d=[],e={};b.forEach(c);throw new Eb(a+": "+d.map(Fb).join([", "]));}function Ib(a,b){for(var c=[],d=0;d<a;d++)c.push(F[(b>>2)+d]);return c}
|
||||
function Jb(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function Kb(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=Za(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c}var Lb=[],Y=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
|
||||
function vb(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=Lb.length?Lb.pop():Y.length;Y[b]={la:1,value:a};return b}}function U(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}function Mb(a,b){switch(b){case 2:return function(c){return this.fromWireType(Ba[c>>2])};case 3:return function(c){return this.fromWireType(Ca[c>>3])};default:throw new TypeError("Unknown float type: "+a);}}
|
||||
function Nb(a,b,c){switch(b){case 0:return c?function(d){return Aa[d]}:function(d){return D[d]};case 1:return c?function(d){return E[d>>1]}:function(d){return ua[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);}}for(var Ob=[null,[],[]],Pb=Array(256),Qb=0;256>Qb;++Qb)Pb[Qb]=String.fromCharCode(Qb);Wa=Pb;O=f.BindingError=$a("BindingError");ab=f.InternalError=$a("InternalError");
|
||||
T.prototype.isAliasOf=function(a){if(!(this instanceof T&&a instanceof T))return!1;var b=this.B.F.D,c=this.B.C,d=a.B.F.D;for(a=a.B.C;b.I;)c=b.R(c),b=b.I;for(;d.I;)a=d.R(a),d=d.I;return b===d&&c===a};T.prototype.clone=function(){this.B.C||eb(this);if(this.B.P)return this.B.count.value+=1,this;var a=ib(Object.create(Object.getPrototypeOf(this),{B:{value:db(this.B)}}));a.B.count.value+=1;a.B.N=!1;return a};
|
||||
T.prototype["delete"]=function(){this.B.C||eb(this);this.B.N&&!this.B.P&&R("Object already scheduled for deletion");gb(this);hb(this.B);this.B.P||(this.B.G=void 0,this.B.C=void 0)};T.prototype.isDeleted=function(){return!this.B.C};T.prototype.deleteLater=function(){this.B.C||eb(this);this.B.N&&!this.B.P&&R("Object already scheduled for deletion");kb.push(this);1===kb.length&&jb&&jb(lb);this.B.N=!0;return this};V.prototype.ea=function(a){this.Y&&(a=this.Y(a));return a};
|
||||
V.prototype.X=function(a){this.M&&this.M(a)};V.prototype.argPackAdvance=8;V.prototype.readValueFromPointer=xb;V.prototype.deleteObject=function(a){if(null!==a)a["delete"]()};
|
||||
V.prototype.fromWireType=function(a){function b(){return this.U?Bb(this.D.O,{F:this.ha,C:c,H:this,G:a}):Bb(this.D.O,{F:this,C:a})}var c=this.ea(a);if(!c)return this.X(a),null;var d=Ab(this.D,c);if(void 0!==d){if(0===d.B.count.value)return d.B.C=c,d.B.G=a,d.clone();d=d.clone();this.X(a);return d}d=this.D.da(c);d=mb[d];if(!d)return b.call(this);d=this.T?d.$:d.pointerType;var e=yb(c,this.D,d.D);return null===e?b.call(this):this.U?Bb(d.D.O,{F:d,C:e,H:this,G:a}):Bb(d.D.O,{F:d,C:e})};
|
||||
f.getInheritedInstanceCount=function(){return Object.keys(zb).length};f.getLiveInheritedInstances=function(){var a=[],b;for(b in zb)zb.hasOwnProperty(b)&&a.push(zb[b]);return a};f.flushPendingDeletes=lb;f.setDelayFunction=function(a){jb=a;kb.length&&jb&&jb(lb)};Eb=f.UnboundTypeError=$a("UnboundTypeError");f.count_emval_handles=function(){for(var a=0,b=5;b<Y.length;++b)void 0!==Y[b]&&++a;return a};f.get_first_emval=function(){for(var a=5;a<Y.length;++a)if(void 0!==Y[a])return Y[a];return null};Ha.push({ba:function(){Rb()}});
|
||||
var Tb={c:function(a,b,c,d){A("Assertion failed: "+(a?qa(D,a,void 0):"")+", at: "+[b?b?qa(D,b,void 0):"":"unknown filename",c,d?d?qa(D,d,void 0):"":"unknown function"])},t:function(a){return Sb(a+16)+16},p:function(a,b,c){(new Ta(a)).ga(b,c);"uncaught_exception"in Ua?Ua.Z++:Ua.Z=1;throw a;},k:function(a,b,c,d,e){var g=Va(c);b=L(b);S(a,{name:b,fromWireType:function(k){return!!k},toWireType:function(k,h){return h?d:e},argPackAdvance:8,readValueFromPointer:function(k){if(1===c)var h=Aa;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[k>>g])},K:null})},o:function(a,b,c,d,e,g,k,h,m,l,n,t,u){n=L(n);g=W(e,g);h&&(h=W(k,h));l&&(l=W(m,l));u=W(t,u);var z=Ya(n);ob(z,function(){Hb("Cannot construct "+n+" due to unbound types",[d])});cb([a,b,c],d?[d]:[],function(r){r=r[0];if(d){var w=r.D;var p=w.O}else p=T.prototype;r=Za(z,function(){if(Object.getPrototypeOf(this)!==H)throw new O("Use 'new' to construct "+n);if(void 0===x.L)throw new O(n+
|
||||
" has no accessible constructor");var P=x.L[arguments.length];if(void 0===P)throw new O("Tried to invoke ctor of "+n+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(x.L).toString()+") parameters instead!");return P.apply(this,arguments)});var H=Object.create(p,{constructor:{value:r}});r.prototype=H;var x=new pb(n,r,H,u,w,g,h,l);w=new V(n,x,!0,!1);p=new V(n+"*",x,!1,!1);var Z=new V(n+" const*",x,!1,!0);mb[a]={pointerType:p,$:Z};Cb(z,r);return[w,p,Z]})},n:function(a,
|
||||
b,c,d,e,g){assert(0<b);var k=Ib(b,c);e=W(d,e);var h=[g],m=[];cb([],[a],function(l){l=l[0];var n="constructor "+l.name;void 0===l.D.L&&(l.D.L=[]);if(void 0!==l.D.L[b-1])throw new O("Cannot register multiple constructors with identical number of parameters ("+(b-1)+") for class '"+l.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");l.D.L[b-1]=function(){Hb("Cannot construct "+l.name+" due to unbound types",k)};cb([],k,function(t){l.D.L[b-1]=
|
||||
function(){arguments.length!==b-1&&R(n+" called with "+arguments.length+" arguments, expected "+(b-1));m.length=0;h.length=b;for(var u=1;u<b;++u)h[u]=t[u].toWireType(m,arguments[u-1]);u=e.apply(null,h);Jb(m);return t[0].fromWireType(u)};return[]});return[]})},m:function(a,b,c,d,e,g,k,h){var m=Ib(c,d);b=L(b);g=W(e,g);cb([],[a],function(l){function n(){Hb("Cannot call "+t+" due to unbound types",m)}l=l[0];var t=l.name+"."+b;h&&l.D.ia.push(b);var u=l.D.O,z=u[b];void 0===z||void 0===z.J&&z.className!==
|
||||
l.name&&z.S===c-2?(n.S=c-2,n.className=l.name,u[b]=n):(nb(u,b,t),u[b].J[c-2]=n);cb([],m,function(r){var w=t,p=l,H=g,x=r.length;2>x&&R("argTypes array size mismatch! Must at least get return value and 'this' types!");var Z=null!==r[1]&&null!==p,P=!1;for(p=1;p<r.length;++p)if(null!==r[p]&&void 0===r[p].K){P=!0;break}var tb="void"!==r[0].name,Q="",aa="";for(p=0;p<x-2;++p)Q+=(0!==p?", ":"")+"arg"+p,aa+=(0!==p?", ":"")+"arg"+p+"Wired";w="return function "+Ya(w)+"("+Q+") {\nif (arguments.length !== "+(x-
|
||||
2)+") {\nthrowBindingError('function "+w+" called with ' + arguments.length + ' arguments, expected "+(x-2)+" args!');\n}\n";P&&(w+="var destructors = [];\n");var ub=P?"destructors":"null";Q="throwBindingError invoker fn runDestructors retType classParam".split(" ");H=[R,H,k,Jb,r[0],r[1]];Z&&(w+="var thisWired = classParam.toWireType("+ub+", this);\n");for(p=0;p<x-2;++p)w+="var arg"+p+"Wired = argType"+p+".toWireType("+ub+", arg"+p+"); // "+r[p+2].name+"\n",Q.push("argType"+p),H.push(r[p+2]);Z&&(aa=
|
||||
"thisWired"+(0<aa.length?", ":"")+aa);w+=(tb?"var rv = ":"")+"invoker(fn"+(0<aa.length?", ":"")+aa+");\n";if(P)w+="runDestructors(destructors);\n";else for(p=Z?1:2;p<r.length;++p)x=1===p?"thisWired":"arg"+(p-2)+"Wired",null!==r[p].K&&(w+=x+"_dtor("+x+"); // "+r[p].name+"\n",Q.push(x+"_dtor"),H.push(r[p].K));tb&&(w+="var ret = retType.fromWireType(rv);\nreturn ret;\n");Q.push(w+"}\n");r=Kb(Q).apply(null,H);void 0===u[b].J?(r.S=c-2,u[b]=r):u[b].J[c-2]=r;return[]});return[]})},s:function(a,b){b=L(b);
|
||||
S(a,{name:b,fromWireType:function(c){var d=Y[c].value;4<c&&0===--Y[c].la&&(Y[c]=void 0,Lb.push(c));return d},toWireType:function(c,d){return vb(d)},argPackAdvance:8,readValueFromPointer:xb,K:null})},j:function(a,b,c){c=Va(c);b=L(b);S(a,{name:b,fromWireType:function(d){return d},toWireType:function(d,e){if("number"!==typeof e&&"boolean"!==typeof e)throw new TypeError('Cannot convert "'+U(e)+'" to '+this.name);return e},argPackAdvance:8,readValueFromPointer:Mb(b,c),K:null})},e:function(a,b,c,d,e){function g(l){return l}
|
||||
b=L(b);-1===e&&(e=4294967295);var k=Va(c);if(0===d){var h=32-8*c;g=function(l){return l<<h>>>h}}var m=-1!=b.indexOf("unsigned");S(a,{name:b,fromWireType:g,toWireType:function(l,n){if("number"!==typeof n&&"boolean"!==typeof n)throw new TypeError('Cannot convert "'+U(n)+'" to '+this.name);if(n<d||n>e)throw new TypeError('Passing a number "'+U(n)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+d+", "+e+"]!");return m?n>>>0:n|0},argPackAdvance:8,readValueFromPointer:Nb(b,
|
||||
k,0!==d),K:null})},d:function(a,b,c){function d(g){g>>=2;var k=I;return new e(G,k[g+1],k[g])}var e=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];c=L(c);S(a,{name:c,fromWireType:d,argPackAdvance:8,readValueFromPointer:d},{fa:!0})},h:function(a,b){b=L(b);var c="std::string"===b;S(a,{name:b,fromWireType:function(d){var e=I[d>>2];if(c)for(var g=d+4,k=0;k<=e;++k){var h=d+4+k;if(k==e||0==D[h]){g=g?qa(D,g,h-g):"";if(void 0===m)var m=g;else m+=String.fromCharCode(0),
|
||||
m+=g;g=h+1}}else{m=Array(e);for(k=0;k<e;++k)m[k]=String.fromCharCode(D[d+4+k]);m=m.join("")}X(d);return m},toWireType:function(d,e){e instanceof ArrayBuffer&&(e=new Uint8Array(e));var g="string"===typeof e;g||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int8Array||R("Cannot pass non-string to std::string");var k=(c&&g?function(){for(var l=0,n=0;n<e.length;++n){var t=e.charCodeAt(n);55296<=t&&57343>=t&&(t=65536+((t&1023)<<10)|e.charCodeAt(++n)&1023);127>=t?++l:l=2047>=t?l+
|
||||
2:65535>=t?l+3:l+4}return l}:function(){return e.length})(),h=Sb(4+k+1);I[h>>2]=k;if(c&&g)ra(e,h+4,k+1);else if(g)for(g=0;g<k;++g){var m=e.charCodeAt(g);255<m&&(X(h),R("String has UTF-16 code units that do not fit in 8 bits"));D[h+4+g]=m}else for(g=0;g<k;++g)D[h+4+g]=e[g];null!==d&&d.push(X,h);return h},argPackAdvance:8,readValueFromPointer:xb,K:function(d){X(d)}})},g:function(a,b,c){c=L(c);if(2===b){var d=ta;var e=va;var g=wa;var k=function(){return ua};var h=1}else 4===b&&(d=xa,e=ya,g=za,k=function(){return I},
|
||||
h=2);S(a,{name:c,fromWireType:function(m){for(var l=I[m>>2],n=k(),t,u=m+4,z=0;z<=l;++z){var r=m+4+z*b;if(z==l||0==n[r>>h])u=d(u,r-u),void 0===t?t=u:(t+=String.fromCharCode(0),t+=u),u=r+b}X(m);return t},toWireType:function(m,l){"string"!==typeof l&&R("Cannot pass non-string to C++ string type "+c);var n=g(l),t=Sb(4+n+b);I[t>>2]=n>>h;e(l,t+4,n+b);null!==m&&m.push(X,t);return t},argPackAdvance:8,readValueFromPointer:xb,K:function(m){X(m)}})},l:function(a,b){b=L(b);S(a,{sa:!0,name:b,argPackAdvance:0,
|
||||
fromWireType:function(){},toWireType:function(){}})},b:function(){A()},r:function(a,b,c){D.copyWithin(a,b,b+c)},f:function(a){a>>>=0;var b=D.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{C.grow(Math.min(2147483648,d)-G.byteLength+65535>>>16);Da(C.buffer);var e=1;break a}catch(g){}e=void 0}if(e)return!0}return!1},i:function(a,b,c,d){for(var e=0,g=0;g<c;g++){for(var k=F[b+8*g>>2],h=F[b+
|
||||
(8*g+4)>>2],m=0;m<h;m++){var l=D[k+m],n=Ob[a];0===l||10===l?((1===a?ma:B)(qa(n,0)),n.length=0):n.push(l)}e+=h}F[d>>2]=e;return 0},a:C,q:function(){}};
|
||||
(function(){function a(e){f.asm=e.exports;Fa=f.asm.u;J--;f.monitorRunDependencies&&f.monitorRunDependencies(J);0==J&&(null!==La&&(clearInterval(La),La=null),Ma&&(e=Ma,Ma=null,e()))}function b(e){a(e.instance)}function c(e){return Ra().then(function(g){return WebAssembly.instantiate(g,d)}).then(e,function(g){B("failed to asynchronously prepare wasm: "+g);A(g)})}var d={a:Tb};J++;f.monitorRunDependencies&&f.monitorRunDependencies(J);if(f.instantiateWasm)try{return f.instantiateWasm(d,a)}catch(e){return B("Module.instantiateWasm callback failed with error: "+
|
||||
e),!1}(function(){return na||"function"!==typeof WebAssembly.instantiateStreaming||Oa()||Na("file://")||"function"!==typeof fetch?c(b):fetch(K,{credentials:"same-origin"}).then(function(e){return WebAssembly.instantiateStreaming(e,d).then(b,function(g){B("wasm streaming compile failed: "+g);B("falling back to ArrayBuffer instantiation");return c(b)})})})().catch(ca);return{}})();
|
||||
var Rb=f.___wasm_call_ctors=function(){return(Rb=f.___wasm_call_ctors=f.asm.v).apply(null,arguments)},Sb=f._malloc=function(){return(Sb=f._malloc=f.asm.w).apply(null,arguments)},X=f._free=function(){return(X=f._free=f.asm.x).apply(null,arguments)},Gb=f.___getTypeName=function(){return(Gb=f.___getTypeName=f.asm.y).apply(null,arguments)};f.___embind_register_native_and_builtin_types=function(){return(f.___embind_register_native_and_builtin_types=f.asm.z).apply(null,arguments)};
|
||||
f.dynCall_jiji=function(){return(f.dynCall_jiji=f.asm.A).apply(null,arguments)};var Ub;Ma=function Vb(){Ub||Wb();Ub||(Ma=Vb)};
|
||||
function Wb(){function a(){if(!Ub&&(Ub=!0,f.calledRun=!0,!oa)){Sa(Ha);Sa(Ia);ba(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();Ja.unshift(b)}Sa(Ja)}}if(!(0<J)){if(f.preRun)for("function"==typeof f.preRun&&(f.preRun=[f.preRun]);f.preRun.length;)Ka();Sa(Ga);0<J||(f.setStatus?(f.setStatus("Running..."),setTimeout(function(){setTimeout(function(){f.setStatus("")},1);a()},1)):a())}}
|
||||
f.run=Wb;if(f.preInit)for("function"==typeof f.preInit&&(f.preInit=[f.preInit]);0<f.preInit.length;)f.preInit.pop()();noExitRuntime=!0;Wb();
|
||||
|
||||
|
||||
return visdif.ready
|
||||
}
|
||||
);
|
||||
})();
|
||||
if (typeof exports === 'object' && typeof module === 'object')
|
||||
module.exports = visdif;
|
||||
else if (typeof define === 'function' && define['amd'])
|
||||
define([], function() { return visdif; });
|
||||
else if (typeof exports === 'object')
|
||||
exports["visdif"] = visdif;
|
||||
|
||||
export default visdif;
|
||||
BIN
codecs/visdif/visdif.wasm
Normal file → Executable file
BIN
codecs/visdif/visdif.wasm
Normal file → Executable file
Binary file not shown.
Binary file not shown.
@@ -1,4 +1,4 @@
|
||||
CODEC_URL = https://chromium.googlesource.com/codecs/libwebp2/+archive/7c0dceb507efdec47f9d219e0b8be91092db8b48.tar.gz
|
||||
CODEC_URL = https://chromium.googlesource.com/codecs/libwebp2/+archive/413df7caeca5013fa9a51401660f7efd8572e0ae.tar.gz
|
||||
CODEC_DIR = node_modules/wp2
|
||||
CODEC_BUILD_ROOT := $(CODEC_DIR)/build
|
||||
CODEC_BASELINE_BUILD_DIR := $(CODEC_BUILD_ROOT)/baseline
|
||||
@@ -60,6 +60,7 @@ $(CODEC_MT_SIMD_BUILD_DIR)/Makefile: CMAKE_FLAGS+=-DWP2_ENABLE_SIMD=1
|
||||
-DWP2_BUILD_TESTS=0 \
|
||||
-DWP2_BUILD_EXAMPLES=0 \
|
||||
-DWP2_BUILD_EXTRAS=0 \
|
||||
-DWP2_REDUCED=1 \
|
||||
-B $(@D) \
|
||||
$(<D)
|
||||
|
||||
|
||||
2
codecs/wp2/dec/wp2_dec.js
generated
2
codecs/wp2/dec/wp2_dec.js
generated
@@ -44,7 +44,7 @@ b,c){A.copyWithin(a,b,b+c)},d:function(a){a>>>=0;var b=A.length;if(2147483648<a)
|
||||
k);)++k;k=fa.decode(m.subarray?m.subarray(0,k):new Uint8Array(m.slice(0,k)));(1===a?da:v)(k);m.length=0}else m.push(k)}f+=h}E[d>>2]=f;return 0},a:z,t: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){v("failed to asynchronously prepare wasm: "+g);y(g)})}var d={a:mb};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||za()||"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 kb=e.___wasm_call_ctors=function(){return(kb=e.___wasm_call_ctors=e.asm.x).apply(null,arguments)},lb=e._malloc=function(){return(lb=e._malloc=e.asm.y).apply(null,arguments)},Y=e._free=function(){return(Y=e._free=e.asm.z).apply(null,arguments)},bb=e.___getTypeName=function(){return(bb=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)};
|
||||
var kb=e.___wasm_call_ctors=function(){return(kb=e.___wasm_call_ctors=e.asm.x).apply(null,arguments)},Y=e._free=function(){return(Y=e._free=e.asm.y).apply(null,arguments)},lb=e._malloc=function(){return(lb=e._malloc=e.asm.z).apply(null,arguments)},bb=e.___getTypeName=function(){return(bb=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 nb;L=function ob(){nb||pb();nb||(L=ob)};
|
||||
function pb(){function a(){if(!nb&&(nb=!0,e.calledRun=!0,!ea)){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=pb;if(e.preInit)for("function"==typeof e.preInit&&(e.preInit=[e.preInit]);0<e.preInit.length;)e.preInit.pop()();noExitRuntime=!0;pb();
|
||||
|
||||
BIN
codecs/wp2/dec/wp2_dec.wasm
Normal file → Executable file
BIN
codecs/wp2/dec/wp2_dec.wasm
Normal file → Executable file
Binary file not shown.
2
codecs/wp2/dec/wp2_node_dec.js
generated
2
codecs/wp2/dec/wp2_node_dec.js
generated
@@ -44,7 +44,7 @@ b,c){z.copyWithin(a,b,b+c)},d:function(a){a>>>=0;var b=z.length;if(2147483648<a)
|
||||
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}D[d>>2]=f;return 0},a:y,t:function(){}};
|
||||
(function(){function a(f){e.asm=f.exports;I=e.asm.w;J--;e.monitorRunDependencies&&e.monitorRunDependencies(J);0==J&&(null!==Ca&&(clearInterval(Ca),Ca=null),K&&(f=K,K=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){v("failed to asynchronously prepare wasm: "+g);u(g)})}var d={a:ob};J++;e.monitorRunDependencies&&e.monitorRunDependencies(J);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||Da()||"function"!==typeof fetch?c(b):fetch(M,{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.x).apply(null,arguments)},Z=e._malloc=function(){return(Z=e._malloc=e.asm.y).apply(null,arguments)},X=e._free=function(){return(X=e._free=e.asm.z).apply(null,arguments)},eb=e.___getTypeName=function(){return(eb=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)};
|
||||
var nb=e.___wasm_call_ctors=function(){return(nb=e.___wasm_call_ctors=e.asm.x).apply(null,arguments)},X=e._free=function(){return(X=e._free=e.asm.y).apply(null,arguments)},Z=e._malloc=function(){return(Z=e._malloc=e.asm.z).apply(null,arguments)},eb=e.___getTypeName=function(){return(eb=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 pb;K=function qb(){pb||rb();pb||(K=qb)};
|
||||
function rb(){function a(){if(!pb&&(pb=!0,e.calledRun=!0,!ja)){N(ya);N(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)}N(Aa)}}if(!(0<J)){if(e.preRun)for("function"==typeof e.preRun&&(e.preRun=[e.preRun]);e.preRun.length;)Ba();N(xa);0<J||(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();
|
||||
|
||||
Binary file not shown.
2
codecs/wp2/enc/wp2_enc.js
generated
2
codecs/wp2/enc/wp2_enc.js
generated
@@ -47,7 +47,7 @@ a,d);0<d%65536&&(d+=65536-d%65536);a:{try{B.grow(Math.min(2147483648,d)-I.byteLe
|
||||
a:B,s:function(){}};
|
||||
(function(){function a(e){f.asm=e.exports;L=f.asm.C;M--;f.monitorRunDependencies&&f.monitorRunDependencies(M);0==M&&(null!==za&&(clearInterval(za),za=null),N&&(e=N,N=null,e()))}function b(e){a(e.instance)}function c(e){return Da().then(function(g){return WebAssembly.instantiate(g,d)}).then(e,function(g){v("failed to asynchronously prepare wasm: "+g);A(g)})}var d={a:ob};M++;f.monitorRunDependencies&&f.monitorRunDependencies(M);if(f.instantiateWasm)try{return f.instantiateWasm(d,a)}catch(e){return v("Module.instantiateWasm callback failed with error: "+
|
||||
e),!1}(function(){return w||"function"!==typeof WebAssembly.instantiateStreaming||Aa()||"function"!==typeof fetch?c(b):fetch(O,{credentials:"same-origin"}).then(function(e){return WebAssembly.instantiateStreaming(e,d).then(b,function(g){v("wasm streaming compile failed: "+g);v("falling back to ArrayBuffer instantiation");return c(b)})})})().catch(ba);return{}})();
|
||||
var mb=f.___wasm_call_ctors=function(){return(mb=f.___wasm_call_ctors=f.asm.D).apply(null,arguments)},nb=f._malloc=function(){return(nb=f._malloc=f.asm.E).apply(null,arguments)},Z=f._free=function(){return(Z=f._free=f.asm.F).apply(null,arguments)},cb=f.___getTypeName=function(){return(cb=f.___getTypeName=f.asm.G).apply(null,arguments)};f.___embind_register_native_and_builtin_types=function(){return(f.___embind_register_native_and_builtin_types=f.asm.H).apply(null,arguments)};
|
||||
var mb=f.___wasm_call_ctors=function(){return(mb=f.___wasm_call_ctors=f.asm.D).apply(null,arguments)},Z=f._free=function(){return(Z=f._free=f.asm.E).apply(null,arguments)},nb=f._malloc=function(){return(nb=f._malloc=f.asm.F).apply(null,arguments)},cb=f.___getTypeName=function(){return(cb=f.___getTypeName=f.asm.G).apply(null,arguments)};f.___embind_register_native_and_builtin_types=function(){return(f.___embind_register_native_and_builtin_types=f.asm.H).apply(null,arguments)};
|
||||
f.dynCall_jiji=function(){return(f.dynCall_jiji=f.asm.I).apply(null,arguments)};var pb;N=function qb(){pb||rb();pb||(N=qb)};
|
||||
function rb(){function a(){if(!pb&&(pb=!0,f.calledRun=!0,!ea)){P(va);P(wa);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();xa.unshift(b)}P(xa)}}if(!(0<M)){if(f.preRun)for("function"==typeof f.preRun&&(f.preRun=[f.preRun]);f.preRun.length;)ya();P(ua);0<M||(f.setStatus?(f.setStatus("Running..."),setTimeout(function(){setTimeout(function(){f.setStatus("")},1);a()},1)):a())}}
|
||||
f.run=rb;if(f.preInit)for("function"==typeof f.preInit&&(f.preInit=[f.preInit]);0<f.preInit.length;)f.preInit.pop()();noExitRuntime=!0;rb();
|
||||
|
||||
BIN
codecs/wp2/enc/wp2_enc.wasm
Normal file → Executable file
BIN
codecs/wp2/enc/wp2_enc.wasm
Normal file → Executable file
Binary file not shown.
6
codecs/wp2/enc/wp2_enc_mt.js
generated
6
codecs/wp2/enc/wp2_enc_mt.js
generated
@@ -17,7 +17,7 @@ function Ba(a){return 2*a.length}function Ca(a,b){for(var c=0,d="";!(c>=b/4);){v
|
||||
function Ea(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 m,aa,ca,da,fa,ha,ia,ka,ma;function p(a){m=a;A.HEAP8=aa=new Int8Array(a);A.HEAP16=da=new Int16Array(a);A.HEAP32=ha=new Int32Array(a);A.HEAPU8=ca=new Uint8Array(a);A.HEAPU16=fa=new Uint16Array(a);A.HEAPU32=ia=new Uint32Array(a);A.HEAPF32=ka=new Float32Array(a);A.HEAPF64=ma=new Float64Array(a)}var Fa=A.INITIAL_MEMORY||16777216;
|
||||
if(D)k=A.wasmMemory,m=A.buffer;else if(A.wasmMemory)k=A.wasmMemory;else if(k=new WebAssembly.Memory({initial:Fa/65536,maximum:32768,shared:!0}),!(k.buffer instanceof SharedArrayBuffer))throw H("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");k&&(m=k.buffer);Fa=m.byteLength;p(m);var L,Ga=[],Ha=[],Ia=[],Ja=[];
|
||||
function Ka(){var a=A.preRun.shift();Ga.unshift(a)}var N=0,La=null,O=null;A.preloadedImages={};A.preloadedAudios={};function J(a){if(A.onAbort)A.onAbort(a);D&&console.error("Pthread aborting at "+Error().stack);H(a);ua=!0;a=new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");oa(a);throw a;}function Ma(){var a=P;return String.prototype.startsWith?a.startsWith("data:application/octet-stream;base64,"):0===a.indexOf("data:application/octet-stream;base64,")}var P="wp2_enc_mt.wasm";
|
||||
Ma()||(P=qa(P));function Na(){try{if(I)return new Uint8Array(I);if(ra)return ra(P);throw"both async and sync fetching of the wasm failed";}catch(a){J(a)}}function Oa(){return I||"function"!==typeof fetch?Promise.resolve().then(Na):fetch(P,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+P+"'";return a.arrayBuffer()}).catch(function(){return Na()})}var Qa={124965:function(a,b){setTimeout(function(){Pa(a,b)},0)},125043:function(){throw"Canceled!";}};
|
||||
Ma()||(P=qa(P));function Na(){try{if(I)return new Uint8Array(I);if(ra)return ra(P);throw"both async and sync fetching of the wasm failed";}catch(a){J(a)}}function Oa(){return I||"function"!==typeof fetch?Promise.resolve().then(Na):fetch(P,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+P+"'";return a.arrayBuffer()}).catch(function(){return Na()})}var Qa={109389:function(a,b){setTimeout(function(){Pa(a,b)},0)},109467:function(){throw"Canceled!";}};
|
||||
function Ra(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(A);else{var c=b.mb;"number"===typeof c?void 0===b.Ka?L.get(c)():L.get(c)(b.Ka):c(void 0===b.Ka?null:b.Ka)}}}function Sa(a,b,c){var d;-1!=a.indexOf("j")?d=c&&c.length?A["dynCall_"+a].apply(null,[b].concat(c)):A["dynCall_"+a].call(null,b):d=L.get(b).apply(null,c);return d}A.dynCall=Sa;var Q=0,Ta=0,Ua=0;function Va(a,b,c){Q=a|0;Ua=b|0;Ta=c|0}A.registerPthreadPtr=Va;
|
||||
function Wa(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(y(),R.bb>>2),d=0;if(c==a&&Atomics.compareExchange(y(),R.bb>>2,c,0)==c&&(--b,d=1,0>=b))return 1;a=Atomics.notify(y(),a>>2,b);if(0<=a)return a+d;throw"Atomics.notify returned an unexpected value "+a;}A._emscripten_futex_wake=Wa;
|
||||
function Xa(a){if(D)throw"Internal Error! cleanupThread() can only ever be called from main application thread!";if(!a)throw"Internal Error! Null pthread_ptr in cleanupThread!";y()[a+12>>2]=0;(a=R.Ea[a])&&R.Qa(a.worker)}
|
||||
@@ -75,7 +75,7 @@ x+108+24>>2);h&&(y()[h>>2]=E);n&&(y()[n>>2]=x)}else H("pthread_getschedparam cal
|
||||
B:function(){}};
|
||||
(function(){function a(f,g){A.asm=f.exports;L=A.asm.V;ta=g;if(!D){var l=R.Ca.length;R.Ca.forEach(function(h){R.ab(h,function(){if(!--l&&(N--,A.monitorRunDependencies&&A.monitorRunDependencies(N),0==N&&(null!==La&&(clearInterval(La),La=null),O))){var n=O;O=null;n()}})})}}function b(f){a(f.instance,f.module)}function c(f){return Oa().then(function(g){return WebAssembly.instantiate(g,d)}).then(f,function(g){H("failed to asynchronously prepare wasm: "+g);J(g)})}var d={a:rc};D||(va(!D,"addRunDependency cannot be used in a pthread worker"),
|
||||
N++,A.monitorRunDependencies&&A.monitorRunDependencies(N));if(A.instantiateWasm)try{return A.instantiateWasm(d,a)}catch(f){return H("Module.instantiateWasm callback failed with error: "+f),!1}(function(){return I||"function"!==typeof WebAssembly.instantiateStreaming||Ma()||"function"!==typeof fetch?c(b):fetch(P,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,d).then(b,function(g){H("wasm streaming compile failed: "+g);H("falling back to ArrayBuffer instantiation");
|
||||
return c(b)})})})().catch(oa);return{}})();var oc=A.___wasm_call_ctors=function(){return(oc=A.___wasm_call_ctors=A.asm.W).apply(null,arguments)},S=A._malloc=function(){return(S=A._malloc=A.asm.X).apply(null,arguments)},T=A._free=function(){return(T=A._free=A.asm.Y).apply(null,arguments)},Gb=A.___getTypeName=function(){return(Gb=A.___getTypeName=A.asm.Z).apply(null,arguments)};
|
||||
return c(b)})})})().catch(oa);return{}})();var oc=A.___wasm_call_ctors=function(){return(oc=A.___wasm_call_ctors=A.asm.W).apply(null,arguments)},T=A._free=function(){return(T=A._free=A.asm.X).apply(null,arguments)},S=A._malloc=function(){return(S=A._malloc=A.asm.Y).apply(null,arguments)},Gb=A.___getTypeName=function(){return(Gb=A.___getTypeName=A.asm.Z).apply(null,arguments)};
|
||||
A.___embind_register_native_and_builtin_types=function(){return(A.___embind_register_native_and_builtin_types=A.asm._).apply(null,arguments)};var ic=A._emscripten_get_global_libc=function(){return(ic=A._emscripten_get_global_libc=A.asm.$).apply(null,arguments)};A.___em_js__initPthreadsJS=function(){return(A.___em_js__initPthreadsJS=A.asm.aa).apply(null,arguments)};
|
||||
var Pb=A.stackSave=function(){return(Pb=A.stackSave=A.asm.ba).apply(null,arguments)},cb=A.stackRestore=function(){return(cb=A.stackRestore=A.asm.ca).apply(null,arguments)},Qb=A.stackAlloc=function(){return(Qb=A.stackAlloc=A.asm.da).apply(null,arguments)},qc=A._memalign=function(){return(qc=A._memalign=A.asm.ea).apply(null,arguments)};A._emscripten_main_browser_thread_id=function(){return(A._emscripten_main_browser_thread_id=A.asm.fa).apply(null,arguments)};
|
||||
var $a=A.___pthread_tsd_run_dtors=function(){return($a=A.___pthread_tsd_run_dtors=A.asm.ga).apply(null,arguments)},ab=A._emscripten_main_thread_process_queued_calls=function(){return(ab=A._emscripten_main_thread_process_queued_calls=A.asm.ha).apply(null,arguments)};A._emscripten_current_thread_process_queued_calls=function(){return(A._emscripten_current_thread_process_queued_calls=A.asm.ia).apply(null,arguments)};
|
||||
@@ -84,7 +84,7 @@ A._emscripten_sync_run_in_main_thread=function(){return(A._emscripten_sync_run_i
|
||||
A._emscripten_sync_run_in_main_thread_2=function(){return(A._emscripten_sync_run_in_main_thread_2=A.asm.pa).apply(null,arguments)};A._emscripten_sync_run_in_main_thread_xprintf_varargs=function(){return(A._emscripten_sync_run_in_main_thread_xprintf_varargs=A.asm.qa).apply(null,arguments)};A._emscripten_sync_run_in_main_thread_3=function(){return(A._emscripten_sync_run_in_main_thread_3=A.asm.ra).apply(null,arguments)};
|
||||
var pc=A._emscripten_sync_run_in_main_thread_4=function(){return(pc=A._emscripten_sync_run_in_main_thread_4=A.asm.sa).apply(null,arguments)};A._emscripten_sync_run_in_main_thread_5=function(){return(A._emscripten_sync_run_in_main_thread_5=A.asm.ta).apply(null,arguments)};A._emscripten_sync_run_in_main_thread_6=function(){return(A._emscripten_sync_run_in_main_thread_6=A.asm.ua).apply(null,arguments)};
|
||||
A._emscripten_sync_run_in_main_thread_7=function(){return(A._emscripten_sync_run_in_main_thread_7=A.asm.va).apply(null,arguments)};var Rb=A._emscripten_run_in_main_runtime_thread_js=function(){return(Rb=A._emscripten_run_in_main_runtime_thread_js=A.asm.wa).apply(null,arguments)},Xb=A.__emscripten_call_on_thread=function(){return(Xb=A.__emscripten_call_on_thread=A.asm.xa).apply(null,arguments)};A._emscripten_tls_init=function(){return(A._emscripten_tls_init=A.asm.ya).apply(null,arguments)};
|
||||
A.dynCall_jiji=function(){return(A.dynCall_jiji=A.asm.za).apply(null,arguments)};var Za=A._main_thread_futex=139708;A.PThread=R;A.PThread=R;A._pthread_self=jc;A.wasmMemory=k;A.ExitStatus=sc;var tc;function sc(a){this.name="ExitStatus";this.message="Program terminated with exit("+a+")";this.status=a}O=function uc(){tc||vc();tc||(O=uc)};
|
||||
A.dynCall_jiji=function(){return(A.dynCall_jiji=A.asm.za).apply(null,arguments)};var Za=A._main_thread_futex=124012;A.PThread=R;A.PThread=R;A._pthread_self=jc;A.wasmMemory=k;A.ExitStatus=sc;var tc;function sc(a){this.name="ExitStatus";this.message="Program terminated with exit("+a+")";this.status=a}O=function uc(){tc||vc();tc||(O=uc)};
|
||||
function vc(){function a(){if(!tc&&(tc=!0,A.calledRun=!0,!ua)){Ra(Ha);D||Ra(Ia);na(A);if(A.onRuntimeInitialized)A.onRuntimeInitialized();if(!D){if(A.postRun)for("function"==typeof A.postRun&&(A.postRun=[A.postRun]);A.postRun.length;){var b=A.postRun.shift();Ja.unshift(b)}Ra(Ja)}}}if(!(0<N)){if(!D){if(A.preRun)for("function"==typeof A.preRun&&(A.preRun=[A.preRun]);A.preRun.length;)Ka();Ra(Ga)}0<N||(A.setStatus?(A.setStatus("Running..."),setTimeout(function(){setTimeout(function(){A.setStatus("")},
|
||||
1);a()},1)):a())}}A.run=vc;if(A.preInit)for("function"==typeof A.preInit&&(A.preInit=[A.preInit]);0<A.preInit.length;)A.preInit.pop()();D||(noExitRuntime=!0);D?R.wb():vc();
|
||||
|
||||
|
||||
BIN
codecs/wp2/enc/wp2_enc_mt.wasm
Normal file → Executable file
BIN
codecs/wp2/enc/wp2_enc_mt.wasm
Normal file → Executable file
Binary file not shown.
6
codecs/wp2/enc/wp2_enc_mt_simd.js
generated
6
codecs/wp2/enc/wp2_enc_mt_simd.js
generated
@@ -17,7 +17,7 @@ function Ba(a){return 2*a.length}function Ca(a,b){for(var c=0,d="";!(c>=b/4);){v
|
||||
function Ea(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 m,aa,ca,da,fa,ha,ia,ka,ma;function p(a){m=a;A.HEAP8=aa=new Int8Array(a);A.HEAP16=da=new Int16Array(a);A.HEAP32=ha=new Int32Array(a);A.HEAPU8=ca=new Uint8Array(a);A.HEAPU16=fa=new Uint16Array(a);A.HEAPU32=ia=new Uint32Array(a);A.HEAPF32=ka=new Float32Array(a);A.HEAPF64=ma=new Float64Array(a)}var Fa=A.INITIAL_MEMORY||16777216;
|
||||
if(D)k=A.wasmMemory,m=A.buffer;else if(A.wasmMemory)k=A.wasmMemory;else if(k=new WebAssembly.Memory({initial:Fa/65536,maximum:32768,shared:!0}),!(k.buffer instanceof SharedArrayBuffer))throw H("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");k&&(m=k.buffer);Fa=m.byteLength;p(m);var L,Ga=[],Ha=[],Ia=[],Ja=[];
|
||||
function Ka(){var a=A.preRun.shift();Ga.unshift(a)}var N=0,La=null,O=null;A.preloadedImages={};A.preloadedAudios={};function J(a){if(A.onAbort)A.onAbort(a);D&&console.error("Pthread aborting at "+Error().stack);H(a);ua=!0;a=new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");oa(a);throw a;}function Ma(){var a=P;return String.prototype.startsWith?a.startsWith("data:application/octet-stream;base64,"):0===a.indexOf("data:application/octet-stream;base64,")}var P="wp2_enc_mt_simd.wasm";
|
||||
Ma()||(P=qa(P));function Na(){try{if(I)return new Uint8Array(I);if(ra)return ra(P);throw"both async and sync fetching of the wasm failed";}catch(a){J(a)}}function Oa(){return I||"function"!==typeof fetch?Promise.resolve().then(Na):fetch(P,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+P+"'";return a.arrayBuffer()}).catch(function(){return Na()})}var Qa={125045:function(a,b){setTimeout(function(){Pa(a,b)},0)},125123:function(){throw"Canceled!";}};
|
||||
Ma()||(P=qa(P));function Na(){try{if(I)return new Uint8Array(I);if(ra)return ra(P);throw"both async and sync fetching of the wasm failed";}catch(a){J(a)}}function Oa(){return I||"function"!==typeof fetch?Promise.resolve().then(Na):fetch(P,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+P+"'";return a.arrayBuffer()}).catch(function(){return Na()})}var Qa={109469:function(a,b){setTimeout(function(){Pa(a,b)},0)},109547:function(){throw"Canceled!";}};
|
||||
function Ra(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(A);else{var c=b.ob;"number"===typeof c?void 0===b.Ma?L.get(c)():L.get(c)(b.Ma):c(void 0===b.Ma?null:b.Ma)}}}function Sa(a,b,c){var d;-1!=a.indexOf("j")?d=c&&c.length?A["dynCall_"+a].apply(null,[b].concat(c)):A["dynCall_"+a].call(null,b):d=L.get(b).apply(null,c);return d}A.dynCall=Sa;var Q=0,Ta=0,Ua=0;function Va(a,b,c){Q=a|0;Ua=b|0;Ta=c|0}A.registerPthreadPtr=Va;
|
||||
function Wa(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(y(),R.eb>>2),d=0;if(c==a&&Atomics.compareExchange(y(),R.eb>>2,c,0)==c&&(--b,d=1,0>=b))return 1;a=Atomics.notify(y(),a>>2,b);if(0<=a)return a+d;throw"Atomics.notify returned an unexpected value "+a;}A._emscripten_futex_wake=Wa;
|
||||
function Xa(a){if(D)throw"Internal Error! cleanupThread() can only ever be called from main application thread!";if(!a)throw"Internal Error! Null pthread_ptr in cleanupThread!";y()[a+12>>2]=0;(a=R.Ga[a])&&R.Sa(a.worker)}
|
||||
@@ -76,7 +76,7 @@ x+108+24>>2);h&&(y()[h>>2]=E);n&&(y()[n>>2]=x)}else H("pthread_getschedparam cal
|
||||
o:function(){}};
|
||||
(function(){function a(f,g){A.asm=f.exports;L=A.asm.V;ta=g;if(!D){var l=R.Ea.length;R.Ea.forEach(function(h){R.cb(h,function(){if(!--l&&(N--,A.monitorRunDependencies&&A.monitorRunDependencies(N),0==N&&(null!==La&&(clearInterval(La),La=null),O))){var n=O;O=null;n()}})})}}function b(f){a(f.instance,f.module)}function c(f){return Oa().then(function(g){return WebAssembly.instantiate(g,d)}).then(f,function(g){H("failed to asynchronously prepare wasm: "+g);J(g)})}var d={a:rc};D||(va(!D,"addRunDependency cannot be used in a pthread worker"),
|
||||
N++,A.monitorRunDependencies&&A.monitorRunDependencies(N));if(A.instantiateWasm)try{return A.instantiateWasm(d,a)}catch(f){return H("Module.instantiateWasm callback failed with error: "+f),!1}(function(){return I||"function"!==typeof WebAssembly.instantiateStreaming||Ma()||"function"!==typeof fetch?c(b):fetch(P,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,d).then(b,function(g){H("wasm streaming compile failed: "+g);H("falling back to ArrayBuffer instantiation");
|
||||
return c(b)})})})().catch(oa);return{}})();var oc=A.___wasm_call_ctors=function(){return(oc=A.___wasm_call_ctors=A.asm.W).apply(null,arguments)},S=A._malloc=function(){return(S=A._malloc=A.asm.X).apply(null,arguments)},T=A._free=function(){return(T=A._free=A.asm.Y).apply(null,arguments)},Gb=A.___getTypeName=function(){return(Gb=A.___getTypeName=A.asm.Z).apply(null,arguments)};
|
||||
return c(b)})})})().catch(oa);return{}})();var oc=A.___wasm_call_ctors=function(){return(oc=A.___wasm_call_ctors=A.asm.W).apply(null,arguments)},T=A._free=function(){return(T=A._free=A.asm.X).apply(null,arguments)},S=A._malloc=function(){return(S=A._malloc=A.asm.Y).apply(null,arguments)},Gb=A.___getTypeName=function(){return(Gb=A.___getTypeName=A.asm.Z).apply(null,arguments)};
|
||||
A.___embind_register_native_and_builtin_types=function(){return(A.___embind_register_native_and_builtin_types=A.asm._).apply(null,arguments)};var ic=A._emscripten_get_global_libc=function(){return(ic=A._emscripten_get_global_libc=A.asm.$).apply(null,arguments)};A.___em_js__initPthreadsJS=function(){return(A.___em_js__initPthreadsJS=A.asm.aa).apply(null,arguments)};
|
||||
var Pb=A.stackSave=function(){return(Pb=A.stackSave=A.asm.ba).apply(null,arguments)},cb=A.stackRestore=function(){return(cb=A.stackRestore=A.asm.ca).apply(null,arguments)},Qb=A.stackAlloc=function(){return(Qb=A.stackAlloc=A.asm.da).apply(null,arguments)},qc=A._memalign=function(){return(qc=A._memalign=A.asm.ea).apply(null,arguments)};A._emscripten_main_browser_thread_id=function(){return(A._emscripten_main_browser_thread_id=A.asm.fa).apply(null,arguments)};
|
||||
var $a=A.___pthread_tsd_run_dtors=function(){return($a=A.___pthread_tsd_run_dtors=A.asm.ga).apply(null,arguments)},ab=A._emscripten_main_thread_process_queued_calls=function(){return(ab=A._emscripten_main_thread_process_queued_calls=A.asm.ha).apply(null,arguments)};A._emscripten_current_thread_process_queued_calls=function(){return(A._emscripten_current_thread_process_queued_calls=A.asm.ia).apply(null,arguments)};
|
||||
@@ -85,7 +85,7 @@ A._emscripten_sync_run_in_main_thread=function(){return(A._emscripten_sync_run_i
|
||||
A._emscripten_sync_run_in_main_thread_2=function(){return(A._emscripten_sync_run_in_main_thread_2=A.asm.pa).apply(null,arguments)};A._emscripten_sync_run_in_main_thread_xprintf_varargs=function(){return(A._emscripten_sync_run_in_main_thread_xprintf_varargs=A.asm.qa).apply(null,arguments)};A._emscripten_sync_run_in_main_thread_3=function(){return(A._emscripten_sync_run_in_main_thread_3=A.asm.ra).apply(null,arguments)};
|
||||
var pc=A._emscripten_sync_run_in_main_thread_4=function(){return(pc=A._emscripten_sync_run_in_main_thread_4=A.asm.sa).apply(null,arguments)};A._emscripten_sync_run_in_main_thread_5=function(){return(A._emscripten_sync_run_in_main_thread_5=A.asm.ta).apply(null,arguments)};A._emscripten_sync_run_in_main_thread_6=function(){return(A._emscripten_sync_run_in_main_thread_6=A.asm.ua).apply(null,arguments)};
|
||||
A._emscripten_sync_run_in_main_thread_7=function(){return(A._emscripten_sync_run_in_main_thread_7=A.asm.va).apply(null,arguments)};var Rb=A._emscripten_run_in_main_runtime_thread_js=function(){return(Rb=A._emscripten_run_in_main_runtime_thread_js=A.asm.wa).apply(null,arguments)},Xb=A.__emscripten_call_on_thread=function(){return(Xb=A.__emscripten_call_on_thread=A.asm.xa).apply(null,arguments)};A._emscripten_tls_init=function(){return(A._emscripten_tls_init=A.asm.ya).apply(null,arguments)};
|
||||
A.dynCall_jiii=function(){return(A.dynCall_jiii=A.asm.za).apply(null,arguments)};A.dynCall_jiiiiii=function(){return(A.dynCall_jiiiiii=A.asm.Aa).apply(null,arguments)};A.dynCall_jiji=function(){return(A.dynCall_jiji=A.asm.Ba).apply(null,arguments)};var Za=A._main_thread_futex=139852;A.PThread=R;A.PThread=R;A._pthread_self=jc;A.wasmMemory=k;A.ExitStatus=sc;var tc;function sc(a){this.name="ExitStatus";this.message="Program terminated with exit("+a+")";this.status=a}O=function uc(){tc||vc();tc||(O=uc)};
|
||||
A.dynCall_jiii=function(){return(A.dynCall_jiii=A.asm.za).apply(null,arguments)};A.dynCall_jiiiiii=function(){return(A.dynCall_jiiiiii=A.asm.Aa).apply(null,arguments)};A.dynCall_jiji=function(){return(A.dynCall_jiji=A.asm.Ba).apply(null,arguments)};var Za=A._main_thread_futex=124172;A.PThread=R;A.PThread=R;A._pthread_self=jc;A.wasmMemory=k;A.ExitStatus=sc;var tc;function sc(a){this.name="ExitStatus";this.message="Program terminated with exit("+a+")";this.status=a}O=function uc(){tc||vc();tc||(O=uc)};
|
||||
function vc(){function a(){if(!tc&&(tc=!0,A.calledRun=!0,!ua)){Ra(Ha);D||Ra(Ia);na(A);if(A.onRuntimeInitialized)A.onRuntimeInitialized();if(!D){if(A.postRun)for("function"==typeof A.postRun&&(A.postRun=[A.postRun]);A.postRun.length;){var b=A.postRun.shift();Ja.unshift(b)}Ra(Ja)}}}if(!(0<N)){if(!D){if(A.preRun)for("function"==typeof A.preRun&&(A.preRun=[A.preRun]);A.preRun.length;)Ka();Ra(Ga)}0<N||(A.setStatus?(A.setStatus("Running..."),setTimeout(function(){setTimeout(function(){A.setStatus("")},
|
||||
1);a()},1)):a())}}A.run=vc;if(A.preInit)for("function"==typeof A.preInit&&(A.preInit=[A.preInit]);0<A.preInit.length;)A.preInit.pop()();D||(noExitRuntime=!0);D?R.yb():vc();
|
||||
|
||||
|
||||
BIN
codecs/wp2/enc/wp2_enc_mt_simd.wasm
Normal file → Executable file
BIN
codecs/wp2/enc/wp2_enc_mt_simd.wasm
Normal file → Executable file
Binary file not shown.
2
codecs/wp2/enc/wp2_node_enc.js
generated
2
codecs/wp2/enc/wp2_node_enc.js
generated
@@ -48,7 +48,7 @@ a,d);0<d%65536&&(d+=65536-d%65536);a:{try{A.grow(Math.min(2147483648,d)-H.byteLe
|
||||
2]=e;return 0},a:A,s:function(){}};
|
||||
(function(){function a(e){f.asm=e.exports;K=f.asm.C;L--;f.monitorRunDependencies&&f.monitorRunDependencies(L);0==L&&(null!==Da&&(clearInterval(Da),Da=null),M&&(e=M,M=null,e()))}function b(e){a(e.instance)}function c(e){return Promise.resolve().then(Ga).then(function(g){return WebAssembly.instantiate(g,d)}).then(e,function(g){v("failed to asynchronously prepare wasm: "+g);u(g)})}var d={a:qb};L++;f.monitorRunDependencies&&f.monitorRunDependencies(L);if(f.instantiateWasm)try{return f.instantiateWasm(d,a)}catch(e){return v("Module.instantiateWasm callback failed with error: "+
|
||||
e),!1}(function(){return w||"function"!==typeof WebAssembly.instantiateStreaming||Ea()||"function"!==typeof fetch?c(b):fetch(N,{credentials:"same-origin"}).then(function(e){return WebAssembly.instantiateStreaming(e,d).then(b,function(g){v("wasm streaming compile failed: "+g);v("falling back to ArrayBuffer instantiation");return c(b)})})})().catch(ba);return{}})();
|
||||
var ob=f.___wasm_call_ctors=function(){return(ob=f.___wasm_call_ctors=f.asm.D).apply(null,arguments)},pb=f._malloc=function(){return(pb=f._malloc=f.asm.E).apply(null,arguments)},Z=f._free=function(){return(Z=f._free=f.asm.F).apply(null,arguments)},eb=f.___getTypeName=function(){return(eb=f.___getTypeName=f.asm.G).apply(null,arguments)};f.___embind_register_native_and_builtin_types=function(){return(f.___embind_register_native_and_builtin_types=f.asm.H).apply(null,arguments)};
|
||||
var ob=f.___wasm_call_ctors=function(){return(ob=f.___wasm_call_ctors=f.asm.D).apply(null,arguments)},Z=f._free=function(){return(Z=f._free=f.asm.E).apply(null,arguments)},pb=f._malloc=function(){return(pb=f._malloc=f.asm.F).apply(null,arguments)},eb=f.___getTypeName=function(){return(eb=f.___getTypeName=f.asm.G).apply(null,arguments)};f.___embind_register_native_and_builtin_types=function(){return(f.___embind_register_native_and_builtin_types=f.asm.H).apply(null,arguments)};
|
||||
f.dynCall_jiji=function(){return(f.dynCall_jiji=f.asm.I).apply(null,arguments)};var rb;M=function sb(){rb||tb();rb||(M=sb)};
|
||||
function tb(){function a(){if(!rb&&(rb=!0,f.calledRun=!0,!ka)){O(za);O(Aa);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();Ba.unshift(b)}O(Ba)}}if(!(0<L)){if(f.preRun)for("function"==typeof f.preRun&&(f.preRun=[f.preRun]);f.preRun.length;)Ca();O(ya);0<L||(f.setStatus?(f.setStatus("Running..."),setTimeout(function(){setTimeout(function(){f.setStatus("")},1);a()},1)):a())}}
|
||||
f.run=tb;if(f.preInit)for("function"==typeof f.preInit&&(f.preInit=[f.preInit]);0<f.preInit.length;)f.preInit.pop()();noExitRuntime=!0;tb();
|
||||
|
||||
Binary file not shown.
@@ -137,10 +137,24 @@ export default function (inputOptions, outputOptions, resolveFileUrl) {
|
||||
const dependencies = getDependencies(clientOutput, clientEntry);
|
||||
|
||||
if (property.startsWith(allSrcPlaceholder)) {
|
||||
const depCodes = dependencies.map(
|
||||
(name) => clientOutput.find((item) => item.fileName === name).code,
|
||||
);
|
||||
return JSON.stringify([clientEntry.code, ...depCodes].join(';'));
|
||||
const allModules = [
|
||||
clientEntry,
|
||||
...dependencies.map((name) =>
|
||||
clientOutput.find((item) => item.fileName === name),
|
||||
),
|
||||
];
|
||||
|
||||
const inlineDefines = [
|
||||
...allModules.map(
|
||||
(item) =>
|
||||
`self.nextDefineUri=location.origin+${resolveFileUrl(item)};${
|
||||
item.code
|
||||
}`,
|
||||
),
|
||||
'self.nextDefineUri=""',
|
||||
];
|
||||
|
||||
return JSON.stringify(inlineDefines.join(''));
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@@ -48,7 +48,7 @@ const appendCssSource = `
|
||||
}
|
||||
`;
|
||||
|
||||
export default function (resolveFileUrl) {
|
||||
export default function () {
|
||||
/** @type {string[]} */
|
||||
let emittedCSSIds;
|
||||
/** @type {Map<string, string>} */
|
||||
|
||||
111
lib/omt.ejs
111
lib/omt.ejs
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2020 Google Inc. All Rights Reserved.
|
||||
* Copyright 2021 Google Inc. All Rights Reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@@ -13,80 +13,63 @@
|
||||
|
||||
// If the loader is already loaded, just stop.
|
||||
if (!self.<%- amdFunctionName %>) {
|
||||
const singleRequire = async name => {
|
||||
if (name === 'require') return require;
|
||||
let url;
|
||||
if (name.startsWith(location.origin)) {
|
||||
url = name.slice(location.origin.length);
|
||||
} else {
|
||||
url = name.slice(1) + '.js';
|
||||
}
|
||||
if (!url.startsWith('/c/')) {
|
||||
url = '/c' + url;
|
||||
}
|
||||
name = './static' + url;
|
||||
if (registry[name]) return registry[name];
|
||||
let registry = {};
|
||||
|
||||
if (!registry[name]) {
|
||||
const singleRequire = (uri, parentUri) => {
|
||||
uri = uri.startsWith(location.origin) ? uri : new URL(uri + ".js", parentUri).href;
|
||||
return registry[uri] || (
|
||||
<% if (useEval) { %>
|
||||
const text = await fetch(url).then(resp => resp.text());
|
||||
eval(text);
|
||||
fetch(uri)
|
||||
.then(resp => resp.text())
|
||||
.then(code => {
|
||||
self.nextDefineUri = uri;
|
||||
eval(code);
|
||||
})
|
||||
<% } else { %>
|
||||
if ("document" in self) {
|
||||
await new Promise(resolve => {
|
||||
new Promise(resolve => {
|
||||
if ("document" in self) {
|
||||
const script = document.createElement("script");
|
||||
script.src = url;
|
||||
document.head.appendChild(script);
|
||||
script.src = uri;
|
||||
script.onload = resolve;
|
||||
});
|
||||
} else {
|
||||
importScripts(url);
|
||||
}
|
||||
document.head.appendChild(script);
|
||||
} else {
|
||||
self.nextDefineUri = uri;
|
||||
importScripts(uri);
|
||||
resolve();
|
||||
}
|
||||
})
|
||||
<% } %>
|
||||
}
|
||||
if (!registry[name]) {
|
||||
throw new Error(`Module ${name} didn’t register its module`);
|
||||
}
|
||||
return registry[name];
|
||||
.then(() => {
|
||||
let promise = registry[uri];
|
||||
if (!promise) {
|
||||
throw new Error(`Module ${uri} didn’t register its module`);
|
||||
}
|
||||
return promise;
|
||||
})
|
||||
);
|
||||
};
|
||||
|
||||
const require = (names, resolve) => {
|
||||
Promise.all(names.map(singleRequire))
|
||||
.then(modules => resolve(modules.length === 1 ? modules[0] : modules));
|
||||
};
|
||||
|
||||
const registry = {
|
||||
require: Promise.resolve(require)
|
||||
};
|
||||
|
||||
self.<%- amdFunctionName %> = (moduleName, depsNames, factory) => {
|
||||
if (registry[moduleName]) {
|
||||
self.<%- amdFunctionName %> = (depsNames, factory) => {
|
||||
const uri = self.nextDefineUri || ("document" in self ? document.currentScript.src : "") || location.href;
|
||||
if (registry[uri]) {
|
||||
// Module is already loading or loaded.
|
||||
return;
|
||||
}
|
||||
registry[moduleName] = Promise.resolve().then(() => {
|
||||
let exports = {};
|
||||
const module = {
|
||||
uri: location.origin + moduleName.slice(1)
|
||||
};
|
||||
return Promise.all(
|
||||
depsNames.map(depName => {
|
||||
switch(depName) {
|
||||
case "exports":
|
||||
return exports;
|
||||
case "module":
|
||||
return module;
|
||||
default:
|
||||
return singleRequire(depName);
|
||||
}
|
||||
})
|
||||
).then(deps => {
|
||||
const facValue = factory(...deps);
|
||||
if (!exports.default) {
|
||||
exports.default = facValue;
|
||||
}
|
||||
return exports;
|
||||
});
|
||||
let exports = {};
|
||||
const require = depUri => singleRequire(depUri, uri);
|
||||
const specialDeps = {
|
||||
module: { uri },
|
||||
exports,
|
||||
require
|
||||
};
|
||||
// Note: Promise.resolve() is necessary to delay loading until all the
|
||||
// `define`s on the current page had a chance to execute first.
|
||||
// This allows to inline some deps on the main page.
|
||||
registry[uri] = Promise.resolve().then(() => Promise.all(depsNames.map(
|
||||
depName => specialDeps[depName] || require(depName)
|
||||
))).then(deps => {
|
||||
factory(...deps);
|
||||
return exports;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
@@ -12,9 +12,11 @@
|
||||
*/
|
||||
import { promises as fs } from 'fs';
|
||||
import { basename } from 'path';
|
||||
import { imageSize } from 'image-size';
|
||||
|
||||
const defaultOpts = {
|
||||
prefix: 'url',
|
||||
imagePrefix: 'img-url',
|
||||
};
|
||||
|
||||
export default function urlPlugin(opts) {
|
||||
@@ -24,6 +26,7 @@ export default function urlPlugin(opts) {
|
||||
let assetIdToSourceBuffer;
|
||||
|
||||
const prefix = opts.prefix + ':';
|
||||
const imagePrefix = opts.imagePrefix + ':';
|
||||
return {
|
||||
name: 'url-plugin',
|
||||
buildStart() {
|
||||
@@ -48,28 +51,49 @@ export default function urlPlugin(opts) {
|
||||
return combinedBuffer;
|
||||
},
|
||||
async resolveId(id, importer) {
|
||||
if (!id.startsWith(prefix)) return;
|
||||
const realId = id.slice(prefix.length);
|
||||
const idPrefix = [prefix, imagePrefix].find((prefix) =>
|
||||
id.startsWith(prefix),
|
||||
);
|
||||
if (!idPrefix) return;
|
||||
|
||||
const realId = id.slice(idPrefix.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';
|
||||
return idPrefix + resolveResult.id + '.js';
|
||||
},
|
||||
async load(id) {
|
||||
if (!id.startsWith(prefix)) return;
|
||||
const realId = id.slice(prefix.length, -'.js'.length);
|
||||
const idPrefix = [prefix, imagePrefix].find((prefix) =>
|
||||
id.startsWith(prefix),
|
||||
);
|
||||
if (!idPrefix) return;
|
||||
|
||||
const realId = id.slice(idPrefix.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),
|
||||
})}`;
|
||||
let imgSizeExport = '';
|
||||
|
||||
if (idPrefix === imagePrefix) {
|
||||
const imgInfo = imageSize(source);
|
||||
imgSizeExport = [
|
||||
`export const width = ${JSON.stringify(imgInfo.width)};`,
|
||||
`export const height = ${JSON.stringify(imgInfo.height)};`,
|
||||
].join('\n');
|
||||
}
|
||||
|
||||
return [
|
||||
`export default import.meta.ROLLUP_FILE_URL_${this.emitFile({
|
||||
type: 'asset',
|
||||
source,
|
||||
name: basename(realId),
|
||||
})};`,
|
||||
imgSizeExport,
|
||||
].join('\n');
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
3
libsquoosh/.gitignore
vendored
Normal file
3
libsquoosh/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
node_modules
|
||||
build
|
||||
.DS_Store
|
||||
1
libsquoosh/.npmignore
Normal file
1
libsquoosh/.npmignore
Normal file
@@ -0,0 +1 @@
|
||||
node_modules
|
||||
0
libsquoosh/.npmrc
Normal file
0
libsquoosh/.npmrc
Normal file
163
libsquoosh/README.md
Normal file
163
libsquoosh/README.md
Normal file
@@ -0,0 +1,163 @@
|
||||
# libSquoosh
|
||||
|
||||
libSquoosh is an _experimental_ way to run all the codecs you know from the [Squoosh] web app directly inside your own JavaScript program. libSquoosh uses a worker pool to parallelize processing images. This way you can apply the same codec to many images at once.
|
||||
|
||||
libSquoosh is currently not the fastest image compression tool in town and doesn’t aim to be. It is, however, fast enough to compress many images sufficiently quick at once.
|
||||
|
||||
## Installation
|
||||
|
||||
libSquoosh can be installed to your local project with the following command:
|
||||
|
||||
```
|
||||
$ npm install @squoosh/lib
|
||||
```
|
||||
|
||||
You can start using the libSquoosh by adding these lines to the top of your JS program:
|
||||
|
||||
```js
|
||||
import { ImagePool } from '@squoosh/lib';
|
||||
const imagePool = new ImagePool();
|
||||
```
|
||||
|
||||
This will create an image pool with an underlying processing pipeline that you can use to ingest and encode images. The ImagePool constructor takes one argument that defines how many parallel operations it is allowed to run at any given time. By default, this number is set to the amount of CPU cores available in the system it is running on.
|
||||
|
||||
## Ingesting images
|
||||
|
||||
You can ingest a new image like so:
|
||||
|
||||
```js
|
||||
const imagePath = 'path/to/image.png';
|
||||
const image = imagePool.ingestImage(imagePath);
|
||||
```
|
||||
|
||||
The `ingestImage` function can take anything the node [`readFile`][readfile] function can take, uncluding a buffer and `FileHandle`.
|
||||
|
||||
The returned `image` object is a representation of the original image, that you can now preprocess, encode, and extract information about.
|
||||
|
||||
## Preprocessing and encoding images
|
||||
|
||||
When an image has been ingested, you can start preprocessing it and encoding it to other formats. This example will resize the image and then encode it to a `.jpg` and `.jxl` image:
|
||||
|
||||
```js
|
||||
await image.decoded; //Wait until the image is decoded before running preprocessors
|
||||
|
||||
const preprocessOptions: {
|
||||
resize: {
|
||||
enabled: true,
|
||||
width: 100,
|
||||
height: 50,
|
||||
}
|
||||
}
|
||||
await image.preprocess(preprocessOptions);
|
||||
|
||||
const encodeOptions: {
|
||||
mozjpeg: {}, //an empty object means 'use default settings'
|
||||
jxl: {
|
||||
quality: 90,
|
||||
},
|
||||
}
|
||||
await image.encode(encodeOptions);
|
||||
|
||||
```
|
||||
|
||||
The default values for each option can be found in the [`codecs.js`][codecs.js] file under `defaultEncoderOptions`. Every unspecified value will use the default value specified there. _Better documentation is needed here._
|
||||
|
||||
You can run your own code inbetween the different steps, if, for example, you want to change how much the image should be resized based on its original height. (See [Extracting image information](#extracting-image-information) to learn how to get the image dimensions).
|
||||
|
||||
## Closing the ImagePool
|
||||
|
||||
When you have encoded everything you need, it is recommended to close the processing pipeline in the ImagePool. This will not delete the images you have already encoded, but it will prevent you from ingesting and encoding new images.
|
||||
|
||||
Close the ImagePool pipeline with this line:
|
||||
|
||||
```js
|
||||
await imagePool.close();
|
||||
```
|
||||
|
||||
## Writing encoded images to the file system
|
||||
|
||||
When you have encoded an image, you normally want to write it to a file.
|
||||
|
||||
This example takes an image that has been encoded as a `jpg` and writes it to a file:
|
||||
|
||||
```js
|
||||
const rawEncodedImage = (await image.encodedWidth.mozjpeg).binary;
|
||||
|
||||
fs.writeFile('/path/to/new/image.jpg', rawEncodedImage);
|
||||
```
|
||||
|
||||
This example iterates through all encoded versions of the image and writes them to a specific path:
|
||||
|
||||
```js
|
||||
const newImagePath = '/path/to/image.'; //extension is added automatically
|
||||
|
||||
for (const encodedImage of Object.values(image.encodedWith)) {
|
||||
fs.writeFile(
|
||||
newImagePath + (await encodedImage).extension,
|
||||
(await encodedImage).binary,
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
## Extracting image information
|
||||
|
||||
Information about a decoded image is available at `Image.decoded`. It looks something like this:
|
||||
|
||||
```js
|
||||
console.log(await image.decoded);
|
||||
// Returns:
|
||||
{
|
||||
bitmap: {
|
||||
data: Uint8ClampedArray(47736584) [
|
||||
225, 228, 237, 255, 225, 228, 237, 255, 225, 228, 237, 255,
|
||||
225, 228, 237, 255, 225, 228, 237, 255, 225, 228, 237, 255,
|
||||
225, 228, 237, 255,
|
||||
... //the entire raw image
|
||||
],
|
||||
width: 4606, //pixels
|
||||
height: 2591 //pixels
|
||||
},
|
||||
size: 2467795 //bytes
|
||||
}
|
||||
```
|
||||
|
||||
Information about an encoded image can be found at `Image.encodedWith[encoderName]`. It looks something like this:
|
||||
|
||||
```js
|
||||
console.log(await image.encodedWith.jxl);
|
||||
// Returns:
|
||||
{
|
||||
optionsUsed: {
|
||||
quality: 75,
|
||||
baseline: false,
|
||||
arithmetic: false,
|
||||
progressive: true,
|
||||
... //all the possible options for this encoder
|
||||
},
|
||||
binary: Uint8Array(1266975) [
|
||||
1, 0, 0, 1, 0, 1, 0, 0, 255, 219, 0, 132,
|
||||
113, 119, 156, 156, 209, 1, 8, 8, 8, 8, 9, 8,
|
||||
9, 10, 10, 9,
|
||||
... //the entire raw encoded image
|
||||
],
|
||||
extension: 'jxl',
|
||||
size: 1266975 //bytes
|
||||
}
|
||||
```
|
||||
|
||||
## Auto optimizer
|
||||
|
||||
libSquoosh 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.
|
||||
|
||||
```js
|
||||
const encodeOptions: {
|
||||
mozjpeg: 'auto',
|
||||
}
|
||||
```
|
||||
|
||||
[squoosh]: https://squoosh.app
|
||||
[codecs.js]: https://github.com/GoogleChromeLabs/squoosh/blob/dev/libsquoosh/src/codecs.js
|
||||
[butteraugli]: https://github.com/google/butteraugli
|
||||
[readfile]: https://nodejs.org/api/fs.html#fs_fspromises_readfile_path_options
|
||||
@@ -10,11 +10,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { promises as fs } from "fs";
|
||||
import { basename } from "path";
|
||||
import { promises as fs } from 'fs';
|
||||
import { basename } from 'path';
|
||||
|
||||
const defaultOpts = {
|
||||
prefix: "asset-url"
|
||||
prefix: 'asset-url',
|
||||
};
|
||||
|
||||
export default function assetPlugin(opts) {
|
||||
@@ -23,16 +23,16 @@ export default function assetPlugin(opts) {
|
||||
/** @type {Map<string, Buffer>} */
|
||||
let assetIdToSourceBuffer;
|
||||
|
||||
const prefix = opts.prefix + ":";
|
||||
const prefix = opts.prefix + ':';
|
||||
return {
|
||||
name: "asset-plugin",
|
||||
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))
|
||||
.map((moduleId) => assetIdToSourceBuffer.get(moduleId))
|
||||
.filter(Boolean);
|
||||
|
||||
if (buffers.length === 0) return;
|
||||
@@ -56,20 +56,20 @@ export default function assetPlugin(opts) {
|
||||
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";
|
||||
return prefix + resolveResult.id + '.js';
|
||||
},
|
||||
async load(id) {
|
||||
if (!id.startsWith(prefix)) return;
|
||||
const realId = id.slice(prefix.length, -".js".length);
|
||||
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",
|
||||
type: 'asset',
|
||||
source,
|
||||
name: basename(realId)
|
||||
name: basename(realId),
|
||||
})}`;
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user