Commit Graph
361 Commits
Author SHA1 Message Date
Nigel Tao 8954281a4e pixconv: allow decoding to PIXEL_FORMAT__RGB
"wuffs genlib" binary size changes:
 77936 clang-static/wuffs-base-pixconv.o  # Before = 1.00x
 79792 clang-static/wuffs-base-pixconv.o  # After  = 1.02x
173784 gcc-static/wuffs-base-pixconv.o    # Before = 1.00x
177112 gcc-static/wuffs-base-pixconv.o    # After  = 1.02x

Some of the benchmark numbers move around even though they don't use the
new WUFFS_BASE__PIXEL_FORMAT__RGB code paths. It's possibly just a code
alignment coincidence per https://news.ycombinator.com/item?id=23633583

name                                                       old speed      new speed      delta

wuffs_jpeg_decode_19k_8bpp/clang11                          249MB/s ± 0%   251MB/s ± 0%   +0.76%  (p=0.008 n=5+5)
wuffs_jpeg_decode_30k_24bpp_progressive/clang11             222MB/s ± 0%   225MB/s ± 0%   +1.16%  (p=0.008 n=5+5)
wuffs_jpeg_decode_30k_24bpp_sequential/clang11              405MB/s ± 0%   406MB/s ± 0%     ~     (p=1.000 n=5+5)
wuffs_jpeg_decode_77k_24bpp/clang11                         357MB/s ± 0%   356MB/s ± 0%   -0.24%  (p=0.008 n=5+5)
wuffs_jpeg_decode_552k_24bpp_420/clang11                    370MB/s ± 0%   372MB/s ± 0%   +0.46%  (p=0.008 n=5+5)
wuffs_jpeg_decode_552k_24bpp_444/clang11                    504MB/s ± 0%   508MB/s ± 0%   +0.83%  (p=0.008 n=5+5)
wuffs_jpeg_decode_4002k_24bpp/clang11                       375MB/s ± 0%   374MB/s ± 0%     ~     (p=0.095 n=5+5)

wuffs_jpeg_decode_19k_8bpp/gcc10                            258MB/s ± 0%   254MB/s ± 0%   -1.68%  (p=0.008 n=5+5)
wuffs_jpeg_decode_30k_24bpp_progressive/gcc10               267MB/s ± 0%   240MB/s ± 0%   -9.95%  (p=0.008 n=5+5)
wuffs_jpeg_decode_30k_24bpp_sequential/gcc10                537MB/s ± 0%   537MB/s ± 0%     ~     (p=0.556 n=4+5)
wuffs_jpeg_decode_77k_24bpp/gcc10                           458MB/s ± 0%   453MB/s ± 0%   -1.18%  (p=0.008 n=5+5)
wuffs_jpeg_decode_552k_24bpp_420/gcc10                      482MB/s ± 0%   478MB/s ± 0%   -0.78%  (p=0.008 n=5+5)
wuffs_jpeg_decode_552k_24bpp_444/gcc10                      508MB/s ± 0%   511MB/s ± 0%   +0.49%  (p=0.008 n=5+5)
wuffs_jpeg_decode_4002k_24bpp/gcc10                         489MB/s ± 0%   484MB/s ± 0%   -1.11%  (p=0.016 n=4+5)

wuffs_png_decode_image_19k_8bpp/clang11                     269MB/s ± 0%   275MB/s ± 0%   +2.25%  (p=0.008 n=5+5)
wuffs_png_decode_image_40k_24bpp/clang11                    328MB/s ± 0%   328MB/s ± 0%     ~     (p=0.841 n=5+5)
wuffs_png_decode_image_77k_8bpp/clang11                     949MB/s ± 0%   962MB/s ± 0%   +1.29%  (p=0.008 n=5+5)
wuffs_png_decode_image_552k_32bpp_ignore_checksum/clang11   854MB/s ± 0%   859MB/s ± 0%   +0.54%  (p=0.008 n=5+5)
wuffs_png_decode_image_552k_32bpp_verify_checksum/clang11   822MB/s ± 0%   826MB/s ± 0%   +0.52%  (p=0.008 n=5+5)
wuffs_png_decode_image_4002k_24bpp/clang11                  331MB/s ± 0%   332MB/s ± 0%   +0.15%  (p=0.008 n=5+5)

