mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-17 16:32:11 +01:00
Remove LZW "cyclical prefix chain" internal error
name old speed new speed delta wuffs_gif_decode_1k_bw/clang 289MB/s ± 1% 309MB/s ± 0% +6.94% (p=0.000 n=50+5) wuffs_gif_decode_1k_color/clang 159MB/s ± 1% 160MB/s ± 0% ~ (p=0.080 n=48+5) wuffs_gif_decode_10k/clang 145MB/s ± 1% 145MB/s ± 0% ~ (p=0.371 n=49+5) wuffs_gif_decode_100k/clang 125MB/s ± 0% 131MB/s ± 1% +4.84% (p=0.000 n=46+5) wuffs_gif_decode_1000k/clang 128MB/s ± 1% 134MB/s ± 0% +5.22% (p=0.000 n=47+5) wuffs_gif_decode_1k_bw/gcc 341MB/s ± 1% 339MB/s ± 0% -0.48% (p=0.001 n=49+5) wuffs_gif_decode_1k_color/gcc 184MB/s ± 1% 186MB/s ± 0% +1.10% (p=0.000 n=50+5) wuffs_gif_decode_10k/gcc 162MB/s ± 0% 164MB/s ± 0% +1.76% (p=0.000 n=50+5) wuffs_gif_decode_100k/gcc 139MB/s ± 0% 143MB/s ± 0% +3.49% (p=0.000 n=49+5) wuffs_gif_decode_1000k/gcc 142MB/s ± 0% 146MB/s ± 0% +3.08% (p=0.000 n=49+5) wuffs_lzw_decode_20k/clang 132MB/s ± 0% 142MB/s ± 0% +7.91% (p=0.000 n=46+5) wuffs_lzw_decode_100k/clang 170MB/s ± 0% 186MB/s ± 1% +9.18% (p=0.000 n=46+5) wuffs_lzw_decode_20k/gcc 156MB/s ± 0% 162MB/s ± 0% +3.74% (p=0.000 n=47+5) wuffs_lzw_decode_100k/gcc 214MB/s ± 0% 235MB/s ± 1% +10.03% (p=0.000 n=47+5)
This commit is contained in:
1 parent
b0ab88c3bb
commit
cae1bfbc7d
2 files changed
+4
-13
No files matched your search
@@ -2515,7 +2515,6 @@ extern "C" {
|
||||
// ---------------- Status Codes
|
||||
|
||||
extern const char* wuffs_lzw__error__bad_code;
|
||||
extern const char* wuffs_lzw__error__cyclical_prefix_chain;
|
||||
|
||||
// ---------------- Public Consts
|
||||
|
||||
@@ -9413,8 +9412,6 @@ exit:
|
||||
// ---------------- Status Codes Implementations
|
||||
|
||||
const char* wuffs_lzw__error__bad_code = "?lzw: bad code";
|
||||
const char* wuffs_lzw__error__cyclical_prefix_chain =
|
||||
"?lzw: cyclical prefix chain";
|
||||
|
||||
// ---------------- Private Consts
|
||||
|
||||
@@ -9618,11 +9615,7 @@ wuffs_lzw__decoder__decode(wuffs_lzw__decoder* self,
|
||||
}
|
||||
while (v_c >= v_clear_code) {
|
||||
self->private_impl.f_stack[v_s] = self->private_impl.f_suffixes[v_c];
|
||||
if (v_s == 0) {
|
||||
status = wuffs_lzw__error__cyclical_prefix_chain;
|
||||
goto exit;
|
||||
}
|
||||
v_s -= 1;
|
||||
v_s = ((v_s - 1) & 4095);
|
||||
v_c = ((uint32_t)(self->private_impl.f_prefixes[v_c]));
|
||||
}
|
||||
self->private_impl.f_stack[v_s] = ((uint8_t)(v_c));
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
// limitations under the License.
|
||||
|
||||
pub status "?bad code"
|
||||
pub status "?cyclical prefix chain"
|
||||
|
||||
pub struct decoder?(
|
||||
literal_width base.u32[..8],
|
||||
@@ -99,10 +98,9 @@ pub func decoder.decode!??(dst base.io_writer, src base.io_reader) {
|
||||
post c < 256 via "a < b: a < c; c <= b"(c:clear_code),
|
||||
{
|
||||
this.stack[s] = this.suffixes[c]
|
||||
if s == 0 {
|
||||
return status "?cyclical prefix chain"
|
||||
}
|
||||
s -= 1
|
||||
// The bitwise-and with 4095 is algorithmically a no-op, but is
|
||||
// necessary for the overflow checker.
|
||||
s = (s ~mod- 1) & 4095
|
||||
c = this.prefixes[c] as base.u32
|
||||
}
|
||||
this.stack[s] = c as base.u8
|
||||
|
||||
Reference in new issue
Block a user