From 9b5d2b46ab3cd70f353713fb53dfd44fb6864a68 Mon Sep 17 00:00:00 2001 From: Mario Kleiner Date: Mon, 20 Nov 2023 03:57:59 +0100 Subject: [PATCH] PlayMoviesDemo.m: Optimize further for fast playing movies. Suppress costly text drawing for any fps >= 30. Skip wait for flip complete for non-HDR. --- Psychtoolbox/PsychDemos/MovieDemos/PlayMoviesDemo.m | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Psychtoolbox/PsychDemos/MovieDemos/PlayMoviesDemo.m b/Psychtoolbox/PsychDemos/MovieDemos/PlayMoviesDemo.m index f562df1ac..d6917efd7 100644 --- a/Psychtoolbox/PsychDemos/MovieDemos/PlayMoviesDemo.m +++ b/Psychtoolbox/PsychDemos/MovieDemos/PlayMoviesDemo.m @@ -366,7 +366,7 @@ function PlayMoviesDemo(moviename, hdr, backgroundMaskOut, tolerance, pixelForma % Draw some info about movie, but only if needed. In HDR mode we only draw text % once in the first frame, then do not clear the framebuffer later on. Why? Because % text drawing can be a rather expensive operation, impairing high fps playback. - if colorprobe || ~hdr || (i == 0) + if colorprobe || (~hdr && fps < 30) || (i == 0) DrawFormattedText(win, ['Movie: ' moviename ], 'center', 20, 0); if coolstuff DrawFormattedText(win, ['Original URL: ' url '\n\n' credits], 'center', 60, 0); @@ -403,8 +403,9 @@ function PlayMoviesDemo(moviename, hdr, backgroundMaskOut, tolerance, pixelForma % some overhead: Screen('Flip', win, [], 1); else - % Regular without real use of imaging pipeline: - Screen('Flip', win); + % Regular without real use of imaging pipeline. Skip waiting + % for flip completion, to squeeze out a bit more fps: + Screen('Flip', win, [], [], 1); end % Release texture: