Author Topic: Simplest possible slideshow software with custom interval time down to millisec.  (Read 1388 times)

0 Members and 1 Guest are viewing this topic.

Offline ricko_ukTopic starter

  • Super Contributor
  • ***
  • Posts: 1110
  • Country: gb
Hi,
I just joined this forum so hopefully I am posting in the right area and according to the guidelines.

I have not used Visual C++/MFC in 18 years... So the simplest and fastest coding solution for the software below is what I am looking for. Not even menu, open/save or anything else. Something I can make ideally in a day or even just few hours...

In summary I want to make (using VC++) the following:

1) a slideshow that displays a set of images in a random order. Such images are located in the same folder where the EXE file is located

2) the images are displayed in RANDOM sequence for XX number of times at RANDOM YY time intervals (from tens of milliseconds to seconds)

3) the ONLY two UI items are the Play Slideshow button and a small table where in each row I specify a) the number that a full set of images in the folder is displayed, b) minimum display time in milliseconds and c) maximum display time again in millisecond. (note, it will be always at least 10 milliseconds display time minimum).

4) it is just for me so a single EXE file with NO installer, no fancy UI, no open file, no images location folder choosing, no save of settings or anything else. I can fill in the table every time I run the software.

5) only in Windows

The goal is to make it as fast as possible. Hopefully just few hours??

The main issue I have not used Visual C++ for over 18 years so don't remember much about it.

Can you please give me some pointers as to how to implement it.

Thank you :)
 

Offline JohnnyMalaria

  • Super Contributor
  • ***
  • Posts: 1154
  • Country: us
    • Enlighten Scientific LLC
Dusting off the cobwebs of my VC++ days and writing real-time video processing software, you will quickly run into the problems associated with the fact that Windows is not a real-time operating system. Although there are simple Sleep commands, they have at best 1ms precision, often 10ms and it depends on the hardware the OS is running on. And there's no guarantee Windows will return to your process after the requested interval.

So, you have it get into the painful world of high precision multimedia timers etc. Trying to get Windows to do anything on your terms as far as timing goes is pretty much impossible because it decides what processes and threads to start and suspend, and when.
,
This will give some idea: https://www.codeguru.com/cpp/w-p/system/timers/article.php/c5759/Creating-a-HighPrecision-HighResolution-and-Highly-Reliable-Timer-Utilising-Minimal-CPU-Resources.htm

What I would do is create a memory mapped file, write a series of images to it and then use Win32 API media player functions to play a video. Basically, set up a memory mapped file as a circular buffer. I'd probably use an AVI container with uncompressed YUV images and keep changing the contents of the buffer. By using a video, you can set a frame rate. I don't know how high a frame rate could be achieved. You are effectively asking for up to 100 frames per second.

Alternatively, you spawn a separate thread that just keeps polling the high precision timer and calls your main thread when a certain time has elapsed. You need to be smart about that, though, to avoid excessive CPU use etc.

Just a consciousness stream that brought up some painful memories :)
 

Offline ricko_ukTopic starter

  • Super Contributor
  • ***
  • Posts: 1110
  • Country: gb
Thank you Johnny,
that is very interesting and although it all makes sense, I would have no idea where/how to start to implement it.

I can relax the minimum time to perhaps 50ms. But for the first version timing accuracy is not that critical, at least for this version.

Someone suggested getting some example code of the simplest possible slideshow and try to tweak that. But no idea where to find such examples that are extremely simple for me to understand the code of.

Any ideas where?

Thank you again! :)
 

Offline DrG

  • Super Contributor
  • ***
  • !
  • Posts: 1199
  • Country: us
I would look into tachistoscope as a search key word rather than slideshow. I would think that you will need to load in all your images into memory and do a lot to deal with timing. Just looking around for a bit I found this jpg (from 1999) that even as some source code.
  https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&cad=rja&uact=8&ved=2ahUKEwiikYvFptbtAhUN11kKHdt7D4EQFjADegQIBxAC&url=https%3A%2F%2Flink.springer.com%2Fcontent%2Fpdf%2F10.3758%2FBF03207728.pdf&usg=AOvVaw2HfPjCAytXYizylBB2WwS_

Not much help I suppose but it could reveal a few helpful items
- Invest in science - it pays big dividends. -
 

Offline ricko_ukTopic starter

  • Super Contributor
  • ***
  • Posts: 1110
  • Country: gb
Thank you Drg.
Very interesting about the tachistoscope.

That link does now work, could you please check it?

I also google tachistoscope but could not find much about software.
 

Offline DrG

  • Super Contributor
  • ***
  • !
  • Posts: 1199
  • Country: us
Thank you Drg.
Very interesting about the tachistoscope.

That link does now work, could you please check it?

I also google tachistoscope but could not find much about software.

