The Fastest JPEG Codec on GPU
Updated:
The Fastvideo JPEG codec encodes a 24 MPix (6K) image at about 1500 fps — roughly 117 GB/s — on an NVIDIA GeForce RTX 4090, significantly faster than the best multithreaded CPU codecs such as libjpeg-turbo. It reaches this speed because it is a fully parallel CUDA implementation of Baseline JPEG: every stage of the algorithm, including entropy encoding and decoding, runs on the GPU. The codec is 100% compliant with the JPEG Baseline standard, stays competitive with dedicated hardware JPEG encoders, and remains fully programmable and portable across NVIDIA GPUs, from Jetson to server cards.
Key Features of the CUDA JPEG Codec
The codec covers the full Baseline JPEG feature set for both compression and decompression:
Compression
- 100% compliance with the JPEG Baseline standard
- Encoding and decoding for grayscale (8-bit) and color (24-bit) images with arbitrary width and height
- Optional 12-bit JPEG encoding for grayscale and color
- Subsampling modes: 4:4:4, 4:2:2, 4:2:0
- JPEG quality in the range 1–100
- Optional custom quantization tables for Y and Cb/Cr
- Image size from 1×1 up to 64,000×64,000
- Automatic insertion of restart markers at encoding for fast parallel decoding
- Read/edit/write of any EXIF section
Data input and output
- Input: 8/24-bit or 12/36-bit images from RAM/HDD/RAID/SSD or GPU memory
- Output: compressed or decompressed image in RAM/HDD/RAID/SSD or GPU memory
- Standard input formats: PGM, YUV, PPM, BMP, JPG
- Continuous data mode: one image after another
Full JPEG pipeline on GPU
- Encoder: input data parsing → color transform → 2D DCT → quantization → zig-zag → AC/DC, DPCM, RLE → Huffman coding → byte stuffing → JFIF formatting
- Decoder: JFIF parsing → restart marker search → inverse Huffman decoding → inverse RLE, DPCM, AC/DC → inverse zig-zag → inverse quantization → inverse DCT → inverse color transform → output formatting
Integration and compatibility
- Compatibility with FFmpeg to read/write MJPEG streams (FFmpeg is under LGPL v2.1); see also the Motion JPEG codec on CUDA
- Optional integration with OpenGL
- Optional input from HD-SDI cards: Blackmagic, Imperx
- OS: Windows 10/11, Linux Ubuntu, L4T
- CUDA-13.3 support
Why Is JPEG on CUDA So Fast
The key is that we parallelized every stage of the JPEG algorithm — including entropy coding. There was a widespread opinion that RLE and Huffman algorithms could only be serial; in our implementation they are fully parallel and are no longer bottlenecks, so nothing is offloaded to the CPU. Most published attempts at JPEG on CUDA accelerate the DCT stage and stop there, but the DCT is only a small part of the problem: the image naturally partitions into a large number of 8×8 and 16×16 blocks, and this parallelism can be exploited at every stage of both the encoder and the decoder — the entropy codec being the hardest part, which we solved on the GPU as well.
Speed does not come at the cost of accuracy: the color transform, 2D DCT, and quantization are computed in floating point and rounded afterwards, which improves accuracy compared with the conventional integer approach.
The performance is far beyond CPU-based codecs: even when host-to-device and device-to-host transfers are included in the timing, the CUDA JPEG codec remains much faster than libjpeg-turbo and turbojpeg on modern multicore CPUs.
JPEG Benchmarks on the NVIDIA GeForce RTX 4090
How many JPEG images per second can a GPU encode?
The headline case comes from modern machine vision cameras: a 5328×4508 24-bit frame (24 MPix) is encoded with subsampling 4:2:0 and quality 90 in 0.65 ms, which corresponds to about 117 GB/s — almost 5 times the real bandwidth of the PCIe 4.0 x16 interface (~24 GB/s).
Benchmarks for single color 24-bit images (all computations on GPU, timings exclude I/O, single-thread application, no batch, no streaming, quality 90, subsampling 4:2:0):
| Resolution | Encoding | Decoding |
|---|---|---|
| Full HD (1920×1080) | ~5500 fps | — |
| 4K (3840×2160) | ~3800 fps | ~1350 fps |
| 6K (5328×4508) | ~1500 fps | — |
| 8K (7680×4320) | ~1180 fps | ~650 fps |
Decoding performance depends strongly on restart markers: they split the JPEG bitstream into chunks that can be decoded in parallel, and parallel processing is the key to speed on the GPU. Restart markers are a standard, optional part of JPEG, and CPU tools such as jpegtran can insert them too, but only slowly; our encoder writes them by default at GPU speed, and to our knowledge no other GPU JPEG codec uses them for parallel decoding. Images produced by our encoder therefore decode much faster while staying fully standard, which makes the codec pair a natural fit for low-latency applications. More benchmarks for the SDK modules are published on a separate page.
Part of the Fastvideo SDK
The JPEG codec ships as a module of the Fastvideo GPU Image & Video Processing SDK, where it combines with demosaicing, denoising, resize, color processing, 3D LUT, the Raw Bayer codec, the JPEG2000 codec, and the rest of the pipeline — entirely in GPU memory, so JPEG encoding becomes the final stage of a complete RAW-to-RGB workflow.
Licensing and Custom Development
We license the Fast JPEG codec and other SDK components to software developers, camera manufacturers, system integrators, and resellers; the SDK is used in a wide range of imaging applications. A demo, documentation, licensing details, and a quotation are available upon request. We also develop custom GPU image processing software according to an agreed specification — if your application needs a significant speedup on the GPU, describe your project in the contact form below.
Downloads and More Info 
- Fast JPEG demo application for Windows
- Motion JPEG codec on CUDA
- Fastvideo SDK benchmarks
- CUDA solutions
Frequently asked questions
How does it differ from a built-in GPU JPEG library?
It gives full control over quality and chroma subsampling, supports restart markers for parallel and robust decoding, runs across both desktop and Jetson GPUs, and its speed is published as open, reproducible benchmarks.
How fast is the Fastvideo JPEG codec?
On an NVIDIA GeForce RTX 4090 it encodes a 24 MPix (6K) image at about 1500 fps, roughly 117 GB/s. Exact numbers depend on your GPU, resolution and quality — see the benchmark methodology.
Is it a standard JPEG?
Yes. The codec is 100% compliant with the Baseline JPEG standard (ITU-T T.81 / ISO IEC 10918), so its output opens in any JPEG viewer.
Which GPUs are supported?
Any CUDA-capable NVIDIA GPU — from Jetson embedded modules to desktop GeForce/RTX and data-center cards.
What image sizes and formats are supported?
Grayscale (8-bit) and color (24-bit), with optional 12-bit encoding; subsampling 4:4:4, 4:2:2, 4:2:0; sizes from 1×1 up to 64,000×64,000; JPEG quality 1–100 with optional custom quantization tables.
Can I test the performance myself?
Yes. Download the free demo app and measure the speed on your own GPU and images — see the benchmark methodology and the Fastvideo SDK benchmark report (PDF).
Roadmap for the Fast JPEG Codec
The Fastvideo JPEG codec is a mature codec, developed and refined over many years; its latest release (2026) adds support for the newest NVIDIA GPUs. It is integrated into the GPU RAW Processor and into FastVCR software for XIMEA cameras, providing real-time JPEG encoding with integrated camera control.
Current development focuses on lower GPU memory usage and faster JPEG decoding.