Commit Graph

106970 Commits

Author SHA1 Message Date
Thilo Borgmann 9cb9da62a3 avfilter: Add blockdetect filter 2022-05-24 11:21:36 +02:00
softworkz 6b32ad59c8 avcodec/dvdsubdec: use avpriv_fopen_utf8() instead of plain fopen()
Unify file access operations by replacing usages of direct calls
to posix fopen() to prepare for long filename support on Windows.

Signed-off-by: softworkz <softworkz@hotmail.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2022-05-24 11:50:32 +03:00
softworkz f579a1d08b avfilter: use avpriv_fopen_utf8() instead of plain fopen()
Unify file access operations by replacing usages of direct calls
to posix fopen() to prepare for long filename support on Windows.

Signed-off-by: softworkz <softworkz@hotmail.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2022-05-24 11:50:24 +03:00
Paul B Mahol d2ef44fbb1 avfilter/af_afftfilt: add threads support 2022-05-24 08:58:42 +02:00
Martin Storsjö 6076dbcb55 Switch uses of av_fopen_utf8 to avpriv_fopen_utf8
The former has been deprecated.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-05-23 13:52:45 +03:00
Martin Storsjö 4cdc14aa95 libavutil: Deprecate av_fopen_utf8, provide an avpriv version
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 e743e7ae6e.

That mechanism doesn't work for external users, thus deprecate the
existing function.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-05-23 13:52:26 +03:00
Martin Storsjö 3fb9244642 fftools: Stop using av_fopen_utf8
Provide a header based inline reimplementation of it.

