[vlc-commits] [Git][videolan/vlc][master] vout: rename chrono "var" to "mad"
Romain Vimont (@rom1v)
gitlab at videolan.org
Fri Jul 16 05:45:45 UTC 2021
Romain Vimont pushed to branch master at VideoLAN / VLC
Commits:
f214ead3 by Romain Vimont at 2021-07-16T05:34:35+00:00
vout: rename chrono "var" to "mad"
The name "var" is misleading: the vout chrono actually uses a "mean
absolute deviation", not a "variance" (squared deviation) or "standard
deviation".
- - - - -
1 changed file:
- src/video_output/chrono.h
Changes:
=====================================
src/video_output/chrono.h
=====================================
@@ -29,8 +29,8 @@ typedef struct {
int shift;
vlc_tick_t avg;
- int shift_var;
- vlc_tick_t var;
+ int shift_mad;
+ vlc_tick_t mad; /* mean absolute deviation */
vlc_tick_t start;
} vout_chrono_t;
@@ -40,22 +40,25 @@ static inline void vout_chrono_Init(vout_chrono_t *chrono, int shift, vlc_tick_t
chrono->shift = shift;
chrono->avg = avg_initial;
- chrono->shift_var = shift+1;
- chrono->var = avg_initial / 2;
+ chrono->shift_mad = shift+1;
+ chrono->mad = avg_initial / 2;
chrono->start = VLC_TICK_INVALID;
}
+
static inline void vout_chrono_Start(vout_chrono_t *chrono)
{
chrono->start = vlc_tick_now();
}
+
static inline vlc_tick_t vout_chrono_GetHigh(vout_chrono_t *chrono)
{
- return chrono->avg + 2 * chrono->var;
+ return chrono->avg + 2 * chrono->mad;
}
+
static inline vlc_tick_t vout_chrono_GetLow(vout_chrono_t *chrono)
{
- return __MAX(chrono->avg - 2 * chrono->var, 0);
+ return __MAX(chrono->avg - 2 * chrono->mad, 0);
}
static inline void vout_chrono_Stop(vout_chrono_t *chrono)
@@ -64,13 +67,13 @@ static inline void vout_chrono_Stop(vout_chrono_t *chrono)
/* */
const vlc_tick_t duration = vlc_tick_now() - chrono->start;
- const vlc_tick_t var = llabs( duration - chrono->avg );
+ const vlc_tick_t abs_diff = llabs( duration - chrono->avg );
/* Update average only if the current point is 'valid' */
if( duration < vout_chrono_GetHigh( chrono ) )
chrono->avg = (((1 << chrono->shift) - 1) * chrono->avg + duration) >> chrono->shift;
- /* Always update the variance */
- chrono->var = (((1 << chrono->shift_var) - 1) * chrono->var + var) >> chrono->shift_var;
+ /* Always update the mean absolute deviation */
+ chrono->mad = (((1 << chrono->shift_mad) - 1) * chrono->mad + abs_diff) >> chrono->shift_mad;
/* For assert */
chrono->start = VLC_TICK_INVALID;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/f214ead36383935a4eed04558869dcf112da3479
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/f214ead36383935a4eed04558869dcf112da3479
You're receiving this email because of your account on code.videolan.org.
More information about the vlc-commits
mailing list