Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding QOI compression support to ROS2 #104

Open
wants to merge 1 commit into
base: rolling
Choose a base branch
from

Conversation

awesomebytes
Copy link

@awesomebytes awesomebytes commented Jul 24, 2022

This is a sibling PR of: #103
However, note that I developed and tested these changes in ROS1. Given the similarity of the codebase I hope it just works by adding the same changes here.

The Quite OK Image format (https://qoiformat.org/) is a good substitute of PNG for lossless compression.

As per QOI's website:

QOI is fast. It losslessy compresses images to a similar size of PNG, while offering 20x-50x faster encoding and 3x-4x faster decoding

This commit adds it as a compressed image transport thanks to Dimitri Belopopsky's (@ShadowMitia) MIT Licensed
library (https://github.com/ShadowMitia/libqoi) implementing Dominic Szablewski's QOI algorithm (which is
CC0 licensed, public domain).

To give context, I implemented this to practice C++ and to provide an alternative to PNG compression for when we'd like lossless compression or to have an alpha channel without framerate drop. Currently using PNG drops a 640x480 webcam stream 30fps to 3fps. With QOI it stays at 30fps.
Taking as baseline raw image publishing with video_stream_opencv, and subscribing with rqt_image_view, on my i7-10875H CPU @ 2.30GHz × 16, QOI compression adds 28% CPU usage and QOI decompression adds 13% CPU usage. Feels reasonable to me, specially compared to PNG going over 100% CPU usage and dropping most of the frames.

I would gladly appreciate help on how to eliminate the (what I think is) unnecessary copy of the image in the publisher and the subscriber.

The Quite OK Image format (https://qoiformat.org/) is a good substitute of PNG for lossless compression.
This commit adds it as a compressed image transport thanks to Dimitri's Belopopsky (@ShadowMitia) MIT Licensed
library (https://github.com/ShadowMitia/libqoi) implementing Dominic Szablewski's QOI algorithm (which is
CC0 licensed, public domain).
@PhilippPolterauer
Copy link

Is there any momentum behind this?
I would be highly interessted in using QOI within ros!
If needed I would devote some time to implementing needed changes.

Br Philipp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants