Commit Graph

178 Commits

Author SHA1 Message Date
Martin Storsjö b4d9fa6cb9 compat: Fix the fallback definition of stdc_trailing_zeros
While shifting "value" to left, we would iterate through all bits
of an unsigned long long, while we only expect to count through
"size * CHAR_BIT" bits; instead shift bits to the right and just
count the trailing zeros.

This fixes fate with MSVC.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-09-24 14:00:27 +03:00
Rémi Denis-Courmont a7505ec562 compat: add a fallback implementation of C23 stdbit.h
Header contents taken from VLC commit 7a970a33329c9836d169727ddbaf49a33240d587.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2024-09-23 17:08:46 +02:00
Anton Khirnov 8c185ef4e7 compat: drop gcc, suncc, and pthreads stdatomic emulation
Since we now require a C11-compliant compiler, there should be no
supported configurations where any of these is used.
2024-09-23 17:08:46 +02:00
Andreas Rheinhardt 790f793844 avutil/common: Don't auto-include mem.h
There are lots of files that don't need it: The number of object
files that actually need it went down from 2011 to 884 here.

Keep it for external users in order to not cause breakages.

Also improve the other headers a bit while just at it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-31 00:08:43 +01:00
L. E. Segovia ddc1cd5cdd configure: Set WIN32_LEAN_AND_MEAN at configure time
Including winsock2.h or windows.h without WIN32_LEAN_AND_MEAN cause
bzlib.h to parse as nonsense, due to an instance of #define char small
in rpcndr.h.

See:

https://stackoverflow.com/a/27794577

Signed-off-by: L. E. Segovia <amy@amyspark.me>
Signed-off-by: Martin Storsjö <martin@martin.st>
2023-08-14 22:57:28 +03:00
Martin Storsjö 7aa9684db3 w32pthreads: Fix function signature mismatches for CreateThread
In WinRT mode, we use CreateThread instead of _beginthreadex.

CreateThread takes a LPTHREAD_START_ROUTINE function pointer,
which has got the signature DWORD WINAPI ThreadProc(LPVOID).
_beginthreadex takes a function with the signature
unsigned __stdcall func(void *).

DWORD is defined as an unsigned long, which is different type
from unsigned int, even if they have the same size on Windows.

This fixes build failures with Clang 16 and newer, where function
pointer type mismatches are a fatal error by default.

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-08-04 21:51:20 +03:00
Ziemowit Laski f8d6d0fbf1 compat: Use '-' instead of '/' for rc.exe options
When building FFMPEG in the MSYS environment under Windows, one
must not use forward slashes ('/') for command-line options.  It
appears that the MSYS shell interprets these as absolute paths and
then automatically rewrites them into equivalent Windows paths.  For
example, the '/nologo' switch below gets rewritten to something like
'C:/Program Files/Git/nologo', and this obviously breaks the build.
Thankfully, most M$ tools accept dashes ('-') as well.

Signed-off-by: Ziemowit Łąski <15880281+zlaski@users.noreply.github.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2023-02-13 13:49:40 +02:00
Timo Rothenpieler 416923346a compat/cuda: switch from powf to __powf intrinsic
The powf builtin causes crashes on older clang, so manually implement
the (faster) intrinsic.
The code it spawns is identical to that of nvcc.
2022-09-03 20:27:34 +02:00
Mohamed Khaled Mohamed 1a5cd79f51 avfilter: add bilateral_cuda filter
GSoC 2022

Signed-off-by: Mohamed Khaled <mohamed.elbassiony00@eng-st.cu.edu.eg>
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2022-09-03 15:18:56 +02:00
Timo Rothenpieler 9ca3b8b7cd compat: add msvc windres wrapper
This is by no means a complete wrapper. It's only designed to fit the
usecase ffmpegs build system has.
2022-08-13 14:42:52 +02:00
Mohamed Khaled Mohamed b1648150b2 avfilter: add chromakey_cuda filter
GSoC'22

libavfilter/vf_chromakey_cuda.cu:the CUDA kernel for the filter
libavfilter/vf_chromakey_cuda.c: the C side that calls the kernel and gets user input
libavfilter/allfilters.c: added the filter to it
libavfilter/Makefile: added the filter to it
cuda/cuda_runtime.h: added two math CUDA functions that are used in the filter

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2022-07-10 17:20:15 +02:00
Nil Admirari dfa062ed3c compat/w32dlfcn.h: Remove MAX_PATH limit and replace LoadLibraryExA with LoadLibraryExW
Signed-off-by: Martin Storsjö <martin@martin.st>
2022-06-21 13:27:46 +03:00
Andreas Rheinhardt 1ea3650823 Replace all occurences of av_mallocz_array() by av_calloc()
They do the same.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-20 01:03:52 +02:00
Timo Rothenpieler acd3c101ef compat/cuda: add __expf() implementation 2021-08-14 15:06:47 +02:00
Timo Rothenpieler 072788c46e avfilter: compress CUDA PTX code if possible 2021-06-22 14:05:44 +02:00
Peter Ross b5ea0980c5 fix broken links to msdn documentation
Signed-off-by: Peter Ross <pross@xvid.org>
2021-05-13 09:13:03 +10:00
Martin Storsjö b1b7cc698b atomics: Fix the win32 atomic_exchange function
This fixes building with MSVC after
a2a38b1606.

