@observertc/client-monitor-js
Version:
ObserveRTC Client Integration Javascript Library
1 lines • 489 B
JavaScript
import{clamp as t}from"../utils/common";export function calculateAudioMOS(o,n,r,u,c,a){const e=20+r+u/2,l=c?8:o?t(55-4.6*Math.log(o),0,30):6,i=t(100-(l+n/(n+(a?20:10))*(100-l))-(.03*e+(e>150?.1*e-150:0)),0,100),M=1+.035*i+i*(i-60)*(100-i)*7/1e6;return t(Math.round(100*M)/100,1,5)}export function calculateVideoMOS(o,n,r,u,c,a,e,l){const i=u+c/2;if(e<1)return 1;const M=("vp9"===a?1.2:1)*o/(n*r)/e,h=t(.56*Math.log(M)+5.36,1,5)-1.9*Math.log(l/e)-.002*i;return t(Math.round(100*h)/100,1,5)}