diff options
author | Kostya Shishkov <kostya.shishkov@gmail.com> | 2024-06-30 14:09:38 +0200 |
---|---|---|
committer | Kostya Shishkov <kostya.shishkov@gmail.com> | 2024-06-30 14:09:38 +0200 |
commit | cb945ee68940b7c1d9971ae3b120996e41e91480 (patch) | |
tree | 867882b87d4d511feaaa65ecd7321192c3c0d8c8 | |
parent | f093f13a60da4822d0a19738c8dcd6b166cf582e (diff) | |
download | nihav-cb945ee68940b7c1d9971ae3b120996e41e91480.tar.gz |
rawvideo: support packed RGB a bit better
-rw-r--r-- | nihav-commonfmt/src/codecs/rawvideo.rs | 6 |
1 files changed, 5 insertions, 1 deletions
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()) |