Jetson Linux Api - Imaging API

Hey Guys,

regarding the official Jetson Linux API Reference Documentation it states:

Jetson Linux API References documents API elements that you can use directly .

But if I want to use e.g. the NvJPEGEncoder I get undefined Reference errors:

  • Checking the libnvjpeg.so seems not to include this class and export it’s functions
  • Regarding the included codesamples it’s seems that the class is rather part of the samples instead of the API, cause it will be build by the sample’s Makefile

So my Questions are:

  • are all Parts in the documented API really included in the API an can be used directly as stated
  • or do I have to build everything on myself
  • and finally: where is than stated what to build and what exists and where i get the Information in which .so/library the listed API elements are included?

Thanks
Damian

Hi,
You may check samples in

/usr/src/jetson_multimedia_api/samples

For JPEG encoding, please try to run this sample and check the source code:

/usr/src/jetson_multimedia_api/samples/05_jpeg_encode

Hey DaneLLL,

thx for answering… but it’s not the answer I expected.
I did check the samples. And as I wrote it is not obvious which parts are really part of the API and which belongs to the samples and have to be build.

So when the Documentation tells me I can use the elements directly I expect them to be included in an existing library, rather then figuring out which one I have to build on my own as e.g. the mentioned NvJPEGEncoder-class.
On the other Hand there is also a NvBuffer-class listed in the API and inside the samples include/common classes… but NvBuffer-related stuff is usable via libnvbuf-utils.so (well… unless it is not a special same-named-samples NvBuffer-class)

Documentation → Jetson Linux API Reference: Main Page

NvJPEGEncoder → Jetson Linux API Reference: NvJPEGEncoder Class Reference

/usr/src/jetson_multimedia_api/include/NvJpegEncoder.h
/usr/src/jetson_multimedia_api/samples/common/classes/NvJpegEncoder.cpp

NvBuffer → Jetson Linux API Reference: NvBuffer Class Reference

/usr/src/jetson_multimedia_api/include/NvBuffer.h
/usr/src/jetson_multimedia_api/samples/common/classes/NvBuffer.cpp

Also the samples aren’t really a help here cause every single sample compiles with every class from the common class folder (via samples/Rules.mk) and links against every library listed in the Rules.mk… so it’s more guessing/filtering what is really essentially needed than a dedicated help…

in samples 05_jpeg_encode Makefile:

include ../Rules.mk
...
SRCS := ... $(wildcard $(CLASS_DIR)/*.cpp)
...
@echo "Linking: $@"
	$(CPP) -o $@ $(OBJS) $(CPPFLAGS) $(LDFLAGS)
...

and in samples/Rules.mk:

...
CLASS_DIR 	:= $(TOP_DIR)/samples/common/classes
...
LDFLAGS += \
	-lpthread -lv4l2 -lEGL -lGLESv2 -lX11 \
	-lnvbuf_utils -lnvjpeg -lnvosd -ldrm \
	-lcuda -lcudart \
	-lnvinfer -lnvparsers -lnvonnxparser \
... other lib folders ...

Well I think it is quiet obvious that every thing should/may work when I link it to the world and compile every class I can find… but I won’t call it a strategy or solution ;)

So once again I would reference to my previous Questions:
What is really part of the documented API and directly usable…? (btw. what is the meaning of directly usable in this case?)
And when the stated classes are part of the API… why do they come with the samples-code and are build via/inside them as if thy where little unimpressive helping classes?
And when everything in common classes is build anyway (regardless of it’s use) with every single sample-code, why there is not just an precompiled/existing or via JetPack installed library containing the documented API elements?

THX
Damian

Hi,
For the statement:

Jetson Linux API References documents API elements that you can use directly .

It is to encourage users to use implemented classes. The implemented classes are in

/usr/src/jetson_multimedia_api/samples/common/classes

For certain hardware functions such as video encoding, we suggest use NvVideoEncoder. However, some users may want to implement it through v4l2_ioctl(). Since all classes/samples are open source, users do have flexibility to do it on their own.

From Jetpack 4.6, we have moved TensorRT-related libs to the individual samples:

	-lnvinfer -lnvparsers -lnvonnxparser \

There is still room for improvement. We will check this. For now if you don’t need the classes or don’t need to link to the libs, please remove them from Rules.mk.