[MPlayer-cvslog] CVS: main/DOCS/tech mpcf.txt,1.96,1.97

Oded Shimon CVS syncmail at mplayerhq.hu
Sat Feb 4 09:53:45 CET 2006


CVS change done by Oded Shimon CVS

Update of /cvsroot/mplayer/main/DOCS/tech
In directory mail:/var2/tmp/cvs-serv8827

Modified Files:
	mpcf.txt 
Log Message:
add compare_ts


Index: mpcf.txt
===================================================================
RCS file: /cvsroot/mplayer/main/DOCS/tech/mpcf.txt,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -r1.96 -r1.97
--- mpcf.txt	4 Feb 2006 08:52:35 -0000	1.96
+++ mpcf.txt	4 Feb 2006 08:53:43 -0000	1.97
@@ -413,6 +413,24 @@
     Note: this calculation MUST be done with unsigned 64 bit integers, and
     is equivalent to (ln*sn)/(d1*d2) but this would require a 96bit integer
 
+compare_ts
+    Compares timestamps from 2 different timebases,
+    if a is before b then compare_ts(a, b) = -1
+    if a is after  b then compare_ts(a, b) =  1
+    else                  compare_ts(a, b) =  0
+
+    Care must be taken that this is done exactly with no rounding errors,
+    simply casting to float or double and doing the obvious
+    a*timebase > b*timebase is not compliant or correct, neither is the
+    same with integers, and
+    a*a_timebase.num*b_timebase.den > b*b_timebase.num*a_timebase.den
+    will overflow. One possible implementation which shouldn't overflow
+    within the range of legal timestamps and timebases is:
+
+    if (convert_ts(a, a_timebase, b_timebase) < b) return -1;
+    if (convert_ts(b, b_timebase, a_timebase) < a) return  1;
+    return 0;
+
 msb_pts_shift
     amount of bits in lsb_pts
     MUST be <16




More information about the MPlayer-cvslog mailing list