Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
78b01823
Commit
78b01823
authored
Feb 07, 2010
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
av_compare_ts()
Originally committed as revision 21671 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
9e5381a2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
mathematics.c
libavutil/mathematics.c
+8
-0
mathematics.h
libavutil/mathematics.h
+9
-0
No files found.
libavutil/mathematics.c
View file @
78b01823
...
...
@@ -136,6 +136,14 @@ int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq){
return
av_rescale_rnd
(
a
,
b
,
c
,
AV_ROUND_NEAR_INF
);
}
int
av_compare_ts
(
int64_t
ts_a
,
AVRational
tb_a
,
int64_t
ts_b
,
AVRational
tb_b
){
int64_t
a
=
tb_a
.
num
*
(
int64_t
)
tb_b
.
den
;
int64_t
b
=
tb_b
.
num
*
(
int64_t
)
tb_a
.
den
;
if
(
av_rescale_rnd
(
ts_a
,
a
,
b
,
AV_ROUND_DOWN
)
<
ts_b
)
return
-
1
;
if
(
av_rescale_rnd
(
ts_b
,
b
,
a
,
AV_ROUND_DOWN
)
<
ts_a
)
return
1
;
return
0
;
}
#ifdef TEST
#include "integer.h"
#undef printf
...
...
libavutil/mathematics.h
View file @
78b01823
...
...
@@ -80,4 +80,13 @@ int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding) av_cons
*/
int64_t
av_rescale_q
(
int64_t
a
,
AVRational
bq
,
AVRational
cq
)
av_const
;
/**
* Compares 2 timestamps each in its own timebases.
* The result of the function is undefined if one of the timestamps
* is outside the int64_t range when represented in the others timebase.
* @returns -1 if ts_a is before ts_b, 1 if ts_a is after ts_b or 0 if they represent the same position
*/
int
av_compare_ts
(
int64_t
ts_a
,
AVRational
tb_a
,
int64_t
ts_b
,
AVRational
tb_b
);
#endif
/* AVUTIL_MATHEMATICS_H */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment