Commit Graph

105199 Commits

Author SHA1 Message Date
Andreas Rheinhardt
72a822b975 avformat/takdec: Don't initialize get_bits context to read one value
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-07 11:55:57 +01:00
Wenbin Chen
035d2cc463 doc/encoders.texi: Add doc for qsv
Add doc for qsv decoder.
Add more option's introduction to qsv encoder.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-01-07 14:06:10 +08:00
Fei Wang
7787cca180 lavc/av1dec: use frame split bsf
Split packed data in case of its contains multiple show frame in some
non-standard bitstream. This can benefit decoder which can decode
continuously instead of interrupt with unexpected error.

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-01-07 14:05:58 +08:00
Cameron Gutman
242ed971cb lavu/videotoolbox: add support for memory mapping frames
Signed-off-by: Cameron Gutman <aicommander@gmail.com>
Signed-off-by: Aman Karmani <aman@tmm1.net>
2022-01-06 19:17:42 -08:00
James Almer
3e17e0e5ef avcodec/libdav1d: honor the requested strict_std_compliance level on supported builds
Signed-off-by: James Almer <jamrial@gmail.com>
2022-01-06 22:57:46 -03:00
Andreas Rheinhardt
2b541b8c1d avcodec/golomb: Factor writing golomb codes out
Most users only want to either read or write golomb codes, not both.
By splitting these headers one avoids having unnecesssary
(get|put)_hits.h inclusions.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-06 08:28:02 +01:00
Andreas Rheinhardt
e228d7b0db configure: Add missing libshine->mpegaudioheader dependency
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-06 08:12:43 +01:00
Andreas Rheinhardt
df4cb384fb avcodec/Makefile: Add missing entry for ADPCM_IMA_AMV_ENCODER
Forgotten in 555f5c1fc5.

