j2k_types/dispatch/
report.rs1#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
7pub struct J2kEncodeDispatchReport {
8 pub deinterleave: usize,
10 pub forward_rct: usize,
12 pub forward_ict: usize,
14 pub forward_dwt53: usize,
16 pub forward_dwt97: usize,
18 pub quantize_subband: usize,
20 pub tier1_code_block: usize,
22 pub ht_code_block: usize,
24 pub packetization: usize,
26}
27
28impl J2kEncodeDispatchReport {
29 #[must_use]
31 pub fn saturating_delta(self, before: Self) -> Self {
32 Self {
33 deinterleave: self.deinterleave.saturating_sub(before.deinterleave),
34 forward_rct: self.forward_rct.saturating_sub(before.forward_rct),
35 forward_ict: self.forward_ict.saturating_sub(before.forward_ict),
36 forward_dwt53: self.forward_dwt53.saturating_sub(before.forward_dwt53),
37 forward_dwt97: self.forward_dwt97.saturating_sub(before.forward_dwt97),
38 quantize_subband: self
39 .quantize_subband
40 .saturating_sub(before.quantize_subband),
41 tier1_code_block: self
42 .tier1_code_block
43 .saturating_sub(before.tier1_code_block),
44 ht_code_block: self.ht_code_block.saturating_sub(before.ht_code_block),
45 packetization: self.packetization.saturating_sub(before.packetization),
46 }
47 }
48
49 #[must_use]
51 pub fn total(self) -> usize {
52 self.forward_rct
53 .saturating_add(self.deinterleave)
54 .saturating_add(self.forward_ict)
55 .saturating_add(self.forward_dwt53)
56 .saturating_add(self.forward_dwt97)
57 .saturating_add(self.quantize_subband)
58 .saturating_add(self.tier1_code_block)
59 .saturating_add(self.ht_code_block)
60 .saturating_add(self.packetization)
61 }
62
63 #[must_use]
65 pub fn any(self) -> bool {
66 self.total() > 0
67 }
68}