бенчмарки Fastvideo SDK

Fast CUDA JPEG encoder

We have wide experience with high speed cameras and software and it's a usual problem - how to increase duration for high speed video recording. All our cameras do online video streaming to PC RAM via PCI-Express framegrabber or CameraLink interface. In that case total recording time is restricted by the size of free RAM which is usually in the range of 1-12 GBytes. Conventional high speed camera data rate is about 800 MB/s or even much more, so one can record up to 16 seconds of high speed video in a raw format.

The basic idea how to improve the situation is quite straightforward. We need to compress incoming to PC stream with lossy algorithm to achieve compression ratio of 10-20 times to be able to write compressed data stream to HDD/SSD/RAID in realtime. Usual CPU is unable to cope with that problem, so we decided to use GPU with NVIDIA CUDA technology instead. We believe that it's a good idea to use video cards to implement the latest NVIDIA findings for parallel computations.

We have implemented JPEG lossy compression algorithm (JPEG baseline for 8/24-bit images) because we consider it to fulfil our considerations. The main demands are the following:

  • algorithm should be able to be adopted to parallel computations
  • good image quality for compression ratio in the range from 10 to 20 times
  • algorithm should not be too computationally intensive
  • task division to maximum number of sub-tasks
  • minimum amount of memory for one thread
  • popular open standard with multiple encoders and decoders available on different platforms

Lossy JPEG compression algorithm meets all criteria for parallel computations on the GPU. To create high-performance JPEG encoder for high speed video applications we have also done algorithm optimization for GPU calculations. This is full, performance-oriented implementation of Baseline JPEG. We got ultra fast JPEG compression and decompression on the GPU due to full parallel implementation of Baseline JPEG algorithm. Our JPEG codec is much more fast in comparison with the best commercial multithreaded JPEG codecs for multicore CPUs.

Fast JPEG image compression features for CUDA JPEG codec

  • Implementation is 100% compliant with JPEG Baseline standard
  • Baseline JPEG compression and decompression for grayscale (8-bit) and color (24-bit) images with arbitrary width and height
  • Extremely fast lossy image encoding and decoding with variable compression ratio
  • Maximum input image size is 12000 x 12000 or even more (optional)
  • Subsampling modes: 4:4:4, 4:2:2, 4:2:0
  • JPEG image quality in the range from 1 to 100%
  • Read/edit/write any EXIF section
  • Data input: 8/24-bit images from RAM/HDD/RAID/SSD
  • Data output: final compressed/uncompressed image in RAM/HDD/RAID/SSD
  • Continuous data mode (input one image after another)
  • Standard set of computations for parallel implementation of Baseline JPEG compression and decompression
    • JPEG Encoding on GPU: Input data parcing, Color Transform, 2D DCT, Quantization, Zig-zag, AC/DC, DPCM, RLE, Huffman, Byte stuffing, JFIF formatting
    • JPEG Decoding on GPU: JFIF parcing, Restart marker search, Inverse Huffman, Inverse RLE, Inverse DPCM, AC/DC, Inverse Zig-zag, Inverse Quantization, IDCT, Inverse Color Transform, Output formatting
  • Optimized for the latest NVIDIA GPUs
  • Optional integration with OpenGL and FFmpeg, MJPEG output
  • Compatible with Windows-7/8/10 and Linux

We have succeeded to make parallel all stages of JPEG algorithm including entropy encoding and decoding. There was a widespread opinion that Huffman algorithm could be only serial. In our solution Huffman coding is not a bottleneck anymore and it's fully parallel. Now we don't off-load anything from GPU to CPU to make JPEG codec faster. CUDA JPEG codec is extremely fast and is functioning completely on GPU.

Benchmarks for JPG encoding on NVIDIA GeForce GTX 1080 TI (Windows-7 and CUDA-8.0, 64-bit)

Now we need just 0.51 ms for Baseline JPEG encoding of 24-bit color image with 4K resolution 3840 × 2160, JPEG quality 90% and subsampling 4:2:0 (it corresponds to image compression ratio ~10:1). We have chosen the above JPEG encoding parameters because they correspond to so called "visually lossless" compression.

These are the latest performance benchmarks for encoding of 2K and 4K images, 24-bit (JPEG compression on GPU, without DeviceIO latency, single image mode, no batch, no streaming) on NVIDIA GeForce GTX 1080 TI and Quadro P6000:

  • Full HD (2K, 1920 × 1080) ~ 35 GByte/s (0.17 ms)
  • 4K (3840 × 2160) ~ 46 GByte/s (0.51 ms)

These are JPEG decoding performance benchmarks on NVIDIA GeForce GTX 1080 TI and Quadro P6000 (no DeviceIO latency, single image mode, no batch, no streaming):

  • Full HD (2K, 1920 × 1080) ~ 5.3 GByte/s (1.2 ms)
  • 4K (3840 × 2160) ~ 11.2 GByte/s (2.12 ms)

The above results are much faster than benchmarks of libjpeg-turbo on CPU. Even if we take into account host to device and device to host transfers, the performance of CUDA JPEG codec will be much higher. More results for performance measurements you can download here.

We can also extend our JPEG compression software by fast image processing pipeline for high speed and high resolution cameras: bad pixel removal, dark frame subtraction, shading correction, white balance, demosaicing, color correction, image filtering, denoising, 1D LUT, 3D LUT, gamma, color management, histogram, online resize, crop, rotate, sharp, OpenGL output, integration with FFmpeg, bayer compression, J2K compression, etc.

Licensing

We license CUDA JPEG and other components of GPU Image Processing SDK to software developers, camera manufacturers, internet providers, software integrators, etc. Our SDK is utilized in wide range of imaging applications. Demo version, documentation, licensing info and quotation are available upon request. We are also offering custom software design according to agreed specification. If you need to get significant speed up for your image processing application, don't hesitate to contact us.

Roadmap for further improvements of CUDA JPEG Codec

  • 12-bit CUDA JPEG decoder
  • Minimum memory usage on GPU

For any further information concerning CUDA JPEG codec or free trial please contact us via email.

Contact Form

This form collects your name and email. Check out our Privacy Policy on how we protect and manage your personal data.