avutil: remove libm.h

It only wrapped math.h and mathematics.h since the fallbacks went away.
Include math.h and mathematics.h directly where needed. internal.h keeps
both so that the many translation units relying on them transitively
keep building.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
This commit is contained in:
Kacper Michajłow committed 2026-09-12 23:52:20 +00:00
1 parent d36cf66ec8
commit 24914d60df
37 files changed
+39 -70

No files matched your search

+1 -1
View File
@@ -12,7 +12,7 @@ the tables as a header file using the tableprint.h helpers.
Both of these files will be compiled for the host system, so to avoid
breakage with cross-compilation neither of them may include, directly
or indirectly, config.h or avconfig.h.
This means that e.g. libavutil/mathematics.h is ok but libavutil/libm.h is not.
This means that e.g. libavutil/mathematics.h is ok but libavutil/internal.h is not.
Due to this, the .c file or Makefile may have to provide additional defines
or stubs, though if possible this should be avoided.
In particular, CONFIG_HARDCODED_TABLES should always be defined to 0.
-1
View File
@@ -38,7 +38,6 @@
#include "libavutil/bprint.h"
#include "libavutil/display.h"
#include "libavutil/getenv_utf8.h"
#include "libavutil/libm.h"
#include "libavutil/mem.h"
#include "libavutil/parseutils.h"
#include "libavutil/eval.h"
+1 -1
View File
@@ -54,7 +54,7 @@
#include "libavutil/stereo3d.h"
#include "libavutil/dict.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/libm.h"
#include "libavutil/mathematics.h"
#include "libavutil/parseutils.h"
#include "libavutil/timecode.h"
#include "libavutil/timestamp.h"
+1 -1
View File
@@ -30,7 +30,7 @@
* add sane pulse detection
***********************************/
#include "libavutil/libm.h" // brought forward to work around cygwin header breakage
#include <math.h> // brought forward to work around cygwin header breakage
#include <float.h>
+1 -1
View File
@@ -29,10 +29,10 @@
* add sane pulse detection
***********************************/
#include <float.h>
#include <math.h>
#include "libavutil/channel_layout.h"
#include "libavutil/crc.h"
#include "libavutil/libm.h"
#include "libavutil/float_dsp.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
+2 -1
View File
@@ -25,7 +25,8 @@
* @author Rostislav Pehlivanov ( atomnuker gmail com )
*/
#include "libavutil/libm.h"
#include <math.h>
#include "aacenc.h"
#include <float.h>
#include "aacenc_tns.h"
-1
View File
@@ -32,7 +32,6 @@
#include "libavcodec/aacps_tables.h"
#else
#include "libavutil/common.h"
#include "libavutil/libm.h"
#include "libavutil/mathematics.h"
#include "libavutil/mem_internal.h"
#define NR_ALLPASS_BANDS20 30
+1 -1
View File
@@ -35,7 +35,7 @@
#include "sbrdsp.h"
#include "libavutil/internal.h"
#include "libavutil/intfloat.h"
#include "libavutil/libm.h"
#include "libavutil/mathematics.h"
#include "libavutil/avassert.h"
#include "libavutil/mem_internal.h"
-1
View File
@@ -63,7 +63,6 @@
#include "aacps.h"
#include "sbrdsp.h"
#include "libavutil/internal.h"
#include "libavutil/libm.h"
#include "libavutil/avassert.h"
#include <stdint.h>
+1 -1
View File
@@ -57,7 +57,7 @@ typedef unsigned int UINTFLOAT;
typedef int16_t SHORTFLOAT;
#else /* USE_FIXED */
#include "libavutil/libm.h"
#include "libavutil/mathematics.h"
#define FIXR(x) ((float)(x))
#define FIXR12(x) ((float)(x))
+1 -1
View File
@@ -37,7 +37,7 @@
#include "libavutil/attributes.h"
#include "libavutil/float_dsp.h"
#include "libavutil/libm.h"
#include "libavutil/mathematics.h"
#include "libavutil/mem.h"
#include "libavutil/mem_internal.h"
#include "libavutil/thread.h"
+1 -1
View File
@@ -28,7 +28,7 @@
#include <math.h>
#include "libavutil/float_dsp.h"
#include "libavutil/libm.h"
#include "libavutil/mathematics.h"
#include "libavutil/mem_internal.h"
#include "sinewin.h"
+2 -1
View File
@@ -18,10 +18,11 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <math.h>
#include "config.h"
#include "cbrt_data.h"
#include "libavutil/libm.h"
#if CONFIG_HARDCODED_TABLES
#include "libavcodec/cbrt_tables.h"
-3
View File
@@ -24,9 +24,6 @@
#include "cbrt_data.h"
#include "libavutil/attributes.h"
#ifdef HAVE_AV_CONFIG_H // Only include libm.h when building for the target, not the host
#include "libavutil/libm.h"
#endif
av_cold void ff_cbrt_dbl_tableinit(double tmp_lut[TMP_LUT_SIZE])
{
+1 -1
View File
@@ -26,10 +26,10 @@
* https://msdn.microsoft.com/en-us/library/bb943982%28v=vs.85%29.aspx
*/
#include <math.h>
#include <stdint.h>
#include "libavutil/attributes.h"
#include "libavutil/libm.h"
#include "libavutil/imgutils.h"
#include "avcodec.h"
+3 -1
View File
@@ -25,10 +25,12 @@
* @author Michael Niedermayer <michaelni@gmx.at>
*/
#include <math.h>
#include "faandct.h"
#include "libavutil/emms.h"
#include "libavutil/internal.h"
#include "libavutil/libm.h"
#include "libavutil/mathematics.h"
typedef float FLOAT;
+2 -1
View File
@@ -16,8 +16,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <math.h>
#include "libavutil/avassert.h"
#include "libavutil/libm.h"
#include "libavutil/mathematics.h"
#include "libavutil/attributes.h"
#include "kbdwin.h"
+1 -1
View File
@@ -24,6 +24,7 @@
* JPEG XL encoder using libjxl
*/
#include <math.h>
#include <string.h>
#include "libavutil/avutil.h"
@@ -31,7 +32,6 @@
#include "libavutil/display.h"
#include "libavutil/error.h"
#include "libavutil/frame.h"
#include "libavutil/libm.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
+1 -1
View File
@@ -24,11 +24,11 @@
* mpeg audio layer decoder tables.
*/
#include <math.h>
#include <stddef.h>
#include <stdint.h>
#include "libavutil/avassert.h"
#include "libavutil/libm.h"
#include "libavutil/thread.h"
#include "mpegaudiodata.h"
+2 -1
View File
@@ -24,6 +24,8 @@
* MPEG Audio decoder
*/
#include <math.h>
#include "config_components.h"
#include "libavutil/attributes.h"
@@ -31,7 +33,6 @@
#include "libavutil/channel_layout.h"
#include "libavutil/crc.h"
#include "libavutil/float_dsp.h"
#include "libavutil/libm.h"
#include "libavutil/mem.h"
#include "libavutil/mem_internal.h"
#include "libavutil/thread.h"
+1 -1
View File
@@ -24,6 +24,7 @@
#ifndef AVCODEC_OPUS_CELT_H
#define AVCODEC_OPUS_CELT_H
#include <math.h>
#include <stdint.h>
#include "libavcodec/avcodec.h"
@@ -32,7 +33,6 @@
#include "rc.h"
#include "libavutil/float_dsp.h"
#include "libavutil/libm.h"
#include "libavutil/mem_internal.h"
#include "libavutil/tx.h"
+2 -1
View File
@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <math.h>
#include "avcodec.h"
#include "codec_internal.h"
#include "encode.h"
@@ -33,7 +35,6 @@
#include "libavutil/buffer.h"
#include "libavutil/crc.h"
#include "libavutil/csp.h"
#include "libavutil/libm.h"
#include "libavutil/mastering_display_metadata.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
-2
View File
@@ -38,8 +38,6 @@
#define SINETABLE_CONST const
#include "libavcodec/sinewin_fixed_tables.h"
#else
// do not use libavutil/libm.h since this is compiled both
// for the host and the target and config.h is only valid for the target
#include <math.h>
#include "libavutil/attributes.h"
-2
View File
@@ -24,8 +24,6 @@
#define AVCODEC_SINEWIN_TABLEGEN_H
#include <assert.h>
// do not use libavutil/libm.h since this is compiled both
// for the host and the target and config.h is only valid for the target
#include <math.h>
#include "libavutil/attributes.h"
#include "libavutil/common.h"
+2 -1
View File
@@ -18,9 +18,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <math.h>
#include "libavutil/emms.h"
#include "libavutil/intmath.h"
#include "libavutil/libm.h"
#include "libavutil/log.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
-1
View File
@@ -22,7 +22,6 @@
#include "libavutil/avassert.h"
#include "libavutil/common.h"
#include "libavutil/float_dsp.h"
#include "libavutil/libm.h"
#include "libavutil/macros.h"
#include "libavcodec/celp_math.h"
+1 -1
View File
@@ -22,13 +22,13 @@
* IN THE SOFTWARE.
*/
#include <math.h>
#include <stddef.h>
#include <stdint.h>
#include "libavutil/attributes.h"
#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/libm.h"
#include "texturedsp.h"
+1 -1
View File
@@ -23,6 +23,7 @@
* video crop filter
*/
#include <math.h>
#include <stdio.h>
#include "avfilter.h"
@@ -32,7 +33,6 @@
#include "libavutil/eval.h"
#include "libavutil/avstring.h"
#include "libavutil/internal.h"
#include "libavutil/libm.h"
#include "libavutil/imgutils.h"
#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
+1 -1
View File
@@ -23,6 +23,7 @@
#include "config_components.h"
#include <math.h>
#include <stdint.h>
#include <inttypes.h>
@@ -54,7 +55,6 @@
#include "libavutil/csp.h"
#include "libavutil/intfloat.h"
#include "libavutil/mathematics.h"
#include "libavutil/libm.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/dict.h"
-1
View File
@@ -32,7 +32,6 @@
#include <float.h>
#include "avstring.h"
#include "libm.h"
typedef struct FFFILE {
size_t buf_size;
-1
View File
@@ -23,7 +23,6 @@
#include <math.h>
#include "display.h"
#include "libm.h"
#include "mathematics.h"
// fixed point to double
+3 -1
View File
@@ -26,8 +26,10 @@
#ifndef AVUTIL_FFMATH_H
#define AVUTIL_FFMATH_H
#include <math.h>
#include "attributes.h"
#include "libm.h"
#include "mathematics.h"
/**
* Compute 10^x for floating point values. Note: this function is by no means
+2 -1
View File
@@ -34,13 +34,14 @@
//#define CHECKED
#include <limits.h>
#include <math.h>
#include <stdint.h>
#include <stddef.h>
#include <assert.h>
#include <stdio.h>
#include "config.h"
#include "attributes.h"
#include "libm.h"
#include "mathematics.h"
#include "macros.h"
#ifndef attribute_align_arg
-30
View File
@@ -1,30 +0,0 @@
/*
* 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
* Wrapper around math.h with platform-specific optimizations
*/
#ifndef AVUTIL_LIBM_H
#define AVUTIL_LIBM_H
#include <math.h>
#include "mathematics.h"
#endif /* AVUTIL_LIBM_H */
+1 -1
View File
@@ -22,7 +22,7 @@
#include <stdio.h>
#include <string.h>
#include "libavutil/libm.h"
#include "libavutil/mathematics.h"
#include "libavutil/eval.h"
static const double const_values[] = {
+3 -1
View File
@@ -25,8 +25,10 @@
* @author Michael Niedermayer <michaelni@gmx.at>
*/
#include <math.h>
#include "libavutil/avassert.h"
#include "libavutil/libm.h"
#include "libavutil/internal.h"
#include "libavutil/mem.h"
#include "libavutil/samplefmt.h"
#include "audioconvert.h"
-1
View File
@@ -34,7 +34,6 @@
#include "libavutil/emms.h"
#include "libavutil/imgutils.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/libm.h"
#include "libavutil/mathematics.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"