core/scale: fix off-by-one typo
authorKostya Shishkov <kostya.shishkov@gmail.com>
Sat, 20 May 2023 14:53:47 +0000 (16:53 +0200)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Sat, 20 May 2023 14:53:47 +0000 (16:53 +0200)
nihav-core/src/scale/colorcvt.rs

index 00ae2a56203b38e2c9ac315be0e1696edd341226..4b076d65342e121071f36d956784cef9a14fd3a2 100644 (file)
@@ -265,8 +265,8 @@ impl Kernel for RgbToYuv {
                     let (y, u, v) = matrix_mul(&self.matrix, r, g, b);
 
                     dst[yoff + x] = (y as i16).max(0).min(255) as u8;
-                    dst[uoff + x] = ((u as i16).max(-128).min(128) + 128) as u8;
-                    dst[voff + x] = ((v as i16).max(-128).min(128) + 128) as u8;
+                    dst[uoff + x] = ((u as i16).max(-128).min(127) + 128) as u8;
+                    dst[voff + x] = ((v as i16).max(-128).min(127) + 128) as u8;
                 }
                 roff += istrides[0];
                 goff += istrides[1];