Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Fast drawing in QT
personlin last edited by
My case is writing a -QT- Qt application to draw four channels video.
I use QImage to load JPEG stream from a network buffer(700Kbits each channel),
and my widget is extending from QGLWidget.
The speed seems not fast enough. Is any idea to speed up the performance such as drawing or converting from JPEG to pixmap?
What is better class to do that?
Try profiling your application! It is very likely that the JPEG->QPixmap transformation is the limiting factor... but your code might also doing something completely different that slows everything down! Without profiling data you are just guessing at the reason.
Don't guess, measure!
bms20 last edited by
Tobias is right.
However, you will probably want to think about what your architecture is doing.
My guess is that you are doing this:
Load jpeg -> decode in ram to RGB -> upload to GPU -> paint onto buffer
So you've copied the image into ram, DMAed the image to the GPU, then copied it into the frame buffer.
I'd suggest one of two alternative approaches:
- Draw the graphics without using opengl; hence cutting out the upload, use threading on your (presumably multicore) CPU to decode the images.
- Use the GPU hardware to decode your jpeg, then display it.
#2 isn't easy but will get you a long way, because you will be copying compressed data into the GPU memory; where the GPU can then be used to rapidly convert the jpeg image into RGB. You can always break the jpeg decoding down into several steps - e.g. do most of the decoding on the cpu, then the final conversion to rgb on the gpu; then attack the next stage, etc...