341 Commits

Author SHA1 Message Date
Changsheng Wu 0480cb05fa riscv64: add compile support
This patch is a basic enablement that supports riscv64 compile.
We are working on adding vector optimizations with riscv64 rvv
extensions, and will push the implementations later.
2025-09-10 09:40:56 +08:00
Martin Storsjö fc4012fb67 configure: Check for the dotprod and i8mm aarch64 extensions 2025-03-12 13:23:40 +02:00
Martin Storsjö f87ca18375 configure: Check for .arch and .arch_extension for enabling aarch64 extensions
This hasn't been needed for SVE/SVE2, as all toolchains have
supported just enabling it via ".arch armv8.2-a+sve". For other
arch extensions, like dotprod/i8mm, there's more combinations of
toolchain bugs in slightly older toolchains; try to detect what is
supported.

Additionally, when involving more than one architecture extension,
we may want to enable/disable individual extensions one at a time,
without needing to specify the full list in one single .arch
statement.

This is a preparatory commit for adding support for the dotprod/i8mm
extensions.

We intentionally don't add AS_ARCH_LEVEL to the CONFIG_HAVE list,
as this define isn't prefixed with "HAVE_", and we don't use the
define except in the case where we actually do set it. (It's not
a regular 0/1 define like the others.)
2025-03-12 13:23:40 +02:00
Martin Storsjö 72ce1cdecf configure: Use as_check for the main check for whether NEON is supported
This requires adding the "-c" flag to ASFLAGS before doing the
check.

This also makes sure to validate the gas-preprocessor is functional
for MSVC configurations, by testing whether the "cmeq" instruction
can be assembled at this point.
2025-03-12 13:23:40 +02:00
Martin Storsjö a0191bd8b1 configure: Use as_check for checking for aarch64 features
This is more correct than using cc_check; we're going to assemble
standalone external assembly - thus check for whether we can
build it in that form, not using inline assembly.

This allows sharing checks with the MSVC codepath (where inline
assembly isn't supported, and where assembly is built using
a tool different from the regular compiler).
2025-03-12 13:23:40 +02:00
Martin Storsjö 27d8370847 Makefile: Generate dependency information implicitly while compiling
This updates the dependecy information on each successive recompile.

When building with MSVC, dependency information is generated with
a separate command just like before, but done together with
compiling each object file. (This is quite similar to how ffmpeg does
the same.)

This avoids the serial dependency generation step. In slow
environments (in particular if using MSVC) it could take a notable
amount of time; this can now all be done in parallel.

In one example, this reduces the time for a full build from clean
with MSVC (wrapped in wine) from 23 seconds down to 9 seconds,
thanks to parallelism. (For non-parallel builds, it doesn't make
much of a difference.)
2025-03-11 22:22:24 +02:00
Brad Smith a64111b1b3 Enable use of __sync_fetch_and_add() wherever detected instead of just X86
Use __sync_fetch_and_add() wherever detected instead of being limited to
just X86.
2024-12-29 12:13:33 -05:00
Brad Smith da14df5535 Make use of sysconf(3) _SC_NPROCESSORS_ONLN and _SC_NPROCESSORS_CONF
Make use of _SC_NPROCESSORS_ONLN if it exists and fallback to
_SC_NPROCESSORS_CONF for really old operating systems. This adds
support for retrieving the number of CPUs on a few OS's such as
NetBSD, DragonFly and a few others.
2024-10-27 12:28:19 -04:00
Anton Mitrofanov 3a21e97bf2 Fix build with Android NDK and API < 24 for 32-bit targets
fseeko() is not available before API 24 with _FILE_OFFSET_BITS=64.
x264.c: x264cli.h must be first as it contains _FILE_OFFSET_BITS define.
2024-10-22 22:59:00 +03:00
Brad Smith 80c1c47cb2 configure: Add DragonFly support 2024-10-20 08:50:55 +00:00
Brad Smith 1243d9ffb0 Provide x264_getauxval() wrapper for getauxvaul() and elf_aux_info() 2024-10-17 06:23:19 -04:00
Brad Smith 3a8b5be2a2 aarch64: Use elf_aux_info() for CPU feature detection on FreeBSD/OpenBSD 2024-10-07 15:58:28 -04:00
Martin Storsjö c24e06c2e1 configure: Check for SVE support in MS armasm64 via as_check
This is mostly supported in armasm64 since MSVC 2022 17.10.
2024-09-17 14:07:10 +03:00
Martin Storsjö db9bc75b0b configure: Check for support for AArch64 SVE and SVE2
We don't expect the user to build the whole x264 codebase with
SVE/SVE2 enabled, as we only enable this feature for the assembly
files that use it, in order to have binaries that are portable
and enable the SVE codepaths at runtime if supported.
2023-10-18 11:23:47 +03:00
Loongson Technology Corporation Limited 1ecc51ee97 loongarch: Init LSX/LASX support
LSX/LASX is the LOONGARCH 128-bit/256-bit SIMD Architecture.

