Algorithm-MOS
view release on metacpan or search on metacpan
lib/Algorithm/MOS.pm view on Meta::CPAN
# Implement a basic curve - deduct 4 for the r_value at 160ms of latency
# (round trip). Anything over that gets a much more agressive deduction
if ($effective_latency < 160) {
$r_value = 93.2 - ($effective_latency / 40);
}
else {
$r_value = 93.2 - ($effective_latency - 120) / 10;
}
# Now, let's deduct 2.5 r_value per percentage of packet_loss
$r_value = $r_value - ($packet_loss * 2.5);
# Convert the r_value into an MOS value. (this is a known formula)
$ret_val = 1 +
(0.035) *
$r_value +
(0.000007) *
$r_value *
($r_value - 60) *
(100 - $r_value);
( run in 0.316 second using v1.01-cache-2.11-cpan-05162d3a2b1 )