Skip to content

Conversation

@jamsinclair
Copy link
Owner

@jamsinclair jamsinclair commented Oct 29, 2024

Fixes #43

@netlify
Copy link

netlify bot commented Oct 29, 2024

Deploy Preview for luxury-jalebi-f8e0e8 ready!

Name Link
🔨 Latest commit 7df4e9e
🔍 Latest deploy log https://app.netlify.com/sites/luxury-jalebi-f8e0e8/deploys/672268202329f60008925e61
😎 Deploy Preview https://deploy-preview-69--luxury-jalebi-f8e0e8.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@jamsinclair
Copy link
Owner Author

jamsinclair commented Nov 2, 2024

For anyone viewing this branch there is an issue with returning the RGB image data to the JavaScript context from Wasm.

libavif seems to compile fine with dav1d. I have also tested the decoded pixel values look correct.

However, when I try and pass the pixel data back to Javascript I encounter some kind of memory issue

avif_dec.js:8 Uncaught (in promise) TypeError: caller is not a function
    at __emval_call (avif_dec.js:8:27103)
    at avif_dec.wasm:0x7c15d
    at avif_dec.wasm:0x7c39d
    at Object.decode (avif_dec.js:8:13828)
    at Module.decode (decode.js:24:27)
    at async decode (main.js:10:14)
    at async convert (main.js:42:21)
    at async HTMLFormElement.<anonymous> (main.js:74:25)

I've traced this back to this part the code

// We want to create a *copy* of the decoded data to be owned by the JavaScript side.
// For that, we perform `new Uint8Array(wasmMemBuffer, wasmPtr, wasmSize).slice()`:
result = ImageData.new_(
Uint8ClampedArray.new_(typed_memory_view(rgb.rowBytes * rgb.height, rgb.pixels)), rgb.width,
rgb.height);

I've spent too much time on this for now, so I'll let it be. There's no urgency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve @jquash/avif decode speed

1 participant