X-Git-Url: https://git.nihav.org/?a=blobdiff_plain;f=src%2Fformats.rs;h=180e9800433bfc297bd2e2015c3e6d223f17a52a;hb=d293626f59d2bc15dcff83af03072688eed7656a;hp=03e6411bf107e4e5e12cb7a8d73738db8f205d37;hpb=15e41b31398703237f32813f89606a45562d5891;p=nihav.git diff --git a/src/formats.rs b/src/formats.rs index 03e6411..180e980 100644 --- a/src/formats.rs +++ b/src/formats.rs @@ -59,7 +59,7 @@ impl fmt::Display for NASoniton { } } -#[derive(Debug,Clone,Copy)] +#[derive(Debug,Clone,Copy,PartialEq)] pub enum NAChannelType { C, L, R, Cs, Ls, Rs, Lss, Rss, LFE, Lc, Rc, Lh, Rh, Ch, LFE2, Lw, Rw, Ov, Lhs, Rhs, Chs, Ll, Rl, Cl, Lt, Rt, Lo, Ro } @@ -142,6 +142,11 @@ impl NAChannelMap { pub fn add_channel(&mut self, ch: NAChannelType) { self.ids.push(ch); } + pub fn add_channels(&mut self, chs: &[NAChannelType]) { + for i in 0..chs.len() { + self.ids.push(chs[i]); + } + } pub fn num_channels(&self) -> usize { self.ids.len() } @@ -325,7 +330,11 @@ impl NAPixelChromaton { } pub fn get_linesize(&self, width: usize) -> usize { let d = self.depth as usize; - (self.get_width(width) * d + d - 1) >> 3 + if self.packed { + (self.get_width(width) * d + d - 1) >> 3 + } else { + self.get_width(width) + } } pub fn get_data_size(&self, width: usize, height: usize) -> usize { let nh = (height + ((1 << self.v_ss) - 1)) >> self.v_ss;