aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2024-06-30 14:09:38 +0200
committerKostya Shishkov <kostya.shishkov@gmail.com>2024-06-30 14:09:38 +0200
commitcb945ee68940b7c1d9971ae3b120996e41e91480 (patch)
tree867882b87d4d511feaaa65ecd7321192c3c0d8c8
parentf093f13a60da4822d0a19738c8dcd6b166cf582e (diff)
downloadnihav-cb945ee68940b7c1d9971ae3b120996e41e91480.tar.gz
rawvideo: support packed RGB a bit better
-rw-r--r--nihav-commonfmt/src/codecs/rawvideo.rs6
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())