Compress bitmap24 data buffer to JPEG with nvJPEG encoder

Hi there,

I was searching for a solution to compress a GPU-located buffer with RGB values to a jpeg conform buffer. During my search I came across the nvJPEG library, which I would like to use as well. Unfortunately I noticed quite fast that the JPEG encoder takes data from the host memory, copies it to the GPU, executes the JPEG algorithm and writes results back to the host memory.

Since a data processing algorithm is running before the compression on the GPU, the Bitmap24 data are already located in GPU memory. To avoid unnecessary transfer between host and GPU, I’m looking for a way to give the nvJPEG encoder a data buffer that is located on the GPU.

Neither the nvJPEG documentation nor example codes provide a way to pass a GPU buffer to the nvJPEG encoder.

The resulting function signature for converting BMP24 to JPEG should look like this

void CudaBase::encodeBmpToJpeg(char* idata, char* odata, int width, int height)

Where idata and odata are pointers located in the GPU memory.

My question: Does the nvJPEG library provide an interface for GPU-located input/output data? If not, what could be an alternative to nvJPEG?

Thanks in advance!

I will answer to my question, in case someone is fancing with the same problem. I found GPUJPEG-library on github to decode and encode JPEG images from bitmaps. The library also provides an interface for data which are located on the GPU before the decoding/encoding. Getting started was very easy due to the good documentation. Therefore I recommend the library to anyone who wants to perform JPEG (de)compression on the GPU!

That statement doesn’t look correct to me.

The documentation for nvjpegEncodeImage():

https://docs.nvidia.com/cuda/nvjpeg/index.html#nvjpeg-encode-image

states:

“source Input Host Pointer to the nvjpeg structure that holds the device pointers to the Y, U(Cb) and V(Cr) image planes and the respective strides.”

So that is a structure that is resident on the host, but it contains pointers to GPU buffers that contain the Y,U,V uncompressed image data.