Blur Busters Forums

Who you gonna call? The Blur Busters! For Everything Better Than 60Hz™ Skip to content

[Mouse Mod] Got the gear, how to best use it?

Everything about input lag. Tips, testing methods, mouse lag, display lag, game engine lag, whole input lag chain, VSYNC OFF vs VSYNC ON, and more! Input Lag Articles on Blur Busters.

Re: [Mouse Mod] Got the gear, how to best use it?

Postby Chief Blur Buster » 31 Aug 2017, 11:27

sharknice wrote:It seems like reviewing the videos could be automated pretty easily. I wonder if there is any free software out there to do it. If there isn't it doesn't seem like it would be too hard to make.

We discussed this. We're considering automated video analysis methods.

I have enough skills to script the analysis in ffmpeg or Avisynth, and Jorimt was the one who was doing the testing. The problem is we have so many projects but not enough time to create the automated video analysis tool.

Hey, since it's so simple, maybe we all can make this a crowdsourced effort?

Simple script for ffmpeg/Avisynth or some other video processing utility.

Simple frame differential detectors make very _easy_ graphing. Basically add all pixels together (SUM(luma of all pixels)), then graph the delta of those values from adjacent frames along a graph axis. There will be a big bump (pulse) on the LED-ON event, and another big bump (pulse) on the screen-reaction event. The time between the graph pulses is the milliseconds. Run a threshold-detecting Excel script on the pulses, and viola -- automatic input lag measurement.

Should be easy with some kind of homebrew ffmpeg or Avisynth script of some kind.

The pseudocode is:

Code: Select all
// PSEUDO CODE: Please port accordingly.
// Output a CSV graph to detect sudden frame changes & scene changes in a video
// ALGORITHM CREDIT: Mark Rejhon of Blur Busters
// LICENSE: CC-by-SA 3.0

int frameCount = GetNumberOfFramesOfVideo();
int vertRes = GetVerticalResolutionOfVideo();
int horizRes = GetHorizontalResolutionOfVideo();

// An array of all pixels of all video frames. 
// Normally we'd load one frame at a time, but this is just psuedocode. :-)
uint[,,] = videoPixels[frameCount, vertRes, horizRes];
uint[] = frameTotalLuma[frameCount];

// Loop to compute all frame differentials
for (uint frameNum = 0; frameNum < frameCount; frameNum++) {
   // Add together brightness of all pixels in one video frame
   int total = 0
   for (uint x = 0; x < horizRes; x++) {
      foreach (uint y = 0; y < vertRes; y++) {
         total += GetBrightnessOfPixel(videoPixels[frameNum][x][y]);
      }
   }
   frameTotalLuma[frameNum] = total;
}

// Now rerun loop to output a differential CSV file to allow graphing
for (uint frameNum = 1; frameNum < frameCount; frameNum++)
{
   int frameDifferential = frameTotalLuma(frameNum - 1) - frameTotalLuma(frameNum);
   WriteRowToCSV(ABS(frameDifferential));
}

// Now load into an Excel or Google Sheets graph.
// Time in long axis (1ms per CSV row for 1000fps camera video), and CSV value in tall axis.
// First curve peak is LED on, second curve peak is screen reaction
// A macro can easily detect these peaks and automatically compute lag.


Noise in picture doesn't matter, it generally averages out. The video-change signal (peaks) will far exceed video noise.

Assuming mouse button press is done offscreen and you point video only to LED + screen (no other video activity) -- the peaks will be extremely umabiguously clear; this automation works for single video clips (one attempt) but not on multiple

I worked on home theater video processors and designed the algorithm for the world's first open-source 3:2 pulldown detector more than 15 years ago (Year 2000 from Internet Archive; has my full name!) back in the days of Pentium 233 MMX days, so I'm familiar with simple frame-differential detectors. This was the day when expensive Faroudja line doubled reigned the day, and hobbyists finally wrote something open source that worked with real-time deinterlacing on Hauppauge TV cards -- in 2001 it was the first time computers became fast enough to convert movies in 480i nearly flawlessly into 480p in real time in a software algorithm (MMX assembly loop) from a capture card -- turning an ordinary PC into a replacement for a $5000+ Faroudja line doubler.

But today, with Avisynth, ffmpeg, the job is so much easier, this type of processing is sort of child's play for someone with sufficient time.

Feel free to port my psuedocode into an Avisynth or ffdshow script, and post here, I've posted the algorithm to me in CC-by-SA 3.0.
We were going to do this ourselves, and to help Blur Busters automate future video tests quicker.

[If you're a reviewer of another site or even competitor, and decide to use this algorithm, please link & credit Blur Busters as credit for piggybacking off a surprisingly simple, highly-scriptable algorithm. Very much appreciated!]
Head of Blur Busters - BlurBusters.com | TestUFO.com | Follow @BlurBusters on Twitter!
To support Blur Busters: Official List of Best Gaming Monitors | G-SYNC | FreeSync | Ultrawide
User avatar
Chief Blur Buster
Site Admin
 
Posts: 3756
Joined: 05 Dec 2013, 15:44

Previous

Return to Input Lag

Who is online

Users browsing this forum: No registered users and 4 guests