Screen/GStreamer: Allow buffering of decoded frames in videosink and other optimizations.

* A new asyncFlag & 4 allows to disable frame dropping if the videosink
  is full. In that case, 'preloadSecs' defines how many video frames
  can be predecoded and buffered in the appsink.

  -> Loss of audio-video sync, but allows to prebuffer video for higher performance
     in some cases.

* A new optional parameter 'specialFlags1' allows to define modus operandi more
  specific:

  Setting of & 1: Try to use YUV texture creation on supported GPU configs.
  Setting of & 2: Disable audio decoding fully.

  -> Both can possibly enhance performance in some cases.

-> Screen for 32-Bit Matlab R2007a on Windows rebuilt & tested.



git-svn-id: http://psychtoolbox-3.googlecode.com/svn/trunk@2516 f5efbe48-b203-0410-9429-fc5e098e5a54
Fixup imread() incompatibilities to Octave 3.6

- Only pass filename to imread(), not redundant image
  type suffix.

- Cleanup a few mlint warnings along the way.



git-svn-id: http://psychtoolbox-3.googlecode.com/svn/trunk@2517 f5efbe48-b203-0410-9429-fc5e098e5a54
Demos/Tests: Some fixups / cleanups of mlint warnings.



git-svn-id: http://psychtoolbox-3.googlecode.com/svn/trunk@2518 f5efbe48-b203-0410-9429-fc5e098e5a54
AssertOpenGL: Sneak in Octave 3.6 short-circuit operators compatibility hack.

Enable Matlab-style evaluation of | and & logical operators
as short-circuit && and || operators on logical input
inside if/while conditions.

This avoids interpreter warnings on Octave 3.6 and later.
We can't fix all instances of | and & (ab)use yet, because
then MK couldn't do any testing of beta releases for
Matlab versions < R2007a anymore.

=> This needs to get revisited once we drop pre-R2007a support
completely.



git-svn-id: http://psychtoolbox-3.googlecode.com/svn/trunk@2519 f5efbe48-b203-0410-9429-fc5e098e5a54
DaqAInScanContinue: Allow live retrieval of data.

Allows to retrieve chunks of captured data while capture
is ongoing, instead of the need to stop aquisition via
DaqAInScanEnd, just to get to the data.

-> DaqAinScan.m modified accordingly.
-> Untested!



git-svn-id: http://psychtoolbox-3.googlecode.com/svn/trunk@2520 f5efbe48-b203-0410-9429-fc5e098e5a54
PsychHID/Linux: Fix bug/regression in PsychHID('KbCheck', [], keylist)

A tiny mistake in the new KbCheck code for Linux causes KbCheck to totally
screw up its results iff and only iff both of the following is true:

a) The default system keyboard [] is queried.
b) A keylist of enabled keys is passed, e.g., as set via RestrictKeysForKbCheck().

This should fix it. Recompile and test pending.



git-svn-id: http://psychtoolbox-3.googlecode.com/svn/trunk@2522 f5efbe48-b203-0410-9429-fc5e098e5a54
Screen: Optimize Screen('MakeTexture') path for uint8 luminance textures.

For uint8 single-layer input matrices for creation of
LUMINANCE8 textures, we can avoid the memcpy() completely
if client storage isn't enabled. Pass pointer to input
byte matrix directly to texture creation routine.

-> "Zero-Copy" texture creation.
-> Reduces maketexture time by a factor of > 2x.

-> Also tweak MakeTextureTimingTest2 a bit for higher efficiency
   in 3-channel RGB case.

=> Screen for 32-bit Matlab on OS/X Intel rebuilt & tested.



git-svn-id: http://psychtoolbox-3.googlecode.com/svn/trunk@2523 f5efbe48-b203-0410-9429-fc5e098e5a54
Fix for case where dir is passed.  That info was not being passed to LoadCalFile, resulting in a failure to preserve older calibrations when a new one is saved in case where dir was explicitly passed.  DHB

