mod forward;
mod inverse;
pub(crate) use forward::{Bases, forward_2d, walsh_hadamard_4x4};
pub(crate) use inverse::inverse_2d;
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub(crate) enum Kind {
Dct,
Adst,
Identity,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub(crate) enum TxType {
DctDct = 0,
AdstDct = 1,
DctAdst = 2,
AdstAdst = 3,
Identity = 9,
}
impl TxType {
pub(crate) const REDUCED_SET: [Self; 5] = [
Self::Identity,
Self::DctDct,
Self::AdstAdst,
Self::AdstDct,
Self::DctAdst,
];
pub(crate) const fn column(self) -> Kind {
match self {
Self::DctDct | Self::DctAdst => Kind::Dct,
Self::AdstDct | Self::AdstAdst => Kind::Adst,
Self::Identity => Kind::Identity,
}
}
pub(crate) const fn row(self) -> Kind {
match self {
Self::DctDct | Self::AdstDct => Kind::Dct,
Self::DctAdst | Self::AdstAdst => Kind::Adst,
Self::Identity => Kind::Identity,
}
}
pub(crate) fn symbol(self) -> usize {
Self::REDUCED_SET
.iter()
.position(|&t| t == self)
.expect("every type is in the reduced set")
}
}