mirror of
https://github.com/storytold/designcraft.git
synced 2026-11-14 14:22:39 +00:00
The gate that limits parallel decodes counted each image at its cached size (4 bytes a pixel and a third more for the smaller levels). A decode holds more than that while it converts the pixels: an 8-bit image keeps its RGBA copy beside the decoded or the premultiplied pixels, 8 bytes a pixel. Two 5,500 pixel square images passed the gate together and could hold more than half the cache budget at once. - decode_sizes returns the cached size and the peak size from one size read. The peak counts the samples as stored beside their converted copy (designcraft_images::decode_bytes_per_pixel): 8 bytes a pixel for 8-bit color, 10 for 16-bit RGB, 12 for 16-bit CMYK TIFFs and 16-bit RGBA, 10 for 8-bit CMYKA TIFFs, 15 for 16-bit CMYKA TIFFs, 9 for PSDs. An EPS counts as its TIFF preview. PDF pages, SVGs and EPS files without a preview count 8. - warm budgets the cache with the cached size and gates decodes with the peak size. - Every warm call in the process shares one gate, so the canvas worker, thumbnails and exports together stay within half the budget while they decode. warm returns the most its own call had decoding. - An EPS without a preview is sized at the larger of its drawn PostScript and its placeholder. The placeholder is clamped to 4000 pixels on each side, so a 10,000 by 4,000 point EPS that is not drawn takes 4000 by 4000 pixels, not the 4000 by 1600 counted before.