Commit c0d46475 authored by Adrien Maglo's avatar Adrien Maglo Committed by Thomas Daede

SAD bench: use the right Pixel format (u8 or u16) in function of the bit depth

This allows to call the right ASM SAD implementation.
parent 4ee26d3e
......@@ -33,14 +33,14 @@ fn new_plane<T: Pixel>(ra: &mut ChaChaRng, width: usize, height: usize) -> Plane
p
}
fn bench_get_sad(b: &mut Bencher, &(bs, bit_depth): &(BlockSize, usize)) {
fn run_sad_bench<T: Pixel>(b: &mut Bencher, &(bs, bit_depth): &(BlockSize, usize)) {
let mut ra = ChaChaRng::from_seed([0; 32]);
let bsw = bs.width();
let bsh = bs.height();
let w = 640;
let h = 480;
let input_plane = new_plane::<u16>(&mut ra, w, h);
let rec_plane = new_plane::<u16>(&mut ra, w, h);
let input_plane = new_plane::<T>(&mut ra, w, h);
let rec_plane = new_plane::<T>(&mut ra, w, h);
let po = PlaneOffset { x: 0, y: 0 };
let plane_org = input_plane.slice(po);
......@@ -52,6 +52,15 @@ fn bench_get_sad(b: &mut Bencher, &(bs, bit_depth): &(BlockSize, usize)) {
})
}
fn bench_get_sad(b: &mut Bencher, &(bs, bit_depth): &(BlockSize, usize)) {
if bit_depth <= 8 {
run_sad_bench::<u8>(b, &(bs, bit_depth))
}
else {
run_sad_bench::<u16>(b, &(bs, bit_depth))
}
}
pub fn get_sad(c: &mut Criterion) {
let blocks = vec![
(BLOCK_4X4, 8),
......
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