wuffs_png_decode_image_19k_8bpp/gcc10                       287MB/s ± 0%   277MB/s ± 0%   -3.46%  (p=0.008 n=5+5)
wuffs_png_decode_image_40k_24bpp/gcc10                      341MB/s ± 0%   346MB/s ± 0%   +1.34%  (p=0.008 n=5+5)
wuffs_png_decode_image_77k_8bpp/gcc10                      1.02GB/s ± 0%  1.01GB/s ± 0%   -0.41%  (p=0.008 n=5+5)
wuffs_png_decode_image_552k_32bpp_ignore_checksum/gcc10     939MB/s ± 0%   916MB/s ± 0%   -2.50%  (p=0.008 n=5+5)
wuffs_png_decode_image_552k_32bpp_verify_checksum/gcc10     895MB/s ± 0%   874MB/s ± 0%   -2.41%  (p=0.008 n=5+5)
wuffs_png_decode_image_4002k_24bpp/gcc10                    352MB/s ± 0%   350MB/s ± 0%   -0.44%  (p=0.008 n=5+5)

Updates #131
2023-07-16 11:17:45 +10:00
Nigel Tao e7df7cafac cgen: add WUFFS_BASE__GENERATED_C_CODE macro
This disables UBSan's "unsigned-integer-overflow" runtime checks.

Updates https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=59966
2023-06-20 17:04:35 +10:00
Nigel Tao 44e745dd0e std/jpeg: optimize EXTEND'ing MCU bits
name                                             old speed     new speed     delta

wuffs_jpeg_decode_19k_8bpp/clang11               224MB/s ± 1%  223MB/s ± 0%     ~     (p=0.190 n=4+5)
wuffs_jpeg_decode_30k_24bpp_progressive/clang11  206MB/s ± 0%  208MB/s ± 0%   +0.86%  (p=0.016 n=4+5)
wuffs_jpeg_decode_30k_24bpp_sequential/clang11   374MB/s ± 0%  375MB/s ± 0%   +0.26%  (p=0.016 n=5+4)
wuffs_jpeg_decode_77k_24bpp/clang11              319MB/s ± 0%  319MB/s ± 0%   +0.16%  (p=0.029 n=4+4)
wuffs_jpeg_decode_552k_24bpp_420/clang11         329MB/s ± 0%  329MB/s ± 0%   -0.06%  (p=0.008 n=5+5)
wuffs_jpeg_decode_552k_24bpp_444/clang11         465MB/s ± 0%  465MB/s ± 0%   -0.12%  (p=0.008 n=5+5)
wuffs_jpeg_decode_4002k_24bpp/clang11            332MB/s ± 0%  331MB/s ± 0%   -0.15%  (p=0.008 n=5+5)

wuffs_jpeg_decode_19k_8bpp/gcc10                 176MB/s ± 0%  208MB/s ± 0%  +18.26%  (p=0.008 n=5+5)
wuffs_jpeg_decode_30k_24bpp_progressive/gcc10    246MB/s ± 0%  243MB/s ± 0%   -1.03%  (p=0.008 n=5+5)
wuffs_jpeg_decode_30k_24bpp_sequential/gcc10     472MB/s ± 0%  479MB/s ± 0%   +1.33%  (p=0.008 n=5+5)
wuffs_jpeg_decode_77k_24bpp/gcc10                334MB/s ± 0%  385MB/s ± 0%  +15.33%  (p=0.008 n=5+5)
wuffs_jpeg_decode_552k_24bpp_420/gcc10           351MB/s ± 0%  407MB/s ± 0%  +15.74%  (p=0.008 n=5+5)
wuffs_jpeg_decode_552k_24bpp_444/gcc10           425MB/s ± 0%  457MB/s ± 0%   +7.38%  (p=0.008 n=5+5)
wuffs_jpeg_decode_4002k_24bpp/gcc10              349MB/s ± 0%  411MB/s ± 0%  +17.74%  (p=0.008 n=5+5)
2023-06-18 17:37:23 +10:00
Nigel Tao 04344db374 cgen: remove "// ¡ BEGIN set_color_u32_at" 2023-06-11 12:33:36 +10:00
Nigel Tao 7511bda9e5 cgen: refactor patch_pixconv's set_color_u32_at 2023-06-11 12:02:47 +10:00
Nigel Tao 43d9c604a2 cgen: unroll etc__swizzle_ycck for 444
name                                             old speed     new speed     delta