Using av_fopen_utf8 doesn't work outside of the libraries when built
with MSVC as shared libraries (in the default configuration, where
each DLL gets a separate statically linked CRT).

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-05-23 13:35:59 +03:00
Tong Wu 1f9b5fa581 avutil/hwcontext_qsv: fix mapping issue between QSV frames and D3D11VA frames
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>
2022-05-23 15:10:05 +08:00
Tong Wu 20807a9d61 avutil/hwcontext_d3d11va: pass the format value from outside for staging texture
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>
2022-05-23 15:10:05 +08:00
Tong Wu 632db3c36d avutil/hwcontext_qsv: derive QSV frames to D3D11VA frames
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>
2022-05-23 15:10:05 +08:00
Steven Liu 90007e0b4e avfilter/avf_showfreqs: fix memleak in plot_freqs
plot_freqs should free colors before return error when
ff_get_video_buffer failed

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2022-05-23 15:07:50 +08:00
Zhao Zhili a12ebbbcaa avcodec/libuavs3d: fix access uninitialized variable when draining
buf_ptr is uninitialized and accessed when function return.
2022-05-23 10:19:23 +08:00
Lynne 27cffd16aa
x86/tx_float: replace fft_sr_avx with fft_sr_fma3
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.
2022-05-21 02:11:50 +02:00
Lynne 0938ff9701
x86/tx_float: improve temporary register allocation for loads
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
2022-05-21 02:11:45 +02:00
Lynne 805e8d1921
lavu/tx: make slow ISA extension penalties smarter
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.
2022-05-21 02:10:14 +02:00
Lynne 19c0bb2aa9
x86/tx_float: add AV_CPU_FLAG_AVXSLOW/SLOW_GATHER flags where appropriate 2022-05-21 02:10:09 +02:00
Lynne 9e94c35941
Revert "x86/tx_float: remove vgatherdpd usage"
This reverts commit 82a68a8771.

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.
2022-05-21 02:10:02 +02:00
Gyan Doshi 9ab20b1614 opt_common: note D and T type streams for completeness.
Addresses #9784
2022-05-20 23:42:23 +05:30
Andreas Rheinhardt 8bf618884b tests/fate: Remove intermediate file of flv-add_keyframe_index test
Do this by making this test a transcode test.
Also fix the test requirements and don't add this test to FATE_AFILTER;
instead use a new variable and a new target for flvenc-tests.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-05-20 10:16:04 +02:00
Andreas Rheinhardt 2f0e48328a fate/filter-video: Fix requirements of tests
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-05-20 10:16:04 +02:00
Andreas Rheinhardt e82472e379 fate/filter-video: Avoid duplication for fate-filter-overlay tests
Also add a fate-filter-overlays target containing all these tests
and fix the requirements of the tests; furthermore, remove
unnecessary scale filters from filter-overlay-rgba?_rgba.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-05-20 10:16:04 +02:00
Andreas Rheinhardt 429f2e5094 fate/filter-video: Avoid duplication for filter-removegrain tests
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-05-20 10:16:04 +02:00
Andreas Rheinhardt f8bdbcd548 fate/filter-video: Avoid duplication for fate-filter-stereo3d tests
Also fix the requirements of these tests: Only the anaglyph
tests need a scale filter, yet it has been inserted for all tests
without any check for its presence.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-05-20 10:16:04 +02:00
Andreas Rheinhardt e715626220 tests/Makefile: Add FRAMECRC variants for filtering
Lots of tests use the framecrc command together with some filters,
so adding a special function for it seems worthwhile. This commit
adds one new one and modifies an already existing one:
All users of FILTERDEMDEC already use framecrc and the more general
FILTERDEMDECENCMUX can be used in scenarios where more control over
the used encoders/muxers is needed, so use this in cases where
an actual input file is involved.
Furthermore, add FILTERFRAMECRC for the cases where no demuxing/decoding
occurs, because the input is generated via lavfi.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-05-20 10:16:04 +02:00
Andreas Rheinhardt c37f65a588 tests/Makefile: Remove FILTERDEMDECMUX
It is unused and given that one needs an encoder to produce
packets from AVFrames (as output by filters) this is likely
to remain so, because FILTERDEMDECENCMUX is better for these
scenarios.
The only case where one can use filters without encoders is
with the lavfi input device: It outputs AVPackets which could
be copied without another conversion to AVFrames. Yet the variable
to check for this is CONFIG_LAVFI_INDEV, but FILTERDEMDECMUX
is designed to work with demuxers (i.e. CONFIG_*_DEMUXER).
So there is no usecase for FILTERDEMDECMUX.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-05-20 10:16:04 +02:00
Lynne 82a68a8771
x86/tx_float: remove vgatherdpd usage
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.
2022-05-20 10:12:34 +02:00
Andreas Rheinhardt 41a558fea0 avfilter/formats: Constify channel_layout in ff_add_channel_layout()
It copies, not moves the channel layout.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-05-19 20:20:38 +02:00
Andreas Rheinhardt 2c8f97831a avcodec/mpegvideo: Move float.h inclusion to mpegvideoenc.h
It is only needed for the options in mpegvideoenc.h.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-05-19 19:16:23 +02:00
Andreas Rheinhardt 9cc38cc636 avcodec/mss2: Remove write-only QpelDSPContext
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-05-19 19:16:23 +02:00
Andreas Rheinhardt 6e5acb6c88 avcodec/error_resilience: Only keep what is needed from MECmpContext
ERContext currently has an embedded MECmpContext, despite only
needing exactly one function from it. This is wasteful because
MECmpContext is pretty large (135 pointers, 1080 B for eight byte
pointers). So keep only what is needed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-05-19 19:16:23 +02:00
Limin Wang 94968dbc11 avcodec/dvdsubenc: return error if canvas_size is too small for subtitle render
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2022-05-19 21:17:31 +08:00
Limin Wang 8e828ee1ad avformat/sccenc: avoid potential invalid access
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2022-05-19 21:17:31 +08:00
Limin Wang 4607868b98 Makefile: remove sccenc dependency on subtitles
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2022-05-19 21:17:31 +08:00
Vignesh Venkatasubramanian dd99d34d67 avformat/img2: Add support for AVIF mux in image2
Add support for AVIF muxing in the image2 muxer.

