Commit Graph

313 Commits

Author SHA1 Message Date
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
Henrik Gramner d2b5f4873e x86: Change assembler from yasm to nasm
This is required to support AVX-512.

Drop `-Worphan-labels` from ASFLAGS since it's enabled by default in nasm.

Also change alignmode from `k8` to `p6` since it's more similar to `amdnop`
in yasm, e.g. use long nops without excessive prefixes.
2017-05-21 22:41:07 +02:00
Anton Mitrofanov 8ae2b62462 msvs/icl: Improve target host detection 2017-05-21 22:41:07 +02:00
Martin Storsjö a52d41c4d1 configure: Support targeting ARM with MSVC tools
Set up the right gas-preprocessor as assembler frontend in these cases,
using armasm as actual assembler.

Don't try to add the -mcpu -mfpu options in this case.

Check whether the compiler actually supports inline assembly.

Check for the ARMv7 features in a different way for the MSVC compiler.
2017-05-21 22:41:07 +02:00
Martin Storsjö b22a5db3c4 configure: Check for -lshell32 before forcibly adding it into LDFLAGSCLI
When targeting the Windows Phone API subset, there is no shell32.lib.

When targeting Windows Phone/RT, the CLI itself won't be built, but
LDFLAGSCLI are included in all later cases of cc_check within configure.
Therefore only add -lshell32 there if it actually is usable.
2017-05-21 22:41:07 +02:00
Martin Storsjö d13705191c arm: Skip using gas-preprocessor for iOS on arm as well
The few constructs that differ can easily be handled within the
source itself - tested to be working since at least Xcode 6.
2017-05-21 22:41:06 +02:00
Martin Storsjö a84e6a486b aarch64: Skip invoking gas-preprocessor for iOS
Clang can handle all the constructs used there these days, working
since Xcode 6 at least.
2017-05-21 22:41:06 +02:00
Henrik Gramner bec87ba694 Windows: Add support for MSVC compilation with WSL
In Windows 10 version 1703 (Creators Update) WSL supports calling native
Windows binaries from the Bash shell, but it requires using full file
names including extension, e.g. `cl.exe` instead of `cl`.

We also don't have access to `cygpath`, so use a simple regex for
converting the dependencies to Unix paths that `make` can understand.
2017-05-21 22:41:06 +02:00
Vittorio Giovara a2d2621cc5 Recursively delete conftest files
On OS X, one of the conftest files might be a directory named `conftest.dSYM`.
2017-05-19 16:12:15 +02:00
Kaustubh Raste 959e869c20 mips: Fix out-of-tree build
Signed-off-by: Kaustubh Raste <kaustubh.raste@imgtec.com>
2017-04-14 14:52:53 +02:00
Martin Storsjö 93340ca300 configure: Always enable PIC in aarch64 assembly for apple platforms
This is similar to what we do for 32-bit ARM assembly as well.

Fixes linker errors such as `ld: Absolute addressing not allowed in
arm64 code but used in '_x264_cabac_encode_terminal_asm' referencing
'_x264_cabac_range_lps' for architecture arm64`.
2017-03-23 22:52:09 +01:00
Luca Barbato 2b741f81e5 ppc: Add VSX support to configure 2016-12-01 16:10:37 +01:00
Henrik Gramner 3f5ed56d41 configure: Support specifying a custom pkg-config 2016-06-13 22:07:00 +02:00
Henrik Gramner 92515e8ff7 configure: Add link-time optimization support
Enabled by using the --enable-lto configuration option.

May give a slight performance improvement in some cases, but it can
also reduce performance in other cases (largely compiler-dependant)
so don't enable it by default. It also makes compilation (and linking
in particular) a fair bit slower.

Note that some older versions of GNU binutils will incorrectly warn
about "memset used with constant zero length parameter" when linking
using LTO. This is due to a bug in binutils and can safely be ignored.
2016-06-13 22:07:00 +02:00
Henrik Gramner b6267e0ff7 configure: Fix clang detection with versioned binaries
Correctly detect clang binaries that has the version number appended
as a suffix to the file name, e.g. `clang38`.
2016-06-13 22:07:00 +02:00
Henrik Gramner 2102de2584 Eliminate some compiler warnings on BSD
Include <strings.h> in addition to <string.h>. According to the POSIX
specification the prototypes for strcasecmp() and strncasecmp() are
declared in <strings.h>. On some systems they are also declared in
<string.h> for compatibility reasons but we shouldn't rely on that.