wuffs_jpeg_decode_552k_24bpp_444/clang11         440MB/s ± 0%  459MB/s ± 0%  +4.48%  (p=0.008 n=5+5)
wuffs_jpeg_decode_552k_24bpp_444/gcc10           393MB/s ± 0%  412MB/s ± 0%  +4.82%  (p=0.008 n=5+5)
2023-06-11 11:23:29 +10:00
Nigel Tao 41fb661626 cgen: make patch_pixconv etc__bgrx__hv11 explicit 2023-06-11 11:20:49 +10:00
Nigel Tao 379000a711 cgen: optimize etc__swizzle_ycck for 420 bgrx/rgbx
name                                             old speed     new speed     delta

wuffs_jpeg_decode_30k_24bpp_progressive/clang11  172MB/s ± 0%  200MB/s ± 0%  +15.74%  (p=0.008 n=5+5)
wuffs_jpeg_decode_30k_24bpp_sequential/clang11   292MB/s ± 0%  362MB/s ± 0%  +23.88%  (p=0.008 n=5+5)
wuffs_jpeg_decode_77k_24bpp/clang11              256MB/s ± 0%  307MB/s ± 0%  +19.79%  (p=0.008 n=5+5)
wuffs_jpeg_decode_552k_24bpp_420/clang11         264MB/s ± 0%  318MB/s ± 0%  +20.32%  (p=0.008 n=5+5)
wuffs_jpeg_decode_4002k_24bpp/clang11            269MB/s ± 0%  320MB/s ± 0%  +19.13%  (p=0.008 n=5+5)

wuffs_jpeg_decode_30k_24bpp_progressive/gcc10    202MB/s ± 0%  224MB/s ± 0%  +11.01%  (p=0.008 n=5+5)
wuffs_jpeg_decode_30k_24bpp_sequential/gcc10     350MB/s ± 0%  454MB/s ± 0%  +29.83%  (p=0.008 n=5+5)
wuffs_jpeg_decode_77k_24bpp/gcc10                248MB/s ± 0%  311MB/s ± 0%  +24.97%  (p=0.008 n=5+5)
wuffs_jpeg_decode_552k_24bpp_420/gcc10           261MB/s ± 0%  327MB/s ± 0%  +25.49%  (p=0.008 n=5+5)
wuffs_jpeg_decode_4002k_24bpp/gcc10              259MB/s ± 0%  324MB/s ± 0%  +25.38%  (p=0.008 n=5+5)
2023-06-09 19:21:28 +10:00
Nigel Tao 311ea1a1f4 cgen: more optimize etc__swizzle_ycck for 444
name                                             old speed     new speed     delta

wuffs_jpeg_decode_552k_24bpp_444/clang11         356MB/s ± 0%  443MB/s ± 0%  +24.62%  (p=0.016 n=4+5)
wuffs_jpeg_decode_552k_24bpp_444/gcc10           348MB/s ± 0%  380MB/s ± 0%   +9.26%  (p=0.008 n=5+5)
2023-06-09 17:15:31 +10:00
Nigel Tao 5d5d01a189 cgen: add "¡ INSERT patch_pixconv" mechanism 2023-06-08 23:26:37 +10:00
Nigel Tao ca2909b6d7 cgen: optimize etc__swizzle_ycck for 444 bgrx/rgbx
name                                             old speed     new speed     delta

