Getting Started#
This section guides you step-by-step how to decode and encode images on the GPU using the nvImageCodec APIs. Before getting started, please review the pre-requisites. Once reviewed, head over to the samples’ section which showcases various nvImageCodec samples.
Note
Throughout this document, the terms “CPU” and “Host” are used synonymously. Similarly, the terms “GPU” and “Device” are synonymous.
Thread Safety#
Not all nvImageCodec types are thread safe. For user-provided allocators (fields in nvimgcodecExecutionParams_t structure), the user needs to ensure thread safety.
Pre-requisites#
Following are the required dependencies to compile nvImageCodec samples.
Ubuntu >= 20.04
NVIDIA driver >= 530.30.02
CUDA Toolit >= 12.1
- Supported systems:
Linux (Ubuntu >= 20.04, RHEL >= 8, and other PEP600 manylinux_2_28 compatible platforms)
WSL2 with Ubuntu >= 20.04
C++ Samples’ Dependencies:
CMake >= 3.18
gcc >= 14
Python Samples’ Dependencies:
Torch
Torchvision
cuPy
cuCIM
CV-CUDA
Samples#
The next section documents the samples showing various use cases across two different types APIs available to consume nvImageCodec functionality:
- C API samples
- Python API samples
- Basics
- Batch processing
- Code stream and partial (ROI) decoding
- Sliding window decoding with tile cache
- CuPy interoperability
- cuCIM interoperability
- CV-CUDA interoperability
- Tensorflow interoperability
- Torch interoperability
- Multi-image
- Advanced multi-image (SubIFDs and Pagination)
- Metadata extraction
- Transcode
- Accelerated DICOM decoding and encoding
- Reuse resources (Image and CodeStream)
Decoder and encoder creation accept an optional options string to tune behavior (e.g. :num_cuda_streams=4 or decoder-specific options). See Codec options for the format and the full list of decoder and encoder options.
Refer to the Installation docs for the sample installation guide using *.deb or *.tar installers.
Refer to the sample README for instructions to compile samples from the source.