diff options
author | Kostya Shishkov <kostya.shishkov@gmail.com> | 2021-09-30 15:52:42 +0200 |
---|---|---|
committer | Kostya Shishkov <kostya.shishkov@gmail.com> | 2021-09-30 18:13:05 +0200 |
commit | 9610895fc9a99562c79a7bcd0e406437ef94363f (patch) | |
tree | 5616d69647d6ab611ee51af5cae70eb64102b54b | |
parent | 6d240c6b3c031388c3bcc6b96f14de8d60e2b4ae (diff) | |
download | nihav-9610895fc9a99562c79a7bcd0e406437ef94363f.tar.gz |
core/formats: fix offsets in YUV pixel format parsing
-rw-r--r-- | nihav-core/src/formats.rs | 4 |
1 files 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<NAPixelFormaton, FormatParseError> { 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, |