git-svn-id: http://psychtoolbox-3.googlecode.com/svn/trunk@2524 f5efbe48-b203-0410-9429-fc5e098e5a54
Screen('MakeTexture'): Add new fast-path for planar texture creation.

If the optional 'specialFlags' flag is set to 4 and the GPU supports
FBO's and rectangle textures and shaders, and the input image is
sufficiently small (size * channels < max_texture_size of GPU), then
we try to store the texture data of multi-channel LA, RGB or RGBA
textures in a single, single channel Luminance texture.

Texel components are not stored pixel-interleaved as usual, but
in a planar fashion, the data blocks for R, G, B, A back-to-back
concatenated to each other. This way, texture creation can happen
without the need for copies at all (zero-copy) for uint8->uint8
textures, and without need for at least planar->interleaved
conversion for double input formats, avoiding the potential
cache trashing and memory controller bank-switching and other
nastyness. A GLSL shader needs to convert planar->interleaved
at 'DrawTexture' time to handle this format which is not supported
in hardware. Also, on use of such a texture as offscreen window or
in 'TransformTexture' or in normalization of its orientation, the
normalize routine must perform a interleaving blit to convert
the texture from planar to interleaved on the fly.

The format suffers certain restrictions when scrolling or
on borders. Therefore it is not enabled by default, but a
opt-in via specialFlags == 4.

Preliminary benchmark shows speedups of MakeTexture + DrawTexture
of anywhere between 2x (Luminance), 4x (RGBA), and 12x - 17x for
LA or RGB textures on the Mobility Radeon X1600. Not bad, at
least for this test case n=1.

-> MakeTextureTimingTest2 refined to test this new path.
-> Screen for OS/X Intel + Matlab rebuilt & tested.



git-svn-id: http://psychtoolbox-3.googlecode.com/svn/trunk@2525 f5efbe48-b203-0410-9429-fc5e098e5a54
Screen: Compile 'MakeTexture' subfunction with -O3 optimizations on OS/X.

-> Screen for OS/X Intel + Matlab rebuilt and tested. Can produce a +30%
   speedup for certain cases in Screen('MakeTexture').



git-svn-id: http://psychtoolbox-3.googlecode.com/svn/trunk@2526 f5efbe48-b203-0410-9429-fc5e098e5a54
MakeTextureTimingTest2: Expose more options as function arguments.

Allows easy testing of different specialFlags, precision values.
Preheats before benchmarking.



git-svn-id: http://psychtoolbox-3.googlecode.com/svn/trunk@2527 f5efbe48-b203-0410-9429-fc5e098e5a54
Screen/Maketexture help text: Clarify speedup of planar texture mode.

Hints to major speedup for LA8, RGB8 textures in general,
and L8, LA8, RGB8, RGBA8 textures when created from uint8
matrices (imread() et al.).

This based on benchmark results on a Core2Duo machine with
RV530 GPU, for the thesis.



git-svn-id: http://psychtoolbox-3.googlecode.com/svn/trunk@2528 f5efbe48-b203-0410-9429-fc5e098e5a54
Screen: Tune GStreamer movie playback a tiny bit more.

Now a wait for arrival of a new frame in Screen('GetMovieImage')
is executed in a more efficient manner with GStreamer than with
Quicktime.

The old implementation used polling in 1 msec intervals for
arrival of new frames, if a blocking wait was requested.

The new implementation will instead truly blocking wait code
inside the GStreamer backend to wait for new frames in a
cpu friendly manner, with a timeout of 0.5 seconds.

This should further reduce cpu load by a percent or so,
but more importantly, reduce the processing delay on
arrival of a new frame to the absolute system minimum.

The old polling implementation has a (stastically expected)
delay of 0.5 msecs. In reality this would be true on Linux or
OS/X, but on Windows with its shoddy scheduler, the value
might be anywhere between 0.5 msecs and 3 msecs on a typical
system.



