spdl.io.decode_image_nvjpeg

decode_image_nvjpeg(src: str | bytes, *, device_config: CUDAConfig | None = None, **kwargs) CUDABuffer[source]

[Experimental] Decode image with nvJPEG.

Warning

This API is exmperimental. The performance is not probed, and the specification might change.

Note

Unlike FFmpeg-based decoding, nvJPEG returns GPU buffer directly.

Parameters:
  • src – File path to a JPEG image or data in bytes.

  • device_config – The CUDA device to use for decoding.

  • scale_width (int) – Resize image.

  • scale_height (int) – Resize image.

  • pix_fmt (str) – Optional Output pixel format. Supported values are "RGB" or "BGR".

Returns:

A CUDABuffer object. Shape is [C==3, H, W].