J2K compression library on Jetson
Updated:
This page is about the J2K compression library inside the Fastvideo SDK, the one that runs on Jetson as well as on desktop cards. The library implements the standard with all the compute-heavy stages running in parallel on the GPU — both encoder and decoder, lossy and lossless — that runs every stage on the NVIDIA GPU, from the wavelet transform through EBCOT entropy coding. That end-to-end GPU execution is what makes it fast — and a practical choice where quality and scalability matter: medical imaging and digital pathology, geospatial data, digital cinema, broadcast contribution and archives.
Codec features
- Encode/decode of grayscale and colour images of arbitrary width and height
- Lossy (wavelet CDF 9/7) and lossless (wavelet CDF 5/3) compression and decompression
- Bit depth 8–16 bits per channel (up to 24); colour spaces RGB, YCbCr, XYZ
- 1–12 decomposition levels; code-block 16×16, 32×32 or 64×64; subsampling 4:4:4, 4:2:2, 4:2:0
- Quality 1–150 (float) and a rate-control option to target a compression ratio
- Single-image, batch (streaming) and multi-tile modes for very large images
- Input/output from HDD/RAID/SSD/CPU/GPU; FFmpeg Motion JPEG2000 read/write (LGPL v2.1); optional OpenGL
- Windows 10/11, Linux Ubuntu and L4T; tuned for the latest NVIDIA GPUs
The codec is a module of our CUDA Image & Video Processing SDK, so J2K coding can be the final stage of a full GPU pipeline. A companion Fast J2K Viewer displays large JPEG2000 images with window-mode decoding.
JPEG2000 benchmarks on NVIDIA GeForce RTX 4090
Encoder performance in multithreaded batch mode, 24-bit images, code-block 32×32:
| Image | Lossy encoding | Lossless encoding |
|---|---|---|
| 2K, 24-bit | ~ 2108 fps | ~ 1238 fps |
| 4K, 24-bit | ~ 732 fps | ~ 425 fps |
On embedded hardware the codec reaches 650 MPix/s for lossless 12-bit raw encoding on NVIDIA Jetson AGX Orin — fast enough for on-camera compression in real-time systems. Timings against CPU codecs (JasPer, OpenJPEG, Kakadu) and earlier GPU codecs, with the full method and the test images: J2K encoder benchmarks.
Encoder and decoder stages
- Encoder: input parsing → colour transform (ICT/RCT) → 2D DWT (CDF 9/7 or 5/3) → quantization → EBCOT Tier-1 (context modelling + MQ-coder) → optional PCRD → Tier-2 (tag-tree coding) → output formatting
- Decoder: input parsing → tag-tree decoding → binary decoder → inverse quantization → IDWT → inverse colour transform → output formatting
Sample applications and command-line parameters
You can use the J2kEncoderSample and J2KDecoderSample applications from the Fastvideo SDK. Main encoder parameters:
-i/-if— input file / folder+mask (BMP, PGM, PPM)-o— output file (JP2)-a— algorithm:rev(lossless) orirrev(lossy)-c— code-block size 16, 32 (default) or 64;-l— resolution levels 1–12-q— quality 1–100;-cr— compression ratio (enables PCRD)-s— subsampling 444/422/420;-b— batch size;-d— GPU index-async,-thread,-threadR,-threadW— async mode overlapping processing with file I/O-tileWidth/-tileHeight,-noMCT,-noHeader,-outputBitdepth,-info,-log
Example (multithreaded lossy batch): J2kEncoderSample.exe -i input.ppm -o output.jp2 -a irrev -c 32 -l 7 -q 90 -d 0 -async -thread 4 -b 2 -repeat 1000