Assume None if the line is all zeros

This commit is contained in:
Andrew 2024-11-27 20:13:08 +13:00
parent 7c89dc17fc
commit 8da44fc45c

View file

@ -360,6 +360,15 @@ impl PngImage {
prev_line = line_data;
} else {
// Heuristic filter selection strategies
if line_data.iter().all(|&x| x == 0) {
// Assume None if the line is all zeros
filtered.push(RowFilter::None as u8);
filtered.extend_from_slice(&line_data);
prev_line = line_data;
continue;
}
let mut best_line = Vec::new();
let mut best_line_raw = Vec::new();
// Avoid vertical filtering on first line of each interlacing pass