PDA

View Full Version : Displaying two huges images in some special circumstances.



hickscorp
7th April 2007, 22:59
Hi to everyone here,

As some of you probably noticed, i'm trying to get a Photoshop plugin made with QT running...
I have done the trickiest part of the threading, now i'm trying to display the original picture, and the processed picture. Here is how it's made so far:
- a Main settings dialog containing all buttons, sliders and fine tuning for my filters.
- This main dialog is in charge of launching / stopping / restarting the processing thread, accordingly to all the settings.
- i do have a QDialog, which will contain two pictures (Left: Original, Right: Processed with real time advancement with the feedback i have from the processing thread). This dialog is displayed using ->show() from the previously described dialog's constructor.
- There is a button on the main dialog, which will be used to "split" the previewing dialog into two distinct dialogs (One containing the original picture, the other dialog the processed picture). And of course the inverse function, to "glue" the two windows once they are splitted.

Now, i'm asking myself on what is the best thing to do for me, i prefered to stop coding and try to get feedback here ^^
The two pictures which i have to display can be pretty huge (1600x1200, sometimes more, often less). The problem is, the RAM is already holding 5 copies of those pictures (The Photoshop data as an input, the Photoshop data as an output, and internally of my application i have made objects named CARGBPlanes which holds 3 times the pictures: i need original, input and output for each filters).
So, what will be the best for me (QT side)? If i rewrite my filters (Which were made a long time ago), would it be a good idea to make them use QT objects instead of my CARGBPlanes objects? If i make my filters work on some QT objects (QImage for example), is it possible that i directly use the "working" object as my main display objects?

I have read a lot tonight about QGraphicsView, QItemsView, QPixmap, QImage, QBitmap... What would be the less RAM-consument combination?

If you need more information to tell me the good points / drawbacks of your ideas, ask me, i'll try to be more specific.

I hope you understand what i'm trying to know ^^
Thanks for any advice.
Pierre.

[EDIT:] I forgot the most important point... The preview pictures (Original and processed) has to be zoomable... That's why i aimed my search at QGraphicScene for now ^^ Also i noticed that QPicture have a maximum of a byte per channel (0xAARRGGBB). If i want to use QT objects internaly, i will have to change it from 8 bits to 16 bits ber channel (But i dont need alpha, only RGB) =/ I'm not sure if it's possible or not...

marcel
8th April 2007, 05:11
If i make my filters work on some QT objects (QImage for example), is it possible that i directly use the "working" object as my main display objects?
Yes, if you store the images as QPixmaps, you could modify directly the QPixmap buffer and update it on screen. But isn't this what you already do with your image buffers?

I am not sure how much memory you will gain by doing this. It depends on how many identical copies of the image your plug-in has stored in memory.
QPixmap when loaded, looks into a QPixmapCache, to see if the image you are trying to load has been loaded before. If it has, the it doesn't create a new copy, but instead gives you a reference to the one loaded first.

If you have only one copy of a image in memory, then QPixmap won't be much help.

Also, QPixmap has some drawbacks related to image size. It apparently does not work with images larger than 2000x2000 pixels( on some computers even less ), so you will have to split a big image in smaller blocks, process them, and then display them on the screen.

On the other hand, QGraphicsView is very fast and this could help you a lot with image preview operations such as zoom, scroll, etc.

Conclusion - QPixmap will not help you much ( from the performance point of view ). But QGraphics view will, therefore you should think about using both.