Skip to content

Commit

Permalink
PlayMoviesDemo.m: Optimize further for fast playing movies.
Browse files Browse the repository at this point in the history
Suppress costly text drawing for any fps >= 30. Skip wait for flip
complete for non-HDR.
  • Loading branch information
kleinerm committed Nov 20, 2023
1 parent e7a300a commit 9b5d2b4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Psychtoolbox/PsychDemos/MovieDemos/PlayMoviesDemo.m
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 9b5d2b4

Please sign in to comment.