From: Kostya Shishkov Date: Thu, 30 Sep 2021 13:52:42 +0000 (+0200) Subject: core/formats: fix offsets in YUV pixel format parsing X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=9610895fc9a99562c79a7bcd0e406437ef94363f;p=nihav.git core/formats: fix offsets in YUV pixel format parsing --- diff --git a/nihav-core/src/formats.rs b/nihav-core/src/formats.rs index 713a3e5..99370f9 100644 --- a/nihav-core/src/formats.rs +++ b/nihav-core/src/formats.rs @@ -1065,8 +1065,8 @@ fn parse_yuv_format(s: &str) -> Result { 444 => [[0, 0], [0, 0], [0, 0], [0, 0]], _ => return Err(FormatParseError {}), }; - for (chro, ss) in chromatons.iter_mut().take(components as usize).zip(subsamp.iter()) { - *chro = Some(NAPixelChromaton{ h_ss: ss[0], v_ss: ss[1], packed: !is_planar, depth, shift: 0, comp_offs: next_elem, next_elem }); + for (i, (chro, ss)) in chromatons.iter_mut().take(components as usize).zip(subsamp.iter()).enumerate() { + *chro = Some(NAPixelChromaton{ h_ss: ss[0], v_ss: ss[1], packed: !is_planar, depth, shift: 0, comp_offs: if is_planar { i as u8 } else { next_elem }, next_elem }); } Ok(NAPixelFormaton { model: ColorModel::YUV(YUVSubmodel::YUVJ), components,