Commit 6db7567e authored by Luca Barbato's avatar Luca Barbato Committed by Luca Barbato

Make the use of the internal aom copy optional

It is currently used for the extended tests.

Fixes #651 and Completes #630.
parent 01ead5dc
......@@ -9,10 +9,11 @@ autobins = false
[features]
repl = ["rustyline", "binaries"]
comparative_bench = []
decode_test = ["bindgen"]
comparative_bench = ["aom"]
decode_test = ["bindgen", "aom"]
binaries = ["y4m", "clap"]
default = ["binaries"]
aom = ["cmake"]
[dependencies]
bitstream-io = "0.8"
......@@ -25,7 +26,7 @@ backtrace = "0.3"
num-traits = "0.2"
[build-dependencies]
cmake = "0.1.32"
cmake = { version = "0.1", optional = true }
[target.'cfg(target_arch = "x86_64")'.build-dependencies]
nasm-rs = { git = "https://github.com/tdaede/nasm-rs.git" }
......
......@@ -26,6 +26,10 @@ Automated AppVeyor builds can be found [here](https://ci.appveyor.com/project/td
# Building
**rav1e** can optionally use a local copy of `libaom` to run some extended tests and some `x86_64`-specific optimizations require a recent version of NASM.
## Internal libaom setup
This repository uses a git submodule. To initialize it, run:
```
......
......@@ -40,6 +40,7 @@ fn write_b(c: &mut Criterion) {
}
fn write_b_bench(b: &mut Bencher, tx_size: TxSize, qindex: usize) {
#[cfg(feature = "aom")]
unsafe {
av1_rtcd();
aom_dsp_rtcd();
......@@ -51,7 +52,7 @@ fn write_b_bench(b: &mut Bencher, tx_size: TxSize, qindex: usize) {
let fc = CDFContext::new(fi.base_q_idx);
let bc = BlockContext::new(fi.sb_width * 16, fi.sb_height * 16);
let mut fs = FrameState::new(&fi);
// For now, restoration unit size is locked to superblock size.
// For now, restoration unit size is locked to superblock size.
let rc = RestorationContext::new(fi.sb_width, fi.sb_height);
let mut cw = ContextWriter::new(fc, bc, rc);
......
// build.rs
#[cfg(feature = "aom")]
extern crate cmake;
#[cfg(unix)]
extern crate pkg_config;
......@@ -9,10 +10,24 @@ extern crate bindgen;
#[cfg(target_arch = "x86_64")]
extern crate nasm_rs;
#[allow(unused_imports)]
use std::env;
use std::fs;
use std::path::Path;
#[allow(dead_code)]
fn rerun_dir<P: AsRef<Path>>(dir: P) {
for entry in fs::read_dir(dir).unwrap() {
let entry = entry.unwrap();
let path = entry.path();
println!("cargo:rerun-if-changed={}", path.to_string_lossy());
if path.is_dir() {
rerun_dir(path);
}
}
}
fn main() {
#[cfg(all(target_arch = "x86_64", not(windows)))] {
use std::fs::File;
......@@ -42,7 +57,7 @@ fn main() {
if cfg!(windows) && cfg!(feature = "decode_test") {
panic!("Unsupported feature on this platform!");
}
#[cfg(feature = "aom")] {
let cargo_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
let build_path = Path::new(&cargo_dir).join("aom_build/aom");
let debug = if let Some(v) = env::var("PROFILE").ok() {
......@@ -108,18 +123,6 @@ fn main() {
let _ = file.write(s.as_bytes());
}
}
fn rerun_dir<P: AsRef<Path>>(dir: P) {
for entry in fs::read_dir(dir).unwrap() {
let entry = entry.unwrap();
let path = entry.path();
println!("cargo:rerun-if-changed={}", path.to_string_lossy());
if path.is_dir() {
rerun_dir(path);
}
}
}
rerun_dir("aom_build");
}
}
......@@ -83,6 +83,7 @@ impl Config {
);
let seq = Sequence::new(&self.frame_info);
#[cfg(feature = "aom")]
unsafe {
av1_rtcd();
aom_dsp_rtcd();
......
......@@ -11,6 +11,7 @@
#![cfg_attr(feature = "cargo-clippy", allow(cast_lossless))]
#![cfg_attr(feature = "cargo-clippy", allow(needless_range_loop))]
#[cfg(all(target_arch = "x86_64", not(windows)))]
use libc;
use num_traits::*;
......@@ -586,7 +587,7 @@ impl Intra<u16> for Block8x8 {}
impl Intra<u16> for Block16x16 {}
impl Intra<u16> for Block32x32 {}
#[cfg(test)]
#[cfg(all(test, feature = "aom"))]
pub mod test {
use super::*;
use rand::{ChaChaRng, Rng, SeedableRng};
......
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