Expand description
Helpers for taking a slice of indices (indices into PLTE
and/or trNS
entries) and transforming this into RGB or RGBA output.
ยงMemoization
To achieve higher throughput, create_rgba_palette
combines entries from
PLTE
and trNS
chunks into a single lookup table. This is based on the
ideas explored in https://crbug.com/706134.
Memoization is a trade-off:
- On one hand, memoization requires spending X ns before starting to call
expand_paletted_...
functions. - On the other hand, memoization improves the throughput of the
expand_paletted_...
functions - they take Y ns less to process each byte
Based on X and Y, we can try to calculate the breakeven point. It seems that memoization is a net benefit for images bigger than around 13x13 pixels.
Functionsยง
- create_rgba_palette ๐
- expand_into_rgb8 ๐