]> git.sesse.net Git - ffmpeg/blobdiff - libavutil/rational.h
hwcontext_vdpau: Fix missing subscripts
[ffmpeg] / libavutil / rational.h
index a4871148bdde239b4c5ea9a26f0cbb466eb67f1a..5d7dab7fd0d2d5081ced7f19f8277537ba6e8dff 100644 (file)
 #include <limits.h>
 #include "attributes.h"
 
+/**
+ * @addtogroup lavu_math
+ * @{
+ */
+
 /**
  * rational number numerator/denominator
  */
@@ -109,6 +114,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.
@@ -132,4 +148,8 @@ int av_nearer_q(AVRational q, AVRational q1, AVRational q2);
  */
 int av_find_nearest_q_idx(AVRational q, const AVRational* q_list);
 
+/**
+ * @}
+ */
+
 #endif /* AVUTIL_RATIONAL_H */