diff options
author | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2008-09-25 19:23:13 +0000 |
---|---|---|
committer | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2008-09-25 19:23:13 +0000 |
commit | 05b90fc0c59aaac40af484f3d5a617a0404b1b4e (patch) | |
tree | bee469192cb8d4dda0b9d626a3a92830a8298b86 /libavutil/rational.h | |
parent | 5f129a05bf69d5655ae6d6ea82ca1a97f0b1913f (diff) | |
download | ffmpeg-05b90fc0c59aaac40af484f3d5a617a0404b1b4e.tar.gz |
Implement av_nearer_q() and av_find_nearest_q_idx() functions.
Originally committed as revision 15415 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavutil/rational.h')
-rw-r--r-- | libavutil/rational.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libavutil/rational.h b/libavutil/rational.h index 5957eee859..70b7735da3 100644 --- a/libavutil/rational.h +++ b/libavutil/rational.h @@ -113,4 +113,17 @@ AVRational av_sub_q(AVRational b, AVRational c) av_const; */ AVRational av_d2q(double d, int max) av_const; +/** + * @return 1 if \q1 is nearer to \p q than \p q2, -1 if \p q2 is nearer + * than \p q1, 0 if they have the same distance. + */ +int av_nearer_q(AVRational q, AVRational q1, AVRational q2); + +/** + * Finds the nearest value in \p q_list to \p q. + * @param q_list an array of rationals terminated by {0, 0} + * @return the index of the nearest value found in the array + */ +int av_find_nearest_q_idx(AVRational q, const AVRational* q_list); + #endif /* AVUTIL_RATIONAL_H */ |