summaryrefslogtreecommitdiff
path: root/libavutil/rational.h
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-08-05 22:17:02 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-08-05 22:17:02 +0200
commitb4780d03d04d402b490be21b01ec886565cabe29 (patch)
tree2c5605baa7b588cced8f79c2916eb724356d5c25 /libavutil/rational.h
parent69aeba1396d5a13e79cbc3cc9f49fd6896addb82 (diff)
parent2096857551660649dbe9a5aad7338b0872858575 (diff)
downloadffmpeg-b4780d03d04d402b490be21b01ec886565cabe29.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: x86: h264_idct: Rename x264_add8x4_idct_sse2 --> h264_add8x4_idct_sse2 rational: add av_inv_q() returning the inverse of an AVRational dpx: Make start offset unsigned lavfi: properly signal out-of-memory error in ff_filter_samples cosmetics: Fix a few switched periods and linebreaks zerocodec: Fix memleak in decode_frame zerocodec: Cosmetics Conflicts: ffmpeg.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/rational.h')
-rw-r--r--libavutil/rational.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/libavutil/rational.h b/libavutil/rational.h
index 8c2bdb5529..417e29e577 100644
--- a/libavutil/rational.h
+++ b/libavutil/rational.h
@@ -115,6 +115,17 @@ AVRational av_add_q(AVRational b, AVRational c) av_const;
AVRational av_sub_q(AVRational b, AVRational c) av_const;
/**
+ * Invert a rational.
+ * @param q value
+ * @return 1 / q
+ */
+static av_always_inline AVRational av_inv_q(AVRational q)
+{
+ AVRational r = { q.den, q.num };
+ return r;
+}
+
+/**
* Convert a double precision floating point number to a rational.
* inf is expressed as {1,0} or {-1,0} depending on the sign.
*