Orin nano Jpeg decode very slow for V4L2_PIX_FMT_YUV422M jpg

Hello, I am trying to use nvjpeg decoder to decode JPEG images. Based on the “jetson_multimedia_api/samples/12_v4l2_camera_cuda” sample code, I have modified it for testing purposes.

1.Tested decoding a 1080P JPEG image read from a file or directly obtained from a USB camera into a YUV image using the nvjpeg decoder’s decodeToFd.
Found that the average decoding time per frame is about 85ms. The decoding speed is too slow, which is definitely abnormal.
Please refer to the attachment for the test code.
The test command is: ./v4l2_camera_cuda -d /dev/video0 -s 1920x1080 -f MJPEG -n 2
During testing, every time a JPEG frame is decoded, the following message appears: NVMMLITE_NVVIDEODEC, NvVideoBufferProcessing:6109 Consume the extra signalling for EOS.

2.Testing environment is Orin Nano。

/$ jetson_release -v
Software part of jetson-stats 4.3.2 - (c) 2024, Raffaello Bonghi
Model: NVIDIA Jetson Orin Nano Developer Kit - Jetpack 6.0 [L4T 36.3.0]
NV Power Mode[0]: 15W
Serial Number: [XXX Show with: jetson_release -s XXX]
Hardware:

  • Module: Check with sudo
  • SoC: tegra234
  • CUDA Arch BIN: 8.7
    Platform:
  • Machine: aarch64
  • System: Linux
  • Distribution: Ubuntu 22.04 Jammy Jellyfish
  • Release: 5.15.136-tegra
  • Python: 3.10.12
    jtop:
  • Version: 4.3.2
  • Service: Active
    Libraries:
  • CUDA: 12.2.140
  • cuDNN: 8.9.4.25
  • TensorRT: 8.6.2.3
  • VPI: 3.1.5
  • Vulkan: 1.3.204
  • OpenCV: 4.8.0 - with CUDA: NO

cat /etc/nv_tegra_release

R36 (release), REVISION: 3.0, GCID: 36191598, BOARD: generic, EABI: aarch64, DATE: Mon May 6 17:34:21 UTC 2024

KERNEL_VARIANT: oot

TARGET_USERSPACE_LIB_DIR=nvidia
TARGET_USERSPACE_LIB_DIR_PATH=usr/lib/aarch64-linux-gnu/nvidia

  1. I found a similar issue at this URL: Jpeg decode very slow for non-yuv420p jpg .

  2. How can this problem of JPEG-to-YUV decoding being too slow be resolved?

  3. The test code is provided in the attachment.
    12_v4l2_camera_cuda.zip (317.5 KB)

Hi,
Please try the prebuilt lib:
Jpeg decode very slow for non-yuv420p jpg - #9 by DavidDDD

I have replaced /usr/lib/aarch64-linux-gnu/nvidia/libnvjpeg.so (e4e4294cd5ab8553cb8690bd96e91c3c libnvjpeg.so) in this topic Jpeg decode very slow for non-yuv420p jpg - #9 by DavidDDD , but it did not work。

After updating libnvjpeg.so, new errors were introduced, causing the sample to terminate during the decoding of the first JPEG image. Details are as follows:

jcy@ubuntu:/usr/src/jetson_multimedia_api/samples/12_v4l2_camera_cuda$ sudo ./v4l2_camera_cuda -d /dev/video0 -s 1920x1080 -f MJPEG -n 2
[sudo] password for uniubi:
test → start_capture 730 ctx->cam_pixfmt=1196444237
start_capture 735 ctx->jpegdec=0xaaaad580c6d0
NvMMLiteOpen : Block : BlockType = 277
NvMMLiteBlockCreate : Block : BlockType = 277
Format unsupported
[ERROR] (NvJpegDecoder.cpp:136) JPEG format is not supported by libnvjpeg
ERROR: start_capture(): (line:838) Cannot decode MJPEG from file
ERROR: main(): (line:972) Failed to start capturing
App run failed

Hi,
Is your system in r36.4?

system in NVIDIA Jetson Orin Nano Developer Kit - Jetpack 6.0 [L4T 36.3.0]

Hi
It would be great if you can upgrade to r36.4.4.

  1. Upgrade to r36.4.4.
  2. Apply the fix from the issue ticket “Jpeg decode very slow for non-yuv420p jpg - #9 by DavidDDD” using the provided r36_4_TEST_libnvjpeg_1.zip (145.6 KB) file.

These two steps have resolved the issue. Thank you very much.
INFO: V4L2_PIX_FMT_YUV420M
INFO: 848 decodeToFd (from file) elapsed time: 4.544 ms (frame: 0, jpeg_size: 460826 pixfmt=842091865)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.