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

View file

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