Add AVIF encoder without options

This commit is contained in:
Surma
2020-02-05 21:52:10 -08:00
committed by Ingvar Stepanyan
parent e1ab43b76f
commit c29006d593
10 changed files with 50 additions and 402 deletions

View File

@@ -82,6 +82,15 @@ async function webpDecode(data: ArrayBuffer): Promise<ImageData> {
return timed('webpDecode', () => decode(data));
}
async function avifEncode(
data: ImageData, options: import('../avif/encoder-meta').EncodeOptions,
): Promise<ArrayBuffer> {
const { encode } = await import(
/* webpackChunkName: "process-avif-enc" */
'../avif/encoder');
return encode(data, options);
}
async function avifDecode(data: ArrayBuffer): Promise<ImageData> {
const { decode } = await import(
/* webpackChunkName: "process-avif-dec" */
@@ -97,6 +106,7 @@ const exports = {
oxiPngEncode,
webpEncode,
webpDecode,
avifEncode,
avifDecode,
};
export type ProcessorWorkerApi = typeof exports;