Skip to content

Implement JPEG decoding via nvjpeg #2742

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
fmassa opened this issue Oct 2, 2020 · 2 comments · Fixed by #3792
Closed

Implement JPEG decoding via nvjpeg #2742

fmassa opened this issue Oct 2, 2020 · 2 comments · Fixed by #3792

Comments

@fmassa
Copy link
Member

fmassa commented Oct 2, 2020

🚀 Feature

We currently provide CPU image decoding functions for PNG and JPEG. It could be interesting to consider using nvjpeg to perform decoding directly on the GPU, as it could benefit certain workloads.

Motivation

With CUDA 10.0, nvjpeg is part of the CUDA toolkit, which means that it would be easily accessible for us to use it.

The API for the decoding function is not yet clear to me, and would require some digging
Ideally, passing a CUDA tensor for decode_jpeg should do the decoding on the GPU, although I'm not sure if that's how nvjpeg works internally.

@jamt9000
Copy link
Contributor

jamt9000 commented Oct 5, 2020

It looks like it requires a host pointer and does some preprocessing on the cpu

Parameter Input / Output Memory Description
const unsigned char *data Input Host Pointer to the encoded data.
nvjpegImage_t *destination Input/Output Host/ Device Pointer to the structure that describes the output destination. This structure should be on the host (CPU), but the pointers in this structure should be pointing to the device (i.e., GPU) memory. See nvjpegImage_t.

so passing gpu data directly wouldn't work

@fmassa
Copy link
Member Author

fmassa commented Oct 6, 2020

Yes, that was my understanding as well. We would need to see what potential speed benefits single-image decoding could bring compared to say turbo-jpeg, and if the speed improvements are there what would be a good API for using it. Passing a device flag to decode_jpeg?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants