Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
65db0587
Commit
65db0587
authored
Jun 09, 2010
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add av_compare_mod()
Originally committed as revision 23551 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
130b096a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
0 deletions
+16
-0
mathematics.c
libavutil/mathematics.c
+7
-0
mathematics.h
libavutil/mathematics.h
+9
-0
No files found.
libavutil/mathematics.c
View file @
65db0587
...
...
@@ -144,6 +144,13 @@ int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b){
return
0
;
}
int64_t
av_compare_mod
(
uint64_t
a
,
uint64_t
b
,
uint64_t
mod
){
int64_t
c
=
(
a
-
b
)
&
(
mod
-
1
);
if
(
c
>
(
mod
>>
1
))
c
-=
mod
;
return
c
;
}
#ifdef TEST
#include "integer.h"
#undef printf
...
...
libavutil/mathematics.h
View file @
65db0587
...
...
@@ -94,5 +94,14 @@ int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const;
*/
int
av_compare_ts
(
int64_t
ts_a
,
AVRational
tb_a
,
int64_t
ts_b
,
AVRational
tb_b
);
/**
* Compare 2 integers modulo mod.
* That is we compare integers a and b for which only the least significant log2(mod) bits are known
* @param mod must be a power of 2
* @returns a negative value if a is smaller than b
* a positiv value if a is greater than b
* 0 if a equals b
*/
int64_t
av_compare_mod
(
uint64_t
a
,
uint64_t
b
,
uint64_t
mod
);
#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