pub const MAX_DECODE_PIXELS: u64 = 128_000_000;Expand description
The decode budget in pixels, refused before the decoder allocates.
128 Mpx, which admits every real camera — a 102 Mpx medium-format frame has ~25% headroom — while bounding what one still can ask the process for.
The bound is worth stating honestly, because the naive figure is a large understatement. A
frame at this ceiling costs, in sequence and with overlap: 0.77 GB for the decoder’s u16
samples, another 0.77 GB where it reallocates to drop an alpha channel, 0.51 GB for
Capsule’s RGBA8 copy, and 0.77 GB again when the encode path widens a tier-sized frame back
to RGB u16. Peak is on the order of 2.5 GB, not the ~1 GB a single buffer suggests.
Since media is implied by native, that peak happens on a phone as well as a workstation,
where it is an OOM kill rather than an error — which is the reason this is not simply set as
high as an allocation bomb would require.