#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
pub struct J2kEncodeDispatchReport {
pub deinterleave: usize,
pub forward_rct: usize,
pub forward_ict: usize,
pub forward_dwt53: usize,
pub forward_dwt97: usize,
pub quantize_subband: usize,
pub tier1_code_block: usize,
pub ht_code_block: usize,
pub packetization: usize,
}
impl J2kEncodeDispatchReport {
#[must_use]
pub fn saturating_delta(self, before: Self) -> Self {
Self {
deinterleave: self.deinterleave.saturating_sub(before.deinterleave),
forward_rct: self.forward_rct.saturating_sub(before.forward_rct),
forward_ict: self.forward_ict.saturating_sub(before.forward_ict),
forward_dwt53: self.forward_dwt53.saturating_sub(before.forward_dwt53),
forward_dwt97: self.forward_dwt97.saturating_sub(before.forward_dwt97),
quantize_subband: self
.quantize_subband
.saturating_sub(before.quantize_subband),
tier1_code_block: self
.tier1_code_block
.saturating_sub(before.tier1_code_block),
ht_code_block: self.ht_code_block.saturating_sub(before.ht_code_block),
packetization: self.packetization.saturating_sub(before.packetization),
}
}
#[must_use]
pub fn total(self) -> usize {
self.forward_rct
.saturating_add(self.deinterleave)
.saturating_add(self.forward_ict)
.saturating_add(self.forward_dwt53)
.saturating_add(self.forward_dwt97)
.saturating_add(self.quantize_subband)
.saturating_add(self.tier1_code_block)
.saturating_add(self.ht_code_block)
.saturating_add(self.packetization)
}
#[must_use]
pub fn any(self) -> bool {
self.total() > 0
}
}