Why is there no cuda accelerated image encoding / decoding methods?

Why is there no cuda accelerated version of cv::imdecode?

If I have a encoded image in memory and I want to decode it into GPU memory, I need to first call cv::imdecode on the CPU encoded image before uploading to GPU memory. I would imagine it would be much faster if I could upload the encoded image to GPU memory using the CUDA Runtime API, and then call cv::cuda::imdecode (which does not exist) on the GPU buffer. Why does this functionality not exist?

On the same line, why is there not a cv::cuda::imread function? Again, if you want to read an image from disk and decode into GPU memory, you first need to read into CPU memory and performing the decoding with the CPU (using cv::imread) before it can be uploaded to GPU memory (cv::cuda::GpuMat::upload). Seems inefficient to me. Perhaps there are reasons for these decisions.

In short, nobody has added support for it yet.

nvJPEG which has been around for a few years now is one possibility

but I am not sure there is much demand for this.

1 Like