Hmm https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&ved=2ahUKEwjR8fPtq9btAhUo01kKHX5BBlUQFjABegQIAxAC&url=https%3A%2F%2Flink.springer.com%2Fcontent%2Fpdf%2F10.3758%2FBF03207728.pdf&usg=AOvVaw2HfPjCAytXYizylBB2WwS_

That works for me and opens up the prompt for how you want to load it - firefox or adobe

It is a journal article and you can see the reference here https://pubmed.ncbi.nlm.nih.gov/10495818/ but for the full pdf either get that link to work or put "The PC tachistoscope has 240 pages" into Google and the pdf link will come up from springer.

Here is another ref https://www.semanticscholar.org/paper/Tachistoscopic-presentation-and-millisecond-timing-Haussmann/4405b50ccabec6d193187fdb2f83e7b30bc99e7d you will need to request a reprint or otherwise find the article.

Years ago, there were many labs into using PCs for this. It sounds like you may want something that specific. Good luck.

Edit: try the link here https://www.semanticscholar.org/paper/The-PC-tachistoscope-has-240-pages-Myors/cd20f576f738f83eaa457d4d6918baaf0ebf0958
« Last Edit: December 18, 2020, 01:27:40 am by DrG »
- Invest in science - it pays big dividends. -
 

Offline ricko_ukTopic starter

  • Super Contributor
  • ***
  • Posts: 1110
  • Country: gb
Thank you very much DrG! :)

It was not working on Chrome or Firefox (not even the pop-up) but managed to open it with Edge.

Very interesting. Thank you
 

Offline snarkysparky

  • Frequent Contributor
  • **
  • Posts: 418
  • Country: us
you can use octave or matlab to create a video from a string of image files. Each with a programmed number of video frames to display the image.

So your video is composed of still images repeated for random durations.

 

Offline ricko_ukTopic starter

  • Super Contributor
  • ***
  • Posts: 1110
  • Country: gb
Thank you snarkysparky :)

That is an interesting solution! Unfortunately I haven't used matlab since over 20 years ago and would have to start pretty much form scratch. And that might be longer to re-learn perhaps?
 

Offline JohnnyMalaria

  • Super Contributor
  • ***
  • Posts: 1154
  • Country: us
    • Enlighten Scientific LLC
ricko_uk -  just to give you a taste of some of the fun and games you'll likely face...

Achieving the most mundane of goals with VC++ can take forever. With the SDKs, you get access to the Win32, GdiPlus APIs etc. Something as trivial as displaying a bitmap can get tedious to program and slow to execute. Displaying a single image requires rendering in your main RAM. The OS then sends it to the display's buffer. To get higher performance, you can use APIs such as DirectDraw and DirectShow (caveat - it's been a few years since I last did any of this so I don't know the current state of things). These permit, for example, direct rendering to the GPU RAM. But these two frameworks rely heavily on interface libraries. If you haven't used those before and you are in the VC++ environment, oh boy. It is very powerful but very tedious to program and hell to debug.

One option to consider, is the DirectShow framework and the Filter Graph concept. With this, you effectively write a plug-in and the framework takes care of all the timing, rendering etc. It's powerful but has a s-t-e-e-p learning curve. I wrote an application using these concepts that processed DV format video in real-time, either from a file or an external DV source. Microsoft provides all the low-level stuff such as controlled the transport of the hardware, file transfer, audio rendering etc etc.

For your application, a DirectShow application would be lightweight. Most of my effort went into the user interface and the help file :)
 

Offline JohnnyMalaria

  • Super Contributor
  • ***
  • Posts: 1154
  • Country: us
    • Enlighten Scientific LLC
I attached an example of a lab instrument I developed that used the DirectShow/Filter Graph concept to characterize the flow of powders. It required comparing consecutive frames arriving in real-time from a camcorder every 30ms. The filter I wrote performed all the calculations and dumped the results to a text file.
 
The following users thanked this post: ricko_uk

Offline BravoV

  • Super Contributor
  • ***
  • Posts: 7549
  • Country: 00
  • +++ ATH1
Not sure if this fits into the requirement -> https://sourceforge.net/projects/jpegview/

Suggesting try download, install and read the .INI file, its one of the fastest image file viewer in Windows as it supports multicores, the slide show speed can be set up to 100fps  :o, and almost no menu at all, or at least very minimalist approach.

Again, once installed, suggesting to read the JPEGView.INI file at the program's folder where it was installed, it has whole documentation there.  :-+

Btw, its open source.  :P
« Last Edit: December 18, 2020, 05:44:01 pm by BravoV »
 

Offline ricko_ukTopic starter

  • Super Contributor
  • ***
  • Posts: 1110
  • Country: gb
Thank you Johnny and BravoV. :)

BravoB that is almost exactly what I am looking for! If it could set different display duration times at different times during the slideshow (i.e. first x minutes transition time is 1 second, then for y minutes it is 0.2 seconds etc.) then that would be exactly what I am looking for!

Thank you VERY much! :)
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf