[FFmpeg-cvslog] lavu/parseutils: rework rational reduction logic in av_parse_ratio()
Stefano Sabatini
git at videolan.org
Sat Oct 20 12:22:09 CEST 2012
ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Tue Oct 16 18:15:58 2012 +0200| [cdea54b4c8cd891aa12f85c41b0cd4bd81be83f9] | committer: Stefano Sabatini
lavu/parseutils: rework rational reduction logic in av_parse_ratio()
Avoid to divide num and den by gcd in case of a parsed expression, since
that is already done in av_d2q(), and force reduction in case of "a:b"
form, allowing to honour the max parameter.
The latter change is consistent with the a/b case, and with the
documentation.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cdea54b4c8cd891aa12f85c41b0cd4bd81be83f9
---
libavutil/parseutils.c | 8 ++------
libavutil/version.h | 2 +-
2 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/libavutil/parseutils.c b/libavutil/parseutils.c
index 84bb9f7..b201331 100644
--- a/libavutil/parseutils.c
+++ b/libavutil/parseutils.c
@@ -57,12 +57,8 @@ int av_parse_ratio(AVRational *q, const char *str, int max,
if (ret < 0)
return ret;
*q = av_d2q(d, max);
- }
-
- gcd = av_gcd(FFABS(q->num), FFABS(q->den));
- if (gcd) {
- q->num /= gcd;
- q->den /= gcd;
+ } else {
+ av_reduce(&q->num, &q->den, q->num, q->den, max);
}
return 0;
diff --git a/libavutil/version.h b/libavutil/version.h
index 3e9c17f..edbf8f7 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -76,7 +76,7 @@
#define LIBAVUTIL_VERSION_MAJOR 51
#define LIBAVUTIL_VERSION_MINOR 76
-#define LIBAVUTIL_VERSION_MICRO 100
+#define LIBAVUTIL_VERSION_MICRO 101
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
LIBAVUTIL_VERSION_MINOR, \
More information about the ffmpeg-cvslog
mailing list