CUDA JPEG encoder for high speed video recording
Updated:
The hard part of high speed recording is duration. Cameras stream to PC RAM over PCIe or CameraLink, and a raw stream of ~800 MB/s or more fills the available RAM in seconds. The fix is to compress the incoming stream on the fly at a 10–20× ratio so it can be written to HDD/SSD/RAID in real time. A CPU cannot keep up, so we do it on the GPU with NVIDIA CUDA.
Why Baseline JPEG
Baseline JPEG (8/24‑bit) meets every requirement for this job: it parallelises well, gives good quality at 10–20× compression, is not too computationally heavy, divides into many small sub‑tasks with little per‑thread memory, and is an open standard with encoders and decoders on every platform. We made every stage parallel — including Huffman entropy coding, long thought to be inherently serial — so the whole codec runs on the GPU with nothing off‑loaded to the CPU.
Features
- 100% compliant with the JPEG Baseline standard
- Encode and decode grayscale (8‑bit) and colour (24‑bit), arbitrary width and height
- Subsampling 4:4:4, 4:2:2, 4:2:0; JPEG quality 1–100%
- Maximum input up to 12000 × 12000 or more (optional)
- Read/edit/write EXIF; continuous one‑image‑after‑another mode
- Optional OpenGL and FFmpeg integration, MJPEG output; Windows and Linux
Benchmarks (GeForce GTX 1080 Ti, 24-bit)
| Resolution | Encoding | Decoding |
|---|---|---|
| Full HD (1920 × 1080) | ~ 35 GB/s (0.17 ms) | ~ 5.3 GB/s (1.2 ms) |
| 4K (3840 × 2160) | ~ 46 GB/s (0.51 ms) | ~ 11.2 GB/s (2.12 ms) |
Measured as GPU computation only (single image, no batch, no streaming, no DeviceIO latency), these results are far faster than libjpeg‑turbo on the CPU. For the latest RTX‑class throughput and full JPEG codec details, see the CUDA JPEG codec page.
Beyond compression
The encoder can be extended with a full image processing pipeline: bad pixel removal, dark frame subtraction, shading correction, white balance, demosaicing, colour correction, denoising, 1D/3D LUT, gamma, online resize/crop/rotate/sharpen, OpenGL output, FFmpeg integration, Bayer and JPEG2000 compression.