Commit 240ec8c4 authored by Simon Persson's avatar Simon Persson Committed by Thomas Daede

Transform tests now use smallest possible tolerances

I started with all tolerances at zero then increased when seeing a failure.
With these tolerances I have now run the test 150 times without failure.
parent 1fd8f438
......@@ -285,7 +285,7 @@ mod test {
use super::*;
use rand::random;
fn test_roundtrip(tx_size: TxSize, tx_type: TxType) {
fn test_roundtrip(tx_size: TxSize, tx_type: TxType, tolerance: i16) {
let mut src_storage = [0u16; 64 * 64];
let src = &mut src_storage[..tx_size.area()];
let mut dst_storage = [0u16; 64 * 64];
......@@ -303,7 +303,7 @@ mod test {
inverse_transform_add(freq, dst, tx_size.width(), tx_size, tx_type, 8);
for (s, d) in src.iter().zip(dst) {
assert!(i16::abs((*s as i16) - (*d as i16)) <= 1);
assert!(i16::abs((*s as i16) - (*d as i16)) <= tolerance);
}
}
......@@ -311,56 +311,56 @@ mod test {
fn roundtrips() {
use partition::TxSize::*;
use partition::TxType::*;
let combinations = vec![
(TX_4X4, DCT_DCT),
(TX_4X4, ADST_DCT),
(TX_4X4, DCT_ADST),
(TX_4X4, ADST_ADST),
(TX_4X4, IDTX),
(TX_4X4, V_DCT),
(TX_4X4, H_DCT),
(TX_4X4, V_ADST),
(TX_4X4, H_ADST),
(TX_8X8, DCT_DCT),
(TX_8X8, ADST_DCT),
(TX_8X8, DCT_ADST),
(TX_8X8, ADST_ADST),
(TX_8X8, IDTX),
(TX_8X8, V_DCT),
(TX_8X8, H_DCT),
(TX_8X8, V_ADST),
(TX_8X8, H_ADST),
(TX_16X16, DCT_DCT),
(TX_16X16, ADST_DCT),
(TX_16X16, DCT_ADST),
(TX_16X16, ADST_ADST),
(TX_16X16, IDTX),
(TX_16X16, V_DCT),
(TX_16X16, H_DCT),
(TX_16X16, V_ADST),
(TX_16X16, H_ADST),
(TX_32X32, DCT_DCT),
//(TX_32X32, ADST_DCT),
//(TX_32X32, DCT_ADST),
//(TX_32X32, ADST_ADST),
(TX_32X32, IDTX),
(TX_32X32, V_DCT),
(TX_32X32, H_DCT),
//(TX_32X32, V_ADST),
//(TX_32X32, H_ADST),
//(TX_64X64, DCT_DCT),
//(TX_64X64, ADST_DCT),
//(TX_64X64, DCT_ADST),
//(TX_64X64, ADST_ADST),
//(TX_64X64, IDTX),
//(TX_64X64, V_DCT),
//(TX_64X64, H_DCT),
//(TX_64X64, V_ADST),
//(TX_64X64, H_ADST),
let combinations = [
(TX_4X4, DCT_DCT, 0),
(TX_4X4, ADST_DCT, 0),
(TX_4X4, DCT_ADST, 0),
(TX_4X4, ADST_ADST, 0),
(TX_4X4, IDTX, 0),
(TX_4X4, V_DCT, 0),
(TX_4X4, H_DCT, 0),
(TX_4X4, V_ADST, 0),
(TX_4X4, H_ADST, 0),
(TX_8X8, DCT_DCT, 1),
(TX_8X8, ADST_DCT, 1),
(TX_8X8, DCT_ADST, 1),
(TX_8X8, ADST_ADST, 1),
(TX_8X8, IDTX, 0),
(TX_8X8, V_DCT, 0),
(TX_8X8, H_DCT, 0),
(TX_8X8, V_ADST, 0),
(TX_8X8, H_ADST, 0),
(TX_16X16, DCT_DCT, 1),
(TX_16X16, ADST_DCT, 1),
(TX_16X16, DCT_ADST, 1),
(TX_16X16, ADST_ADST, 1),
(TX_16X16, IDTX, 0),
(TX_16X16, V_DCT, 1),
(TX_16X16, H_DCT, 1),
(TX_16X16, V_ADST, 1),
(TX_16X16, H_ADST, 1),
(TX_32X32, DCT_DCT, 2),
//(TX_32X32, ADST_DCT, 0),
//(TX_32X32, DCT_ADST, 0),
//(TX_32X32, ADST_ADST, 0),
(TX_32X32, IDTX, 0),
(TX_32X32, V_DCT, 1),
(TX_32X32, H_DCT, 1),
//(TX_32X32, V_ADST, 0),
//(TX_32X32, H_ADST, 0),
//(TX_64X64, DCT_DCT, 0),
//(TX_64X64, ADST_DCT, 0),
//(TX_64X64, DCT_ADST, 0),
//(TX_64X64, ADST_ADST, 0),
//(TX_64X64, IDTX, 0),
//(TX_64X64, V_DCT, 0),
//(TX_64X64, H_DCT, 0),
//(TX_64X64, V_ADST, 0),
//(TX_64X64, H_ADST, 0),
];
for (tx_size, tx_type) in combinations {
for &(tx_size, tx_type, tolerance) in combinations.iter() {
println!("Testing combination {:?}, {:?}", tx_size, tx_type);
test_roundtrip(tx_size, tx_type);
test_roundtrip(tx_size, tx_type, tolerance);
}
}
}
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