WriteHeader copied h into w.header before calling w.Write to emit the
GNUTYPE_LONGNAME block holding the name. Write only accepts TypeReg and
TypeGNUSparse, so a TypeDir header failed that call and left the Writer
permanently in an error state - every later entry on the same Writer
failed too.
Set w.header after the name block has gone out instead.
Write left w.bIndex at 512 once a full block had been written out, so the
next loop iteration took the "partial block" branch, copied zero bytes and
went round again forever, writing the same 512 bytes over and over. Calling
Write with sizes that aren't multiples of 512 is enough to hit this.
It also duplicated the last data block when a Write call happened to end
exactly on a block boundary, because flush then saw a non-zero bIndex and
wrote the block out a second time.
Bumps the go_modules group with 1 update in the / directory: [golang.org/x/image](https://github.com/golang/image).
Updates `golang.org/x/image` from 0.38.0 to 0.41.0
- [Commits](https://github.com/golang/image/compare/v0.38.0...v0.41.0)
---
updated-dependencies:
- dependency-name: golang.org/x/image
dependency-version: 0.41.0
dependency-type: direct:production
dependency-group: go_modules
...
Signed-off-by: dependabot[bot] <support@github.com>
Prior to 381e186f "std/vp8: swizzle_ycck once, not once per MB row", we
swizzled one row of macroblocks at a time. After 381e186f, we swizzled
the whole image in one pass, but kept the option of, in the future,
amending the swizzle_ycck implementation to allow ((y_min_incl > 0) and
(ycc_upsampling == FANCY_ETC)) at the same time.
However, 381e186f didn't show a performance loss so large that it seems
worth complicating the swizzle_ycck implementation in that way. So we
just drop, in this commit, the option of that amendment.
This prepares us to change std/vp8's YCC upsampling method from "basic"
to "fancy, like libwebp". Wuffs' current implementation of "fancy"
requires the initial Y coordinate to be zero, as fancy upsampling
special cases the top row of the image and it's simpler if the top row
(row zero) is always presented in the upsampling call.
This is not an optimization or pessimization per se, but for the record,
the performance impact is between negligible and a small improvement.
name old speed new speed delta
wuffs_webp_lossy_decode_image_19k_8bpp/clang14 33.7MB/s ± 0% 34.1MB/s ± 0% +1.28% (p=0.008 n=5+5)
wuffs_webp_lossy_decode_image_40k_24bpp/clang14 106MB/s ± 0% 106MB/s ± 0% +0.09% (p=0.008 n=5+5)
wuffs_webp_lossy_decode_image_77k_24bpp/clang14 129MB/s ± 0% 130MB/s ± 0% +0.54% (p=0.008 n=5+5)
wuffs_webp_lossy_decode_image_552k_32bpp/clang14 207MB/s ± 0% 211MB/s ± 0% +1.90% (p=0.008 n=5+5)
wuffs_webp_lossy_decode_image_4002k_24bpp/clang14 137MB/s ± 0% 138MB/s ± 0% +0.40% (p=0.008 n=5+5)
wuffs_webp_lossy_decode_image_19k_8bpp/gcc12 32.9MB/s ± 0% 32.9MB/s ± 0% +0.05% (p=0.008 n=5+5)
wuffs_webp_lossy_decode_image_40k_24bpp/gcc12 98.4MB/s ± 0% 98.8MB/s ± 0% +0.42% (p=0.008 n=5+5)
wuffs_webp_lossy_decode_image_77k_24bpp/gcc12 125MB/s ± 0% 125MB/s ± 0% +0.17% (p=0.008 n=5+5)
wuffs_webp_lossy_decode_image_552k_32bpp/gcc12 211MB/s ± 0% 214MB/s ± 0% +1.21% (p=0.008 n=5+5)
wuffs_webp_lossy_decode_image_4002k_24bpp/gcc12 137MB/s ± 0% 137MB/s ± 0% ~ (p=0.095 n=5+5)