Home » Community » Newbie corner » Is it possible?
Is it possible? [message #29837] |
Sun, 21 November 2010 09:43 |
Wlad
Messages: 20 Registered: February 2010 Location: Ukraine, KharkOv
|
Promising Member |
|
|
Is it possible to show 30 "fps" (Size = 704x576x32) using standard U++ widgets?
"Frames" are the jpeg images saved in a BIG file consequentially (one after other without gaps).
[Updated on: Sun, 21 November 2010 09:45] Report message to a moderator
|
|
|
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
|
|
|
|
Re: Is it possible? [message #29843 is a reply to message #29841] |
Sun, 21 November 2010 18:22 |
|
Have a look at the forum and search for SDLCtrl and video player. Koldo is working on it currently and I believe it is just about to be finished. It uses SDL for displaying video and ffmpg for decoding, all encapsulated into U++ Ctrl. It should be capable to play the common video formats, such as M-JPEG. Don't hesitate to ask Koldo directly for further info
Honza
|
|
|
|
|
|
Re: Is it possible? [message #29998 is a reply to message #29837] |
Thu, 02 December 2010 13:48 |
AnnabelleR
Messages: 4 Registered: November 2010 Location: Usa
|
Junior Member |
|
|
Hello,
Sorry i can't help you because i am newbie here and i am here for getting information regarding U++.So i hope you guys will help me learning about U++.
Regards,
Ali.
|
|
|
Goto Forum:
Current Time: Sat May 11 17:49:26 CEST 2024
Total time taken to generate the page: 0.03159 seconds
|