Nigel Tao
|
4ff64de78e
|
Mark deflate's decode_huffman_fast as !? not !??
|
2018-11-24 20:34:31 +11:00 |
|
Nigel Tao
|
ec0fd9649d
|
Don't skip derived I/O vars for !? methods
|
2018-11-24 17:52:04 +11:00 |
|
Nigel Tao
|
cf51406fcf
|
Mark deflate's init_fixed_huffman as !? not !??
|
2018-11-24 16:49:52 +11:00 |
|
Nigel Tao
|
312cdc8a0a
|
Mark deflate's init_huff as merely !? not !??
|
2018-11-24 16:41:45 +11:00 |
|
Nigel Tao
|
2434f0dee5
|
Remove some redundant cgen funk fields
|
2018-11-24 15:25:31 +11:00 |
|
Nigel Tao
|
762b320b5e
|
Make the return value mandatory; add ok
|
2018-11-24 15:09:28 +11:00 |
|
Nigel Tao
|
875362ea07
|
Change status "?foo" to just "?foo"
|
2018-11-24 12:36:42 +11:00 |
|
Nigel Tao
|
4023294ba2
|
Add a gif.decoder.frame_dirty_rect method
|
2018-11-17 21:26:53 +11:00 |
|
Nigel Tao
|
3338d6d1bc
|
Write LZW output 8 bytes at a time, not 1
The benchmarks are mixed, but I think it's still a net win.
----
name old speed new speed delta
wuffs_gif_decode_1k_bw/clang 258MB/s ± 0% 253MB/s ± 1% -2.04% (p=0.008 n=5+5)
wuffs_gif_decode_1k_color/clang 159MB/s ± 0% 116MB/s ± 0% -26.76% (p=0.008 n=5+5)
wuffs_gif_decode_10k/clang 167MB/s ± 0% 138MB/s ± 0% -17.42% (p=0.008 n=5+5)
wuffs_gif_decode_100k_artificial/clang 205MB/s ± 0% 439MB/s ± 0% +114.53% (p=0.008 n=5+5)
wuffs_gif_decode_100k_realistic/clang 151MB/s ± 0% 164MB/s ± 0% +8.41% (p=0.008 n=5+5)
wuffs_gif_decode_1000k/clang 155MB/s ± 0% 165MB/s ± 0% +6.50% (p=0.008 n=5+5)
wuffs_gif_decode_anim_screencap/clang 255MB/s ± 0% 921MB/s ± 0% +261.50% (p=0.008 n=5+5)
wuffs_gif_decode_1k_bw/gcc 316MB/s ± 2% 267MB/s ± 1% -15.78% (p=0.008 n=5+5)
wuffs_gif_decode_1k_color/gcc 184MB/s ± 1% 134MB/s ± 0% -27.57% (p=0.008 n=5+5)
wuffs_gif_decode_10k/gcc 196MB/s ± 0% 161MB/s ± 0% -17.50% (p=0.008 n=5+5)
wuffs_gif_decode_100k_artificial/gcc 287MB/s ± 0% 449MB/s ± 1% +56.22% (p=0.008 n=5+5)
wuffs_gif_decode_100k_realistic/gcc 182MB/s ± 0% 182MB/s ± 1% ~ (p=0.690 n=5+5)
wuffs_gif_decode_1000k/gcc 187MB/s ± 1% 185MB/s ± 1% ~ (p=0.056 n=5+5)
wuffs_gif_decode_anim_screencap/gcc 397MB/s ± 0% 973MB/s ± 0% +145.42% (p=0.008 n=5+5)
wuffs_lzw_decode_20k/clang 170MB/s ± 0% 191MB/s ± 1% +12.52% (p=0.008 n=5+5)
wuffs_lzw_decode_100k/clang 242MB/s ± 0% 312MB/s ± 2% +29.00% (p=0.008 n=5+5)
wuffs_lzw_decode_20k/gcc 220MB/s ± 0% 227MB/s ± 0% +3.31% (p=0.008 n=5+5)
wuffs_lzw_decode_100k/gcc 317MB/s ± 0% 369MB/s ± 1% +16.53% (p=0.008 n=5+5)
----
LZW is the compression method used by GIF images. Roughly speaking, LZW
is a sequence of codes, and each code emits either 1 byte (a literal
code) or multiple bytes (a copy code). The speed gain in this commit
comes from, when emitting an N-byte copy code, this now requires N/8
iterations instead of N iterations, as each iteration now writes 8 bytes
instead of 1. Literal codes, both before and after this commit, requires
a single iteration.
Decoding should therefore get faster or slower depending on whether it's
copy-code-heavy or literal-code-heavy respectively. For what it's worth,
copy-code-heavy GIF images also usually compress better.
Running script/extract-giflzw.go (or examining the cached output at
test/data/analysis/giflzw-emission-lengths.txt) on the anim_screencap
(which got faster) and 1k_color (which got slower) cases (also known as
gifplayer-muybridge.gif and hippopotamus.regular.gif) shows that the
proportion of literal codes agrees with that explanation.
----
gifplayer-muybridge.gif (all frames)
Percent Count Emission_Length_Bucket
12.78 34658 1 (Literal Code)
14.05 38106 2
13.25 35937 3
10.59 28707 4
7.85 21286 5
6.08 16481 6
4.85 13156 7
3.60 9764 8
9.34 25318 9 .. 16
4.89 13257 17 .. 32
4.78 12954 33 .. 64
4.72 12806 65 .. 128
3.02 8190 127 .. 256
0.20 550 256+
hippopotamus.regular.gif (all frames)
Percent Count Emission_Length_Bucket
82.66 672 1 (Literal Code)
13.04 106 2
2.83 23 3
0.86 7 4
0.37 3 5
0.25 2 6
0.00 0 7
0.00 0 8
0.00 0 9 .. 16
0.00 0 17 .. 32
0.00 0 33 .. 64
0.00 0 65 .. 128
0.00 0 127 .. 256
0.00 0 256+
----
The new algorithm also adds more CPU and RAM overhead, regardless of
whether the input GIF image's LZW data is copy-code-heavy or
literal-code-heavy. For example, the suffix table grows by 8x, from 4KiB
to 32 KiB.
The gifplayer-muybridge.gif image is also larger (472 x 298) and the
hippopotamus.regular.gif image is also smaller (36 x 28). Higher fixed
costs may have larger (negative) relative effects on decoding smaller
images.
To repeat, I think it's still a net win.
An upcoming commit will update the std/lzw/README.md file to provide
more detail on the algorithm.
Thanks to Tushar Khandelwal for the idea.
|
2018-10-21 14:48:40 +11:00 |
|
Nigel Tao
|
9c04249bfe
|
Add warnings as another status code category
|
2018-08-26 23:22:45 +10:00 |
|
Nigel Tao
|
eec0fce647
|
Change error "?foo" to status "?foo"
|
2018-08-12 21:31:56 +10:00 |
|
Nigel Tao
|
b840c80040
|
Make the status type a const char*, not a struct
|
2018-08-12 16:05:14 +10:00 |
|
Nigel Tao
|
2a32a86a6c
|
Make the status type a struct, not an int32_t
|
2018-08-11 13:27:29 +10:00 |
|
Nigel Tao
|
9c0b2d2f5c
|
Rename ioptr_etc cgen variables
|
2018-08-11 08:32:49 +10:00 |
|
Nigel Tao
|
f2ee78aa2a
|
Remove short_read_src cgen code path
|
2018-08-04 09:45:35 +10:00 |
|
Nigel Tao
|
df19bcdb03
|
Require if and while conditions to be effect-free
|
2018-07-29 14:20:15 +10:00 |
|
Nigel Tao
|
5cca9471ec
|
Have cgen look for !?? methods not ? methods
|
2018-07-29 14:01:57 +10:00 |
|
Nigel Tao
|
0a47966e72
|
Introduce finer-grained effects
|
2018-07-29 13:40:49 +10:00 |
|
Nigel Tao
|
9919d78245
|
Change func out-type from struct to bare type
|
2018-07-29 10:02:06 +10:00 |
|
Nigel Tao
|
85c4de47b9
|
Remove ProvenNotToSuspend and BoundsCheckOptimized
|
2018-07-08 21:48:50 +10:00 |
|
Nigel Tao
|
ccb78f5db7
|
Rename ast.Node methods from Foo to AsFoo
|
2018-07-01 20:41:21 +10:00 |
|
Nigel Tao
|
50a955317a
|
Remove the WUFFS_FOO__STATUS_ETC names
|
2018-06-10 22:05:06 +10:00 |
|
Nigel Tao
|
d770e879ab
|
Remove the wuffs_foo__status types
|
2018-06-10 21:40:43 +10:00 |
|
Nigel Tao
|
8474b473ca
|
Refactor some read_uxx cgen code
|
2018-06-02 13:11:49 +10:00 |
|
Nigel Tao
|
20e459cfb2
|
Add read_u24be etc methods
Fixes #12
|
2018-06-02 13:03:24 +10:00 |
|
Nigel Tao
|
00203e564f
|
Let ? methods return OK even without suspending
|
2018-05-27 19:09:58 +10:00 |
|
Nigel Tao
|
eda326726a
|
Allow table base.u8 as a type
|
2018-05-18 10:31:24 +10:00 |
|
Nigel Tao
|
b5e45740c0
|
Rename o_0_ioptr1_v_w to o_0_ioptr_v_w
|
2018-05-17 10:03:51 +10:00 |
|
Nigel Tao
|
7452ec8035
|
Rename b_rptr_foo as ioptr_foo
|
2018-05-17 09:59:04 +10:00 |
|
Nigel Tao
|
2448b2ae7a
|
Factor out writeBuiltinCallSuspendibles
|
2018-05-16 12:12:47 +10:00 |
|
Nigel Tao
|
6835c6e23c
|
Remove more hard-coding in writeCallSuspendibles
Fixes #8
|
2018-05-16 11:51:33 +10:00 |
|
Nigel Tao
|
8b4a82ab83
|
Remove hard-coded output in writeCallSuspendibles
Updates #8
|
2018-05-16 11:41:48 +10:00 |
|
Nigel Tao
|
8071a2096c
|
Remove parenthesesPolicy, part 3 of N
|
2018-05-14 20:48:31 +10:00 |
|
Nigel Tao
|
0870643c77
|
Remove parenthesesPolicy, part 2 of N
|
2018-05-14 20:42:39 +10:00 |
|
Nigel Tao
|
f159bcdadc
|
Remove parenthesesPolicy, part 1 of N
|
2018-05-14 20:33:52 +10:00 |
|
Nigel Tao
|
f10ff8c896
|
Have std/gif pass through an intermediary
|
2018-05-13 15:50:51 +10:00 |
|
Nigel Tao
|
ed1a8b4057
|
Update std/gif's pass-through uncompressed_wi
|
2018-05-13 13:09:58 +10:00 |
|
Nigel Tao
|
a86023b290
|
Simplify temporary io_bind variables
|
2018-05-13 10:52:49 +10:00 |
|
Nigel Tao
|
92720594ac
|
Distinguish io_bind(in.foo) versus io_bind(foo)
|
2018-05-13 10:45:07 +10:00 |
|
Nigel Tao
|
2d3b3b1dae
|
Add an io_writer var to gif's decoder.decode_id
|
2018-05-13 10:40:44 +10:00 |
|
Nigel Tao
|
bd12c54ab5
|
Rename mark to set_mark, part 1 of N
|
2018-05-12 14:17:26 +10:00 |
|
Nigel Tao
|
b65fdee306
|
Make the else-length-1 iterate tail explicit
|
2018-05-11 10:22:24 +10:00 |
|
Nigel Tao
|
e8eeee371a
|
Raise built-in ident capacity from 96 to 768
|
2018-05-05 09:23:10 +10:00 |
|
Nigel Tao
|
1702c1e303
|
Rename iterate's step to length
|
2018-05-05 08:25:23 +10:00 |
|
Nigel Tao
|
76b74f9d3e
|
Refactor gen.writeStatement
|
2018-05-04 14:28:50 +10:00 |
|
Nigel Tao
|
5c25b0e1d1
|
Factor out a writeIterateRound method
|
2018-05-04 14:19:58 +10:00 |
|
Nigel Tao
|
7bd37588b1
|
Factor out a writeIterate method
|
2018-05-04 14:03:47 +10:00 |
|
Nigel Tao
|
58cd282138
|
Unroll the std/crc32 loop
name old speed new speed delta
wuffs_crc32_ieee_10k/clang 2.30GB/s ± 1% 2.37GB/s ± 0% +3.31% (p=0.016 n=5+4)
wuffs_crc32_ieee_100k/clang 2.30GB/s ± 0% 2.35GB/s ± 0% +2.39% (p=0.008 n=5+5)
wuffs_crc32_ieee_10k/gcc 2.49GB/s ± 1% 2.72GB/s ± 0% +9.19% (p=0.008 n=5+5)
wuffs_crc32_ieee_100k/gcc 2.50GB/s ± 0% 2.70GB/s ± 1% +8.18% (p=0.008 n=5+5)
wuffs_gzip_decode_10k/clang 206MB/s ± 2% 207MB/s ± 0% ~ (p=1.000 n=5+5)
wuffs_gzip_decode_100k/clang 231MB/s ± 2% 235MB/s ± 0% +1.57% (p=0.008 n=5+5)
wuffs_gzip_decode_10k/gcc 234MB/s ± 0% 235MB/s ± 1% ~ (p=0.095 n=5+5)
wuffs_gzip_decode_100k/gcc 267MB/s ± 0% 266MB/s ± 2% ~ (p=0.690 n=5+5)
|
2018-05-04 14:00:04 +10:00 |
|
Nigel Tao
|
a23681d1ba
|
Rename some generated iterate variables
|
2018-05-04 13:44:55 +10:00 |
|
Nigel Tao
|
96a549814d
|
Change iterate variable types from ptr to slice
|
2018-05-04 13:20:34 +10:00 |
|