OSDN Git Service
(root)
/
android-x86
/
external-ffmpeg.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1545ace
)
simplify
author
Michael Niedermayer
<michaelni@gmx.at>
Fri, 30 Apr 2004 18:11:34 +0000
(18:11 +0000)
committer
Michael Niedermayer
<michaelni@gmx.at>
Fri, 30 Apr 2004 18:11:34 +0000
(18:11 +0000)
Originally committed as revision 3097 to svn://svn.ffmpeg.org/ffmpeg/trunk
libavcodec/utils.c
patch
|
blob
|
history
diff --git
a/libavcodec/utils.c
b/libavcodec/utils.c
index
59e9a30
..
6998f77
100644
(file)
--- a/
libavcodec/utils.c
+++ b/
libavcodec/utils.c
@@
-776,15
+776,11
@@
int av_reduce(int *dst_nom, int *dst_den, int64_t nom, int64_t den, int64_t max)
assert(den != 0);
- if(den < 0){
- den= -den;
- nom= -nom;
- }
+ if(den < 0)
+ return av_reduce(dst_nom, dst_den, -nom, -den, max);
- if(nom < 0){
- nom= -nom;
- sign= 1;
- }
+ sign= nom < 0;
+ nom= ABS(nom);
gcd = ff_gcd(nom, den);
nom /= gcd;
@@
-814,9
+810,7
@@
int av_reduce(int *dst_nom, int *dst_den, int64_t nom, int64_t den, int64_t max)
assert(ff_gcd(nom, den) == 1);
- if(sign) nom= -nom;
-
- *dst_nom = nom;
+ *dst_nom = sign ? -nom : nom;
*dst_den = den;
return exact;