Signed-off-by: Shiyou Yin <yinshiyou-hf@loongson.cn>
Signed-off-by: Xiwei Gu <guxiwei-hf@loongson.cn>
2023-10-10 09:00:09 +08:00
Stephen Hutchinson bfc87b7a33 configure: Allow AviSynth+ on *BSD and Haiku 2022-02-22 18:03:57 +00:00
Anton Mitrofanov 35fe20d1ba Replace AvxSynth with AviSynth+ on POSIX systems 2022-02-21 21:57:05 +00:00
Jessica Clarke 19856cc41a configure: Always make shared imply PIC
Building a shared library without -fPIC does not make sense. On most
architectures, especially recent ones, doing so will give link-time
errors due to relocations in read-only sections like .text. On some
legacy architectures, including i386, it is allowed by default, but will
warn, and is highly discouraged due to the overheads it adds at library
load time. Most architectures were already listed here as having shared
imply PIC, but not all, such as i386 which ends up with unwanted text
relocations, as well as architectures not known to the build system
currently like RISC-V, which does not permit text relocations by
default. There is no good reason to want shared without PIC on any
architecture, so just remove the architecture list.
2021-12-30 20:10:51 +00:00
Anton Mitrofanov c347e7a0b4 CI: Add macos-arm64 target (cross-compile)
Rename the old macos target to macos-x86_64.
2021-04-13 20:46:00 +00:00
Anton Mitrofanov 979044a659 mp4: Add GPAC detection with pkg-config 2021-04-13 19:20:26 +00:00
Henrik Gramner 6bc7fe4f36 configure: Fix endianness test when LTO is enabled through CFLAGS 2021-01-07 14:25:43 +01:00
Damiano Galassi 1086f4504e configure: Add Apple Silicon support 2020-10-25 20:40:48 +03:00
Anton Mitrofanov 375cc58822 configure: Add options for bash-completion install 2020-07-14 15:35:11 +02:00
A. David 7c2004b58c mp4: Update GPAC support to v0.8.0 or later 2020-07-02 19:45:50 +02:00
Henrik Gramner a41d4e2944 cli: Install bash autocomplete during 'make install' 2020-07-02 19:20:21 +02:00
Henrik Gramner 2e3caed26d lavf: Update to the new API for iterating demuxers 2020-07-02 19:08:51 +02:00
JHammler d1fee1e052 configure: Fix building under the MSYS shell 2020-06-15 21:57:16 +02:00
Sergei Trofimovich 235ce61301 configure: allow 'strings' override via STRINGS variable
This allows building x264 on systems where 'strings' or
'${HOST}-strings' does not exist, but llvm-strings exists.
2020-06-10 23:10:38 +02:00
Anton Mitrofanov 1771b556ee Check support for force_align_arg_pointer attribute
Closes videolan/x264#9.
2019-11-27 02:50:00 +03:00
Anton Mitrofanov 7114174b23 aarch64: Fix compilation with disabled asm 2019-11-05 21:13:14 +03:00
Anton Mitrofanov b2e66daba6 Export symbols only when building shared library 2019-11-01 20:49:52 +03:00
Anton Mitrofanov 76c5afc25b Fix MSVS build with ./configure --enable-shared --system-libx264 2019-07-17 20:19:23 +03:00
Anton Mitrofanov a615f027ed Mark explicitly DSO public API symbols and hide all other by -fvisibility=hidden
Removes need for -Bsymbolic during linking.
2019-07-17 20:19:23 +03:00
Anton Mitrofanov 34c06d1c17 Strip git-hash from version in x264.pc
pkg-config doesn't like spaces in version string.
2019-07-17 20:15:34 +03:00
Henrik Gramner 82721eae6e x86inc: Add x86-32 PIC support macros 2019-03-06 22:45:53 +03:00
Henrik Gramner 275ef5332d x86: Always use PIC in x86-64 asm
Most x86-64 operating systems nowadays doesn't even allow .text relocations
in object files any more, and there is no measurable overall performance
difference from using RIP-relative addressing in x264 asm.

