NVIDIA / CUDALibrarySamples

CUDA Library Samples
Other
1.5k stars 311 forks source link

host memory and GPU memory #157

Closed pytho12 closed 9 months ago

pytho12 commented 9 months ago

The input of the nvJPEG library is in the host memory and the output is in the GPU memory. Can the input be in the GPU memory and the output be in the GPU memory?

zohebk-nv commented 9 months ago

For decoder, we do have NVJPEG_BACKEND_GPU_HYBRID_DEVICE and NVJPEG_BACKEND_GPU_HYBRID_DEVICE backends that accept input bitstreams on device memory. See this link for details. There are certain limitations

  1. These backends work only with ​nvjpegDecodeBatched() API
  2. You will need to know in advance that the jpeg files in question are supported by nvjpeg. If not you will have to copy the bitstream to host and use nvjpegDecodeBatchedSupported() API to determine whether your image is supported by nvjpeg.
pytho12 commented 9 months ago

Doesn’t encoding support exist?

zohebk-nv commented 9 months ago

There is encoding support as well. The encode APIs(nvjpegEncodeYUV and nvjpegEncodeImage) accept input on device memory. It is possible to retrieve the compressed bitstream on either on device using - nvjpegEncodeRetrieveBitstreamDevice or on host using nvjpegEncodeRetrieveBitstream

zohebk-nv commented 9 months ago

closing. Feel free to reopen if you have additional questions