From: Kostya Shishkov Date: Sun, 30 Jun 2024 12:09:38 +0000 (+0200) Subject: rawvideo: support packed RGB a bit better X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=cb945ee68940b7c1d9971ae3b120996e41e91480;p=nihav.git rawvideo: support packed RGB a bit better --- 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())