bvibber / ogv.js

JavaScript media player using Ogg/Vorbis/Theora/Opus/WebM libs compiled with Emscripten
https://brooke.vibber.net/misc/ogv.js/demo/
Other
1.19k stars 99 forks source link

Disassemble wasm simd .. what tools work #604

Closed jlb6740 closed 2 years ago

jlb6740 commented 2 years ago

Hi, I downloaded release 1.8.6. I wanted to look at the disassemble of the wasm that takes advantage of SIMD to see which instructions were used. However using either the latest wasm-dis from binaryen or the latest wasm2wat from wabt, both fail. By latest I mean head as of today. For example:

~/ogvjs-1.8.6/ogvjs-1.8.6$ ~/binaryen/bin/wasm-dis ./ogv-decoder-video-vp9-simd-mt-wasm.wasm [parse exception: Illegal lane index (at 0:32919)] Fatal: error in parsing wasm binary

~/ogvjs-1.8.6/ogvjs-1.8.6$ wasm2wat --enable-all ./ogv-decoder-video-vp9-simd-wasm.wasm 0007c31: error: invalid call_indirect table index

I could not compile from HEAD do to various errors that did not troubleshoot right away, how is 1.8.6 compiled? Specifically, what tools should be capable of disassembling the wasm files:

./ogv-decoder-video-av1-simd-wasm.wasm
./ogv-decoder-video-vp9-simd-mt-wasm.wasm
./ogv-decoder-video-av1-simd-mt-wasm.wasm
./ogv-decoder-video-vp9-simd-wasm.wasm

Thanks.

bvibber commented 2 years ago

At some point there was a change to the encoding, so if you've got an old build it might not match the wasm-dis in binaryen. But if you make a fresh build with current emscripten & binaryen, and disassemble that, it should work fine.

Note I've been considering dropping the SIMD support for libvpx; I haven't gotten very far in and it's made only small improvements. For dav1d I was getting good results, but I think there's another project that's now more advanced in this work (aiming at things like runtime decoding of AVIF images which use the AV1 codec), so you might want to take a look at those!

jlb6740 commented 2 years ago

Hmm ... Ok thanks @brion. What I was thinking is that maybe my tools were too new and that I needed to drop back to an older version. Not sure. So what was this new project you are referring to that is the next thing in AV1/AVIF decoding?

bvibber commented 2 years ago

Well you should use tools that match your compilation; there is no binary distribution that includes them so this is up to you.

I don't know what the project was; you'll have to search around.