Enforcing PIC reduces complexity and simplifies testing.
2019-03-06 22:45:50 +03:00
Anton Mitrofanov d6af823959 configure: Fix log2f misdetection on some systems
Bug report by Dirk Fieldhouse.
2018-12-23 20:13:43 +01:00
Henrik Gramner d1a53926fb Prefer a monotonic clock source if available 2018-08-06 23:24:13 +02:00
Emanuele Ruffaldi 698c5a32e6 4:0:0 (monochrome) encoding support
Virtually zero increase in compression efficiency compared to 4:2:0 with empty
chroma planes. Performance is better though, especially with fast settings.
2018-08-06 23:24:12 +02:00
Anton Mitrofanov 9d33c8fefb configure: Fix required version checks for lavf and swscale 2018-08-06 23:24:12 +02:00
Anton Mitrofanov 57dd6274e2 configure: Fix ambiguous "$((" 2018-05-27 20:58:53 +02:00
Martin Storsjö 3d90057e15 configure: Only use gas-preprocessor with armasm for compiler=CL
This picks the right assembler automatically for arm and aarch64
llvm-mingw targets.

This doesn't get the right assembler for clang setups when clang
acts like MSVC and uses MSVC headers though (where it perhaps
should use armasm as before), but that's probably an even more
obscure setup.
2018-03-31 21:53:42 +02:00
Diego Biurrun 6fce82284a Minor configure improvements
* Drop empty addition of GPLed filters

 * Replace backticks with $()
2018-01-17 18:31:04 +01:00
Martin Storsjö f745815e59 configure: Add support for building with MSVC/armasm for ARM64 2017-12-24 23:47:26 +03:00
Anton Mitrofanov 694d031c1d configure: Improvements
Log result of pkg-config checks to config.log.
Fix lavf support detection for pkg-config fallback case.
Fix detection of linking dependencies errors for lavf/lsmash/gpac.
Cosmetics.
2017-12-24 23:47:25 +03:00
Vittorio Giovara 71ed44c731 Unify 8-bit and 10-bit CLI and libraries
Add 'i_bitdepth' to x264_param_t with the corresponding '--output-depth' CLI
option to set the bit depth at runtime.

Drop the 'x264_bit_depth' global variable. Rather than hardcoding it to an
incorrect value, it's preferable to induce a linking failure. If applications
relies on this symbol this will make it more obvious where the problem is.

Add Makefile rules that compiles modules with different bit depths. Assembly
on x86 is prefixed with the 'private_prefix' define, while all other archs
modify their function prefix internally.

Templatize the main C library, x86/x86_64 assembly, ARM assembly, AARCH64
assembly, PowerPC assembly, and MIPS assembly.

The depth and cache CLI filters heavily depend on bit depth size, so they
need to be duplicated for each value. This means having to rename these
filters, and adjust the callers to use the right version.

Unfortunately the threaded input CLI module inherits a common.h dependency
(input/frame -> common/threadpool -> common/frame -> common/common) which
is extremely complicated to address in a sensible way. Instead duplicate
the module and select the appropriate one at run time.

Each bitdepth needs different checkasm compilation rules, so split the main
checkasm target into two executables.
2017-12-24 23:47:24 +03:00
Anton Mitrofanov 4e2ed4087a configure: Check for strtok_r compiler support 2017-12-24 22:54:15 +03:00
Henrik Gramner 1e27313c12 configure: Increase x86 stack alignment on clang 2017-12-24 22:54:13 +03:00
Anton Mitrofanov f1ac712264 configure: Don't try to detect clang by $CC
Only check if option -Werror=unknown-warning-option is supported before adding it
2017-05-23 16:57:45 +02:00
Henrik Gramner 472ce3648a x86: AVX-512 support
AVX-512 consists of a plethora of different extensions, but in order to keep
things a bit more manageable we group together the following extensions
under a single baseline cpu flag which should cover SKL-X and future CPUs:
 * AVX-512 Foundation (F)
 * AVX-512 Conflict Detection Instructions (CD)
 * AVX-512 Byte and Word Instructions (BW)
 * AVX-512 Doubleword and Quadword Instructions (DQ)
 * AVX-512 Vector Length Extensions (VL)

On x86-64 AVX-512 provides 16 additional vector registers, prefer using
those over existing ones since it allows us to avoid using `vzeroupper`
unless more than 16 vector registers are required. They also happen to
be volatile on Windows which means that we don't need to save and restore
existing xmm register contents unless more than 22 vector registers are
required.

Also take the opportunity to drop X264_CPU_CMOV and X264_CPU_SLOW_CTZ while
we're breaking API by messing with the cpu flags since they weren't really
used for anything.

Big thanks to Intel for their support.
2017-05-21 22:42:15 +02:00