Skip to content

vout: improve chrono estimation on start

Romain Vimont requested to merge rom1v/vlc:chrono_on_start into master

During a new measurement, the current state of the chrono were always weighted in the same way, regardless of the number of samples that contributed in the values. As a consequence, the initial (arbitrary) value was too impactful.

Instead, until there are enough values (according to the provided "shift"), weight the average and mean absolute deviation by the number of contributing samples.

In particular, the first real sample overrides the arbitrary initial average.


I made this change to improve the "prepare" estimation on this !324, but it is quite independent, and I would like to submit it beforehand to keep the other MR focused on display lock changes.

Here is how the chrono average (avg) and mean absolute deviation (mad) evolve for the whole "render" estimation on master.

Before the change, the avg starts at the initial arbitrary value and mad starts at avg/2, then they take some time to adjust to the actual sample duration (the "estimated" duration, as given by vout_chrono_GetHigh(), is just avg + 2 * mad): chrono_before

After the change, the initial arbitrary value is only used for the first estimation (before the first sample) avg. It is immediately discarded after the first sample (which happens to be far longer than the others in practice). Then, the average and mad accurately represent the actual samples (they are affected by the first longer sample, but correctly weighted by its contribution in the average/deviation): chrono_after

But mostly, this change allows to get a correct "prepare" estimation on start: !324 (comment 274263)

prepare_estim3

Edited by Romain Vimont

Merge request reports