#[cfg(test)]
mod tests;
use anyhow::Result;
use crate::{analysis::MVAnalysisData, fake::group_of_planes::FakeGroupOfPlanes};
#[derive(Debug, Clone)]
pub struct SCDetection {
thscd1: u64,
thscd2: u64,
}
impl SCDetection {
#[inline]
pub fn new(
vectors_data: MVAnalysisData,
thscd1: Option<u64>,
thscd2: Option<u64>,
) -> Result<Self> {
let mut thscd1 = thscd1.unwrap_or(crate::params::MV_DEFAULT_SCD1);
let mut thscd2 = thscd2.unwrap_or(crate::params::MV_DEFAULT_SCD2);
vectors_data.scale_thscd(&mut thscd1, &mut thscd2, "SCDetection")?;
Ok(Self { thscd1, thscd2 })
}
#[must_use]
#[inline]
pub fn scene_change(&self, vectors: &FakeGroupOfPlanes) -> bool {
!vectors.is_usable(self.thscd1, self.thscd2)
}
}