Skip to main content

JPEG_COMPRESSOR

Constant JPEG_COMPRESSOR 

Source
const JPEG_COMPRESSOR: LocalKey<RefCell<Option<Compressor>>>;
Expand description

Reused libjpeg-turbo compressor kept per worker thread to avoid paying a tjInitCompress/tjDestroy round trip for every stripe of every frame.

The striped JPEG path compresses one stripe per rayon worker, so the compressor is thread-local rather than shared: each worker creates its own lazily on first use and then holds it for the process lifetime. Making it thread-local also sidesteps the locking a shared compressor would otherwise need across the parallel stripe encoders.