Nigel Tao
|
9741eada02
|
Replace "= try foo" with "=? foo"
|
2018-12-01 13:11:47 +11:00 |
|
Nigel Tao
|
ad9851ea75
|
Prohibit effect-ful subexpressions
|
2018-12-01 11:33:26 +11:00 |
|
Nigel Tao
|
c986536230
|
Rename some read_uxx methods as read_uxx_as_uyy
|
2018-11-25 12:15:05 +11:00 |
|
Nigel Tao
|
c72f7a158d
|
Re-order some token.ID numbers
|
2018-11-25 11:24:30 +11:00 |
|
Nigel Tao
|
0482fadf41
|
Generate implicit wuffs_base__status for !? funcs
|
2018-11-24 15:41:56 +11:00 |
|
Nigel Tao
|
762b320b5e
|
Make the return value mandatory; add ok
|
2018-11-24 15:09:28 +11:00 |
|
Nigel Tao
|
24ace1c144
|
Type and bounds check the "x" in "return x"
|
2018-11-24 14:46:52 +11:00 |
|
Nigel Tao
|
c84732f3d3
|
Quote built-in statuses
|
2018-11-24 13:42:18 +11:00 |
|
Nigel Tao
|
9e5aec5d25
|
Change "$foo" to base."$foo"
|
2018-11-24 13:36:09 +11:00 |
|
Nigel Tao
|
875362ea07
|
Change status "?foo" to just "?foo"
|
2018-11-24 12:36:42 +11:00 |
|
Nigel Tao
|
5f9d007b1c
|
Make a struct's implicit reset method impure
|
2018-11-24 11:05:39 +11:00 |
|
Nigel Tao
|
e84a716313
|
Add comment to consider status.is_complete
|
2018-11-24 10:10:39 +11:00 |
|
Nigel Tao
|
4023294ba2
|
Add a gif.decoder.frame_dirty_rect method
|
2018-11-17 21:26:53 +11:00 |
|
Nigel Tao
|
3854ce3e89
|
Let test binaries run from any dir in the repo
Also spin out generate.WuffsRoot into its own package.
|
2018-11-03 08:46:31 +11:00 |
|
Nigel Tao
|
c3ef038c79
|
Fix missing operator for ast.Expr.Str
|
2018-10-21 18:12:26 +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
|
ff92d22ea6
|
Read LZW input bits 4 bytes at a time, not 1
name old speed new speed delta
wuffs_gif_decode_1k_bw/clang 306MB/s ± 0% 295MB/s ± 0% -3.62% (p=0.008 n=5+5)
wuffs_gif_decode_1k_color/clang 156MB/s ± 0% 163MB/s ± 0% +4.64% (p=0.008 n=5+5)
wuffs_gif_decode_10k/clang 153MB/s ± 0% 179MB/s ± 0% +17.34% (p=0.008 n=5+5)
wuffs_gif_decode_100k/clang 147MB/s ± 0% 155MB/s ± 0% +5.13% (p=0.008 n=5+5)
wuffs_gif_decode_1000k/clang 151MB/s ± 1% 159MB/s ± 0% +5.34% (p=0.008 n=5+5)
wuffs_gif_decode_1k_bw/gcc 319MB/s ± 0% 313MB/s ± 0% -1.79% (p=0.008 n=5+5)
wuffs_gif_decode_1k_color/gcc 165MB/s ± 0% 173MB/s ± 0% +4.82% (p=0.008 n=5+5)
wuffs_gif_decode_10k/gcc 171MB/s ± 1% 184MB/s ± 1% +7.48% (p=0.008 n=5+5)
wuffs_gif_decode_100k/gcc 161MB/s ± 1% 173MB/s ± 1% +7.32% (p=0.008 n=5+5)
wuffs_gif_decode_1000k/gcc 166MB/s ± 0% 179MB/s ± 1% +7.53% (p=0.008 n=5+5)
wuffs_lzw_decode_20k/clang 167MB/s ± 0% 185MB/s ± 0% +10.85% (p=0.008 n=5+5)
wuffs_lzw_decode_100k/clang 239MB/s ± 0% 260MB/s ± 0% +8.96% (p=0.008 n=5+5)
wuffs_lzw_decode_20k/gcc 192MB/s ± 0% 211MB/s ± 0% +9.47% (p=0.008 n=5+5)
wuffs_lzw_decode_100k/gcc 295MB/s ± 0% 300MB/s ± 0% +1.65% (p=0.008 n=5+5)
|
2018-10-14 22:14:02 +11:00 |
|
Nigel Tao
|
9573b88a02
|
Remove unused appendFact code path
|
2018-10-14 13:11:58 +11:00 |
|
Nigel Tao
|
630a96ede6
|
Add token.IDXBinaryTildeModShiftL string form
|
2018-10-14 12:52:11 +11:00 |
|
Nigel Tao
|
7be9c39283
|
Move num_loops out of the image_config
For the GIF format, it isn't necessarily before the first frame.
|
2018-10-13 17:00:45 +11:00 |
|
Nigel Tao
|
34049e52d8
|
Optimize deflate Huffman; tighten an if
name old speed new speed delta
wuffs_deflate_decode_1k/clang 148MB/s ± 0% 149MB/s ± 0% +0.61% (p=0.008 n=5+5)
wuffs_deflate_decode_10k/clang 228MB/s ± 1% 235MB/s ± 0% +3.45% (p=0.016 n=5+4)
wuffs_deflate_decode_100k/clang 253MB/s ± 0% 262MB/s ± 0% +3.42% (p=0.008 n=5+5)
wuffs_deflate_decode_1k/gcc 158MB/s ± 1% 157MB/s ± 0% -0.44% (p=0.032 n=5+5)
wuffs_deflate_decode_10k/gcc 265MB/s ± 0% 274MB/s ± 0% +3.31% (p=0.008 n=5+5)
wuffs_deflate_decode_100k/gcc 300MB/s ± 0% 317MB/s ± 0% +5.45% (p=0.008 n=5+5)
|
2018-10-07 18:13:25 +11:00 |
|
Nigel Tao
|
73ed2eece1
|
Change warning string's prefix from "!" to "~"
|
2018-09-15 08:59:37 +10:00 |
|
Nigel Tao
|
ead965c61f
|
Add a ! effect to copy_from_slice
|
2018-09-08 11:14:37 +10:00 |
|
Nigel Tao
|
724b136bf8
|
Remove the obsolete set_palette method
|
2018-09-08 11:11:36 +10:00 |
|
Nigel Tao
|
fbbdc412d1
|
Rename work_buffer_size to workbuf_len
|
2018-09-08 09:06:56 +10:00 |
|
Nigel Tao
|
5bf7c5c051
|
Add image_config.first_frame_io_position
Also fix a type typo for image_config.first_frame_is_opaque.
|
2018-09-08 08:40:45 +10:00 |
|
Nigel Tao
|
555a72d7a9
|
Add a decode_frame_options type
|
2018-09-02 15:08:00 +10:00 |
|
Nigel Tao
|
8b1e023e6a
|
Add image_config.work_buffer_size
|
2018-09-02 14:56:53 +10:00 |
|
Nigel Tao
|
a3269e160e
|
Tweak gif restart_frame args
|
2018-09-02 14:12:51 +10:00 |
|
Nigel Tao
|
a34cc5311e
|
Place the frame_config's pos before it not after
|
2018-08-26 23:58:03 +10:00 |
|
Nigel Tao
|
9c04249bfe
|
Add warnings as another status code category
|
2018-08-26 23:22:45 +10:00 |
|
Nigel Tao
|
d4f7c263e3
|
Rename s/invalid/bad/ in "invalid call sequence"
|
2018-08-26 21:20:25 +10:00 |
|
Nigel Tao
|
814507e848
|
First sketch of reset_for_decode_frame
|
2018-08-26 21:18:08 +10:00 |
|
Nigel Tao
|
132b54378c
|
Remove frame_config.palette_changed
|
2018-08-26 17:22:29 +10:00 |
|
Nigel Tao
|
7798beaa8c
|
Add I/O positions
|
2018-08-26 16:31:19 +10:00 |
|
Nigel Tao
|
f836d3b743
|
Rename "check_wuffs_version called twice"
|
2018-08-19 17:08:36 +10:00 |
|
Nigel Tao
|
fbb8bd44b8
|
Make blend an enum, not just a bool
|
2018-08-19 17:00:00 +10:00 |
|
Nigel Tao
|
9367cd800b
|
Remove the (pointer-typed) private_impl.status
|
2018-08-19 11:32:31 +10:00 |
|
Nigel Tao
|
c1af1e2c82
|
Rename $(etc) to [etc]
|
2018-08-18 10:11:43 +10:00 |
|
Nigel Tao
|
6236e7205f
|
Remove packageid
|
2018-08-12 21:44:49 +10:00 |
|
Nigel Tao
|
82a19afd4a
|
Sort built-in status messages
|
2018-08-12 21:32:41 +10:00 |
|
Nigel Tao
|
eec0fce647
|
Change error "?foo" to status "?foo"
|
2018-08-12 21:31:56 +10:00 |
|
Nigel Tao
|
203b45e869
|
Remove status values
|
2018-08-12 19:36:29 +10:00 |
|
Nigel Tao
|
c499f03bc7
|
Delete obsolete wuffs_foo__status__string funcs
|
2018-08-12 19:10:24 +10:00 |
|
Nigel Tao
|
b385c30b4f
|
Add a "?" prefix to non-built-in status messages
|
2018-08-12 14:07:40 +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
|
fd43e777bc
|
Have check_wuffs_version return a status code
|
2018-08-05 22:29:54 +10:00 |
|
Nigel Tao
|
eca5565821
|
Removed closed-for-read/write status codes
|
2018-08-04 09:34:39 +10:00 |
|
Nigel Tao
|
98b2aa9837
|
Move some Go packages from lang/foo to lib/foo
|
2018-08-04 09:17:08 +10:00 |
|
Nigel Tao
|
0822842344
|
Require effectful func's args to be effect-free
|
2018-08-04 09:11:33 +10:00 |
|