TheImagingSource / tiscamera

The Linux SDK for The Imaging Source cameras.
https://www.theimagingsource.com
Apache License 2.0
299 stars 148 forks source link

Performance Variation Across Ubuntu Versions and tiscamera Package Versions #549

Closed yukiogawa21 closed 7 months ago

yukiogawa21 commented 7 months ago

I'm currently utilizing a Jetson(arm64) device to run an application for visual inspection within a container environment. We've been experimenting with the tiscamera package, available for Ubuntu 18, 20, and 22. Upon conducting the same operations within our application, we observed a performance discrepancy; the package for Ubuntu 20 exhibited roughly a 10ms delay in processing compared to the packages for Ubuntu 18/22. Additionally, upgrading from version 1.0.0 to 1.1.0 of the tiscamera package also resulted in an approximate 10ms increase in processing speed. While we continue to investigate other potential factors, I'm curious if the differences in tiscamera package versions are known to cause variations in processing speeds. Furthermore, why is there a separate package specifically for Ubuntu 20 as opposed to a unified package for Ubuntu 18/22?

TIS-Edgar commented 7 months ago

Hi,

Ubuntu 20.04 Packages have to exist separately due to the fact that a different libzip library is shipped. Ubuntu <=18 and >= 22 ship libzip4. Ubuntu 20 ships libzip5. We were unable to find any reasoning on Ubuntus side for this. The libzip dependency is the only difference in the packages, code wise

Our download section is also kept in sync with the github release page (easier to link to): https://github.com/TheImagingSource/tiscamera/releases

The precompiled Debian packages are all natively compiled with the default compiler of the respective Ubuntu release. Ubuntu18 packages will have been compiled with gcc 7.5.0. Ubuntu20 packages will have been compiled with gcc 9.3.0.

The change causing performance differences between 1.0 and 1.1 is very likely the tcammainsrc GstBufferPool. I am assuming you are using a USB/GigE and not a FPD camera. The bufferpool ensures that a fixed amount of buffers and their metadata are allocated at the start of the stream and are then reused once the user frees them. Previously reallocations could happen as the entire buffer management was done by gstreamer and not tiscamera.

I am unsure if that change is enough to account for the entire difference you are observing.

If we can assist you in any way, please let us know.

yukiogawa21 commented 7 months ago

Hi,

I am currently specifying the l4t-ml image and switching Ubuntu versions within the container to test. The application uses a GigE camera. Thank you for the detailed explanation regarding the different speeds between Ubuntu 18 and Ubuntu 20. Currently, I cannot fully replicate the application in an Ubuntu 22 container. If I use the tiscamera package for Ubuntu 18/22 in the Ubuntu 22 container, given that it's the same package, is it correct to assume that the processing speed could be similar to what it was with Ubuntu 18?

TIS-Edgar commented 7 months ago

You should be able to use the Ubuntu18 packages, yes. We cannot guarantee the same performance as gstreamer libraries, etc will be different but from our code no performance differences should occur.

If you want to save additional disk space and reduce the image size it may be a good idea to create the debian packages yourself. That way you can remove libusb and other dependencies that are not required for GigE. It would not be much but might be something of interest for your task

yukiogawa21 commented 7 months ago

Thank you very much. Your assistance has been incredibly helpful.