mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-12 08:47:31 +00:00
Remove mt AVIF encoder for now (#964)
This commit is contained in:
@@ -13,22 +13,11 @@
|
|||||||
import type { AVIFModule } from 'codecs/avif/enc/avif_enc';
|
import type { AVIFModule } from 'codecs/avif/enc/avif_enc';
|
||||||
import type { EncodeOptions } from '../shared/meta';
|
import type { EncodeOptions } from '../shared/meta';
|
||||||
import wasmUrlWithoutMT from 'url:codecs/avif/enc/avif_enc.wasm';
|
import wasmUrlWithoutMT from 'url:codecs/avif/enc/avif_enc.wasm';
|
||||||
import wasmUrlWithMT from 'url:codecs/avif/enc/avif_enc_mt.wasm';
|
|
||||||
import workerUrl from 'omt:codecs/avif/enc/avif_enc_mt.worker.js';
|
|
||||||
import { initEmscriptenModule } from 'features/worker-utils';
|
import { initEmscriptenModule } from 'features/worker-utils';
|
||||||
import { threads } from 'wasm-feature-detect';
|
|
||||||
|
|
||||||
let emscriptenModule: Promise<AVIFModule>;
|
let emscriptenModule: Promise<AVIFModule>;
|
||||||
|
|
||||||
async function init() {
|
async function init() {
|
||||||
if (await threads()) {
|
|
||||||
const avifEncoder = await import('codecs/avif/enc/avif_enc_mt');
|
|
||||||
return initEmscriptenModule<AVIFModule>(
|
|
||||||
avifEncoder.default,
|
|
||||||
wasmUrlWithMT,
|
|
||||||
workerUrl,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
const avifEncoder = await import('codecs/avif/enc/avif_enc.js');
|
const avifEncoder = await import('codecs/avif/enc/avif_enc.js');
|
||||||
return initEmscriptenModule(avifEncoder.default, wasmUrlWithoutMT);
|
return initEmscriptenModule(avifEncoder.default, wasmUrlWithoutMT);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,9 +68,6 @@ import webpDecWasm from 'url:codecs/webp/dec/webp_dec.wasm';
|
|||||||
import wp2DecWasm from 'url:codecs/wp2/dec/wp2_dec.wasm';
|
import wp2DecWasm from 'url:codecs/wp2/dec/wp2_dec.wasm';
|
||||||
|
|
||||||
// AVIF
|
// AVIF
|
||||||
import * as avifEncMtWorker from 'entry-data:codecs/avif/enc/avif_enc_mt.worker.js';
|
|
||||||
import * as avifEncMt from 'entry-data:codecs/avif/enc/avif_enc_mt';
|
|
||||||
import avifEncMtWasm from 'url:codecs/avif/enc/avif_enc_mt.wasm';
|
|
||||||
import avifEncWasm from 'url:codecs/avif/enc/avif_enc.wasm';
|
import avifEncWasm from 'url:codecs/avif/enc/avif_enc.wasm';
|
||||||
import * as avifEnc from 'entry-data:codecs/avif/enc/avif_enc.js';
|
import * as avifEnc from 'entry-data:codecs/avif/enc/avif_enc.js';
|
||||||
|
|
||||||
@@ -141,17 +138,7 @@ export const theRest = (async () => {
|
|||||||
if (!supportsWebP) items.push(webpDec.main, ...webpDec.deps, webpDecWasm);
|
if (!supportsWebP) items.push(webpDec.main, ...webpDec.deps, webpDecWasm);
|
||||||
|
|
||||||
// AVIF
|
// AVIF
|
||||||
if (supportsThreads) {
|
items.push(avifEnc.main, ...avifEnc.deps, avifEncWasm);
|
||||||
items.push(
|
|
||||||
avifEncMtWorker.main,
|
|
||||||
...avifEncMtWorker.deps,
|
|
||||||
avifEncMt.main,
|
|
||||||
...avifEncMt.deps,
|
|
||||||
avifEncMtWasm,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
items.push(avifEnc.main, ...avifEnc.deps, avifEncWasm);
|
|
||||||
}
|
|
||||||
|
|
||||||
// JXL
|
// JXL
|
||||||
if (supportsThreads && supportsSimd) {
|
if (supportsThreads && supportsSimd) {
|
||||||
|
|||||||
Reference in New Issue
Block a user