1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00
Commit Graph

5156 Commits

Author SHA1 Message Date
Andreas Rheinhardt
2c6f532e0a Mark some pointers as const
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-01-01 15:25:48 +01:00
Anton Khirnov
baecaa16c1 mpegvideo: use the AVVideoEncParams API for exporting QP tables
Do it only when requested with the AV_CODEC_EXPORT_DATA_VIDEO_ENC_PARAMS
flag.

Drop previous code using the long-deprecated AV_FRAME_DATA_QP_TABLE*
API. Temporarily disable fate-filter-pp, fate-filter-pp7,
fate-filter-spp. They will be reenabled once these filters are converted
in following commits.
2021-01-01 14:23:19 +01:00
Anton Khirnov
e15371061d lavu/mem: move the DECLARE_ALIGNED macro family to mem_internal on next+1 bump
They are not properly namespaced and not intended for public use.
2021-01-01 14:14:57 +01:00
Anton Khirnov
c8c2dfbc37 lavu: move LOCAL_ALIGNED from internal.h to mem_internal.h
That is a more appropriate place for it.
2021-01-01 14:11:01 +01:00
Lynne
53c56585a6
hwcontext_drm: make dependency on Linux kernel headers optional
This was introduced in version 4.6. And may not exist all without an
optional package. So to prevent a hard dependency on needing the Linux
kernel headers to compile, make this optional.

Also ignore the status of the ioctl, since it may fail on older kernels
which don't support it. It's okay to ignore as its not fatal and any
serious errors will be caught later by the mmap call.
2020-12-30 23:14:46 +01:00
Marvin Scholz
d67c6c7f6f lavu: use address-of operator checking clock_gettime
When targeting a recent enough macOS/iOS version that has clock_gettime
it won't be a weak symbol, in which case clang warns for this check
as it's always true:

  warning: address of function 'clock_gettime' will always
  evaluate to 'true'

This warning is silenced by using the address-of operator to make
the intent explicit.
2020-12-28 01:12:26 -03:00
Lynne
b51b9bbd42
hwcontext_vulkan: wait and signal semaphores when transferring to CUDA
Same as when downloading. Not sure why this isn't done, probably
because the CUDA code predates the sync mechanism we settled on.
2020-12-05 23:53:23 +01:00
Limin Wang
48235c8263 avutil/opt: add AV_OPT_FLAG_DEPRECATED option
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-12-05 09:00:53 +08:00
Marton Balint
eca12f4d5a avutil/timecode: add av_timecode_init_from_components
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-12-03 18:32:54 +01:00
Marton Balint
2d90d51c56 avutil/timecode: allow drop frame timecodes for multiples of 30000/1001 fps
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-12-03 18:32:13 +01:00
James Almer
53b4550bdd avutil/film_grain_params: fix doxy for ar_coeff_* fields
Signed-off-by: James Almer <jamrial@gmail.com>
2020-12-03 13:25:21 -03:00
Paul B Mahol
13df9bfbcb avutil/avsscanf: fix possible overreads when dealing with %c or %s 2020-12-02 13:54:53 +01:00
Lynne
659e6e9c88
hwcontext_vulkan: reduce priority for PACK32 formats
Due to some endian-dependent overlap, these should be used last.
2020-11-27 02:58:02 +01:00
James Almer
ee61d4dc68 avutil/film_grain_params: add more details to some AVFilmGrainAOMParams fields
Signed-off-by: James Almer <jamrial@gmail.com>
2020-11-26 22:35:40 -03:00
Lynne
2ba04670c3
lavu/film_grain_params: fix typo in type enum
Ref: xkcd #1015
2020-11-27 02:30:01 +01:00
Niklas Haas
3fbc74582f
hwcontext_vulkan: optionally enable more functionality
These two extensions and two features are both optionally used by
libplacebo to speed up rendering, so it makes sense for libavutil to
automatically enable them as well.
2020-11-25 23:14:47 +01:00
Lynne
2aeb152653
hwcontext_vulkan: support additional pixel formats
We support every single packed format possible now.
There are some fringe leftover mappings which are uninteresting.
2020-11-25 23:14:47 +01:00
Lynne
48b3532183
hwcontext_vulkan: fix incorrect A/0BGR mapping
Vulkan formats with a PACK suffix define native endianess.
Vulkan formats without a PACK suffix are in bytestream order.

