mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2026-10-28 10:04:37 +08:00
compat/android: provide log2 and log2f below API level 18
Bionic gained log2 and log2f in Android 4.3, API level 18. Devices below that are under 0.1 percent of the installed base, Google Play services dropped them in 2021 and no NDK newer than r24 can target them. VLC 3 however still ships Android 4.2 builds with NDK 21 against current FFmpeg releases, so provide the two functions for that case rather than keeping generic fallbacks for the whole libm. Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
This commit is contained in:
1 parent
02fed0bda7
commit
f212f5736c
3 files changed
+35
No files matched your search
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#ifndef COMPAT_ANDROID_MATH_H
|
||||
#define COMPAT_ANDROID_MATH_H
|
||||
|
||||
#include <math.h>
|
||||
#include <android/api-level.h>
|
||||
|
||||
#if __ANDROID_API__ < 18
|
||||
#define log2(x) (log(x) * M_LOG2E)
|
||||
#define log2f(x) (logf(x) * (float)M_LOG2E)
|
||||
#endif
|
||||
|
||||
#endif /* COMPAT_ANDROID_MATH_H */
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "libavutil/common.h"
|
||||
#include "libavutil/error.h"
|
||||
#include "libavutil/hash.h"
|
||||
#include "libavutil/internal.h"
|
||||
#include "libavutil/macros.h"
|
||||
#include "libavutil/opt.h"
|
||||
#include "avtextformat.h"
|
||||
|
||||
@@ -68,6 +68,10 @@
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __ANDROID__
|
||||
# include "compat/android/math.h"
|
||||
#endif
|
||||
|
||||
#define FF_ALLOC_TYPED_ARRAY(p, nelem) (p = av_malloc_array(nelem, sizeof(*p)))
|
||||
#define FF_ALLOCZ_TYPED_ARRAY(p, nelem) (p = av_calloc(nelem, sizeof(*p)))
|
||||
|
||||
|
||||
Reference in new issue
Block a user