Home » Community » Newbie corner » Is it possible?
Re: Is it possible? [message #29838 is a reply to message #29837] |
Sun, 21 November 2010 12:23 |
|
Wlad wrote on Sun, 21 November 2010 09:43 | Is it possible to show 30 "fps" (Size = 704x576x32) using standard U++ widgets?
|
Hi Wlad,
Theoretically yes. Not sure how much standard do you need the widgets to be, but a simple custom control using standard U++ capabilities gives about 40fps for the resolution you asked about on my machine (intel atom netbook, no high performance system ). The code can be something like this: class MyAnim: public Ctrl{
public:
Image img;
typedef win CLASSNAME;
void Paint(Draw& w){
SetSurface(w,0,0,704,576,img);
}
win(){
//some initialization here
SetTimeCallback(-1,THISBACK(Next));
}
void Next(){
img = LoadNextFrame(); //you'd have to implement this one, but it should be simple
Refresh();Sync();
}
};
Note that the code is not complete, it's purpose was only to benchmark the speed. It plays as fast as it can; to achieve a given frame rate, you would have to control that better. The SetTimeCallback solution is simple, but probably not optimal. Also it produces some flicker, you would probably have to add bit more logic to avoid that.
Wlad wrote on Sun, 21 November 2010 09:43 | "Frames" are the jpeg images saved in a BIG file consequentially (one after other without gaps).
|
This could be a problem. Decoding jpeg is not very fast. With some random 704x576 images I got about 50ms to load and decode. That limits the performance a lot (for comparison SetSurface() in above code takes only about 10ms), unless you are able to get the images buffered in memory before playing (or doing it in second thread, while playing). That should be easy for some reasonably low number of frames, but quite challenging for long animations.
Are you trying to play a movie or some kind of animation? I would recommend you to experiment with other image formats if you can, they might cheaper decoding. For GIF or multipage TIFF, you could use RasterPlayer, but the price to pay there would be probably a quality.
Best regards,
Honza
|
|
|
Goto Forum:
Current Time: Thu May 23 11:51:16 CEST 2024
Total time taken to generate the page: 0.01800 seconds
|