]> git.nihav.org Git - nihav.git/blob - nihav-codec-support/src/vq/mod.rs
core: fix or silence clippy warnings
[nihav.git] / nihav-codec-support / src / vq / mod.rs
1 //! Vector quantisation routines.
2 mod generic_elbg;
3 mod generic_mediancut;
4
5 pub trait VQElement: Sized+Copy+PartialEq {
6 fn dist(&self, rval: Self) -> u32;
7 fn min_cw() -> Self;
8 fn max_cw() -> Self;
9 fn min(&self, rval: Self) -> Self;
10 fn max(&self, rval: Self) -> Self;
11 fn num_components() -> usize;
12 fn sort_by_component(arr: &mut [Self], component: usize);
13 fn max_dist_component(min: &Self, max: &Self) -> usize;
14 }
15
16 pub trait VQElementSum<T: VQElement> {
17 fn zero() -> Self;
18 fn add(&mut self, rval: T, count: u64);
19 fn get_centroid(&self) -> T;
20 }
21
22 pub use self::generic_elbg::ELBG;
23 pub use self::generic_mediancut::quantise_median_cut;