Fast drawing in QT
-
wrote on 19 Dec 2011, 14:56 last edited by
Hi,
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? -
wrote on 19 Dec 2011, 15:26 last edited by
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!
-
wrote on 22 Dec 2011, 15:17 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 bufferSo 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...
Good luck.
-bms
2/3