Skip to content
Snippets Groups Projects

WIP MR: clock: add vlc_clock_leastsquares

Open Thomas Guillem requested to merge input-clock-leastsquaresfit into master

Filter clock points with a least squares regression. The LSR computation can easily overflow since it sum squares of timestamps multiplied by update count. The overflow occurs after more than 10sec of normal playback. That is why we use several LSR contexts with a given time window (8sec):

t |----------------------------------------------------->
  |---8s---| First LSR (cls->index = 0)
     |---8s---| Second LSR (cls->index = 1)
        |---8s---| Third LSR (cls->index = 2)
           |---8s---| Fourth LSR (cls->index = 3)
              |---8s---| Fifth LSR (cls->index = 0)

One other advantage of using several contexts is that it will be more reactive to a sudden clock rate change.

Note that there is a safeguard if an overflow occurs within that small time window, the time window will be divided by 2 in that case. This case is very unlikely but could happen in case of burst of clock updates.

vlc_clock_leastsquares can be used when we know that the clock source is not precise.

  • LSR vs moving average with clock test "lowprecision"

Screenshot_from_2023-11-03_15-01-47

  • LSR vs moving average with live rtsp

Screenshot_from_2023-11-08_16-46-15

Edited by Thomas Guillem

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
Please register or sign in to reply
Loading