From cb945ee68940b7c1d9971ae3b120996e41e91480 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Sun, 30 Jun 2024 14:09:38 +0200 Subject: [PATCH] rawvideo: support packed RGB a bit better --- nihav-commonfmt/src/codecs/rawvideo.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nihav-commonfmt/src/codecs/rawvideo.rs b/nihav-commonfmt/src/codecs/rawvideo.rs index 52dcc52..c0cf103 100644 --- a/nihav-commonfmt/src/codecs/rawvideo.rs +++ b/nihav-commonfmt/src/codecs/rawvideo.rs @@ -62,7 +62,11 @@ impl NADecoder for RawDecoder { let esize = vinfo.format.elem_size as usize; let ychr = vinfo.format.get_chromaton(0).unwrap(); let ystep = if ychr.next_elem != 0 { ychr.next_elem as usize } else { esize }; - let stride = (width * esize + ystep - 1) / ystep; + let stride = if vinfo.format.model.is_yuv() { + (width * esize + ystep - 1) / ystep + } else { + width * esize + }; let offs = vec![0]; let strides = vec![stride]; NABufferType::VideoPacked(NAVideoBuffer::from_raw_parts(*vinfo, src, offs, strides).into_ref()) -- 2.39.2