1# Crabby Avif 2 3Avif parser/decoder implementation in Rust. 4 5Feel free to file an issue for any question, suggestion or bug report. 6Contributions are also welcome, see [CONTRIBUTING](CONTRIBUTING.md). 7 8## Features 9 * Supports dav1d, libgav1 or android mediacodec as the underlying AV1 decoder. 10 * C API compatible with [libavif](https://github.com/aomediacodec/libavif) 11 * ..and more 12 13## Build 14 15```sh 16git clone https://github.com/webmproject/CrabbyAvif.git 17# If dav1d system library can be found with pkg-config, this step can be skipped. 18cd CrabbyAvif/sys/dav1d-sys 19./dav1d.cmd 20# If libyuv system library can be found with pkg-config, this step can be skipped. 21cd ../libyuv-sys 22./libyuv.cmd 23cd ../.. 24cargo build 25``` 26 27## Tests 28 29```sh 30cargo test -- --skip test_conformance 31``` 32 33### Conformance Tests 34 35```sh 36git clone https://github.com/AOMediaCodec/av1-avif.git external/av1-avif 37git clone https://github.com/AOMediaCodec/libavif.git external/libavif 38cd external/libavif/ext 39./dav1d.cmd 40cd .. 41cmake -S . -B build -DAVIF_CODEC_DAV1D=LOCAL -DAVIF_LIBYUV=OFF -DAVIF_BUILD_APPS=ON 42cmake --build build --parallel -t avifdec 43cd ../.. 44cargo test -- test_conformance 45``` 46 47If you already have the `av1-avif` repository checked out and the `avifdec` 48binary available, you can point to those by setting the following environment 49variables: 50 51``sh 52CRABBYAVIF_CONFORMANCE_TEST_DATA_DIR=<path> CRABBYAVIF_CONFORMANCE_TEST_AVIFDEC=<avifdec_binary> cargo test -- test_conformance 53`` 54 55### C API Tests 56 57```sh 58# Build google test 59cd external 60./googletest.cmd 61cd .. 62# Build the library with C API enabled 63cargo build --features capi --release 64# Build and run the C/C++ Tests 65mkdir c_build 66cd c_build 67cmake ../c_api_tests/ 68make 69make test 70``` 71 72### Android Tests 73 74The decoder tests can be run on Android using [dinghy](https://crates.io/crates/cargo-dinghy). 75 76```sh 77# One time set up 78cargo install cargo-dinghy 79# Set path to NDK 80export ANDROID_NDK_HOME=<path_to_ndk> 81# Install rust toolchain for target 82rustup target add aarch64-linux-android 83# End of One time set up 84# Make sure the device/emulator is available via adb. 85cargo dinghy -d android test --no-default-features --features android_mediacodec,libyuv --target aarch64-linux-android --test decoder_tests 86``` 87 88## License 89 90See the [Apache v2.0 license](LICENSE) file. 91