Have lzw rewind in and flush out on a bad code

name                                    old speed      new speed      delta

wuffs_lzw_decode_20k/clang               214MB/s ± 0%   204MB/s ± 2%  -4.62%  (p=0.008 n=5+5)
wuffs_lzw_decode_100k/clang              369MB/s ± 0%   337MB/s ± 2%  -8.72%  (p=0.008 n=5+5)

wuffs_lzw_decode_20k/gcc                 232MB/s ± 1%   236MB/s ± 0%  +1.99%  (p=0.008 n=5+5)
wuffs_lzw_decode_100k/gcc                384MB/s ± 1%   396MB/s ± 1%  +3.00%  (p=0.008 n=5+5)

wuffs_gif_decode_1k_bw/clang             236MB/s ± 0%   230MB/s ± 0%  -2.67%  (p=0.008 n=5+5)
wuffs_gif_decode_1k_color/clang          118MB/s ± 1%   120MB/s ± 0%  +1.10%  (p=0.008 n=5+5)
wuffs_gif_decode_10k_bgra/clang          562MB/s ± 0%   562MB/s ± 0%    ~     (p=0.690 n=5+5)
wuffs_gif_decode_10k_indexed/clang       149MB/s ± 0%   149MB/s ± 0%    ~     (p=0.421 n=5+5)
wuffs_gif_decode_100k_artificial/clang   487MB/s ± 0%   459MB/s ± 1%  -5.63%  (p=0.008 n=5+5)
wuffs_gif_decode_100k_realistic/clang    183MB/s ± 0%   174MB/s ± 0%  -4.52%  (p=0.008 n=5+5)
wuffs_gif_decode_1000k/clang             185MB/s ± 0%   177MB/s ± 1%  -4.61%  (p=0.008 n=5+5)
wuffs_gif_decode_anim_screencap/clang   1.02GB/s ± 0%  0.97GB/s ± 0%  -5.30%  (p=0.008 n=5+5)

wuffs_gif_decode_1k_bw/gcc               250MB/s ± 0%   249MB/s ± 0%  -0.63%  (p=0.016 n=5+5)
wuffs_gif_decode_1k_color/gcc            133MB/s ± 0%   133MB/s ± 1%    ~     (p=0.151 n=5+5)
wuffs_gif_decode_10k_bgra/gcc            543MB/s ± 1%   543MB/s ± 0%    ~     (p=0.548 n=5+5)
wuffs_gif_decode_10k_indexed/gcc         167MB/s ± 1%   166MB/s ± 1%  -0.83%  (p=0.032 n=5+5)
wuffs_gif_decode_100k_artificial/gcc     465MB/s ± 1%   465MB/s ± 1%    ~     (p=0.841 n=5+5)
wuffs_gif_decode_100k_realistic/gcc      190MB/s ± 0%   190MB/s ± 1%    ~     (p=0.222 n=5+5)
wuffs_gif_decode_1000k/gcc               192MB/s ± 1%   193MB/s ± 0%    ~     (p=0.421 n=5+5)
wuffs_gif_decode_anim_screencap/gcc     1.00GB/s ± 1%  1.00GB/s ± 1%    ~     (p=0.841 n=5+5)
This commit is contained in:
Nigel Tao committed 2018-12-22 14:45:42 +11:00
1 parent 010df42d75
commit 179f7afb9b
3 files changed
+68 -4

No files matched your search

+12 -2
View File
@@ -2628,6 +2628,7 @@ struct wuffs_lzw__decoder__struct {
uint32_t v_save_code;
uint32_t v_prev_code;
uint32_t v_width;
bool v_bad;
uint32_t v_j;
uint32_t v_bits;
uint32_t v_n_bits;
@@ -7145,6 +7146,7 @@ wuffs_lzw__decoder__decode(wuffs_lzw__decoder* self,
uint32_t v_save_code;
uint32_t v_prev_code;
uint32_t v_width;
bool v_bad;
uint32_t v_j;
uint32_t v_bits;
uint32_t v_n_bits;
@@ -7181,6 +7183,7 @@ wuffs_lzw__decoder__decode(wuffs_lzw__decoder* self,
v_save_code = self->private_impl.c_decode[0].v_save_code;
v_prev_code = self->private_impl.c_decode[0].v_prev_code;
v_width = self->private_impl.c_decode[0].v_width;
v_bad = self->private_impl.c_decode[0].v_bad;
v_j = self->private_impl.c_decode[0].v_j;
v_bits = self->private_impl.c_decode[0].v_bits;
v_n_bits = self->private_impl.c_decode[0].v_n_bits;
@@ -7192,6 +7195,7 @@ wuffs_lzw__decoder__decode(wuffs_lzw__decoder* self,
v_lm1_b = 0;
v_lm1_a = 0;
} else {
v_bad = false;
}
switch (coro_susp_point) {
WUFFS_BASE__COROUTINE_SUSPENSION_POINT_0;
@@ -7205,6 +7209,7 @@ wuffs_lzw__decoder__decode(wuffs_lzw__decoder* self,
v_save_code = v_end_code;
v_prev_code = v_end_code;
v_width = (v_literal_width + 1);
v_bad = 0;
v_j = 0;
while (v_j < v_clear_code) {
self->private_impl.f_lm1s[v_j] = 0;
@@ -7334,8 +7339,8 @@ wuffs_lzw__decoder__decode(wuffs_lzw__decoder* self,
v_prev_code = v_code;
}
} else {
status = wuffs_lzw__error__bad_code;
goto exit;
v_bad = true;
goto label_1_break;
}
if (v_j > 4095) {
while (v_n_bits >= 8) {
@@ -7375,6 +7380,10 @@ wuffs_lzw__decoder__decode(wuffs_lzw__decoder* self,
goto suspend;
}
}
if (v_bad) {
status = wuffs_lzw__error__bad_code;
goto exit;
}
goto ok;
ok:
@@ -7391,6 +7400,7 @@ suspend:
self->private_impl.c_decode[0].v_save_code = v_save_code;
self->private_impl.c_decode[0].v_prev_code = v_prev_code;
self->private_impl.c_decode[0].v_width = v_width;
self->private_impl.c_decode[0].v_bad = v_bad;
self->private_impl.c_decode[0].v_j = v_j;
self->private_impl.c_decode[0].v_bits = v_bits;
self->private_impl.c_decode[0].v_n_bits = v_n_bits;