Tegra_multimedia_api/samples/05_jpeg_encode run time error

Hi,

I built tegra_multimedia_api/samples/05_jpeg_encode
on Tx2 with xEC2 board. but I got the following error message during run-time. “JPEG parameter struct mismatch: library thinks size is 728, caller expects 704”

It is a lib conflict problem between libjpeg and libnvjpeg based on the discussion in this forum. Maybe I missed something, I did not find a clear answer on how to fix this issue. Therefore I post it again.

BTW, i did not build and install opencv yet. Here is my L4T version
$cat /etc/nv_tegra_release
R32 (release), REVISION: 3.1, GCID: 18186506, BOARD: t186ref, EABI: aarch64, DATE: Tue Dec 10 07:03:07 UTC 2019

Here is my compile and link command.
g++ -I"/usr/include/aarch64-linux-gnu" -I"…/…/include" -I"…/…/include/libjpeg-8b" -c jpeg_encode_csvparser.cpp

g++ -I"/usr/include/aarch64-linux-gnu" -I"…/…/include" -I"…/…/…/include" -I"…/…/…/include/libjpeg-8b" -c NvJpegEncoder.cpp

g++ -o jpeg_encode jpeg_encode_csvparser.o jpeg_encode_main.o …/common/classes/NvElementProfiler.o …/common/classes/NvElement.o …/common/classes/NvApplicationProfiler.o …/common/classes/NvVideoDecoder.o …/common/classes/NvJpegEncoder.o …/common/classes/NvVideoConverter.o …/common/classes/NvBuffer.o …/common/classes/NvLogging.o …/common/classes/NvEglRenderer.o …/common/classes/NvUtils.o …/common/classes/NvJpegDecoder.o …/common/classes/NvVideoEncoder.o …/common/classes/NvV4l2ElementPlane.o …/common/classes/NvV4l2Element.o -I"/usr/include/aarch64-linux-gnu" -I"…/…/include" -I"…/…/include/libjpeg-8b" -L"/usr/lib/aarch64-linux-gnu" -L"/usr/lib/aarch64-linux-gnu/ tegra " -lpthread -lv4l2 -lEGL -lGLESv2 -lX11 -lnvbuf_utils -lnvjpeg

The following is the global search results of the related lib and headers in my machine:

A.
nvidia@ubuntu:/$ sudo find / -name libjpeg. *

/usr/lib/aarch64-linux-gnu/libjpeg.so.9

/usr/lib/aarch64-linux-gnu/libjpeg.so.9.2.0

/usr/lib/aarch64-linux-gnu/vlc/plugins/codec/libjpeg_plugin.so

/usr/lib/aarch64-linux-gnu/libjpeg.so.8

/usr/lib/aarch64-linux-gnu/libjpeg.so.8.1.2

B.

nvidia@ubuntu:/$ sudo find / -name libnvjpeg. *

/usr/lib/aarch64-linux-gnu/tegra/libnvjpeg.so

C.

nvidia@ubuntu:/$ sudo find / -name jpeglib.h

/home/nvidia/pkg/tegra/tegra_multimedia_api/include/libjpeg-8b/jpeglib.h

/home/nvidia/susa_wami/src/server/libAppJpeg/libjpeg-8b/jpeglib.h

Thanks for your help!

Hi,
It looks like it doesn’t refer to correct jpeglib.h. Please ensure you refer to the one in jetson_multimedia_api. There is a default Makefile. You may also try to build/run with the one.

Thanks DaneLLL,

I built it from the default Makefile inside jetson_multimedia_api. And it does refer to the jpeglib.h coming with 05 sample code.

Hi,
After the installation, the samples are in

/usr/src/jetson_multimedia_api

Do you run this sample? The default samples are verified in each release and should run well.

Thanks again DaneLLL!

Since we re-flashing TX2 by using a specific-custom-oem pkg (cuda 10.0) provided by XIMEA for its xEC2 board, there is no source code in /usr/src/jetson_multimedia_api, then I downloaded it from sabipeople · GitHub

What I want to do is to compress and save 8000x6000 RGB images into jpeg file at ~5-10 frames/sec. To do that i researched the following options

  1. Using nvJPEG :: CUDA, but it needs cuda 10.1 and beyond (XIMEA cannot provide the latest cuda kit at this moment)

  2. Using libnvjpeg examples in tegra_multimedia_api/samples/05_jpeg_encode

  3. open source based on npp such as
    GitHub - yuanxy92/GenCameraDriver: General Industry Camera Driver
    but comparing with cv::imencode(), the compressed image quality is very bad.

Therefore i focus on the 2nd approach. Seems the issue comes from that jetson_multimedia_api is not match my system. Do you have an office place to download it for the the following platform?
R32 (release), REVISION: 3.1, GCID: 18186506, BOARD: t186ref, EABI: aarch64

Thanks!

Thanks the hint from DaneLLL. I eventually find a right way to download the official nvidia-l4t-jetson-multimedia-api by:
$sudo apt install nvidia-l4t-jetson-multimedia-api

Then build and run the following sample code without any errors. /usr/src/jetson_multimedia_api/samples/05_jpeg_encode

At this point, this ticket is closed!

1 Like

Hi,
Good to know that. Thanks for sharing the tip.