Benchmarks for JPEG2000 encoders on CPU and GPU
Benchmarks JPEG2000 Encoders are important to see the difference between CPU-based and GPU-based codecs. Here we present a comparison for available open source and proprietary J2K encoding solutions. Some of them are CPU-only, while the others use GPU to accelerate JPEG2000 computations.
Approaches for JPEG2000 performance measurements
There are two standard approaches to performance measurements of JPEG2000 codecs, which utilize GPU. They correspond to the two most common use cases for J2K encoders and decoders.
1. Single image mode consists in processing of single image and could be called "latency-oriented" or "low latency" approach. In that case the time interval (latency) between availability of original image in RAM and availability of the processed image in RAM is measured. It means that software cannot expect that any additional images will be processed at the same time and therefore cannot take advantage of multiple image encoding or decoding. Overlapping of current image processing with other activities is undesirable because it would increase total latency. We need single image mode almost in all camera applications. You can get more info from our Image & Video Processing SDK.
2. Batch mode consists in processing of batch of images and could be called "throughput-oriented" or "maximum performance". In that case frame rate becomes more important than latency. It is calculated via division of the total time of processing by the number of processed images. Some JPEG2000 codecs are optimized for this use case, meaning that exploiting of task parallelism leads to better frame rate (throughput) at the expense of increased processing time for separate images. It is possible, because we actually have three devices (CPU, GPU and bus interface between them), which can be used simultaneously in that mode, whereas at single image mode these devices are used sequentially for different stages of JPEG2000 algorithm. Moreover, GPU can process several images simultaneously to increase frame rate even more, if each image is too small to load a multitude of GPU cores (especially at Tier-1 stage). Important limitation for simultaneous processing of several images is imposed by amount of free GPU memory. Batch mode is a must for streaming applications when the pipeline contains JPEG2000 encoder or decoder. For more complicated workflow it could be better to utilize single image mode, though fps will be reduced.
Briefly, JPEG2000 batch mode can take into account specific methods of task parallelism, based on the following:
CPU-based JPEG2000 solutions have no explicit implementation of batch mode, because all processing stages are done on CPU and complete loading of available CPU cores can be achieved by simply running multiple decoders in separate processes. Multithreaded mode of CPU-based JPEG2000 decoders decreases latency of single image processing, so we can consider this mode as single image mode.
At the moment we don't consider here the following possible modes for JPEG 2000 benchmarking on GPU:
Results for all modes will be published as soon as their implementations are ready.
We don't hide anything concerning benchmarking procedures and achieved results. Thus, everyone can always reproduce our benchmarks, because we publish not only timing and performance, we supply full info about hardware, JPEG2000 parameters, test images and testing modes.
JPEG 2000 encoding benchmarks
We've carried out time and performance measurements for JPEG2000 encoding for 24-bit images with 2K and 4K resolutions. All results don't include any host I/O latency (image loading to RAM from HDD/SSD and saving back) and we've also excluded host-to-device transfer time. We've done such an assumption to reproduce J2K encoder usage in our conventional image processing pipeline, when initial data reside in GPU memory. Results for GPU-based JPEG2000 encoding software also include Tier-2 time on CPU, because this stage in our implementation is performed on CPU. In the tables below, you can find averaged measurements results for the best series of 1000 encoded frames.
Hardware and software
JPEG2000 Encoders for comparison
JPEG2000 lossy encoding at single image mode for 2K image: 2k_wild.ppm (1920×1080, 4:4:4, 24-bit)
JPEG2000 lossy encoding at single image mode for 4K image: 4k_wild.ppm (3840×2160, 4:4:4, 24-bit)
MB/s – MegaBytes per second
Fig.1: Fastvideo JPEG2000 performance on GeForce RTX 2080ti (lossy encoding, single image mode)
From the above figure we can see the encoding speed (JPEG 2000 performance for lossy compression) as a function of image size for Fastvideo JPEG2000 encoder at single image mode. Maximum JPEG2000 performance could be achieved with codeblock size 32×32 in most cases. For images with frame size more than 6 MB, preferred codeblock size is 32×32 at single image mode. It could also be seen that there is a performance saturation, which is dependent on image size for different codeblocks. This is the key point to get better results at batch mode. For 8K image compression with visually lossless parameters, performance saturation is reached for any codeblock size at single image mode.
Figure 1 shows that on NVIDIA GeForce GTX 1080 it's possible to achieve important milestones at single image mode for visually lossless JPEG2000 encoding. For codeblocks 16×16 one can overcome 900 MB/s performance, for codeblocks 32×32 maximum performance exceeds 1300 MB/s, for codeblocks 64×64 maximum performance could reach 1100 MB/s. Performance saturation for codeblocks 16×16 occurs at 4K resolution for visually lossless compression.
Fig.2: Fastvideo J2K performance as a function of compression ratio (lossy encoding, single image mode)
Figure 2 shows Fastvideo JPEG 2000 encoder performance as a function of compression ratio for different image resolutions for lossy compression at single image mode at standard testing conditions as stated above.
Lossless JPEG2000 encoding at single image mode for 2K image: 2k_wild.ppm (1920×1080, 4:4:4, 24-bit)
Lossless JPEG2000 encoding at single image mode for 4K image: 4k_wild.ppm (3840×2160, 4:4:4, 24-bit)
Superior performance of JPEG 2000 encoding at batch multithreaded mode
For the multithreaded batch mode we've carried out performance measurements for JPEG 2000 encoding exactly with the same parameters as we used at the single image mode. All results don't include host I/O latency (image loading to RAM from HDD/SSD and saving back). In the table below, one can find averaged measurement results for the best series of frames (each lasting 10 seconds).
As we know, these are the fastest benchmarks on the market for J2K encoding both for CPU and GPU.
To the best of our knowledge, the above performance benchmarks for J2K lossy and lossless encoding are the fastest among all existing open source and commercial JPEG2000 encoders on CPU or GPU both for single image mode and for batch mode. To make it transparent and simple, we have published all info concerning time measurements, together with sample images, JPEG2000 parameters and hardware specifications to offer everyone an opportunity to reproduce our results and to check performance measurements of other J2K encoders at the same testing conditions. Our demo GPU J2K encoder for Windows could be downloaded here. This is the link to Fastvideo J2K decoder benchmarks.
One can download our latest benchmarks for Jetson Nano, TX2, AGX Xavier, GeForce GTX 1080 and Quadro P6000. You can find there not only results for J2K encoding on GPU, but also benchmarks for other image processing algorithms from Fastvideo Image & Video Processing SDK.
Please let us know about your performance results for JPEG2000 encoders that you could have: Aware, Comprimato, Elecard, ERDAS ECW, FFmpeg, Kakadu, Leadtools, Lizardtech, Lurawave, Mainconcept, Morgan, etc.