mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-12 19:18:44 +02:00
8772156be0
* qatar/master: APIChanges: document git revision for CODEC_CAP_SLICE_THREADS addition. Introduce slice threads flag. FATE: allow forcing thread-type when doing threaded fate runs. Use av_log_ask_for_sample() where appropriate. error: sort, pack, and align error code and string definitions The stabilization period after version bumps should be one month, not one week. applehttp: Expose the stream bitrate via metadata doc: Add some initial docs on the applehttp demuxer Provide a fallback version of the libm function trunc libavdevice: Define _XOPEN_SOURCE for usleep lavc: provide deprecated avcodec_thread_init until next major version lavc: provide the opt.h header until the next bump error: change AVERROR_EOF value error: remove AVERROR_NUMEXPECTED error: add error code AVERROR_OPTION_NOT_FOUND, and use it in opt.c Conflicts: libavcodec/h264.c libavutil/error.c libavutil/error.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
104 lines
2.3 KiB
C
104 lines
2.3 KiB
C
/*
|
|
* This file is part of FFmpeg.
|
|
*
|
|
* FFmpeg is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
*
|
|
* FFmpeg is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with FFmpeg; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
*/
|
|
|
|
/**
|
|
* @file
|
|
* Replacements for frequently missing libm functions
|
|
*/
|
|
|
|
#ifndef AVUTIL_LIBM_H
|
|
#define AVUTIL_LIBM_H
|
|
|
|
#include <math.h>
|
|
#include "config.h"
|
|
#include "attributes.h"
|
|
|
|
#if !HAVE_EXP2
|
|
#undef exp2
|
|
#define exp2(x) exp((x) * 0.693147180559945)
|
|
#endif /* HAVE_EXP2 */
|
|
|
|
#if !HAVE_EXP2F
|
|
#undef exp2f
|
|
#define exp2f(x) ((float)exp2(x))
|
|
#endif /* HAVE_EXP2F */
|
|
|
|
#if !HAVE_LLRINT
|
|
#undef llrint
|
|
#define llrint(x) ((long long)rint(x))
|
|
#endif /* HAVE_LLRINT */
|
|
|
|
#if !HAVE_LLRINTF
|
|
#undef llrintf
|
|
#define llrintf(x) ((long long)rint(x))
|
|
#endif /* HAVE_LLRINT */
|
|
|
|
#if !HAVE_LOG2
|
|
#undef log2
|
|
#define log2(x) (log(x) * 1.44269504088896340736)
|
|
#endif /* HAVE_LOG2 */
|
|
|
|
#if !HAVE_LOG2F
|
|
#undef log2f
|
|
#define log2f(x) ((float)log2(x))
|
|
#endif /* HAVE_LOG2F */
|
|
|
|
#if !HAVE_LRINT
|
|
static av_always_inline av_const long int lrint(double x)
|
|
{
|
|
return rint(x);
|
|
}
|
|
#endif /* HAVE_LRINT */
|
|
|
|
#if !HAVE_LRINTF
|
|
static av_always_inline av_const long int lrintf(float x)
|
|
{
|
|
return (int)(rint(x));
|
|
}
|
|
#endif /* HAVE_LRINTF */
|
|
|
|
#if !HAVE_ROUND
|
|
static av_always_inline av_const double round(double x)
|
|
{
|
|
return (x > 0) ? floor(x + 0.5) : ceil(x - 0.5);
|
|
}
|
|
#endif /* HAVE_ROUND */
|
|
|
|
#if !HAVE_ROUNDF
|
|
static av_always_inline av_const float roundf(float x)
|
|
{
|
|
return (x > 0) ? floor(x + 0.5) : ceil(x - 0.5);
|
|
}
|
|
#endif /* HAVE_ROUNDF */
|
|
|
|
#if !HAVE_TRUNC
|
|
static av_always_inline av_const double trunc(double x)
|
|
{
|
|
return (x > 0) ? floor(x) : ceil(x);
|
|
}
|
|
#endif /* HAVE_TRUNC */
|
|
|
|
#if !HAVE_TRUNCF
|
|
static av_always_inline av_const float truncf(float x)
|
|
{
|
|
return (x > 0) ? floor(x) : ceil(x);
|
|
}
|
|
#endif /* HAVE_TRUNCF */
|
|
|
|
#endif /* AVUTIL_LIBM_H */
|