Skip to content

Commit

Permalink
Assume None if the line is all zeros
Browse files Browse the repository at this point in the history
  • Loading branch information
andrews05 committed Nov 27, 2024
1 parent 7c89dc1 commit 8da44fc
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/png/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8da44fc

Please sign in to comment.