summaryrefslogtreecommitdiff
path: root/libavutil
Commit message (Collapse)AuthorAgeFilesLines
* lavu/frame: extend AVFrame.repeat_pict documentationAnton Khirnov2023-05-151-2/+16
|
* avutil/version: bump minor after recent changesJames Almer2023-05-041-1/+1
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/frame: deprecate key_frameJames Almer2023-05-043-1/+10
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/frame: add a keyframe flag to AVFrameJames Almer2023-05-041-0/+4
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/frame: deprecate interlaced_frame and top_field_firstJames Almer2023-05-043-0/+13
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/frame: add new interlaced and top_field_first flagsJames Almer2023-05-041-0/+9
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* riscv/intmath: use builtins for counting onesRémi Denis-Courmont2023-05-021-26/+4
| | | | | | As with the earlier bswap change, all versions of GCC and Clang that support RISC-V support the popcount built-ins, so we can just use them instead of inline assembler.
* riscv/bswap: use compiler builtinsRémi Denis-Courmont2023-05-021-47/+5
| | | | | | | | | | | av_bswapXX() are used in context that expect exact size types, notably variable arguments to av_log(). On Linux RV64, uint_fast32_t is an unsigned long, so the current inline assembler does not work properly. Since GCC and Clang gained their byte-swap built-ins before they supported RISC-V, we can simply defer to them. As an added bonus, the compiler can do instruction scheduling, which it couldn't with the Zbb inline assembler.
* lavu/hwcontext_qsv: Update after adding support for VAAPI on WindowsSil Vilerino2023-04-241-2/+12
| | | | | | | | | | | | | - qsv_internal.h: Remove unnecessary include va_drm.h - qsv_internal.h: Enable AVCODEC_QSV_LINUX_SESSION_HANDLE on Linux/VA only - hwcontext_qsv.c: Do not allow child_device_type VAAPI for Windows until support is added, keep D3D11/DXVA2 as more prioritary defaults. Initial review at https://github.com/intel-media-ci/ffmpeg/pull/619/ Signed-off-by: Sil Vilerino <sivileri@microsoft.com> Reviewed-by: Dmitry Rogozhkin <dmitry.v.rogozhkin@intel.com> Reviewed-by: Wu, Tong1 <tong1.wu@intel.com>
* lavu/hwcontext_vaapi: Add Windows/VAAPI support with vaGetDisplayWin32Sil Vilerino2023-04-242-3/+77
| | | | | | | | | | | | Libva 2.17+ adds a new libva-win32 node and Mesa 22.3 adds a VAAPI driver based on Direct3D 12 for Windows. Both of them are available at: https://www.nuget.org/packages/Microsoft.Direct3D.VideoAccelerationCompatibilityPack Initial review at https://github.com/intel-media-ci/ffmpeg/pull/619/ Signed-off-by: Sil Vilerino <sivileri@microsoft.com> Reviewed-by: Dmitry Rogozhkin <dmitry.v.rogozhkin@intel.com> Reviewed-by: Wu, Tong1 <tong1.wu@intel.com>
* avutil/tx_priv: Use unsigned in BF() to avoid signed overflowsMichael Niedermayer2023-04-221-4/+10
| | | | | | | | Fixes: signed integer overflow: 100183269 - -2132769113 cannot be represented in type 'int' Fixes: 55063/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_FIXED_fuzzer-5039294027005952 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: propagate MultiByteToWideChar() and ↵James Almer2023-04-141-2/+4
| | | | | | | | WideCharToMultiByte() failures Don't return success if the string could not be converted. Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/internal: remove timer.h againZhao Zhili2023-04-151-1/+0
| | | | | | | | | | | | | | | | | | | timer.h has been removed from internal.h, and then added back with 3e6088f for convenience. This patch removed it again for the following reasons: 1. Only includes what's necessary is a common and safe strategy. 2. It fixed some build errors on Android: a. libavutil/timer.h includes sys/ioctl.h, and ioctl.h includes termios.h on Android. b. termios.h reserves names prefixed with ‘c_’, ‘V’, ‘I’, ‘O’, and ‘TC’; and names prefixed with ‘B’ followed by a digit. c. libavcodec uses B0 B1 and so on as variable names a lot. So the code failed to build with --enable-linux-perf, or --target-os=Linux. Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
* avutil: make av_frame_get_plane_buffer accept a const AVFrame*Niklas Haas2023-04-142-2/+2
| | | | Signed-off-by: Niklas Haas <git@haasn.dev>
* avutil/hdr_dynamic_metadata: allow av_dynamic_hdr_plus_to_t35() to accept an ↵James Almer2023-04-053-12/+32
| | | | | | | | | | | | | existing buffer The function now accepts an existing buffer to avoid unnecessary allocations, as well as only reporting the needed amount of bytes if you pass a NULL pointer as input for data. For this, both parameters become input and output, as well as making data optional. This is backwards compatible, and as such not breaking any existing use of the function in external code (if there's any). Signed-off-by: James Almer <jamrial@gmail.com>
* mips: fix build fail on MIPS R6Junxian Zhu2023-03-261-3/+3
| | | | | | | | Add macro define to avoid causing build fail with incompatible assembler code on MIPS R6. Signed-off-by: Junxian Zhu <zhujunxian@oss.cipunited.com> Reviewed-by: Shiyou Yin <yinshiyou-hf@loongson.cn> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avutil/frame: move counters utilized in loops to their scopeJan Ekström2023-03-241-44/+32
| | | | | | This way we can clean up separate definitions in functions with just a single loop, as well as have no reuse between different loops' counters in functions with multiple.
* avutil: add HDR10+ dynamic metadata serialization functionRaphaël Zumer2023-03-213-1/+161
| | | | | | Co-authored-by: Mohammad Izadi <moh.izadi@gmail.com> Signed-off-by: Raphaël Zumer <rzumer@tebako.net> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/avutil: move dynamic HDR10+ metadata parsing to libavutilRaphaël Zumer2023-03-212-0/+203
| | | | | Signed-off-by: Raphaël Zumer <rzumer@tebako.net> Signed-off-by: James Almer <jamrial@gmail.com>
* lavu/frame: deprecate AVFrame.pkt_{pos,size}Anton Khirnov2023-03-203-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | These fields are supposed to store information about the packet the frame was decoded from, specifically the byte offset it was stored at and its size. However, - the fields are highly ad-hoc - there is no strong reason why specifically those (and not any other) packet properties should have a dedicated field in AVFrame; unlike e.g. the timestamps, there is no fundamental link between coded packet offset/size and decoded frames - they only make sense for frames produced by decoding demuxed packets, and even then it is not always the case that the encoded data was stored in the file as a contiguous sequence of bytes (in order for pos to be well-defined) - pkt_pos was added without much explanation, apparently to allow passthrough of this information through lavfi in order to handle byte seeking in ffplay. That is now implemented using arbitrary user data passthrough in AVFrame.opaque_ref. - several filters use pkt_pos as a variable available to user-supplied expressions, but there seems to be no established motivation for using them. - pkt_size was added for use in ffprobe, but that too is now handled without using this field. Additonally, the values of this field produced by libavcodec are flawed, as described in the previous ffprobe conversion commit. In summary - these fields are ill-defined and insufficiently motivated, so deprecate them.
* libavutil/hdr_dynamic_vivid_metadata: fix three spline paramsZhao Zhili2023-03-172-2/+64
| | | | | | There are two group of three_Spline params. Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
* lavu/frame: improve AVFrame.opaque[_ref] documentationAnton Khirnov2023-03-101-7/+23
| | | | | Make them match each other, mention interaction with AV_CODEC_FLAG_COPY_OPAQUE.
* lavu/vulkan: fix handle type for 32-bit targetsKacper Michajłow2023-03-072-1/+5
| | | | | | | Fixes compilation with clang which errors out on Wint-conversion. Signed-off-by: Kacper Michajłow <kasper93@gmail.com> Signed-off-by: Martin Storsjö <martin@martin.st>
* vulkan: Fix win/i386 calling conventionMartin Storsjö2023-03-071-4/+4
| | | | | | | | | | | This fixes the following error when compiling with a modern version of Clang for Windows/i386: src/libavutil/hwcontext_vulkan.c:738:32: error: incompatible function pointer types initializing 'PFN_vkDebugUtilsMessengerCallbackEXT' (aka 'unsigned int (*)(enum VkDebugUtilsMessageSeverityFlagBitsEXT, unsigned int, const struct VkDebugUtilsMessengerCallbackDataEXT *, void *) __attribute__((stdcall))') with an expression of type 'VkBool32 (VkDebugUtilsMessageSeverityFlagBitsEXT, VkDebugUtilsMessageTypeFlagsEXT, const VkDebugUtilsMessengerCallbackDataEXT *, void *)' (aka 'unsigned int (enum VkDebugUtilsMessageSeverityFlagBitsEXT, unsigned int, const struct VkDebugUtilsMessengerCallbackDataEXT *, void *)') [-Wincompatible-function-pointer-types] .pfnUserCallback = vk_dbg_callback, ^~~~~~~~~~~~~~~ Signed-off-by: Martin Storsjö <martin@martin.st>
* lavu/hwcontext_vaapi: sync surface before export its DRM handleFei Wang2023-02-271-1/+10
| | | | | | | | | | According to description of vaExportSurfaceHandle in libva, vaSyncSurface must be called if the contents of the surface will be read. Fixes ticket #9967. Reviewed-by: Zhao Zhili <zhilizhao@tencent.com> Signed-off-by: Fei Wang <fei.w.wang@intel.com>
* avutil: [LA] use getauxval to do runtime check.Shiyou Yin2023-02-271-16/+8
| | | | | | | Replace cpucfg with getauxval to avoid crash in case of some processor capabilities are not supportted by kernel used. Reviewed-by: Steven Liu <liuqi05@kuaishou.com>
* qsv: remove CONFIG_VAAPI for mutiple formatsTong Wu2023-02-221-3/+3
| | | | | | | | | Remove CONFIG_VAAPI for VUYX, YUYV422, Y210, XV30, Y212, XV36. Make 8-bit, 10-bit, 12-bit YUV 4:2:2 video sources as well as YUV 4:4:4 video sources supported by d3d11va and dxva2 just like what VAAPI does. Sign-off-by: Tong Wu <tong1.wu@intel.com>
* hwcontext_dxva2: add mutiple supported formatsTong Wu2023-02-221-0/+7
| | | | | | | | | | | Add support for VUYX, YUYV422, Y210, XV30, P012, Y212, XV36. The added formats work with qsv acceleration and will not have impact on dxva2 acceleration(-hwaccel dxva2) since so far these formats are still not supported by using dxva2 acceleration. Hwupload and hwdownload can work with the added formats. Signed-off-by: Tong Wu <tong1.wu@intel.com>
* hwcontext_d3d11va: add mutiple supported DXGI formatsTong Wu2023-02-221-0/+7
| | | | | | | | | | | | Add support for VUYX, YUYV422, Y210, XV30, P012, Y212, XV36. The added formats work with qsv acceleration and will not have impact on d3d11va acceleration(-hwaccel d3d11va) since so far these formats are still not supported by using d3d11va acceleration. Hwupload and hwdownload can work with the added formats. Signed-off-by: Tong Wu <tong1.wu@intel.com>
* version.h: Bump minor post 6.0 branchn6.1-devMichael Niedermayer2023-02-191-1/+1
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* version.h: Bump minor for 6.0 branchMichael Niedermayer2023-02-191-1/+1
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avutil/frame: deprecate AVFrame.coded_picture_number and display_picture_numberMarton Balint2023-02-133-1/+10
| | | | | | | | Their usefulness is questionable, very few decoders set them, and their type should have been int64_t. A replacement field can be added later if a valid use case is found. Signed-off-by: Marton Balint <cus@passwd.hu>
* Bump major versions of all librariesJames Almer2023-02-091-2/+2
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/version: postpone the remaining API deprecationsJames Almer2023-02-091-6/+6
| | | | | | They are too recent. Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/{color_utils, csp}: merge color_utils into csp and expose APILeo Izen2023-02-096-293/+213
| | | | | | | | | | | | | | | | | | | | | | | | libavutil/color_utils contains some avpriv_ symbols that map enum AVTransferCharacteristic values to gamma-curve approximations and to the actual transfer functions to invert them (i.e. -> linear). There's two issues with this: (1) avpriv is evil and should be avoided whenever possible (2) libavutil/csp.h exposes a public API for handling color that already handles primaries and matricies I don't see any reason this API has to be private, so this commit takes the functionality from avutil/color_utils and merges it into avutil/csp with an exposed av_ API rather than the previous avpriv_ API. Every reference to the previous API has been updated to point to the new one. color_utils.h has been deleted as well. This should not break any applications as it only contained avpriv_ symbols in the first place, so nothing in that header could be referenced by other applications. Signed-off-by: Leo Izen <leo.izen@gmail.com> Signed-off-by: Anton Khirnov <anton@khirnov.net>
* avutil: remove FF_API_AV_MALLOCZ_ARRAYJames Almer2023-02-093-19/+0
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avutil: remove FF_API_COLORSPACE_NAMEJames Almer2023-02-093-27/+0
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avutil: remove FF_API_DECLARE_ALIGNEDJames Almer2023-02-093-83/+0
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avutil: remove FF_API_D2STRJames Almer2023-02-094-36/+0
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* lavu/hwcontext_qsv: add support for UYVYHaihao Xiang2023-02-071-0/+7
| | | | | | | | | | | | | | The SDK supports UYVY from version 1.17, and VPP may support UYVY input on Linux [1] $ ffmpeg -loglevel verbose -init_hw_device qsv=intel -f lavfi -i \ yuvtestsrc -vf \ "format=uyvy422,hwupload=extra_hw_frames=32,vpp_qsv=format=nv12" \ -f null - [1] https://github.com/Intel-Media-SDK/MediaSDK/blob/master/doc/samples/readme-vpp_linux.md Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* lavu/frame: deprecate reordered_opaqueAnton Khirnov2023-02-043-0/+10
| | | | | It is only used in libavcodec, where it's been superseded by AV_CODEC_CAP_COPY_OPAQUE.
* x86: replace explicit REP_RETs with RETsLynne2023-02-012-11/+11
| | | | | | | | | | | | | | | | | | | From x86inc: > On AMD cpus <=K10, an ordinary ret is slow if it immediately follows either > a branch or a branch target. So switch to a 2-byte form of ret in that case. > We can automatically detect "follows a branch", but not a branch target. > (SSSE3 is a sufficient condition to know that your cpu doesn't have this problem.) x86inc can automatically determine whether to use REP_RET rather than REP in most of these cases, so impact is minimal. Additionally, a few REP_RETs were used unnecessary, despite the return being nowhere near a branch. The only CPUs affected were AMD K10s, made between 2007 and 2011, 16 years ago and 12 years ago, respectively. In the future, everyone involved with x86inc should consider dropping REP_RETs altogether.
* lavu/video_enc_params: Avoid relying on an undefined C constructMartin Storsjö2023-01-311-5/+5
| | | | | | | | | | | | | | | | | | | | | The construct of using offsetof on a (potentially anonymous) struct defined within the offsetof expression, while supported by all current compilers, has been declared explicitly undefined by the C standards committee [1]. Clang recently got a change to identify this as an issue [2]; initially it was treated as a hard error, but it was soon after softened into a warning under the -Wgnu-offsetof-extensions option (not enabled automatically as part of -Wall though). Nevertheless - in this particular case, it's trivial to fix the code not to rely on the construct that the standards committee has explicitly called out as undefined. [1] https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2350.htm [2] https://reviews.llvm.org/D133574 Signed-off-by: Martin Storsjö <martin@martin.st>
* lavu/opt: use AV_DICT_MULTIKEY in av_opt_set_dict2()Anton Khirnov2023-01-311-1/+1
| | | | | | | | | | If the dictionary provided on input contains multiple entries for an option (relevant for flags modifying the previous value with '+' or '-') and the option is not found in the target object, only the last entry would be returned to the caller. Pass AV_DICT_MULTIKEY to av_dict_set() to make sure all such entries are returned.
* avutil/hwcontext_mediacodec: fix backward compatibilityZhao Zhili2023-01-262-1/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | AVMediaCodecDeviceContext without surface or native_window is useless, it shouldn't be created at all. Such dummy AVHWDeviceContext is allowed before, and it's used by mpv player. Creating a ANativeWindow automatically breaks such usecases. So disable creating a ANativeWindow by default. It can be enabled via the create_window flag, or by set the AVDictionary of av_hwdevice_ctx_create(). The downside is that ffmpeg -hwaccel mediacodec -i input.mp4 \ -c:a copy -c:v hevc_mediacodec output.mp4 use ByteBuffer mode which isn't as efficient as before. The upside is libavfilter works now, which should be less surprise. To enable create_window on ffmpeg command line, use ffmpeg -hwaccel mediacodec \ -init_hw_device mediacodec=mediacodec,create_window=1 \ -i input.mp4 -c:a copy -c:v hevc_mediacodec output.mp4 Users should know what it is to enable create_window. It should be OK to take sometime to figure out the option. And there are comments inside hwcontext_mediacodec.h to help user figure it out. Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
* avutil: introduce AVAmbientViewingEnvironment side dataJan Ekström2023-01-136-1/+130
| | | | | This enables exposing H.274 Ambient Viewing Environment metadata in the framework.
* avutil/hwcontext_videotoolbox: BGRA should be full rangeZhao Zhili2023-01-111-1/+1
| | | | | | HEVC alpha layer encoding is broken without the patch. Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
* avutil/tx_template: Use more unsigned ints to avoid undefined overflowsMichael Niedermayer2022-12-251-2/+2
| | | | | | | | Fixes: signed integer overflow: 574590586 - -1875616554 cannot be represented in type 'int' Fixes: 53914/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_FIXED_fuzzer-5037125846564864 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* hwcontext_vulkan: remove optional encode/decode extensions from the listLynne2022-12-251-8/+0
| | | | | | | They're not currently used, so they don't need to be there. Vulkan stabilized the decode extensions less than a week ago, and their name prefixes were changed from EXT to KHR. It's a bit too soon to be depending on it, so rather than bumping, just remove these for now.
* lavu/pixdesc: handle xv30be in av_[read|write]_image_linePhilip Langdale2022-12-081-20/+50
| | | | | | | | | | | | | | | | | | | | xv30be is an obnoxious format that I shouldn't have included in the first place. xv30 packs 3 10bit channels into 32bits and while our byte-oriented logic can handle Little Endian correctly, it cannot handle Big Endian. To avoid that, I marked xv30be as a bitstream format, but while that didn't produce FATE errors, it turns out that the existing read/write code silently produces incorrect results, which can be revealed via ubsan. In all likelyhood, the correct fix here is to remove the format. As this format is only used by Intel vaapi, it's only going to show up in LE form, so we could just drop the BE version. But I don't want to deal with creating a hole in the pixfmt list and all the weirdness that comes from that. Instead, I decided to write the correct read/write code for it. And that code isn't too bad, as long as it's specialised for this format, as the channels are all bit-aligned inside a 32bit word.