From 9610895fc9a99562c79a7bcd0e406437ef94363f Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Thu, 30 Sep 2021 15:52:42 +0200 Subject: [PATCH] core/formats: fix offsets in YUV pixel format parsing --- nihav-core/src/formats.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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, -- 2.39.5