00001 /* 00002 * copyright (c) 2005 Michael Niedermayer <michaelni@gmx.at> 00003 * 00004 * This file is part of FFmpeg. 00005 * 00006 * FFmpeg is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * FFmpeg is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with FFmpeg; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00019 */ 00020 00021 #ifndef AVUTIL_MATHEMATICS_H 00022 #define AVUTIL_MATHEMATICS_H 00023 00024 #include <stdint.h> 00025 #include <math.h> 00026 #include "common.h" 00027 #include "rational.h" 00028 00029 #ifndef M_E 00030 #define M_E 2.7182818284590452354 /* e */ 00031 #endif 00032 #ifndef M_LN2 00033 #define M_LN2 0.69314718055994530942 /* log_e 2 */ 00034 #endif 00035 #ifndef M_LN10 00036 #define M_LN10 2.30258509299404568402 /* log_e 10 */ 00037 #endif 00038 #ifndef M_PI 00039 #define M_PI 3.14159265358979323846 /* pi */ 00040 #endif 00041 #ifndef M_SQRT1_2 00042 #define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ 00043 #endif 00044 00045 enum AVRounding { 00046 AV_ROUND_ZERO = 0, 00047 AV_ROUND_INF = 1, 00048 AV_ROUND_DOWN = 2, 00049 AV_ROUND_UP = 3, 00050 AV_ROUND_NEAR_INF = 5, 00051 }; 00052 00053 int64_t av_const av_gcd(int64_t a, int64_t b); 00054 00059 int64_t av_rescale(int64_t a, int64_t b, int64_t c) av_const; 00060 00065 int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding) av_const; 00066 00070 int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const; 00071 00072 #endif /* AVUTIL_MATHEMATICS_H */