2020-11-05 10:15:15 +00:00
|
|
|
"wasm-av1" sample introduction
|
|
|
|
==============
|
2020-11-13 09:53:23 +00:00
|
|
|
|
|
|
|
This sample demonstrates how to build [wasm-av1](https://github.com/GoogleChromeLabs/wasm-av1) into
|
|
|
|
WebAssembly with simd support and run it with iwasm.
|
|
|
|
|
|
|
|
## Preparation
|
|
|
|
|
|
|
|
please refer to [installation instructions](../README.md).
|
|
|
|
|
2020-12-29 06:41:09 +00:00
|
|
|
## Build with wasi-sdk
|
|
|
|
|
|
|
|
``` shell
|
|
|
|
$ mkdir build && cd build
|
|
|
|
$ cmake ..
|
|
|
|
$ make
|
|
|
|
# to verify
|
|
|
|
$ ls testavx.wasm
|
|
|
|
```
|
|
|
|
|
|
|
|
## Or build with EMSDK
|
2020-11-13 09:53:23 +00:00
|
|
|
|
|
|
|
just run the convenience script:
|
|
|
|
|
2020-11-05 10:15:15 +00:00
|
|
|
```bash
|
|
|
|
./build.sh
|
|
|
|
```
|
2020-11-13 09:53:23 +00:00
|
|
|
|
2020-12-29 06:41:09 +00:00
|
|
|
the script builds wasm-av1 and runs it with iwasm, which basically contains the following steps:
|
2020-11-05 10:15:15 +00:00
|
|
|
- hack emcc to delete some objects in libc.a
|
|
|
|
- patch wasm-av1 and build it with emcc compiler
|
|
|
|
- build iwasm with simd and libc-emcc support
|
|
|
|
- run testav1.aot with iwasm
|
2020-11-13 09:53:23 +00:00
|
|
|
|
|
|
|
### Run workload
|
|
|
|
|
|
|
|
Firstly please build iwasm with simd support:
|
|
|
|
|
|
|
|
``` shell
|
|
|
|
$ cd <wamr dir>/product-mini/platforms/linux/
|
|
|
|
$ mkdir build && cd build
|
2023-02-02 01:42:25 +00:00
|
|
|
$ cmake .. -DWAMR_BUILD_LIBC_EMCC=1
|
2020-11-13 09:53:23 +00:00
|
|
|
$ make
|
|
|
|
```
|
|
|
|
|
|
|
|
Then compile wasm file to aot file and run:
|
|
|
|
|
|
|
|
``` shell
|
2020-12-29 06:41:09 +00:00
|
|
|
$ cd <dir of testavx.wasm>
|
2023-02-02 01:42:25 +00:00
|
|
|
$ <wamr dir>/wamr-compiler/build/wamrc -o testavx.aot testavx.wasm
|
2020-12-29 06:41:09 +00:00
|
|
|
# copy sample data like <wamr dir>/samples/workload/wasm-av1/av1/third_party/samples/elephants_dream_480p24.ivf
|
|
|
|
# make sure you declare the access priority of the directory in which the sample data is
|
|
|
|
$ <wamr dir>/product-mini/platforms/linux/build/iwasm --dir=. testavx.aot elephants_dream_480p24.ivf
|
|
|
|
```
|