wuffs_jpeg_decode_552k_24bpp_444/clang11         227MB/s ± 0%  275MB/s ± 0%  +20.76%  (p=0.008 n=5+5)
wuffs_jpeg_decode_552k_24bpp_444/gcc10           223MB/s ± 0%  249MB/s ± 0%  +11.51%  (p=0.008 n=5+5)
2023-06-07 22:25:02 +10:00
Nigel Tao 2865c5bfbd std/jpeg: call slice.bulk_{load,save}_host_endian
Updates https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=59540

name                                             old speed     new speed     delta

wuffs_jpeg_decode_30k_24bpp_progressive/clang11  131MB/s ± 0%  168MB/s ± 0%  +28.44%  (p=0.008 n=5+5)
wuffs_jpeg_decode_30k_24bpp_progressive/gcc10    167MB/s ± 0%  175MB/s ± 0%   +4.80%  (p=0.008 n=5+5)
2023-06-05 12:51:50 +10:00
Nigel Tao 2f18dc61d0 std/jpeg: call slice.bulk_memset 2023-06-04 21:22:14 +10:00
Nigel Tao 7d73f3cfa4 pixconv: fix ycck implicit promotion to signed int
Updates https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=59182
2023-05-22 14:00:17 +10:00
Nigel Tao a41149e73c std/jpeg: implement triangle-filter upsampling
"script/confirm-matches-djpeg.sh test/data/*.jpeg" is now all matches.
2023-05-21 22:05:38 +10:00
Nigel Tao 94df43c530 std/jpeg: prepare for triangle-filter upsampling 2023-05-21 22:04:45 +10:00
Nigel Tao 85b244aa49 std/netpbm: add new package 2023-05-16 16:29:58 +10:00
Nigel Tao 7514dede23 std/jpeg: decode color images, not just gray
Updates #42
2023-05-14 23:03:33 +10:00
Nigel Tao 8cfe304f3c std/jpeg: implement Inverse DCT
Updates #42
2023-05-08 21:51:47 +10:00
Nigel Tao 4834cb97c8 base: deprecate ETC__PIXEL_FORMAT__NUM_PLANES_MAX 2023-04-16 11:12:06 +10:00
Nigel Tao e126c998e0 std: limit supported image dimensions to 0xFF_FFFF 2023-04-16 08:57:55 +10:00
Nigel Tao 6e8349129c base: remove deprecated names 2023-04-09 16:12:49 +10:00
Nigel Tao 00d5e35865 floatconv: optimize parse_number_f64 fallback
The time taken running script/manual-test-parse-number-f64.cc on the
parse-number-fxx-test-data suite falls from 3.565s to 2.491s (a 1.43x
ratio; the inverse is 0.70 = 100% - 30%).

Fixes #113
2023-04-08 14:56:32 +10:00
Nigel Tao 4d4c3c4c3c floatconv: tweak Simple Decimal Conversion
This tweaks the code and comments added in commit 36d7748e "Merge pull
request #90 from sarastro-nl/improvement/optimize-SDC" and commit
d46220ca "optimize SDC". Both of those two commit messages are short but
see the discussion re algorithmic changes on PR 87 (yes, 87, not 90):
https://github.com/google/wuffs/pull/87

Also run clang-format.

Also update doc/changelog.md

Compared to before commit d46220ca "optimize SDC", when running
script/manual-test-parse-number-f64.cc and disabling both the
etc__parse_number_f64_eisel_lemire function and the "If both man and
(10 ** exp10) are exactly representable by a double" fast path, the
tests still pass but the number of etc__high_prec_dec__small_lshift and
etc__high_prec_dec__small_rshift calls drop:

Function    Before      After       Ratio
lshift      31174584    25762258    82.64% = 100% - 17.36%
rshift      21592604    20982502    97.17% = 100% -  2.83%

The time taken drops from 15.984s to 13.710s (85.77% = 100% - 14.23%).

To repeat, these are the improvements after disabling the Eisel-Lemire
and other fast paths. Simple Decimal Conversion is the rarely invoked
fallback parse_number_f64 algorithm. The practical improvement (with
Eisel-Lemire etc enabled) is smaller.
2023-02-04 14:48:25 +11:00
sarastro-nl d46220ca00 optimize SDC 2022-11-21 22:10:19 +01:00
Nigel Tao c226ed60f5 Use memcpy-based peeks and pokes on Microsoft C
I don't have a Windows machine readily available, but according to
https://godbolt.org/z/q4MfjzTPh and the https://imgur.com/UD5a7MF
profile mentioned in #72, this could improve inner loop performance.

