Skip to content

Commit c59ad07

Browse files
committed
Dependencies and js wrapper update.
1 parent 4a7621e commit c59ad07

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "avif"
3-
version = "0.1.0"
3+
version = "0.2.0"
44
edition = "2021"
55

66
[lib]
@@ -9,7 +9,7 @@ crate-type = ["cdylib",'rlib']
99
[dependencies]
1010
wasm-bindgen = "0.2"
1111
avif-serialize = "0.8"
12-
rav1e = { version = "0.6.4", default-features = false, features = ["wasm"] }
12+
rav1e = { version = "0.6.6", default-features = false, features = ["wasm"] }
1313

1414
[profile.release]
1515
opt-level = "s"

avif.mjs

+8-7
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,30 @@ const src=()=>`(async()=>{
44
const mod=await WebAssembly.compileStreaming(await fetch('${url}',{cache:'force-cache'}));
55
const imports={
66
wbg:{
7-
__wbg_log_d5989ac76b02a61f: (p,n)=>{
7+
__wbg_log_d415f1170b035824: (p,n)=>{
88
console.log(
99
new TextDecoder().decode(new Uint8Array(wasm.memory.buffer).subarray(p,p+n))
1010
)
1111
}
1212
}
1313
};
1414
const wasm=(await WebAssembly.instantiate(mod,imports)).exports;
15-
const malloc=wasm.__wbindgen_malloc;const free=wasm.__wbindgen_free;
15+
const malloc=wasm.__wbindgen_malloc;
16+
const free=wasm.__wbindgen_free;
17+
const pointer=wasm.__wbindgen_add_to_stack_pointer;
1618
const fn=({data,width,height,quality,speed})=>{
19+
const n1=data.length;
20+
const p1=malloc(n1,1);
21+
const r=pointer(-16);
1722
try{
18-
const r=wasm.__wbindgen_add_to_stack_pointer(-16);
19-
const n1=data.length;const p1=malloc(n1);
2023
new Uint8Array(wasm.memory.buffer).set(data,p1);
2124
wasm.avif_from_imagedata(r,p1,n1,width,height,quality,speed);
2225
const arr=new Int32Array(wasm.memory.buffer);
2326
const p2=arr[r/4];const n2=arr[r/4+1];
2427
const res=new Uint8Array(wasm.memory.buffer).subarray(p2,p2+n2).slice();
2528
free(p2,n2);
2629
return res;
27-
}finally{
28-
wasm.__wbindgen_add_to_stack_pointer(16);
29-
}
30+
}finally{pointer(16)}
3031
};
3132
onmessage=async msg=>postMessage(fn(msg.data));
3233
postMessage('ready');

avif.wasm

15.3 KB
Binary file not shown.

0 commit comments

Comments
 (0)