]> git.nihav.org Git - nihav.git/commitdiff
rawvideo: support packed RGB a bit better master
authorKostya Shishkov <kostya.shishkov@gmail.com>
Sun, 30 Jun 2024 12:09:38 +0000 (14:09 +0200)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Sun, 30 Jun 2024 12:09:38 +0000 (14:09 +0200)
nihav-commonfmt/src/codecs/rawvideo.rs

index 52dcc52e1f24893c29accc72676e37304c7db075..c0cf1035d85fb45b4dcb82f755e38bc4ccbbcf30 100644 (file)
@@ -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())