nvjpegdec can decode a jpeg to RGB format?

I’m trying to decode jpeg to for a realtime project. RGB data is need, but now only got I420. Convert I420 to RGB spent need too much extra time.

2 tests:
Test1:
gst-launch-1.0 filesrc location=1.jpg ! nvjpegdec ! video/x-raw,format=I420 ! nvjpegenc ! filesink location=1-1.jpg
Test2:
gst-launch-1.0 filesrc location=1.jpg ! nvjpegdec ! video/x-raw,format=RGB ! nvjpegenc ! filesink location=1-1.jpg

Test1 succ, but Test2 was failed with:
ERROR: from element /GstPipeline:pipeline0/GstFileSrc:filesrc0: Internal data flow error.
Additional debug info:
gstbasesrc.c(2865): gst_base_src_loop (): /GstPipeline:pipeline0/GstFileSrc:filesrc0:
streaming task paused, reason not-negotiated (-4)
ERROR: pipeline doesn’t want to preroll.

It sames nvjpegdec can’t decode jpeg to RGB format? Or some mistake?

Any replies will be appriciated!

Hi cchao,
Unfortunately, nvjpegdec does not support this case. If the JPEG is I420 compressed, it only can be decoded into I420 output, but cannot do the I420 to RGB conversion to have RGB output.

For your case, if you can implement I420 to RGB conversion via CUDA, it should improve the performance significantly.

I’ve got it. Thanks a lot!
With gstreamer, jpegdec is same with nvjpegdec or something? gst-inspect-1.0 nvjpegdec and jpegdec, this two are very different. However, I’ve found that decoding with jpegdec is faster so much than libjpeg or turbojpeg, but jpegdec’s speed does match with nvjpegdec. Sames jpegdec is accelerated by gpu or video encoder(HW)? Altrough now is working well with jpegdec, I still want to know:), more reason: sometimes gst_element_factory_make to make nvjpegdec will cause a segmentfault, but jpegdec always works well.

Hi cchao,
TK1 is a 4-plus-1 design and there are 4 CPUs(Cortex A15) and 1 COP(ARM7 AVP). The nvjpegdec leverages the ARM7 AVP for jpeg decoding. It is not a full HW accelerated path.

Since jpegdec gets better performance in your case, please use jpegdec.

We will check the issue you report but currently we don’t have plan for next TK1 release. If you need quick fix, you can check the source code
https://developer.nvidia.com/embedded/dlc/l4t-Jetson-TK1-Gstjpeg-Sources-R21-5

Hi DaneLLL, thank you for your help:)

[quote=“DaneLLL”]

TK1 is a 4-plus-1 design and there are 4 CPUs(Cortex A15) and 1 COP(ARM7 AVP). The nvjpegdec leverages the ARM7 AVP for jpeg decoding. It is not a full HW accelerated path.

DaneLLL, so, nvjpegdec is only supported on Tegra serials, including TK1, TX1, TX2. And it’s not supported on Tesla or Geforce series, right?

[quote]

No, it is not supported. It is a gstreamer plugin on Tegra series only.

Got it, DaneLLL, thanks.