Skip to content

Commit

Permalink
jmode.c: zrle-consider
Browse files Browse the repository at this point in the history
  • Loading branch information
kspalaiologos committed Oct 17, 2024
1 parent a37eda2 commit 2529f42
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions jmode.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,20 @@ int rsd32(u8 data[N]) {
return count;
}

// ============================================================================
// ZRLE.
// ============================================================================
static bool zrle_consider(u8 * restrict in, sz n) {
i32 savings = 0;
Fi(n, if (!in[i]) {
sz j = i + 1;
while (j < n && in[j] == 0) j++;
savings += j - i - 2;
i = j - 1;
})
return savings > 0;
}

// ============================================================================
// Processing. We apply a few strategies that depend on some specifics of the
// process at hand:
Expand Down

0 comments on commit 2529f42

Please sign in to comment.