Pixel formats with a LE/BE suffix define endianess.
Pixel formats without LE/BE suffix are in bytestream order.
2020-11-25 23:14:46 +01:00
Lynne
3aa8de12ab
hwcontext_vulkan: simplify plane size calculations and support 4-plane formats
Needed to support YUVA.
2020-11-25 23:14:46 +01:00
Lynne
7b274a9b89
hwcontext_vulkan: do not segfault when failing to init a AVHWFramesContext
frames_uninit is always called on failure, and the free_exec_ctx function
did not zero the pool when freeing it, so it resulted in a double free.
2020-11-25 23:14:46 +01:00
Lynne
18a6535b08
hwcontext_vulkan: always attempt to map host memory when transferring
This relies on the fact that host memory is always going to be required
to be aligned to the platform's page size, which means we can adjust
the pointers when we map them to buffers and therefore skip an entire
copy. This has already had extensive testing in libplacebo without
problems, so its safe to use here as well.

Speeds up downloads and uploads on platforms which do not pool their
memory hugely, but less so on platforms that do.

We can pool the buffers ourselves, but that can come as a later patch
if necessary.
2020-11-25 23:14:01 +01:00
Lynne
9cf1811d3d
hwcontext_vulkan: check for memory size before choosing type
It makes allocation a bit more robust in case some weird device with
weird drivers which segments memory in weird ways appears.
2020-11-25 23:06:36 +01:00
Lynne
ff29ca2f1f
hwcontext_vulkan: correctly access the p->extensions bitmask
Its a 64-bit bitfield being put directly into an int.
2020-11-25 23:06:36 +01:00
Lynne
b83e0560f7
hwcontext_vulkan: unify download/upload functions
They were identical, save for variable names and order.
2020-11-25 23:06:35 +01:00
Lynne
b4f9d05301
hwcontext_vulkan: add VkExternalMemoryBufferCreateInfo to imported buffers
Its a validation layer thing.
2020-11-25 23:06:35 +01:00
Lynne
10b3c9b533
hwcontext_vulkan: do not use uninitialized variables on errors in CUDA code 2020-11-25 23:06:35 +01:00
Lynne
993d8d9429
hwcontext_drm: issue DMA_BUF_IOCTL_SYNC when mapping FDs
This improves performance and helps a little when given FDs without
any synchronization fences.
2020-11-25 23:06:34 +01:00
Lynne
4f9ee87253
libavutil: introduce AVFilmGrainParams side data
This patch introduces a new frame side data type AVFilmGrainParams for use
with video codecs which support it.

It can save a lot of memory used for duplicate processed reference frames and
reduce copies when applying film grain during presentation.
2020-11-25 23:06:33 +01:00
Anton Khirnov
800feae5d6 lavu: add missing stddef.h includes for size_t. 2020-11-20 15:20:24 +01:00
Gil Pedersen
7ac1dc2364 avutil/frame: fix potential leaks in av_frame_ref()
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-11-19 10:12:58 -03:00
Gil Pedersen
2b6b19dd9b avutil/frame: use av_buffer_replace() to simplify code
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Gil Pedersen <git@gpost.dk>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-11-19 10:09:47 -03:00
Timo Rothenpieler
98d3f23598 avutil/hwcontext_cuda: fix edge case with non-even frame heights 2020-11-04 01:36:48 +01:00
Timo Rothenpieler
2f3cb5ccca avutil/hwcontext_cuda: query correct alignment from device 2020-11-04 01:36:39 +01:00
Timo Rothenpieler
d5763edab2 avutil/hwcontext_cuda: increase CUDA frame alignment to 512
At least on Turing, a frame without 512 byte alignment cannot be passed
to cuTexObjectCreate.
2020-11-03 18:17:35 +01:00
Michael Niedermayer
ac8cebd48e avutil/mathematics: Use av_sat_add64() for the last addition in av_add_stable()
Fixes: signed integer overflow: 9223372036854770375 + 5450 cannot be represented in type 'long'
Fixes: 26471/clusterfuzz-testcase-minimized-ffmpeg_dem_MXG_fuzzer-6229617557635072

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-10-25 09:49:21 +01:00
Michael Niedermayer
4e9514e99b avutil/common: Implement av_sat_add64_c() with fewer branches
No benchmark because this is not used in any speed relevant pathes nor is it
used where __builtin_add_overflow is available.
So I do not know how to realistically benchmark it.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-10-24 19:11:12 +02:00
James Almer
979cc0c7cb avutil/pixdesc: add missing FF_API_PSEUDOPAL check
Signed-off-by: James Almer <jamrial@gmail.com>
2020-10-02 00:18:13 -03:00
Anton Khirnov
68918d3b7f lavu/buffer: add a convenience function for replacing buffers
A common pattern e.g. in libavcodec is replacing/updating buffer
references: unref old one, ref new one. This function allows simplifying
such code and avoiding unnecessary refs+unrefs if the references are
already equivalent.
2020-09-28 11:33:35 +02:00
Jan Ekström
d8ce8e8ed3 avutil/pixfmt: improve definition of AVColorRange
As it was brought up that the current documentation leaves things
as specific to YCbCr only, ICtCp and RGB are now mentioned.
Additionally, the specifications on which these definitions of
narrow and full range are defined are mentioned.