Tested with this example:
ffmpeg -lavfi testsrc=duration=1:size=320x320 -g 1 -flags global_header -c:v libaom-av1 -f image2 img-%2d.avif

Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
2022-05-19 14:22:52 +05:30
softworkz b8ede4d637 fftools/opt_common: add includes of avf headers for clarity
Signed-off-by: softworkz <softworkz@hotmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-05-18 18:01:51 +02:00
Andreas Rheinhardt e3580f6077 avformat/hls, dashdec: Don't use AV_OPT flags in av_dict_set()
av_dict_set() expects a different set of flags, namely the AV_DICT_*
flags. Using AV_OPT_FLAG_DECODING_PARAM (or any AV_OPT_FLAG_*) ic
av_dict_set() is therefore completely wrong and given that av_dict_set()
just doesn't care about whether the string it receives has anything
to do with a decoding parameter or not, it should just be removed
without replacement.
(The numerical value of AV_OPT_FLAG_DECODING_PARAM currently coincides
with AV_DICT_IGNORE_SUFFIX. Given that the dictionaries we are dealing
with here are always empty (i.e. NULL) before the calls to
av_dict_set(), this flag changes nothing. It would be different if
it were equal to one of the AV_DICT_DONT_STRDUP_* values.)

Reviewed-by: Jan Ekström <jeebjp@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-05-16 10:56:34 +02:00
Gyan Doshi 00ae20dfb4 doc/muxers: note write_btrt option for MOV/MP4 2022-05-16 13:56:38 +05:30
Andreas Rheinhardt d31a3af6a9 avcodec/wrapped_avframe: Don't attach FrameDecodeData unnecessarily
It is unneeded, as this decoder does not call ff_get_buffer().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-05-15 19:08:43 +02:00
Andreas Rheinhardt 104abea646 avcodec/ac3: Move non-(de|en)coder-only parts out of ac3.h
Move AC3HeaderInfo into ac3_parser_internal.h and the rest
into a new header ac3defs.h.

This also breaks an include cycle of ac3.h and ac3tab.h
(the latter now only needs ac3defs.h).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-05-15 18:13:56 +02:00
Andreas Rheinhardt cbd75ecc18 avcodec/ac3tab: Move some tables only used by ac3.c to it
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-05-15 18:13:55 +02:00
Andreas Rheinhardt 996ec1cbe8 avcodec/ac3: Remove declaration of inexistent function
Removed in 7b11eead1b.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-05-15 18:13:55 +02:00
Paul B Mahol 163e737c17 avfilter/af_afir: add support for double sample format 2022-05-15 13:34:50 +02:00
Paul B Mahol e6f0cec880 avfilter/af_acrossover: add precision option 2022-05-14 14:11:52 +02:00
Gyan Doshi 8b64d8d9aa avformat/dashdec: accept and relay CENC decryption key
Allows to process CENC-encrypted media segments.
Option arg syntax is same as that for option decryption_key in MOV demuxer
2022-05-14 14:46:01 +05:30
Paul B Mahol b90341d1d5 avfilter/af_asubboost: add channels option 2022-05-13 22:09:08 +02:00
Paul B Mahol 710dce131f avfilter/vf_zscale: active region use doubles so use that type here too 2022-05-13 15:18:43 +02:00
Paul B Mahol 075c2308e3 avfilter/af_asubboost: add boost option 2022-05-13 15:18:42 +02:00
Paul B Mahol 2c77d9150d avfilter/af_crossfeed: always return same number of samples with block processing 2022-05-13 15:18:42 +02:00
Paul B Mahol 52a14b8505 avfilter/vf_zscale: improve slice processing 2022-05-13 10:22:51 +02:00
Vignesh Venkatasubramanian 84241e63cf avformat/movenc: Add support for AVIF muxing
Add an AVIF muxer by re-using the existing the mov/mp4 muxer.

AVIF Specification: https://aomediacodec.github.io/av1-avif

Sample usage for still image:
ffmpeg -i image.png -c:v libaom-av1 -still-picture 1 image.avif

Sample usage for animated AVIF image:
ffmpeg -i video.mp4 animated.avif

We can re-use any of the AV1 encoding options that will make
sense for image encoding (like bitrate, tiles, encoding speed,
etc).

The files generated by this muxer has been verified to be valid
AVIF files by the following:
1) Displays on Chrome (both still and animated images).
2) Displays on Firefox (only still images, firefox does not support
   animated AVIF yet).
3) Verified to be valid by Compliance Warden:
   https://github.com/gpac/ComplianceWarden

Fixes the encoder/muxer part of Trac Ticket #7621

Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
2022-05-13 12:46:21 +05:30