Commit 4db3aed6 authored by Luca Barbato's avatar Luca Barbato Committed by Luca Barbato

Preparation for encode-decode tests

- [x] Build the full aom decoder
- [ ] Generate rust bindings for it
- [ ] Write the actual tests
parent c6504a99
......@@ -17,6 +17,9 @@ enum-iterator-derive = "0.1.1"
[build-dependencies]
cc = "1"
cmake = "0.1.29"
bindgen = "0.33"
pkg-config = "0.3.9"
[dev-dependencies]
bencher = "0.1.5"
......
// build.rs
// Bring in a dependency on an externally maintained `gcc` package which manages
// invoking the C compiler.
extern crate pkg_config;
extern crate bindgen;
extern crate cmake;
extern crate cc;
use std::env;
use std::path::Path;
use std::fs::OpenOptions;
use std::io::Write;
fn format_write(builder: bindgen::Builder, output: &str) {
let s = builder
.generate()
.unwrap()
.to_string()
.replace("/**", "/*")
.replace("/*!", "/*");
let mut file = OpenOptions::new()
.write(true)
.truncate(true)
.create(true)
.open(output)
.unwrap();
let _ = file.write(s.as_bytes());
}
fn main() {
let cargo_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
let build_path = Path::new(&cargo_dir).join("aom_build/aom");
let cfg = cmake::Config::new(build_path)
.define("CONFIG_AV1_ENCODER", "0")
.define("CONFIG_DEBUG", "1")
.define("CONFIG_EXPERIMENTAL", "1")
.define("CONFIG_UNIT_TESTS", "0")
.define("CONFIG_AOM_QM", "0")
.define("CONFIG_EXT_INTRA", "0")
.define("CONFIG_EXT_PARTITION", "0")
.define("CONFIG_EXT_PARTITION_TYPES", "0")
.define("CONFIG_LOOPFILTER_LEVEL", "0")
.define("CONFIG_INTRA_EDGE", "0")
.define("CONFIG_CFL", "0")
.define("CONFIG_KF_CTX", "0")
.define("CONFIG_STRIPED_LOOP_RESTORATION", "0")
.define("CONFIG_MAX_TILE", "0")
.define("CONFIG_EXT_INTRA_MOD", "0")
.define("CONFIG_FRAME_SIZE", "0")
.define("CONFIG_Q_ADAPT_PROBS", "0")
.define("CONFIG_SIMPLIFY_TX_MODE", "0")
.define("CONFIG_OBU", "0")
.define("CONFIG_ANALYZER", "0")
.build();
env::set_var("PKG_CONFIG_PATH", cfg.join("lib/pkgconfig"));
let libs = pkg_config::Config::new().statik(true).probe("aom").unwrap();
let headers = libs.include_paths.clone();
let mut builder = bindgen::builder()
.raw_line("#![allow(dead_code)]")
.raw_line("#![allow(non_camel_case_types)]")
.raw_line("#![allow(non_snake_case)]")
.raw_line("#![allow(non_upper_case_globals)]")
.blacklist_type("max_align_t")
.header("data/aom.h");
for header in headers {
builder = builder.clang_arg("-I").clang_arg(header.to_str().unwrap());
}
// Manually fix the comment so rustdoc won't try to pick them
format_write(builder, "tests/aom.rs");
cc::Build::new()
.file("aom_build/aom/aom_mem/aom_mem.c")
.file("aom_build/aom/aom_dsp/entdec.c")
.file("aom_build/aom/aom_dsp/entcode.c")
.file("aom_build/aom/aom_dsp/fwd_txfm.c")
.file("aom_build/aom/aom_dsp/inv_txfm.c")
.file("aom_build/aom/aom_dsp/intrapred.c")
.file("aom_build/aom/av1/common/odintrin.c")
.file("aom_build/aom/av1/common/entropymode.c")
.file("aom_build/aom/av1/common/entropy.c")
.file("aom_build/aom/av1/common/scan.c")
.file("aom_build/aom/av1/common/quant_common.c")
.file("aom_build/aom/av1/common/av1_inv_txfm1d.c")
.file("aom_build/aom/av1/common/av1_inv_txfm2d.c")
.file("aom_build/aom/av1/common/blockd.c")
.file("aom_build/aom/av1/encoder/dct.c")
.include("aom_build")
.include("aom_build/aom")
......
#include <aom/aom_decoder.h>
#include <aom/aomdx.h>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment