Page 1 of 1

Display image as fast as possible

Posted: Wed Mar 13, 2019 9:52 am
by perfo
I'm trying to display a series of still images as fast as possible.
Hoping for 60fps or more.
I can use any image format if one is preferable to others (involves less decoding maybe)
So a few questions really.
Is OpenMAX going to be the way to go ?

I may be way off beam here but I'm thinking as omxplayer can play a video at this rate (or greater) and it uses OpenMAX then with a bit of surrounding C code (possibly python even) I should be able to load a few images then display them in quick succession.

Is this possible ? Is OpenMax the way to go ? Would anyone know of any examples anywhere that does this , that I could adapt or at least learn how to do it.


PS if anyone saw my last topic , then this is still trying to solve the same problem.

Re: Display image as fast as possible

Posted: Wed Mar 13, 2019 12:02 pm
by 6by9
omxplayer decodes video streams, ie H264, MJPEG, MPEG4, VC-1, MPEG2, VP6, or VP8.
Decoding stills tends to be slower depending on the resolution and format.

I'd suggest you look at MMAL instead of IL unless you have a very specific reason to go IL. IL is a right pain in the proverbial to get right. MMAL was written to (hopefully) overcome many of those limitations.

Certainly MMAL will happily display frames at 60fps if you present them to the video_render component at an appropriate rate. is a simple example should you have decoded the frames yourself and just want to present them.

If you want to use the GPU to decode the images as well, then you need to look at either the video_decode component (for H264, MJPEG, MPEG4, VC-1 MPEG2, VP6, or VP8), or image_decode component (for JPEG, PNG, GIF, BMP, TGA, or PPM files).
H264, MJPEG, MPEG4, VC-1 MPEG2, and JPEG are all hardware accelerated, whilst the others are decoded in software but optimised for a vector processor.

Re: Display image as fast as possible

Posted: Wed Mar 13, 2019 4:48 pm
by perfo
Nope, I'm not brought in to any particular way, as long as I can do it..
I'll go away and read up on MMAL. If I'm understanding it right are you saying MMAL doesn't use hardware acceleration and yet still manages 60fps or more ? That's impressive.. Ok off to read , thanks for the tip. I'll report back ...

Re: Display image as fast as possible

Posted: Wed Mar 13, 2019 4:52 pm
by 6by9
MMAL and IL both use the same elements of hardware acceleleration. IL is not the easiest of APIs to deal with, whilst MMAL hopefully resolves some of those issues but is Pi specific.

Re: Display image as fast as possible

Posted: Wed Mar 13, 2019 6:27 pm
by perfo
being Pi specific isn't a prob at all as that's where I'm hoping to do it all.
I've been digging around the MMAl business for a few hours and not a lot further on than when I started :-(
I had a look at that example you kindly provided but can't work out for the life of me where I'd stick in a Jpeg file. My problem is (I think) my lack of skills in C and the scanti nature of the help files on the net for these things.. No one on the net seems to have produced a simple image display with MMAL. There are some impressive things out there and complete suits of stuff using MMAL but nothing simple enough for me to unpick..
My first thing would have been to load two images at full screen size and get a loop to display them alternating between the two then maybe doing a 1000 iterations to see what speed I could get.
Any other examples out there you know off that display an image ? Thanks again for your assistance..

Re: Display image as fast as possible

Posted: Wed Mar 13, 2019 7:22 pm
by perfo
Ah penny dropped about Jpegs.. there isn't a way to present a Jpeg in your example. It has to be de coded in to a memory location first and the memory location sent to the renderer. So Off to read more on how to use a Image_decoder to get the jpeg in the right format. Still none the wiser what to do with it but it's a journey... (with no sandwiches or fizzy drink).

Re: Display image as fast as possible

Posted: Wed Mar 13, 2019 9:32 pm
by perfo
Nope still no closer.
Is there a way python can render images using the GPU ? Maybe some sort of MMAL interface that hides all the complexities from me ?

Re: Display image as fast as possible

Posted: Thu Mar 14, 2019 8:33 am
by perfo
Problem with me is I believed the hype about basic and vba / visual basic being the future when MS decided to include it in there packages. I started with C , fortran , pascal and the usual crew but dropped them 30 years ago.. Not that I was particularly good then but my older brain has difficulty getting back up to speed...I'm stuck on this now.... :-(