Loading Images with small CPU load
-
Hello,
Has somebody experience what's the best or correct way for image loading with preferably a small CPU load ?
Because it's an embedded system I've to get along with a not very powerfull CPU.I've over hundred images as png-Files. Everyone with size of 300 x 300 Pixel
In my usecase every 100 ms I've to replace an image with a new one. For the intervall I'm using a timer.Can somebody give a tip ?
Thanks and best regards,
snoopy
-
Hi,
Depending on what these images you should avoid using a compressed format.
-
That much image data would be ~205MByte stored uncompressed (at 24bits/pixel) per hundred images. Might be a lot for an embedded system? But if you've got the storage available you could just store the raw image data into files and load when needed and point a QImage at the data. (Or memory-mapping the image data might be better depending whether usage patterns and available RAM lead to some caching and re-use of already loaded data).
-
@Snoopy said in Loading Images with small CPU load:
For the intervall I'm using a timer.
How far did you get with the advice you got from https://forum.qt.io/topic/87537/need-a-timer-which-works-exactly/ ?
-
I've detected that in my case the QML Timer was the problem and not loading the images. The Timer himself is imprecise. I've checked it by comparing the elapsed time with the system time of the PC.
One more example: If there is only running the timer with an interval of 100 ms (without loading images), and I'm moving the mouse the triggeredEvents will be fired only after 180 ms in average.Now I've integrated the QTimer based on C++ into my QML-code. I'm using the QTimer with type PreciseTimer.
This works very fine.In combination with loading images I've opened a new topic
https://forum.qt.io/topic/87826/caching-many-png-images-files-in-one-go
I would be very gratefull If you could look inside it. Maybe you have experience with this topic.Thanks.
Best regards
Snoopy
-
@Snoopy you may want to take a look at a series of blog posts regarding Fast-Booting Qt Devices. Although some items covered there might not apply to you, some tips about do's and do not's could be relevant.