Use libdeflater in evaluate

This commit is contained in:
Andrew 2022-10-23 18:13:29 +13:00
parent 3e8fcc1335
commit 62ebd64aae
2 changed files with 3 additions and 11 deletions

View file

@ -7,8 +7,6 @@ use crate::png::PngData;
use crate::png::PngImage; use crate::png::PngImage;
use crate::png::STD_COMPRESSION; use crate::png::STD_COMPRESSION;
use crate::png::STD_FILTERS; use crate::png::STD_FILTERS;
use crate::png::STD_STRATEGY;
use crate::png::STD_WINDOW;
#[cfg(not(feature = "parallel"))] #[cfg(not(feature = "parallel"))]
use crate::rayon; use crate::rayon;
use crate::Deadline; use crate::Deadline;
@ -116,13 +114,10 @@ impl Evaluator {
if deadline.passed() { if deadline.passed() {
return; return;
} }
if let Ok(idat_data) = deflate::deflate( if let Ok(idat_data) = deflate::libdeflater_deflate(
&image.filter_image(filter), &image.filter_image(filter),
STD_COMPRESSION, STD_COMPRESSION,
STD_STRATEGY,
STD_WINDOW,
&best_candidate_size, &best_candidate_size,
&deadline,
) { ) {
best_candidate_size.set_min(idat_data.len()); best_candidate_size.set_min(idat_data.len());
// ignore baseline images after this point // ignore baseline images after this point

View file

@ -14,11 +14,8 @@ use std::iter::Iterator;
use std::path::Path; use std::path::Path;
use std::sync::Arc; use std::sync::Arc;
pub(crate) const STD_COMPRESSION: u8 = 6; /// Must use normal (lazy) compression, as faster ones (greedy) are not representative
/// Must use normal compression, as faster ones (Huffman/RLE-only) are not representative pub(crate) const STD_COMPRESSION: u8 = 5;
pub(crate) const STD_STRATEGY: u8 = 0;
/// OK to use a bit smalller window for evaluation
pub(crate) const STD_WINDOW: u8 = 13;
pub(crate) const STD_FILTERS: [u8; 2] = [0, 5]; pub(crate) const STD_FILTERS: [u8; 2] = [0, 5];
pub(crate) mod scan_lines; pub(crate) mod scan_lines;