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
5f63d108
Commit
5f63d108
authored
Jul 14, 2004
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simplify
Originally committed as revision 3314 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
80d1c272
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
39 deletions
+26
-39
utils.c
libavcodec/utils.c
+26
-39
No files found.
libavcodec/utils.c
View file @
5f63d108
...
...
@@ -786,49 +786,36 @@ char av_get_pict_type_char(int pict_type){
}
int
av_reduce
(
int
*
dst_nom
,
int
*
dst_den
,
int64_t
nom
,
int64_t
den
,
int64_t
max
){
int
exact
=
1
,
sign
=
0
;
int64_t
gcd
;
assert
(
den
!=
0
);
if
(
den
<
0
)
return
av_reduce
(
dst_nom
,
dst_den
,
-
nom
,
-
den
,
max
);
sign
=
nom
<
0
;
nom
=
ABS
(
nom
);
gcd
=
ff_gcd
(
nom
,
den
);
nom
/=
gcd
;
den
/=
gcd
;
if
(
nom
>
max
||
den
>
max
){
AVRational
a0
=
{
0
,
1
},
a1
=
{
1
,
0
};
exact
=
0
;
for
(;;){
int64_t
x
=
nom
/
den
;
int64_t
a2n
=
x
*
a1
.
num
+
a0
.
num
;
int64_t
a2d
=
x
*
a1
.
den
+
a0
.
den
;
if
(
a2n
>
max
||
a2d
>
max
)
break
;
nom
%=
den
;
a0
=
a1
;
a1
=
(
AVRational
){
a2n
,
a2d
};
if
(
nom
==
0
)
break
;
x
=
nom
;
nom
=
den
;
den
=
x
;
}
nom
=
a1
.
num
;
den
=
a1
.
den
;
AVRational
a0
=
{
0
,
1
},
a1
=
{
1
,
0
};
int
sign
=
(
nom
<
0
)
^
(
den
<
0
);
int64_t
gcd
=
ff_gcd
(
ABS
(
nom
),
ABS
(
den
));
nom
=
ABS
(
nom
)
/
gcd
;
den
=
ABS
(
den
)
/
gcd
;
if
(
nom
<=
max
&&
den
<=
max
){
a1
=
(
AVRational
){
nom
,
den
};
den
=
0
;
}
assert
(
ff_gcd
(
nom
,
den
)
==
1
);
while
(
den
){
int64_t
x
=
nom
/
den
;
int64_t
next_den
=
nom
-
den
*
x
;
int64_t
a2n
=
x
*
a1
.
num
+
a0
.
num
;
int64_t
a2d
=
x
*
a1
.
den
+
a0
.
den
;
if
(
a2n
>
max
||
a2d
>
max
)
break
;
a0
=
a1
;
a1
=
(
AVRational
){
a2n
,
a2d
};
nom
=
den
;
den
=
next_den
;
}
assert
(
ff_gcd
(
a1
.
num
,
a1
.
den
)
==
1
);
*
dst_nom
=
sign
?
-
nom
:
no
m
;
*
dst_den
=
den
;
*
dst_nom
=
sign
?
-
a1
.
num
:
a1
.
nu
m
;
*
dst_den
=
a1
.
den
;
return
exact
;
return
den
==
0
;
}
int64_t
av_rescale
(
int64_t
a
,
int64_t
b
,
int64_t
c
){
...
...
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