From: Kostya Shishkov Date: Wed, 4 Feb 2026 19:31:24 +0000 (+0100) Subject: nihav_core/scale: stricter checks for 2x special scaling path X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=f9589c69c90be18fba129824164d002a16a1810d;p=nihav.git nihav_core/scale: stricter checks for 2x special scaling path It should have not been used when different components have different scaling factors (e.g. 16x16 YUV410 to 32x32 YUV420). --- diff --git a/nihav-core/src/scale/scale/mod.rs b/nihav-core/src/scale/scale/mod.rs index 29a91b0..944a3b3 100644 --- a/nihav-core/src/scale/scale/mod.rs +++ b/nihav-core/src/scale/scale/mod.rs @@ -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); }