This way, the documentation of AVColorRange should now match how
most people seem to read interpret it at this point, and thus
flagging RGB AVFrames as full range is valid not only according to
common sense, but also the enum definition.
2020-09-23 19:14:45 +03:00
Michael Niedermayer
4a02ae49c2 avutil/fixed_dsp: Fix integer overflows in butterflies_fixed_c()
Fixes: signed integer overflow: 0 - -2147483648 cannot be represented in type 'int'
Fixes: 23646/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_FIXED_fuzzer-5480991098667008

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-09-19 00:37:45 +02:00
James Almer
7cc8a2bb0b avutil/cuda_check: add missing dynlink_loader.h include
Fixes make checkheaders

Signed-off-by: James Almer <jamrial@gmail.com>
2020-09-15 19:29:37 -03:00
Marton Balint
837b6eb90e avutil/timecode: add av_timecode_make_smpte_tc_string2
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-09-13 17:51:57 +02:00
Marton Balint
5357401671 avutil/timecode: do not trash bits on invalid av_timecode_get_smpte arguments
The function has no way to return error, so let's clip or calculate modulo.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-09-13 17:51:57 +02:00
Marton Balint
d0596e0bb0 avutil/timecode: cosmetics on av_timecode_get_smpte
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-09-13 17:51:57 +02:00
Marton Balint
00117e28c1 avutil/timecode: fix av_timecode_get_smpte_from_framenum with 50/60 fps
SMPTE 12M timecode can only count frames up to 39, because the tens-of-frames
value is stored in 2 bit. In order to resolve this 50/60 fps SMPTE timecode is
using the field bit (which is the same bit as the phase correction bit) to
signal the least significant bit of a 50/60 fps timecode. See SMPTE ST
12-1:2014 section 12.1.

Therefore we slightly change the format of the return value of
av_timecode_get_smpte_from_framenum and AV_FRAME_DATA_S12M_TIMECODE and start
using the previously unused Phase Correction bit as Field bit. (As the SMPTE
standard suggests)

We add 50/60 fps support to av_timecode_get_smpte_from_framenum by calling the
recently added av_timecode_get_smpte function in it which already handles this
properly.

This change affects the decklink indev and the DV and MXF muxers. MXF has no
fate test for 50/60fps content, DV does, therefore the changes.

MediaInfo (a recent version) confirms that half-frame timecode must be inserted
to DV. MXFInspect confirms valid timecode insertion to the System Item of MXF
files. For MXF, also see EBU R122.

Note that for DV the field flag is not used because in the HDV specs (SMPTE
370M) it is still defined as biphase mark polarity correction flag. So it
should not matter that the DV muxer overrides the field bit.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-09-13 17:51:57 +02:00
Mark Thompson
303d252a4b hwcontext_vaapi: Don't require a render node when deriving from DRM
The V4L2 driver does not actually have an associated DRM device at all, so
users work around the requirement by giving libva an unrelated display-only
device instead (which is fine, because it doesn't actually do anything with
that device).  This was broken by bc9b6358fb
forcing a render node, because the display-only device did not have an
associated render node to use.  Fix that by just passing through the
original non-render DRM fd if we can't find a render node.

Reported-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Tested-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
2020-08-31 21:42:14 +01:00
Nicolas George
2b71cd3e0b lavu/buffer: forward av_buffer_realloc() error code.
Fix CID 1457235.
2020-08-21 11:44:30 +02:00
Nicolas George
06f2651204 lavu/avstring: deprecate av_d2str().
It is no longer used in our code base and does not seem
to be used much in other projects.
2020-08-21 11:01:39 +02:00
leozhang
3b7036bc1d avutil/video_enc_params: fix code comment
Reviewed-by: Zhao Zhili <zhilizhao@tencent.com>
Signed-off-by: leozhang <leozhang@qiyi.com>
2020-08-20 17:45:00 +08:00
Jan Ekström
34de0abbe7 avutil/channel_layout: add 22.2 layout
Requires some extraneous top side and bottom front channels to be
defined.

According to STD-B59v2, the defined channel layout is:
- FL
- FR
- FC
- LFE1
- BL
- BR
- FLc
- FRc
- BC
- LFE2
- SiL
- SiR
- TpFL
- TpFR
- TpFC
- TpC
- TpBL
- TpBR
- TpSiL
- TpSiR
- TpBC
- BtFC
- BtFL
- BtFR
2020-08-04 00:17:56 +03:00