Reviewed-by: Zane van Iperen <zane@zanevaniperen.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-06 08:12:28 +01:00
Andreas Rheinhardt
a2372f904c avcodec/Makefile: Only compile nvenc.o if needed
This fixes compilation errors in case nvenc is enabled
(e.g. autodected) with both nvenc-based encoders disabled
because nvenc uses ff_alloc_a53_sei(), yet only the nvenc-based
encoders require atsc_a53.
(This error does not manifest itself in case of static linking
(nothing pulls in nvenc.o), but it exists with shared builds.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2022-01-05 19:33:14 +01:00
Wu Jianhua
9a194252c7 avfilter: add a blend_vulkan filter
This commit adds a blend_vulkan filter and a normal blend mode, and
reserves support for introducing the blend modes in the future.

Use the commands below to test: (href: https://trac.ffmpeg.org/wiki/Blend)
I. make an image for test
ffmpeg -f lavfi -i color=s=256x256,geq=r='H-1-Y':g='H-1-Y':b='H-1-Y' -frames 1 \
-y -pix_fmt yuv420p test.jpg

II. blend in sw
ffmpeg -i test.jpg -vf "split[a][b];[b]transpose[b];[a][b]blend=all_mode=normal,\
pseudocolor=preset=turbo" -y normal_sw.jpg

III. blend in vulkan
ffmpeg -init_hw_device vulkan -i test.jpg -vf "split[a][b];[b]transpose[b];\
[a]hwupload[a];[b]hwupload[b];[a][b]blend_vulkan=all_mode=normal,hwdownload,\
format=yuv420p,pseudocolor=preset=turbo" -y normal_vulkan.jpg

Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2022-01-05 15:16:22 +01:00
Wu Jianhua
49250b582a avfilter/vf_blend: fix un-checked potential memory allocation failure
Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2022-01-05 15:16:22 +01:00
Andreas Rheinhardt
aa8bb05d29 avcodec/Makefile: Add missing HEVC decoder->h274.o dependency
Forgotten in 3cc3f5de2a.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-05 14:41:39 +01:00
Wu Jianhua
c4ecc643bb avutil/hwcontext_vulkan: fixed incorrect memory offset
This commit fixed hwupload in Vulkan:

ffmpeg -init_hw_device vulkan -i test.jpg -vf hwupload,hwdownload,format=yuv420p -y out.jpg

Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2022-01-05 14:13:39 +01:00
James Almer
ce4d459db1 Changelog: Add new <next> line after 5.0
Signed-off-by: James Almer <jamrial@gmail.com>
2022-01-05 08:37:55 -03:00
James Almer
746df0a19a Changelog: replace <next> by 5.0
Signed-off-by: James Almer <jamrial@gmail.com>
2022-01-05 08:37:15 -03:00
Zane van Iperen
21e25d2fe2
Changelog: add IMF demuxer
Suggested-By: Pierre-Anthony Lemieux <pal@palemieux.com>
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2022-01-05 21:19:48 +10:00
Pierre-Anthony Lemieux
74afc3c650
avformat/imf: Fix indentation
Signed-off-by: Pierre-Anthony Lemieux <pal@palemieux.com>
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2022-01-05 21:19:48 +10:00
Pierre-Anthony Lemieux
76ffe1c2f1
avformat/imf: fix CPL parsing error handling
Signed-off-by: Pierre-Anthony Lemieux <pal@palemieux.com>
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2022-01-05 21:19:47 +10:00
Pierre-Anthony Lemieux
59f1a46048
avformat/imf: fix bad free() when directory name of the input url is empty
Signed-off-by: Pierre-Anthony Lemieux <pal@palemieux.com>
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2022-01-05 21:19:34 +10:00
Pierre-Anthony Lemieux
c1b55cb70c
avformat/imf: fix error CPL root element is absent
Signed-off-by: Pierre-Anthony Lemieux <pal@palemieux.com>
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2022-01-05 14:26:42 +10:00
Andreas Rheinhardt
07fd34aca7 avcodec/Makefile: Add missing mpegaudiodata.o dependency to MPEGAUDIO
mpegaudiodec_template.c uses stuff from mpegaudiodata directly,
yet this dependency was only indirectly fulfilled via mpegaudio-headers
before 33e6d57f01. Since this commit,
the latter only needs (and therefore provides) mpegaudiotabs,
leading to compilation failures.
This commit adds this missing direct dependency directly.
(Sorry for not having checked indirect dependencies.)

Found-by: Zane van Iperen <zane@zanevaniperen.com>
Reviewed-by: Zane van Iperen <zane@zanevaniperen.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-05 05:11:33 +01:00
Haihao Xiang
7c6f9b9d63 Revert "avutils/hwcontext: When deriving a hwdevice, search for existing device in both directions"
This reverts commit a428949775.
There were objections on ML (see
https://ffmpeg.org/pipermail/ffmpeg-devel/2021-December/290530.html)

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-01-05 11:56:58 +08:00
Haihao Xiang
8d4c0c8823 lavc/qsvdec: needn't free the string for AV_OPT_TYPE_STRING AVOption
The string for AV_OPT_TYPE_STRING AVOption gets freed by av_opt_free()
when closing the AVCodecContext

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-01-05 11:05:06 +08:00
Haihao Xiang
0d82613b7d lavc/qsvenc: set base address for V plane
The SDK checks Data.V when using system memory for VP9 encoding. This
fixed the error below:

$ ffmpeg -qsv_device /dev/dri/renderD129 -f lavfi -i yuvtestsrc -c:v
vp9_qsv -f null -

[vp9_qsv @ 0x55b8387cbe90] Error during encoding: NULL pointer (-2)
Video encoding failed

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-01-05 11:05:06 +08:00
Soft Works
a428949775 avutils/hwcontext: When deriving a hwdevice, search for existing device in both directions
The test /libavutil/tests/hwdevice checks that when deriving a device
from a source device and then deriving back to the type of the source
device, the result is matching the original source device, i.e. the
derivation mechanism doesn't create a new device in this case.

Previously, this test was usually passed, but only due to two different
kind of flaws:

1. The test covers only a single level of derivation (and back)

It derives device Y from device X and then Y back to the type of X and
checks whether the result matches X.

What it doesn't check for, are longer chains of derivation like:

CUDA1 > OpenCL2 > CUDA3 and then back to OpenCL4

In that case, the second derivation returns the first device (CUDA3 ==
CUDA1), but when deriving OpenCL4, hwcontext.c was creating a new
OpenCL4 context instead of returning OpenCL2, because there was no link
from CUDA1 to OpenCL2 (only backwards from OpenCL2 to CUDA1)

If the test would check for two levels of derivation, it would have
failed.

This patch fixes those (yet untested) cases by introducing forward
references (derived_device) in addition to the existing back references
(source_device).

2. hwcontext_qsv didn't properly set the source_device

In case of QSV, hwcontext_qsv creates a source context internally
(vaapi, dxva2 or d3d11va) without calling av_hwdevice_ctx_create_derived
and without setting source_device.

This way, the hwcontext test ran successful, but what practically
happened, was that - for example - deriving vaapi from qsv didn't return
the original underlying vaapi device and a new one was created instead:
Exactly what the test is intended to detect and prevent. It just
couldn't do so, because the original device was hidden (= not set as the
source_device of the QSV device).

This patch properly makes these setting and fixes all derivation
scenarios.

(at a later stage, /libavutil/tests/hwdevice should be extended to check
longer derivation chains as well)

Reviewed-by: Lynne <dev@lynne.ee>
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Tested-by: Wenbin Chen <wenbin.chen@intel.com>
Signed-off-by: softworkz <softworkz@hotmail.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-01-05 11:05:06 +08:00
Niklas Haas
db28bb8fb4 lavfi/libplacebo: support dovi metadata application
libplacebo supports automatic dolby vision application, but it requires
us to switch to a new API. Also add some logic to strip the dolby vision
metadata from the output frames in any case where we end up changing the
colorimetry.

The libplacebo dependency bump is justified because neither 184 nor 192
are part of any stable libplacebo release, so users have to build from
git anyways for this filter to exist.

Signed-off-by: Niklas Haas <git@haasn.dev>
2022-01-05 03:13:12 +01:00
rcombs
da92865b27 lavfi/drawutils: re-enable P010 and P016 support
These formats now work as expected.
2022-01-04 19:39:22 -06:00
rcombs
66343e46cf lavfi/drawutils: overhaul to improve pixel format support
- No longer mixes u8 and u16 component accesses (this was UB)
- De-duplicated 8->16 conversion
- De-duplicated component -> plane+offset conversion
- De-duplicated planar + packed RGB
- No longer calls ff_fill_rgba_map
- Removed redundant comp_mask data member
- RGB0 and related formats no longer write an alpha value to the 0 byte
- Non-planar YA formats now work correctly
- High-bit-depth semi-planar YUV now works correctly
2022-01-04 19:39:22 -06:00
rcombs
f67bd3a825 lavfi/drawutils: ensure we don't support formats with non-pixel-sized offsets 2022-01-04 19:39:22 -06:00
rcombs
f320722eb5 lavfi/drawutils: ensure we can't overflow a component 2022-01-04 19:39:22 -06:00
rcombs
f00079b25c lavfi/drawutils: ensure we don't allow mixed-byte-depth formats
These could be hazardous because of FFDrawColor's union
2022-01-04 19:39:22 -06:00
rcombs
e24b71add5 lavfi/drawutils: reimplement ff_fill_rgba_map without hardcoding the list
Same outputs, but computed instead of statically known, so new formats will be
supported more easily. Asserts in place to ensure we update this if we add
anything incompatible with its logic.
2022-01-04 19:39:22 -06:00
rcombs
5018103fa3 lavfi/drawutils: reject shift-packed formats
Disables x2bgr10/x2rgb10 (which did not behave correctly before).
2022-01-04 19:39:22 -06:00
rcombs
186e931f74 lavfi/drawutils: remove redundant BE format checks
We already explicitly don't support big-endian in general
2022-01-04 19:39:22 -06:00
rcombs
52fe11ef34 lavfi/drawutils: move BE check out of loop 2022-01-04 19:39:22 -06:00
rcombs
df9180d8a0 swscale/output: use isSwappedChroma 2022-01-04 19:39:22 -06:00
rcombs
cb3a6cc082 swscale/output: use isSemiPlanarYUV for NV12/21/24/42 case 2022-01-04 19:39:22 -06:00
rcombs
f8e284be69 swscale: introduce isSwappedChroma 2022-01-04 19:39:22 -06:00
rcombs
bb4f19f2a2 swscale/output: use isDataInHighBits for 10-bit case
This code will need fleshing-out (probably templating) if we ever add
e.g. a P012 format.
2022-01-04 19:39:22 -06:00
rcombs
cf9e8cb52f swscale/output: use isSemiPlanarYUV for 16-bit case 2022-01-04 19:39:22 -06:00
rcombs
e5d83463c8 swscale: introduce isDataInHighBits 2022-01-04 19:39:22 -06:00
rcombs
cb87a3b137 swscale/output: template-ize yuv2nv12cX 10-bit and 16-bit cases
Fixes incorrect big-endian output introduced in 88d804b7ff

Avoids making the filter-time BE check more expensive
2022-01-04 19:39:22 -06:00
Limin Wang
e35b70ab27 avformat: remove unused v210.c
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2022-01-05 09:38:20 +08:00
Limin Wang
41f213c3bf avformat: reuse the common code for v210/v210x
As suggested by Andreas Rheinhardt, most code of v210 demuxer is common code
which is duplicated from rawvideodec, so it's better to move v210/v210x
demuxer code to rawvideodec.c and reuse the common code.

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2022-01-05 09:38:14 +08:00
Limin Wang
46f43f222e avcodec/videotoolbox: Fix undefined symbol with minimal configuration
Please reproduced with the following minimal configure command:
./configure --enable-shared --disable-all --enable-avcodec --enable-decoder=h264 --enable-hwaccel=h264_videotoolbox

You'll get below error:

Undefined symbols for architecture x86_64:
  "_ff_videotoolbox_vpcc_extradata_create", referenced from:
      _videotoolbox_start in videotoolbox.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Reported-by: Cameron Gutman <aicommander@gmail.com>
Tested-by: Cameron Gutman <aicommander@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2022-01-05 09:26:52 +08:00
Andreas Rheinhardt
8abc192236 avcodec/mpeg12enc: Inline constants
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 16:28:56 +01:00
Andreas Rheinhardt
c037f3fc7d avcodec/mpeg12enc: Partially inline whether codec is MPEG-1
MPEG-1 only supports 4:2:0, so one can optimize away the checks
for whether one encodes MPEG-1 in codepaths that encode 4:2:2.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 16:28:55 +01:00
Andreas Rheinhardt
d91b5020ec avcodec/mpeg12enc: Also inline chroma subsampling
ff_mpeg1_encode_mb() contains two inlined calls to
mpeg1_encode_mb_internal(); these calls are supposed
to inline the properties depending upon the color space
used. Yet inlining vertical chroma subsampling (which
allows to remove complete branches and blocks depending
upon them) has been forgotten.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 16:28:55 +01:00
Andreas Rheinhardt
58f6d1e758 avcodec/mpegvideo_enc: Remove dead code at compile time
There are no encoders for interlaced dct that support 4:4:4.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 16:28:55 +01:00
Andreas Rheinhardt
bf2c34a01a avcodec/mpegvideo_enc: Improve inlining of chroma_format
encode_mb() calls encode_mb_internal() three times, once
for each supported chroma format. The reason for this is
that some chroma format dependent parameters can then be
inlined as encode_mb_internal() is marked as av_always_inline.
Yet the most basic parameters based upon chroma format have
not been inlined: The chroma format itself and the chroma
subsampling parameters. This commit does so.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 16:28:55 +01:00