diff --git a/jmode.c b/jmode.c index 6094d3d..afe084f 100644 --- a/jmode.c +++ b/jmode.c @@ -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: