Skip to content

v0.50.0 — bytes that were already the picture

Choose a tag to compare

@tannevaled tannevaled released this 27 Sep 09:48
· 43 commits to main since this release
53618e6

Faster on scanned pages, and 553 MB less on the heaviest

decodeJPX converted the JPEG 2000 decoder's *image.RGBA into a raster.Image,
allocating a second image the size of the first and copying through it. The
conversion is not gratuitous — image.RGBA is premultiplied and a raster.Image
is straight — but at an alpha of 255 the two are the same bytes, and a JPEG 2000
codestream carries no alpha. The buffer is now adopted when Opaque(), the stride
and the origin all agree, and converted when any of them does not.

Time

min-of-7, three rounds, one interleaved run:

document before after
b31820797.pdf 687.6 ms 659.2 ms −4.1%
bulletin43peab.pdf 612.8 ms 596.8 ms −2.6%
jahresberichtder710meye.pdf 749.8 ms 736.7 ms −1.8%

Memory, both ways

Peak resident, min of three:

document before after
jahresberichtder710meye 360.5 MB 395.6 MB +10%
bulletin43peab 354.4 MB 389.7 MB +10%
b31820797 2044.6 MB 1491.6 MB −27%

Adoption keeps the decoder's buffer live rather than copying it and freeing the
original: a modest page holds a little more, a page with a large picture holds a
great deal less.

Unchanged output

All 3 215 corpus documents render byte-identical to v0.49.0.