git-svn-id: http://psychtoolbox-3.googlecode.com/svn/trunk@2529 f5efbe48-b203-0410-9429-fc5e098e5a54
Linux: Screen, PsychHID for 64-Bit Octave & Matlab rebuilt.

-> Latest Screen improvements to MakeTexture and GStreamer.
-> Bugfix for PsychHID KbCheck off-by-one bug.



git-svn-id: http://psychtoolbox-3.googlecode.com/svn/trunk@2530 f5efbe48-b203-0410-9429-fc5e098e5a54
MOGL: glext_edit.h -- Strip it down to the essentials...

Out of the (gasp!) multiple thousands lines, only 19 were
actually used by our mogl parser/code generator for anything.

Remove all unused definitions, so one can see what the file
actually does/contains...

-> Verified to produce exactly the same post-processing output.



git-svn-id: http://psychtoolbox-3.googlecode.com/svn/trunk@2531 f5efbe48-b203-0410-9429-fc5e098e5a54
glext_edit.h: Replace old file by file derived from OpenGL registry of Khronos Group.

* Derive MOGL's glext_edit.h from official glext.h 2012 file of OpenGL registry,
  instead of old glext.h file from Apple OS/X Tiger SDK.

* Adapt our autocode.m parser to handle slightly different file format.

* Verified to produce identical output/results, so this is fully compatible.

Why do we do this? Because the glext.h file from Khronos / OpenGL is licensed
in a BSD/MIT style license, instead of an outdated/confusing mishmash of
SGI and Apple license.

This should simplify integration of Psychtoolbox into NeuroDebian / Debian.



git-svn-id: http://psychtoolbox-3.googlecode.com/svn/trunk@2532 f5efbe48-b203-0410-9429-fc5e098e5a54
Add our default welcomeWait.gif to managementtools folder.

So we can create customized welcome images if we want to...



git-svn-id: http://psychtoolbox-3.googlecode.com/svn/trunk@2533 f5efbe48-b203-0410-9429-fc5e098e5a54
Screen: Add support for loadable startup splash image.

If a valid PPM RGB image file with 24 bpp, 8 bpc and
a maximum size of 1280 x 1024 pixels is found in the
Psychtoolbox/PsychBasic/ folder as WelcomeSplash.ppm
then this image file is loaded and presented during
display calibration at onscreen window open time.

If no such file can be loaded, the old hard-coded,
compiled in "Welcome to the Psychtoolbox" splash
image is used - or nothing on MS-Windows.

At first execution of Screen('Openwindow') after
a fresh Psychtoolbox installation or Psychtoolbox
update / setup, the splash image screen is now
shown for at least 10 seconds, instead of the
typically < 1 second. Each successive invocation
takes as long as before. This allows to direct the
users attention to interesting information displayed
as splash image after a ptb update.

The current WelcomeSplash.ppm file is an identical
copy of our old "Welcome" screen, but may be replaced
in the future with something more interesting.

The ppm loader was tested with ppm files generated
by "The GIMP" image manipulation program, but should
probably work with other ppm's as well.

=> Screen for 32-Bit Matlab on OS/X Intel rebuilt & tested.



git-svn-id: http://psychtoolbox-3.googlecode.com/svn/trunk@2534 f5efbe48-b203-0410-9429-fc5e098e5a54
MS-Windows: Screen, PsychPortAudio for Octave and Matlab R2007a rebuilt.



git-svn-id: http://psychtoolbox-3.googlecode.com/svn/trunk@2535 f5efbe48-b203-0410-9429-fc5e098e5a54
OSX: Screen, PsychPortAudio for Octave and Matlab on IntelMac rebuilt.



git-svn-id: http://psychtoolbox-3.googlecode.com/svn/trunk@2536 f5efbe48-b203-0410-9429-fc5e098e5a54