summaryrefslogtreecommitdiff
path: root/libavutil
Commit message (Collapse)AuthorAge
* x86/tx_float: save a branch during coefficient deinterleavingLynne2022-08-09
| | | | | | | | | | | Directly branch into the special 64-point deinterleave subroutine rather than going through the general deinterleave. 64-point transform timings on Zen 3: Before: 1974 decicycles in av_tx (fft),16776864 runs, 352 skips After: 1956 decicycles in av_tx (fft),16775378 runs, 1838 skips
* avutil/hwcontext_videotoolbox: add missing include for AVFrameZhao Zhili2022-08-08
| | | | Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
* avutil/test/pixfmt_best: test the VUYA pixel formatJames Almer2022-08-07
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/loongarch/h264chroma, vc1dsp_lasx: Add wrapper for __lasx_xvldxAndreas Rheinhardt2022-08-05
| | | | | | | | | __lasx_xvldx does not accept a pointer to const (in fact, no function in lasxintrin.h does so), although it is not allowed to modify the pointed-to buffer. Therefore this commit adds a wrapper for it in order to constify the H264Chroma API in a later commit. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/loongarch: Add wrapper for __lsx_vldxAndreas Rheinhardt2022-08-05
| | | | | | | | | __lsx_vldx does not accept a pointer to const (in fact, no function in lsxintrin.h does so), although it is not allowed to modify the pointed-to buffer. Therefore this commit adds a wrapper for it in order to constify the HEVC DSP functions in a later commit. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavu/hwcontext_vaapi: Map the AYUV formatPhilip Langdale2022-08-03
| | | | This is the format used by Intel VAAPI for 8bit 4:4:4 content.
* lavu/pixfmt: Add packed 4:4:4 formatPhilip Langdale2022-08-03
| | | | | | | | | The "AYUV" format is defined by Microsoft as their preferred format for 4:4:4 content, and so it is the format used by Intel VAAPI and QSV. As Microsoft like to define their byte ordering in little-endian fashion, the memory order is reversed, and so our pix_fmt, which follows memory order, has a reversed name (VUYA).
* avutil/opt: Combine multiple av_log statementsAndreas Rheinhardt2022-08-03
| | | | | Reviewed-by: Thilo Borgmann <thilo.borgmann@mail.de> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavu/frame: allow calling av_frame_make_writable() on non-refcounted framesAnton Khirnov2022-08-02
| | | | | This is an easy way to make a refcounted frame from a non-refcounted one.
* lavu/frame: add a duration field to AVFrameAnton Khirnov2022-07-19
| | | | | | | | | The only duration field currently present in AVFrame is pkt_duration, which is semantically restricted to those frames that are output by decoders. Add a new field that stores the frame's duration without regard for how that frame was produced. Deprecate pkt_duration.
* avutil/hwcontext_d3d11va: add BGRA/RGBA10 formats supportTimo Rothenpieler2022-07-18
| | | | Desktop duplication outputs those
* avutil/hwcontext_d3d11va: update hwctx flags from input textureTimo Rothenpieler2022-07-18
| | | | At least QSV relies on those being set correctly when deriving a hwctx.
* avutil/hwcontext_d3d11va: fix texture_infos writes on non-fixed-size poolsTimo Rothenpieler2022-07-18
|
* avutil/hwcontext_d3d11va: fix mixed declaration and codeTimo Rothenpieler2022-07-18
|
* Bump versions after 5.1 branchMichael Niedermayer2022-07-13
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Bump Versions for 5.1 branchMichael Niedermayer2022-07-13
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avfilter: add remap opencl filterPaul B Mahol2022-07-07
|
* avutil/mem: Handle fast allocations near UINT_MAX properlyAndreas Rheinhardt2022-07-06
| | | | | | | | | | | | | | | | | | | | | av_fast_realloc and av_fast_mallocz? store the size of the objects they allocate in an unsigned. Yet they overallocate and currently they can allocate more than UINT_MAX bytes in case a user has requested a size of about UINT_MAX * 16 / 17 or more if SIZE_MAX > UINT_MAX (and if the user increased max_alloc_size via av_max_alloc). In this case it is impossible to store the true size of the buffer via the unsigned*; future requests are likely to use the (re)allocation codepath even if the buffer is actually large enough because of the incorrect size. Fix this by ensuring that the actually allocated size always fits into an unsigned. (This entails erroring out in case the user requested more than UINT_MAX.) Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* )hwcontext: add a stub implementation for Vulkan functionsLynne2022-07-05
|
* Revert "avutil/channel_layout: av_channel_layout_describe_bprint: Check for ↵James Almer2022-07-04
| | | | | | | | | | | | buffer end" The doxy for av_channel_layout_describe() states that the user should look at the return value to check if the string was truncated. Returning an error code in this scenario goes against this and is an API break. A proper fix for the timeout was applied to the Matroska demuxer in 94901a9518. This reverts commit 8154cb7c2ff2afcb1a0842de8c215b7714c814d0.
* avutil/channel_layout: av_channel_layout_describe_bprint: Check for buffer endMichael Niedermayer2022-07-02
| | | | | | | | Fixes: Timeout printing a billion channels Fixes: 48099/clusterfuzz-testcase-minimized-ffmpeg_dem_MATROSKA_fuzzer-6754782204788736 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avutil/wchar_filename: Make the header C++ compatibleAndreas Rheinhardt2022-06-28
| | | | | | | | | | | When compiling decklink, this header is included from a C++ file (albeit inside 'extern "C"') and this causes compilation failures because of an implicit void* -> char* conversion. So add an explicit cast. Fixes ticket #9819. Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/ppc/cpu: Use proper header for OpenBSD PPC CPU detectionBrad Smith2022-06-25
| | | | | | | | Use the proper header for PPC CPU detection code. sys/param.h includes sys/types, but sys/types.h is the more appropriate header to be used here. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avutil/x86/float_dsp: Remove obsolete 3dnowext functionAndreas Rheinhardt2022-06-22
| | | | | | | | | | | x64 always has MMX, MMXEXT, SSE and SSE2 and this means that some functions for MMX, MMXEXT, SSE and 3dnow are always overridden by other functions (unless one e.g. explicitly disables SSE2). So given that the only systems which benefit from ff_vector_fmul_window_3dnowext are truely ancient 32bit AMD x86s it is removed. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/x86/pixelutils: Remove obsolete MMX(EXT) functionsAndreas Rheinhardt2022-06-22
| | | | | | | | | | | x64 always has MMX, MMXEXT, SSE and SSE2 and this means that some functions for MMX, MMXEXT, SSE and 3dnow are always overridden by other functions (unless one e.g. explicitly disables SSE2). So given that the only systems which benefit from the 8x8 MMX (overridden by MMXEXT) or the 16x16 MMXEXT (overridden by SSE2) are truely ancient 32bit x86s they are removed. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* libavutil: Add wchartoutf8(), wchartoansi(), utf8toansi(), getenv_utf8(), ↵Nil Admirari2022-06-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | freeenv_utf8() and getenv_dup() wchartoutf8() converts strings returned by WinAPI into UTF-8, which is FFmpeg's preffered encoding. Some external dependencies, such as AviSynth, are still not Unicode-enabled. utf8toansi() converts UTF-8 strings into ANSI in two steps: UTF-8 -> wchar_t -> ANSI. wchartoansi() is responsible for the second step of the conversion. Conversion in just one step is not supported by WinAPI. Since these character converting functions allocate the buffer of necessary size, they also facilitate the removal of MAX_PATH limit in places where fixed-size ANSI/WCHAR strings were used as filename buffers. On Windows, getenv_utf8() wraps _wgetenv() converting its input from and its output to UTF-8. Strings returned by getenv_utf8() must be freed by freeenv_utf8(). On all other platforms getenv_utf8() is a wrapper around getenv(), and freeenv_utf8() is a no-op. The value returned by plain getenv() cannot be modified; av_strdup() is usually used when modifications are required. However, on Windows, av_strdup() after getenv_utf8() leads to unnecessary allocation. getenv_dup() is introduced to avoid such an allocation. Value returned by getenv_dup() must be freed by av_free(). Because of cleanup complexities, in places that only test the existence of an environment variable or compare its value with a string consisting entirely of ASCII characters, the use of plain getenv() is still preferred. (libavutil/log.c check_color_terminal() is an example of such a place.) Plain getenv() is also preffered in UNIX-only code, such as bktr.c, fbdev_common.c, oss.c in libavdevice or af_ladspa.c in libavfilter. Signed-off-by: Martin Storsjö <martin@martin.st>
* avutil/cpu_internal: Fix check for SSE2SLOWAndreas Rheinhardt2022-06-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For SSE2 and SSE3, there are four states that the two flags involved (AV_CPU_FLAG_SSE[23] and AV_CPU_FLAG_SSE[23]SLOW) can convey. When ordered from worst to best they are: 1. both flags unset (SSE[23] unavailable) 2. the slow flag set, the ordinary flag unset (this is designed for cases where SSE2 is available, but so slow that MMX(EXT)/SSE code is usually faster) 3. both flags set (SSE2 is available, but there might be scenarios where MMX(EXT)/SSE code is faster) 4. the ordinary flag set, the slow flag unset (this is the normal case) The ordinary macros for checking cpuflags return true in the latter two cases; the fast macros only return true for the latter case. Yet the macros to check for slow currently only return true in case three. This seems unintended. In fact, the only uses of the slow macros are all of the form if (EXTERNAL_SSE2(cpu_flags) || EXTERNAL_SSE2_SLOW(cpu_flags)) where the check for EXTERNAL_SSE2_SLOW is completely redundant. Even more importantly, it is not what was intended. Before 6369ba3c9cc74becfaad2a8882dff3dd3e7ae3c0, the checks passed in cases 2 to 4. Said commit changed this to something that only passes for the third case. Commits 7fb758cd8ed08e4a37f10e25003953d13c68b8cd and c1913064e38cb338039f29c280a0dacc3fd1e451 restored the old behaviour, yet merging 4efab89332ea39a77145e8b15562b981d9dbde68 (in commit ac774cfa571734c49c26e2d3387adccff8957ff8) broke this again by changing it to what it is now.* This commit changes the macros to make the slow macros check whether a specific instruction is supported, even if slow. This restores the intended meaning to all uses of the SLOW macros and is generally more natural. *: Libav only checks for EXTERNAL_SSE2_SLOW, i.e. for the third case only. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* all: Replace if (ARCH_FOO) checks by #if ARCH_FOOAndreas Rheinhardt2022-06-15
| | | | | | | | | | | | | | | | | | This is more spec-compliant because it does not rely on dead-code elimination by the compiler. Especially MSVC has problems with this, as can be seen in https://ffmpeg.org/pipermail/ffmpeg-devel/2022-May/296373.html or https://ffmpeg.org/pipermail/ffmpeg-devel/2022-May/297022.html This commit does not eliminate every instance where we rely on dead code elimination: It only tackles branching to the initialization of arch-specific dsp code, not e.g. all uses of CONFIG_ and HAVE_ checks. But maybe it is already enough to compile FFmpeg with MSVC with whole-programm-optimizations enabled (if one does not disable too many components). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil: bump version after UUID changesZane van Iperen2022-06-13
| | | | | | | Forgot to bump after 76e95daa08f4c8874dbb570b6293716e2175213a. Signed-off-by: Zane van Iperen <zane@zanevaniperen.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/tests/uuid: add uuid testsPierre-Anthony Lemieux2022-06-12
|
* avutil/uuid: add utility library for manipulating UUIDs as specified in RFC 4122Zane van Iperen2022-06-12
| | | | | Co-authored-by: Pierre-Anthony Lemieux <pal@palemieux.com> Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avutil/wchar_filename,file_open: Support long file names on Windowssoftworkz2022-06-09
| | | | | Signed-off-by: softworkz <softworkz@hotmail.com> Signed-off-by: Martin Storsjö <martin@martin.st>
* libavutil/tests/md5: Remove 'volatile workaround' to avoid warningssoftworkz2022-06-08
| | | | | | | | | | | Those are always showing up on Patchwork when FATE tests are failing, covering some possibly more useful information. The volatile keyword was used as a workaround for an eight year old clang version. Signed-off-by: softworkz <softworkz@hotmail.com> Signed-off-by: Marton Balint <cus@passwd.hu>
* avutil/avframe: fix channel layout checks in av_frame_copy()James Almer2022-06-05
| | | | | | | | | | | | | | | Normally, both the source and dest frame would have only the old API fields set, only the new API fields set, or both set. But in some cases, like when calling av_frame_ref() using a non reference counted source frame where only the old channel layout API fields were populated, the result would be the dst frame having both the new and old fields populated. This commit takes this into account and fixes the checks by calling av_channel_layout_compare() only if the source frame has the new API fields set, and doing sanity checks for the source frame old API fields if the new ones are not set. Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/csp: create public API for colorspace structsLeo Izen2022-06-01
| | | | | | | | | | This commit moves some of the functionality from avfilter/colorspace into avutil/csp and exposes it as a public API so it can be used by libavcodec and/or libavformat. It also converts those structs from double values to AVRational to make regression testing easier and more consistent. Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
* avutil/mem: fix doc for reallocsZhao Zhili2022-05-26
| | | | | | | | | | The doc says those function are like av_free if size or nmemb is zero. It doesn't match the code. av_realloc() realloc one byte if size is zero, which was added by 91ff05f6ac5 ten years ago. realloc() itself in C is implementation-dependent. Make the doc match the longstanding behaviour. Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
* qsv: add requirement for the mininal version of libmfxHaihao Xiang2022-05-25
| | | | | | | | | | libmfx 1.28 was released 3 years ago, it is easy to get a greater version than 1.28. We may remove lots of compile-time checks if adding the requirement for the minimal version in the configure script. Reviewed-by: softworkz <softworkz@hotmail.com> Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* libavutil: Deprecate av_fopen_utf8, provide an avpriv versionMartin Storsjö2022-05-23
| | | | | | | | | | | | | | | | | | | | | | Since every DLL can use an individual CRT on Windows, having an exported function that opens a FILE* won't work if that FILE* is going to be used from a different DLL (or from user application code). Internally within the libraries, the issue can be worked around by duplicating the function in all libraries (this already happened implicitly because the function resided in file_open.c) and renaming the function to ff_fopen_utf8 (so that it doesn't end up exported from the DLLs) and duplicating it in all libraries that use it. This makes the avpriv_fopen_utf8 / ff_fopen_utf8 function work in the exact same way as the existing avpriv_open / ff_open, with the same setup as introduced in e743e7ae6ee7e535c4394bec6fe6650d2b0dbf65. That mechanism doesn't work for external users, thus deprecate the existing function. Signed-off-by: Martin Storsjö <martin@martin.st>
* avutil/hwcontext_qsv: fix mapping issue between QSV frames and D3D11VA framesTong Wu2022-05-23
| | | | | | | | | | | | Fixes: $ ffmpeg.exe -init_hw_device d3d11va=d3d11 -init_hw_device \ qsv=qsv@d3d11 -s:v WxH -pix_fmt nv12 -i input.yuv -vf \ "hwupload=extra_hw_frames=16,hwmap=derive_device=d3d11va,format=d3d11,\ hwmap=derive_device=qsv,format=qsv" -f null - Reviewed-by: Soft Works <softworkz@hotmail.com> Signed-off-by: Tong Wu <tong1.wu@intel.com> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* avutil/hwcontext_d3d11va: pass the format value from outside for staging textureTong Wu2022-05-23
| | | | | | | | | | | | | | | | In d3d11va_create_staging_texture(), during the hwmap process, the ctx->internal->priv is not initialized, resulting in the texDesc.Format not initialized. Now pass the format value from d3d11va_transfer_data() to fix it. $ ffmpeg.exe -y -hwaccel qsv -init_hw_device d3d11va=d3d11 \ -init_hw_device qsv=qsv@d3d11 -c:v h264_qsv \ -i input.h264 -vf "hwmap=derive_device=d3d11va,format=d3d11,hwdownload,format=nv12" \ -f null - Reviewed-by: Soft Works <softworkz@hotmail.com> Signed-off-by: Tong Wu <tong1.wu@intel.com> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* avutil/hwcontext_qsv: derive QSV frames to D3D11VA framesTong Wu2022-05-23
| | | | | | | | | | | Fixes: $ ffmpeg.exe -y -hwaccel qsv -init_hw_device d3d11va=d3d11 \ -init_hw_device qsv=qsv@d3d11 -c:v h264_qsv -i input.h264 \ -vf "hwmap=derive_device=d3d11va,format=d3d11" -f null - Reviewed-by: Soft Works <softworkz@hotmail.com> Signed-off-by: Tong Wu <tong1.wu@intel.com> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* x86/tx_float: replace fft_sr_avx with fft_sr_fma3Lynne2022-05-21
| | | | | | | | | | | | When the SLOW_GATHER flag was added to the AVX2 version, this made FMA3-features not enabled on Zen CPUs. As FMA3 adds 6-7% across all platforms that support it, in the interest of saving space, this commit removes the AVX version and replaces it with an FMA3 version. The only CPUs affected are Sandy Bridge and Bulldozer, which have AVX support, but no FMA3 support. In the future, if there's a demand for it, a version of the function duplicated for AVX can be added.
* x86/tx_float: improve temporary register allocation for loadsLynne2022-05-21
| | | | | | | | | | On Zen 3: Before: 1484285 decicycles in av_tx (fft), 131072 runs, 0 skips After: 1415243 decicycles in av_tx (fft), 131072 runs, 0 skips
* lavu/tx: make slow ISA extension penalties smarterLynne2022-05-21
| | | | | | | | Instead of having a fixed -64 prio penalty, make the penalties more granular. As the prio is based on the register size in bits, decrementing it by 129 makes AVX SLOW functions be avoided in favor of any SSE versions.
* x86/tx_float: add AV_CPU_FLAG_AVXSLOW/SLOW_GATHER flags where appropriateLynne2022-05-21
|
* Revert "x86/tx_float: remove vgatherdpd usage"Lynne2022-05-21
| | | | | | | | This reverts commit 82a68a8771ca39564f6a74e0f875d6852e7a0c2a. Smarter slow ISA penalties makes gathers still useful. The intention is to use gathers with the final stage of non-ptwo iMDCTs, where they give benefit.
* x86/tx_float: remove vgatherdpd usageLynne2022-05-20
| | | | | | | | | | | | | | | | | | | | Its performance loss ranges from either being just as fast as individual loads (Skylake), a few percent slower (Alderlake), 8% slower (Zen 3), to completely disasterous (older/other CPUs). Sadly, gathers never panned out fast on x86, even with the benefit of time and implementation experience. This also saves a register, as there's no need to fill out an additional register mask. Zen 3 (16384-point transform): Before: 1561050 decicycles in av_tx (fft), 131072 runs, 0 skips After: 1449621 decicycles in av_tx (fft), 131072 runs, 0 skips Alderlake: 2% slower on big transforms (65536), to 1% (131072), to a few percent for smaller sizes.
* lib*/version: Move library version functions into files of their ownAndreas Rheinhardt2022-05-10
| | | | | | | This avoids having to rebuild big files every time FFMPEG_VERSION changes (which it does with every commit). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/hwcontext_videotoolbox: create real buffer poolZhao Zhili2022-04-29
| | | | | | vt_get_buffer shouldn't do buffer pool's job. Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
* avutil/timecode: use timecode fps for number of frame digitsMarton Balint2022-04-22
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>