Define _POSIX_C_SOURCE only when it's required to do so. Some BSD
variants doesn't declare certain function prototypes otherwise.
2016-04-20 17:15:51 +02:00
Henrik Gramner 64f4e24909 osx: Add -D_DARWIN_C_SOURCE to CFLAGS
OSX doesn't like _POSIX_C_SOURCE being defined when _DARWIN_C_SOURCE isn't.
2016-04-12 21:47:47 +02:00
Henrik Gramner deae1b1001 windows: Flag debug builds in the resource file 2016-04-12 17:10:39 +02:00
Henrik Gramner dfe394cadc ffms: Various improvements
* Drop the MinGW Unicode workarounds. Those were required at the time
   Windows Unicode support was added to x264 but the underlying problem
   has since been fixed in FFMS.

 * Use FFMS_IndexBelongsToFile() as an additional sanity check when reading
   an index file to ensure that it belongs to the current source video.

 * Upgrade to the new API to prevent deprecation warnings when compiling.

 * Fix a resource leak that would occur if FFMS_GetFirstTrackOfType() or
   FFMS_CreateVideoSource() failed.

 * Minor string handling adjustments related to progress reporting.

This increases the FFMS version requirement from 2.16.2 to 2.21.0.
2016-04-11 16:59:51 +02:00
Henrik Gramner 5be32efc24 configure: Define feature test macros for --std=gnu99
Makes the printf() family functions on MinGW use the correct C99 POSIX
versions instead of the broken pre-VS2015 Microsoft ones.

Also allows us to get rid of some _GNU_SOURCE and _ISOC99_SOURCE defines.
2016-04-11 16:58:23 +02:00
Henrik Gramner c01bf42117 mingw: Enable high-entropy ASLR on 64-bit Windows
To fully utilize HEASLR the image base address must also be set above
4 GiB. For consistency use the same address as MSVC uses by default.

This requires binutils 2.25 which isn't available on all common
distributions, so only enable it after checking that it's supported.
2016-04-11 16:58:23 +02:00
Henrik Gramner dd6b7b974e msvs: WinRT support
To compile x264 for WinRT the following additional steps has to be performed.

 * Ensure that the necessary SDK is installed.

 * Set the correct environment variables in the VS command prompt as shown at
   https://trac.ffmpeg.org/wiki/CompilationGuide/WinRT

 * Add one of the following to --extra-cflags depending on the target OS:
   "-DWINAPI_FAMILY=WINAPI_FAMILY_PC_APP -D_WIN32_WINNT=0x0A00" (Windows 10)
   "-DWINAPI_FAMILY=WINAPI_FAMILY_PC_APP -D_WIN32_WINNT=0x0603" (Windows 8.1)
2016-04-11 16:58:22 +02:00
Henrik Gramner 7650a13670 configure: Disable CLI libraries when CLI is disabled 2016-04-11 16:58:22 +02:00
Henrik Gramner 3d972062c8 cli: Use memory-mapped input frames for yuv and y4m
Improves performance by avoiding extraneous memory copying.
Most beneficial on fast settings.

On average around 5-10% faster overall on ultrafast but the
performance improvement can be even larger in some cases.
2016-01-17 00:30:13 +01:00
Henrik Gramner cc652c158c configure: Simplify cygwin/mingw/msys code
Avoids some code duplication.

Also drop the -mno-cygwin check since that option was removed back in 2008.
2016-01-17 00:30:13 +01:00
Henrik Gramner 30ba5dc22f windows: Use native threads by default
--disable-win32thread can be passed as an argument to configure to compile
with pthreads, which was the old default behavior.
2016-01-17 00:30:13 +01:00
Anton Mitrofanov 479d0c1fe7 Don't assume 16-byte stack alignment by default on x86-32
Some compilers depending on target OS uses 4-byte stack alignment by default.
Explicitly check known good compilers and specific options for stack alignment.
2015-10-11 18:44:54 +02:00
Jerome Duval 39af8c72e6 Haiku support
Add Haiku as supported platform in configure.
Haiku has no nice() function, use the platform specific substitute instead.
2015-10-11 18:44:54 +02:00
Henrik Gramner 3dff8af303 x86: Enable SSE2 by default on x86-32
It makes more sense to tune the defaults to benefit the vast majority of users.

Anyone still using a Pentium III for video encoding is of course free to
explicitly set different flags when compiling.
2015-08-19 01:24:27 +03:00