Skip to content

Avoid LibTIFF library and use raw image format

philippemilletresearch edited this page Aug 2, 2018 · 12 revisions

Guideline Information

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

Guideline advice

Avoid complex data structure (TIFF) and use raw image format instead.

Insights that led to the guideline

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.

Instantiation of the recommended implementation method in the reference platform

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.

Evaluation of the guideline in reference applications

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.

References

Review

Related guidelines

  1. Avoid using heavy libraries while writing source code for embedded systems
Clone this wiki locally