]> git.nihav.org Git - nihav.git/commitdiff
nihav_core/scale: stricter checks for 2x special scaling path master
authorKostya Shishkov <kostya.shishkov@gmail.com>
Wed, 4 Feb 2026 19:31:24 +0000 (20:31 +0100)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Wed, 4 Feb 2026 19:35:39 +0000 (20:35 +0100)
It should have not been used when different components have different
scaling factors (e.g. 16x16 YUV410 to 32x32 YUV420).

nihav-core/src/scale/scale/mod.rs

index 29a91b026fdde2fa44c9a6dba6cc8338170d4bca..944a3b394486830d0f7fd83a6819b0b83a934b3f 100644 (file)
@@ -515,8 +515,13 @@ impl Kernel for Scaler {
         let ncomp = in_fmt.fmt.get_num_comp().min(dest_fmt.fmt.get_num_comp());
         for comp in 0..ncomp {
             if let (Some(sfmt), Some(dfmt)) = (in_fmt.fmt.get_chromaton(comp), dest_fmt.fmt.get_chromaton(comp)) {
+                let sw = sfmt.get_width(in_fmt.width);
                 let sh = sfmt.get_height(in_fmt.height);
                 let dw = dfmt.get_width(dest_fmt.width);
+                let dh = dfmt.get_height(dest_fmt.height);
+                if sw * 2 != dw || sh * 2 != dh {
+                    self.is_nn = false;
+                }
                 let tmp_size = sh * ((dw + 15) & !15);
                 max_size = max_size.max(tmp_size);
             }