A Real-Time Scene Player

George Fedorov, Kate Levichkina, Peter Jurica

George Fedorov, Peter Jurica, Kate Levichkina, RIKEN BSI, Japan

The Real-Time Scene Player is a computer program for presenting moving visual stimuli on a CRT monitor “in real-time”, i.e. with the refresh rate equal to the one of the monitor with control on the frame loss.

 

The rt-player was designed as a program to present some moving visual stimuli on the computer screen with as high timing accuracy as possible: our main goal was to synchronize the display of the frames of our “moving picture” with the vertical blank events – the events when the electronic gun of the monitor returns from the bottom right of the display to the top left of it to start the next drawing cycle – the refresh cycle of the monitor.

It is rather difficult to fulfill such a goal on a usual environment because most of the modern computer environments imply using some multi-tasking operating system, what means that every application running on such a computer can receive only some limited amount of CPU time to perform its actions – the so-called system quantum. For the most wide-spread versions of the operating systems like Windows such a quantum usually has an order of 10 ms (for example, 6 or 20 ms) and is granted to an application in some uniform but semi-random way.

The properties of a visual perception depend on the characteristics of a stimulus presentation on the CRT monitor. It was shown that the monitor vertical blank events provoke a retinogram reaction under the refresh frequency 76 Hz (Berman, Greenhouse, Bailey, Clear, Raasch, 1991) and the visual evoked potentials in human brain cortex under the refresh frequency 72 Hz (Lyskov, Ponomarev, Sandström, Mild, Medvedev, 1998). Zele and Vingrys also demonstrated the artifacts in visual input, which occur due to the fugacity of CRT monitor phosphor activation under the monitor refresh rate 100Hz (Zele, Vingrys, 2005). Thus it seems obvious that the irregularities of the monitor refresh cycle connected with the system quantum circulation in the multi-tasking operational system lead to the stimulus presentation irregularities and therefore to the errors of a stimulus perception.

There is an obvious way to avoid this problem using a single-task operating environment like DOS (Simpson, Shahani,  Manahilov, 2004), but such a solution might happen to be rather labour-intensive, non-flexible, and somehow limited due to relative obsolescence of the single-tasking environments, lacking of new hardware support, etc.

Another way to bypass this obstacle is to use a real-time operating system, i.e. an operating system that guarantees that (after some requirements are met) the application will receive its quantum often enough to process the necessary operations (this is the standard definition for real-time systems). This seems for us to be a preferable way, so we have selected for our purposes a GNU/Linux OS with the Real-Time Preemptible Kernel Patch, based on a Ubuntu Linux distribution. The latter choice can save much time bypassing many problems like hardware drivers support and software installation, including the necessary libraries and library extensions.

Our application was designed especially for this platform, and was later ported to Windows for the purposes of demonstration and simplifying of creating the experiment scripts.

The latter is a simple plain text file that specifies the sequence and the parameters of the scenes to be displayed, for example, a simple (very simple) scene is just a blank screen, that can be displayed for some specified amount of time, and does not have any parameters. A bit more complicated example of a scene is a disk, that is commonly used as a fixation point, that can be not only displayed for some time period, but also can have at least two parameters: the color and the radius.

The number of the scenes is potentially unlimited; adding a scene for a new series of means just adding some drawing code; this part is usually implemented by a programmer. After being added, the new scene is available via this “experiment scripting mini-language”, that contains just two types of lines: first tells the player to set some parameter, and second instructs it to display some scene for a given amount of time.

The instructions of the first type look like “set param-name <param-value>”, setting some value to a (predefined) scene parameter, and the instructions of the second type look like “call scene-name <duration>”, leading to the scene of the named type to be displayed for a specified duration, for example:

===

; draw a gray disk in the center of the screen

set gray-disk-whiteness 0.2 ; set the intensity of the gray level

set gray-disk-radius 30.0 ; set the radius

call gray-disk 15.0 ; draw the disk for 15 seconds

===

Here you can see that actually there exists the third type of the instructions: the comments, that are successfully ignored by the player and that’s why were missed in the first description. The comments are also very simple – a comment is just any line starting with the ‘;’ character. The comments are ignored before executing the script of the experiment, so it is absolutely safe to add any text here without making any influence at the performance of the scene player.

The scene player can be extended to draw rather complicated stimuli and is currently used to simulate the wagon-wheel effect with different variations in the scenes.

We hope that it can demonstrate the possibility of a low-cost implementation of a visual stimuli presentation system that allows to achieve rather timing accuracy of a one millisecond order.

References

1. David Y. Amamoto, Michael Ariel A low-cost VGA-based stimulus generation and control system, J Neurosci Methods. 46(2):147-57. 1993

2. Varner JL, Rohrbaugh JW. Event related potentials using visual stimulation, Biomed Sci Instrum. 29:423-5., 1993

3. Wollman DE, Palmer LA. Phase locking of neuronal responses to the vertical refresh of computer display monitors in cat lateral geniculate nucleus and striate cortex. J Neurosci Methods. 60(1-2):107-13., 1995

4. Simpson, W. A., Shahani, U., & Manahilov, V.  Illusory percepts of moving patterns due to discrete temporal sampling. Neuroscience Letters, 375, 23–2, 2004

5. Berman SM, Greenhouse DS, Bailey IL, Clear RD, Raasch TW. Human Electroretinogram Responses to Video Displays, Fluorescent Lighting, and Other High Frequency Sources. Optom Vis Sci. 68(8):645-62. 1991

6. Lyskov E, Ponomarev V, Sandström M, Mild KH, Medvedev S. Steady-state visual evoked potentials to computer monitor flicker. Int J Psychophysiol. 28(3):285-90, 1998

7. Zele AJ, Vingrys AJ. Cathode-ray-tube monitor artifacts in neurophysiology. J Neurosci Methods. 141(1):1-7, 2005

8. M. G. Knyazeva, D. C. Kiper, V. Y. Vildavski, P. A. Despland, M. Maeder-Ingvar, and G. M. Innocenti Visual Stimulus–Dependent Changes in Interhemispheric EEG Coherence in Humans. J Neurophysiol 82:3095-3107, 1999.

9. Kevin Dankwardt (2002) “Real Time and Linux". ELJonline, http://www.linuxdevices.com/articles/AT5997007602.html

10. Adrian Nye, Xlib programming manual (1993), O'Reilly & Associates, Inc.

11. OpenGL Architecture Review Board, OpenGL Programming Guide (1993), http://www.glprogramming.com/red/

12. Schneider, W., Eschman, A., & Zuccolotto, A. (2002) E-Prime Users Guide. Pittsburgh: Psychology Software Tools Inc