diff options
author | ods15 <ods15@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-02-04 08:53:43 +0000 |
---|---|---|
committer | ods15 <ods15@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-02-04 08:53:43 +0000 |
commit | a3a2ac9da674c6caaa25666c8574d4b48630d3f6 (patch) | |
tree | 4da9cd7159598fc3a9c77ba205c2690e13c12dd0 | |
parent | ebcf3473e58de378da552ad31d293dcf98aec5b3 (diff) |
add compare_ts
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17533 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r-- | DOCS/tech/mpcf.txt | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/DOCS/tech/mpcf.txt b/DOCS/tech/mpcf.txt index 3fed86fd5e..7a0076bdbd 100644 --- a/DOCS/tech/mpcf.txt +++ b/DOCS/tech/mpcf.txt @@ -413,6 +413,24 @@ convert_ts 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 |