Updates #72
2022-06-12 17:18:49 +10:00
Nigel Tao be047533e1 Add bounds check to wuffs_base__make_slice_uNN_ij 2022-05-23 11:07:31 +10:00
Nigel Tao 84ef91dda8 Tweak cgen for an_array[i .. j] 2022-05-17 00:00:25 +10:00
Nigel Tao 787ff21cc7 Let magic_number_guess_fourcc sniff compression 2022-05-13 11:01:28 +10:00
Nigel Tao c82793a984 Tighten magic_number_guess_fourcc TGA heuristic
Prior to this commit, test/data/cbor-rfc-7049-examples.cbor was
incorrectly sniffed as TGA. /usr/bin/file did this too.

$ file test/data/cbor-rfc-7049-examples.cbor
test/data/cbor-rfc-7049-examples.cbor: Targa image data - Map 59395 x 26
x 15 +6169 +6500 - 2-bit alpha - interleave "@\033"

Updates #67
2022-01-15 14:32:51 +11:00
Nigel Tao 792d05bd9c Have magic_number_guess_fourcc use prefix_closed 2022-01-14 15:26:21 +11:00
Nigel Tao e5ead0218e Rename the magic-submodule "prefix" arguments 2022-01-14 15:16:20 +11:00
Nigel Tao f0412122be Add magic_number_guess_fourcc prefix_closed arg 2022-01-14 15:12:14 +11:00
Nigel Tao 546af5a7c3 Let magic_number_guess_fourcc sniff TGA
Updates #67
2022-01-14 14:40:58 +11:00
Nigel Tao b64b2ff09a Tighten magic_number_guess_fourcc ICO heuristic 2022-01-14 10:54:55 +11:00
Nigel Tao dda01f1a77 Add WUFFS_BASE__FOURCC__QOI definition 2022-01-02 09:10:51 +11:00
Nigel Tao 4c04ac1127 Replace FOURCC__{WP8,WP8L} with FOURCC__WEBP
Fixes #61
2021-12-15 15:53:14 +11:00
Nigel Tao ccbec18330 Re-order pixconv "Extract... components" variables 2021-11-21 21:20:59 +11:00
Nigel Tao 55cad41d6c Have nonpremul SRC_OVER keep transparent red/blue 2021-11-21 21:16:10 +11:00
Nigel Tao f5d6ce3797 Have etc__limited_copy_etc args match call sites 2021-11-20 22:34:25 +11:00
Nigel Tao 161e4730d8 Tweak default WUFFS_VERSION_PRE_RELEASE_LABEL 2021-11-18 19:18:34 +11:00
Nigel Tao d40bf000a9 Rename wuffs_base__table_u8__row as etc__row_u32 2021-11-15 17:26:51 +11:00
Nigel Tao 962a515dd2 Add wuffs_base__table_u8__subtable_ij 2021-11-15 09:58:02 +11:00
Nigel Tao f148f5c5b3 Make "// - etc" bullet point comments consistent 2021-11-05 16:50:38 +11:00
Nigel Tao badce3ffa4 Tweak magic_number_guess_fourcc negative codes 2021-10-31 16:27:17 +11:00
Nigel Tao 8f9a4f40c2 Rename METADATA_RAW as METADATA_RAW_PASSTHROUGH 2021-10-31 15:17:46 +11:00
Nigel Tao a9a6332be2 Have etc__magic_number_guess_fourcc find ICO 2021-10-22 15:51:44 +11:00
Nigel Tao 0460bfcd7a Add FourCC comment 2021-10-17 23:18:58 +11:00
Nigel Tao 9437d1a265 Tighten magic number guessing for WBMP 2021-10-17 22:57:42 +11:00
Nigel Tao e317f04bfd Add defined(__clang__) to defined(__GNUC__) checks 2021-10-17 12:14:54 +11:00