-
Notifications
You must be signed in to change notification settings - Fork 0
Avoid LibTIFF library and use raw image format
Item | Value |
---|---|
Guideline Number | 28 |
Guideline Responsible (Name, Affiliation) | Alvin Sashala Naik, Thales |
Guideline Reviewer (Name, Affiliation) | Michael Grinberg, Fraunhofer |
Guideline Audience (Category) | Application developers |
Guideline Expertise (Category) | Application developers |
Guideline Keywords (Category) | Image decompression, hardware optimisation |
Avoid complex data structure (TIFF) and use raw image format instead.
While we were porting the medical use case on the Tegra family processors, we got difficulties to integrate LibTIFF library because the memory resources required by the library while doing image compression and decompression were way too much compared to the resourced available on the target.
Another problem comes with data manipulation. When the format is too complex, it is difficult to modify the way filters are implemented and to optimise the source code for a given processor.
Recommended implementation method of the guideline along with a solid motivation for the recommendation
Use simple data format. Compression will not free any RAM, on the contrary it uses more space because the processor needs both the compressed format for storage and the uncompressed format for manipulation. Doing compression and decompression will slow down the processing application. Compression is only effective for data storage or while transmitting data on a network to save bandwidth. Using simpler data format will allow easier manipulation of the data and will also make it easier to port the application on embedded targets.
We advice to use either PPM/PGM images format or hexdump format because the structure is similar to a matrix of pixels.
When using a live image sensor (i.e. a camera), we also advice to work on the raw data flow from the image sensor, for you would have to decompress the video prior to using it which costs CPU time. If you need compression on the data line because the bandwidth is not high enough, we advice to use hardware IPs to do the decompression because it will be the best option to save power consumption while also saving the bandwidth.
The reference platform per se does not include any software libraries for image compression or decompression. However, depending on the chosen hardware components, hardware accelerators might be available in the platform. For instance, on the Zynq SoC, one may include IPs on the FPGA fabric to do data compression and decompression. Such an IP will be available for the application through the operating system interfaces of the driver that takes care of the FPGA of the Zynq from the ARM processor. The management of the IP itself has to be taken into account from the application code.
The medical use case was processing TIFF images. We modified the source code and changed the reference images format to PGM. This allowed to get ride of the LibTIFF library and to lower the memory usage of the application.
TULIPP Guideline Wiki