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
b317f945
Commit
b317f945
authored
Jan 03, 2014
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avutil/mathematics: add av_add_stable()
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
de5b6c73
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
1 deletion
+32
-1
APIchanges
doc/APIchanges
+3
-0
mathematics.c
libavutil/mathematics.c
+14
-0
mathematics.h
libavutil/mathematics.h
+14
-0
version.h
libavutil/version.h
+1
-1
No files found.
doc/APIchanges
View file @
b317f945
...
...
@@ -15,6 +15,9 @@ libavutil: 2012-10-22
API changes, most recent first:
2014-01-04 - xxxxxxx - lavu 52.60.100 - mathematics.h
Add av_add_stable() function.
2013-12-22 - xxxxxxx - lavu 52.59.100 - avstring.h
Add av_strnlen() function.
...
...
libavutil/mathematics.c
View file @
b317f945
...
...
@@ -174,3 +174,17 @@ simple_round:
return
av_rescale_q
(
this
,
fs_tb
,
out_tb
);
}
int64_t
av_add_stable
(
AVRational
ts_tb
,
int64_t
ts
,
AVRational
inc_tb
,
int64_t
inc
)
{
AVRational
step
=
av_mul_q
(
inc_tb
,
(
AVRational
)
{
inc
,
1
});
if
(
av_cmp_q
(
step
,
ts_tb
)
<
0
)
{
//increase step is too small for even 1 step to be representable
return
ts
;
}
else
{
int64_t
old
=
av_rescale_q
(
ts
,
ts_tb
,
step
);
int64_t
old_ts
=
av_rescale_q
(
old
,
step
,
ts_tb
);
return
av_rescale_q
(
old
+
1
,
step
,
ts_tb
)
+
(
ts
-
old_ts
);
}
}
libavutil/mathematics.h
View file @
b317f945
...
...
@@ -141,6 +141,20 @@ int64_t av_compare_mod(uint64_t a, uint64_t b, uint64_t mod);
int64_t
av_rescale_delta
(
AVRational
in_tb
,
int64_t
in_ts
,
AVRational
fs_tb
,
int
duration
,
int64_t
*
last
,
AVRational
out_tb
);
/**
* Add a value to a timestamp.
*
* This function gurantees that when the same value is repeatly added that
* no accumulation of rounding errors occurs.
*
* @param ts Input timestamp
* @param ts_tb Input timestamp timebase
* @param inc value to add to ts
* @param inc_tb inc timebase
*/
int64_t
av_add_stable
(
AVRational
ts_tb
,
int64_t
ts
,
AVRational
inc_tb
,
int64_t
inc
);
/**
* @}
*/
...
...
libavutil/version.h
View file @
b317f945
...
...
@@ -56,7 +56,7 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 52
#define LIBAVUTIL_VERSION_MINOR
59
#define LIBAVUTIL_VERSION_MINOR
60
#define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
...
...
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