Remove the stray semicolon, and add casts for the input argument
(which is an intptr_t*) to the right type (PVOID volatile *).

Signed-off-by: Martin Storsjö <martin@martin.st>
2021-04-04 11:06:08 +03:00
Matt Oliver b57037d663 compat/cuda: correct ushort4 to use ushort
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2021-02-22 17:03:52 +01:00
rcombs eabf5e6d6b All: update names in copyright headers 2021-01-20 01:02:56 -06:00
Timo Rothenpieler cfdddec0c8 avfilter/scale_cuda: add lanczos algorithm 2020-11-04 01:43:21 +01:00
Timo Rothenpieler f1d0f83712 avfilter/scale_cuda: add bicubic interpolation 2020-11-03 19:58:13 +01:00
rcombs fb17ba86a8 compat/cuda/ptx2c: remove shell loop; fix BSD sed compat
This fixes building on macOS, and improves build times dramatically there
2020-06-01 22:10:41 -05:00
Stephen Hutchinson 0c75acb4ce compat/avisynth: remove avisynth headers 2020-04-05 01:17:55 +02:00
phunkyfish 0830e9116f avformat/udp: support w32pthreads compat
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-03-08 19:08:04 +01:00
Dave Yeo 9e6ee46c7d compat/os2threads: define INCL_DOSERRORS
This is needed to pull in the define for ERROR_TIMEOUT

Signed-off-by: Dave Yeo <daveryeo@telus.net>
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-02-15 18:25:51 +01:00
Matt Oliver fc6fde22c3 avutil/thread: Add pthread_cond_timedwait function
v2: fix calculating milisecond times and use SleepConditionVariableSRW.

Signed-off-by: Matt Oliver <protogonoi@gmail.com>
2020-01-21 22:34:15 +01:00
Matt Oliver 1fd8929450 compat/avisynth: Fix unicode compilation.
Reviewed-by: Stephen Hutchinson <qyot27@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-01 16:38:28 +01:00
Andreas Rheinhardt b307d74fe6 compat/cuda: Change inclusion guards
cuda_runtime.h as well as dynlink_loader.h used nonstandard inclusion
guards with an AV_ prefix, although these files are not in an libav*/
path. So change the inclusion guards and adapt the ref file of the
source fate test accordingly.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2019-08-05 12:07:09 +02:00
Rodger Combs 01994c93db build: add support for building CUDA files with clang
This avoids using the CUDA SDK at all; instead, we provide a minimal
reimplementation of the basic functionality that lavfi actually uses.
It generates very similar code to what NVCC produces.

The header contains no implementation code derived from the SDK.
The function and type declarations are derived from the SDK only to the
extent required to build a compatible implementation. This is generally
accepted to qualify as fair use.

Because this option does not require the proprietary SDK, it does not require
the "--enable-nonfree" flag in configure.

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2019-08-04 19:08:08 +02:00
Timo Rothenpieler a6818d5bd0 compat/cuda/ptx2c: don't drop final newline 2019-05-24 19:23:39 +02:00
Stephen Hutchinson 18bbb2dd01 compat/avisynth: update headers
As part of the update, it is now possible to test 32-bit GCC builds
of AviSynth+ with FFmpeg by using the AVS_WIN32_GCC32 define. Due to
different calling conventions between MSVC and GCC regarding 32-bit
Windows, this is unfortunately necessary.
2019-05-04 11:56:53 +05:30
Cyber Sinh 499b46fd0a compat/windows/makedef: Allow building shared libs with MSVC under WSL
A similar patch was posted by Gilles Khouzam in his blog.
2019-04-24 01:41:13 +02:00
Carl Eugen Hoyos 48860df34d configure: Add .exe suffix to toolchain calls.
Allows in-tree msvc compilation with wsl.
2019-04-20 00:12:34 +02:00
Peter Ross dea1224754 additional math.h functions for djgpp 2018-11-28 22:16:07 +11:00
Timo Rothenpieler 27cbbbb33f compat: remove in-tree NVidia headers
External headers are no longer welcome in the ffmpeg codebase because they
increase the maintenance burden. However, in the NVidia case the vanilla
headers need some modifications to be usable in ffmpeg therefore we still
provide them, but in a separate repository.

