From 5f031d75f99167db3aca5e0bb25c06c487deb236 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Wed, 6 Oct 2021 12:41:10 +0200 Subject: [PATCH] core/scale: fix check for checking formats subsampling differences --- nihav-core/src/scale/mod.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/nihav-core/src/scale/mod.rs b/nihav-core/src/scale/mod.rs index caf489b..cc2388e 100644 --- a/nihav-core/src/scale/mod.rs +++ b/nihav-core/src/scale/mod.rs @@ -250,13 +250,22 @@ fn is_better_fmt(a: &ScaleInfo, b: &ScaleInfo) -> bool { } false } +fn fmt_needs_scale(ifmt: &NAPixelFormaton, ofmt: &NAPixelFormaton) -> bool { + for (ichr, ochr) in ifmt.comp_info.iter().zip(ofmt.comp_info.iter()) { + if let (Some(ic), Some(oc)) = (ichr, ochr) { + if ic.h_ss != oc.h_ss || ic.v_ss != oc.v_ss { + return true; + } + } + } + false +} fn build_pipeline(ifmt: &ScaleInfo, ofmt: &ScaleInfo, just_convert: bool) -> ScaleResult> { let inname = ifmt.fmt.get_model().get_short_name(); let outname = ofmt.fmt.get_model().get_short_name(); println!("convert {} -> {}", ifmt, ofmt); - let needs_scale = if (ofmt.fmt.get_max_subsampling() > 0) && - (ofmt.fmt.get_max_subsampling() != ifmt.fmt.get_max_subsampling()) { + let needs_scale = if fmt_needs_scale(&ifmt.fmt, &ofmt.fmt) { true } else { !just_convert -- 2.30.2