JPEG Decoding

Hybrid JPEG decoding on CPU and GPU using Nvjpeg.

class augpy::Decoder

Wrapper for Nvjpeg-based JPEG decoding.

Public Functions

Decoder(size_t device_padding, size_t host_padding, bool gpu_huffman)

Create a new decoder on the current_device.

Parameters
  • device_padding: see Nvjpeg docs

  • host_padding: see Nvjpeg docs

  • gpu_huffman: enable Huffman decoding on the GPU; not recommended unless you really need to offload from CPU

~Decoder()
CudaTensor *decode(std::string data, CudaTensor *buffer)

Decode a JPEG image using Nvjpeg. Output is in \( (H,W,C) \) format and resides on the GPU device.

Return

decoded image on GPU in \( (H,W,C) \) format

Parameters
  • data: compressed JPEG image as a JFIF string, i.e., the full file contents

  • buffer: optional buffer to use; may be NULL; if not NULL must be big enough to contain the decoded image