The external headers can be found at
https://git.videolan.org/?p=ffmpeg/nv-codec-headers.git

Fate-source is updated because of the deleted files, and dynlink_loader.h
license headers were updated with the standard FFmpeg headers.

Signed-off-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2018-02-27 16:22:12 +01:00
KO Myung-Hun 3c0a081a1e compat/os2threads: support static mutexes
Reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2018-01-07 00:14:12 -03:00
James Almer 613f789c19 w32pthreads: remove some remaining superfluous checks
Signed-off-by: James Almer <jamrial@gmail.com>
2017-12-25 23:17:56 -03:00
wm4 9b121dfc32 w32pthreads: always use Vista+ API, drop XP support
This removes the XP compatibility code, and switches entirely to SWR
locks, which are available starting at Windows Vista.

This removes CRITICAL_SECTION use, which allows us to add
PTHREAD_MUTEX_INITIALIZER, which will be useful later.

Windows XP is hereby not a supported build target anymore. It was
decided in a project vote that this is OK.
2017-12-26 02:49:48 +01:00
Mark Thompson 1dc483a6f2 compat/cuda: Pass a logging context to load functions
Reviewed-by: Timo Rothenpieler <timo@rothenpieler.org>
2017-11-20 15:47:05 +00:00
Timo Rothenpieler 15b019e40a avcodec/nvenc: fix double defined GUID on cygwin 2017-11-17 23:34:18 +01:00
James Almer edef07569c Merge commit 'bad7ce1d82f0b7da55086b8c6124eff0d35a1b1a'
* commit 'bad7ce1d82f0b7da55086b8c6124eff0d35a1b1a':
  makedef: Pass EXTERN_PREFIX from configure to makedef

Merged-by: James Almer <jamrial@gmail.com>
2017-11-16 13:12:59 -03:00
Martin Storsjö bad7ce1d82 makedef: Pass EXTERN_PREFIX from configure to makedef
This avoids having to use either "dumpbin -headers" to find out
the current architecture, or pass $ARCH from configure to deduce it.

When configuring with --disable-asm, ARCH is equal to "c", which doesn't
give any indication of what symbol prefix is to be used.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-11-16 16:54:08 +02:00
James Almer 12f4e2ba02 Merge commit '0af8a72174108b9bb482f1073a1e9a3bc258af51'
* commit '0af8a72174108b9bb482f1073a1e9a3bc258af51':
  build: Drop support for legacy TI ARM compiler

Merged-by: James Almer <jamrial@gmail.com>
2017-11-11 23:41:35 -03:00
James Almer ab7c8e1d6c Merge commit 'a37e84be69310cd7de9540c8bc194cb0a6d158ed'
* commit 'a37e84be69310cd7de9540c8bc194cb0a6d158ed':
  makedef: Add support for identifying the ARM64 machine type

Merged-by: James Almer <jamrial@gmail.com>
2017-11-11 16:59:36 -03:00
James Almer c14f8125a8 Merge commit '1a7bf48eed806beea7e835b31b06aa6bc94da5da'
* commit '1a7bf48eed806beea7e835b31b06aa6bc94da5da':
  makedef: Extend the script for use with mingw tools as well

Merged-by: James Almer <jamrial@gmail.com>
2017-11-11 11:31:22 -03:00
James Almer 24f1685f6e Merge commit '44aa9105c535471ca9e23796d7ca29b341f47636'
* commit '44aa9105c535471ca9e23796d7ca29b341f47636':
  makedef: Fold as much text transformations as possible into the initial dump

Merged-by: James Almer <jamrial@gmail.com>
2017-11-11 11:30:32 -03:00
James Almer ce52e430b2 compat/w32dlfcn: add missing config.h include
Fixes warnings about undefined HAVE_WINRT

Signed-off-by: James Almer <jamrial@gmail.com>
2017-11-07 16:50:26 -03:00
Diego Biurrun 0af8a72174 build: Drop support for legacy TI ARM compiler 2017-10-25 13:39:58 +02:00
Martin Storsjö a37e84be69 makedef: Add support for identifying the ARM64 machine type
Since this machine type is 5 chars while the existing ones only
were 3 (which the regexp assumed), the regexp has to be extended
a little.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-10-12 21:49:19 +03:00
Martin Storsjö 1a7bf48eed makedef: Extend the script for use with mingw tools as well
This is invoked by setting the NM and AR variables to the names of
those specific tools. The ARCH variable also needs to be provided,
to choose the symbol prefix (nm doesn't provide any option that
dumps the architecture easily).

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-08-31 14:22:18 +03:00