Disable deinterlacing with --nx

This commit is contained in:
Andrew 2023-08-06 09:46:40 +12:00
parent 73f8aad65d
commit e9c61ba5fb

View file

@ -225,7 +225,7 @@ fn main() {
) )
.arg( .arg(
Arg::new("no-reductions") Arg::new("no-reductions")
.help("No reductions") .help("No reductions or deinterlacing")
.long("nx") .long("nx")
.action(ArgAction::SetTrue), .action(ArgAction::SetTrue),
) )
@ -431,14 +431,6 @@ fn parse_opts_into_struct(
Some(level) => Options::from_preset(level.parse::<u8>().unwrap()), Some(level) => Options::from_preset(level.parse::<u8>().unwrap()),
}; };
if let Some(x) = matches.get_one::<String>("interlace") {
opts.interlace = if x == "keep" {
None
} else {
x.parse::<u8>().unwrap().try_into().ok()
};
}
if let Some(x) = matches.get_one::<IndexSet<u8>>("filters") { if let Some(x) = matches.get_one::<IndexSet<u8>>("filters") {
opts.filter.clear(); opts.filter.clear();
for &f in x { for &f in x {
@ -507,10 +499,19 @@ fn parse_opts_into_struct(
opts.color_type_reduction = false; opts.color_type_reduction = false;
opts.palette_reduction = false; opts.palette_reduction = false;
opts.grayscale_reduction = false; opts.grayscale_reduction = false;
opts.interlace = None;
} }
opts.idat_recoding = !matches.get_flag("no-recoding"); opts.idat_recoding = !matches.get_flag("no-recoding");
if let Some(x) = matches.get_one::<String>("interlace") {
opts.interlace = if x == "keep" {
None
} else {
x.parse::<u8>().unwrap().try_into().ok()
};
}
if let Some(keep) = matches.get_one::<String>("keep") { if let Some(keep) = matches.get_one::<String>("keep") {
let names = keep let names = keep
.split(',') .split(',')