Merge branch 'master' into filter-heuristics

This commit is contained in:
Josh Holmer 2019-08-04 12:10:20 -04:00 committed by GitHub
commit 1ade19aebf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 2 deletions

View file

@ -135,6 +135,19 @@ pub fn deinterlace_image(png: &PngImage) -> PngImage {
if current_pass == 3 && png.ihdr.height <= 4 { if current_pass == 3 && png.ihdr.height <= 4 {
current_pass += 1; current_pass += 1;
} }
if current_pass == 4 && png.ihdr.width <= 2 {
current_pass += 1;
}
if current_pass == 5 && png.ihdr.height <= 2 {
current_pass += 1;
}
if current_pass == 6 && png.ihdr.width == 1 {
current_pass += 1;
}
if current_pass == 7 && png.ihdr.height == 1 {
break;
}
pass_constants = interlaced_constants(current_pass); pass_constants = interlaced_constants(current_pass);
current_y = pass_constants.y_shift as usize; current_y = pass_constants.y_shift as usize;
} }

View file

@ -16,7 +16,10 @@ pub(crate) fn try_alpha_reductions(
alphas: &HashSet<AlphaOptim>, alphas: &HashSet<AlphaOptim>,
eval: &Evaluator, eval: &Evaluator,
) { ) {
assert!(!alphas.is_empty()); if alphas.is_empty() {
return;
}
let alphas = alphas.iter().collect::<Vec<_>>(); let alphas = alphas.iter().collect::<Vec<_>>();
let alphas_iter = alphas.par_iter().with_max_len(1); let alphas_iter = alphas.par_iter().with_max_len(1);
alphas_iter alphas_iter

View file

@ -634,4 +634,20 @@ fn issue_175() {
ColorType::Grayscale, ColorType::Grayscale,
BitDepth::One, BitDepth::One,
); );
} }
#[test]
fn issue_182() {
let input = "tests/files/issue-175.png";
let (output, mut opts) = get_opts(Path::new(input));
opts.interlace = Some(0);
test_it_converts(
input,
Some((output, opts)),
ColorType::Grayscale,
BitDepth::One,
ColorType::Grayscale,
BitDepth::One,
);
}