Fork 0
Commit Graph

5854 Commits

Author SHA1 Message Date
Paul B Mahol f11515c77f avcodec: add RTV1 decoder 2023-06-07 09:00:18 +02:00
Martin Storsjö 9b0052200a aarch64: Add Apple runtime detection of dotprod and i8mm using sysctl
For now, there's not much value in this since Clang don't support
enabling the dotprod or i8mm features with either .arch_extension
or .arch (it has to be enabled by the base arch flags passed to
the compiler). But it may be supported in the future.

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-06-06 12:41:20 +03:00
Martin Storsjö 493fcde50a aarch64: Add Linux runtime cpu feature detection using HWCAP_CPUID
Based partially on code by Janne Grunau.

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-06-06 12:40:57 +03:00
Martin Storsjö fb1b88af77 configure: aarch64: Support assembling the dotprod and i8mm arch extensions
These are available since ARMv8.4-a and ARMv8.6-a respectively,
but can also be available optionally since ARMv8.2-a.

Check if ".arch armv8.2-a" and ".arch_extension {dotprod,i8mm}" are
supported, and check if the instructions can be assembled.

Current clang versions fail to support the dotprod and i8mm
features in the .arch_extension directive, but do support them
if enabled with -march=armv8.4-a on the command line. (Curiously,
lowering the arch level with ".arch armv8.2-a" doesn't make the
extensions unavailable if they were enabled with -march; if that
changes, Clang should also learn to support these extensions via
.arch_extension for them to remain usable here.)

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-06-06 12:40:26 +03:00
Timo Rothenpieler 03823ac0c6 configure: use non-deprecated nvenc GUID for conftest 2023-06-01 23:24:43 +02:00
Lynne 160a415e22
lavfi: add nlmeans_vulkan filter 2023-05-29 00:42:01 +02:00
Lynne 7cfd7e4af4
lavfi: add color_vulkan filter 2023-05-29 00:42:00 +02:00
Lynne 77478f6793
av1dec: add Vulkan hwaccel 2023-05-29 00:42:00 +02:00
Lynne 36c16a06b2
hevcdec: add Vulkan hwaccel
Thanks to Dave Airlie for figuring out a lot of the parameters.
2023-05-29 00:41:58 +02:00
Lynne a9fbe8b472
h264dec: add Vulkan hwaccel
Thanks to Dave Airlie for figuring out a lot of the parameters.
2023-05-29 00:41:58 +02:00
Lynne 023ae6103f
libavcodec: add Vulkan common video code 2023-05-29 00:41:57 +02:00
Lynne 09dc9193ea
lavfi: add bwdif_vulkan 2023-05-29 00:41:56 +02:00
Lynne 59707cc485
hwcontext_vulkan: initialize and require instance version 1.3
This just bumps the required loader library version (libvulkan).
All device-related features, such as video decoding, atomics, etc.
are still optional and the code deals with their loss on a local level
(e.g. the decoder or filter checks for the features it needs, not
the hwcontext).

Bumping the required version essentially packs all maintenance
extensions which correct the spec rather than requiring to enable
them individually.
2023-05-29 00:41:36 +02:00
James Almer 97f4263457 avcodec/av1dec: convert to receive_frame()
This removes the overhead of inserting the av1_frame_split bsf as part of the
decoding process.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-25 11:21:35 -03:00
Samuel Mira 416fd1b43b avcodec/mediacodec: Add VP8 encoder
Connected FFmpeg to Mediacodec VP8 encoder.

Signed-off-by: Samuel Mira <samuel.mira@qt.io>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-05-17 19:20:57 +08:00
Samuel Mira acd37fd566 avcodec/mediacodec: Add AV1 encoder
Connected FFmpeg to Mediacodec AV1 encoder

Signed-off-by: Samuel Mira <samuel.mira@qt.io>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-05-17 19:19:51 +08:00
Sil Vilerino d54127c41a lavu/hwcontext_vaapi: Add Windows/VAAPI support with vaGetDisplayWin32
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:

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>
2023-04-24 13:24:41 +08:00
Paul B Mahol 40bae5be5e avcodec: add PDV decoder 2023-04-20 15:44:38 +02:00
Zhao Zhili 4dffa564d1 configure: remove duplicated extralibs of android_camera
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-04-11 19:57:09 +08:00
Zhao Zhili ef09db1eac configure: add mediacodec_extralibs to avutil
Fix #10299

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-04-11 19:57:00 +08:00
Zhao Zhili ab177c7469 configure: cleanup mediacodec dependency
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-04-11 19:56:50 +08:00
Michael Niedermayer 60ccb3fe78
Remove libopenjpeg decoder
We do not support other video/image decoders when we have our own.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-04-02 23:54:51 +02:00
Samuel Raposo Vieira Mira b4eca5cce2 avcodec/mediacodec: add mpeg4 encoder
This patch will add MPEG4 encoder using Android Mediacodec

Signed-off-by: Samuel Mira <samuel.mira@qt.io<mailto:samuel.mira@qt.io>>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-04-02 15:10:15 +08:00
Samuel Raposo Vieira Mira 139f3352ed avcodec/mediacodec: add vp9 encoder using mediacodec
The only encoders avaliable using mediacodec were h264 and hevc. This
patch adds the vp9 encoder.

Signed-off-by: Samuel Mira <samuel.mira@qt.io<mailto:samuel.mira@qt.io>>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-04-02 15:09:45 +08:00
TADANO Tokumei b6138633cd lavc/libaribcaption.c: add ARIB caption decoder using libaribcaption
This patch add another ARIB caption decoder using libaribcaption
external library.

Unlike libaribb24, it supports 3 types of subtitle outputs:
* text: plain text
* ass: ASS formatted text
* bitmap: bitmap image

Default subtitle type is ass as same as libaribb24.
Advantages compared with libaribb24 on ASS subtitle are:
* Subtitle positioning.
* Multi-rect subtitle: some captions are displayed at different
  position at a time.
* More stability and reproducibility.

To compile with this feature:
* libaribcaption external library has to be pre-installed.
* configure with `--enable-libaribcaption` option.

`--enable-libaribb24` and `--enable-libaribcaption` options are
not exclusive. If both enabled, libaribcaption precedes as
order listed in `libavcodec/allcodecs.c`.

Signed-off-by: rcombs <rcombs@rcombs.me>
2023-03-28 12:05:19 -04:00
J. Dekker 4f55568217 configure: add LTO optarg
This allows users to specify an argument such as './configure
--enable-lto=thin' to use ThinLTO with Clang. The old functionality with
'./configure --enable-lto' is preserved.

Signed-off-by: J. Dekker <jdek@itanimul.li>
2023-03-27 08:42:44 +02:00
Michael Niedermayer 06b451d276
avfilter/vf_mcdeint: update to new API
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-03-26 01:46:49 +01:00
Anton Khirnov c29e5ab5c1 fftools/ffplay: depend on avfilter
Making lavfi optional adds a lot of complexity for very questionable
2023-03-20 10:42:09 +01:00
Michael Niedermayer 771c27119d
avfilter/vf_uspp: update to new APIs
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-03-18 18:20:02 +01:00
James Almer 8e5e578453 avocdec/Makefile: add missing dependencies to av1 and libdav1d decoders
Missed in d6d5765051 and b465e6fed0

Signed-off-by: James Almer <jamrial@gmail.com>
2023-03-12 16:31:54 -03:00
Gyan Doshi 9f7e51e513 configure: select subordinate formats for HLS
HLS segments may be MPEG-TS or fragmented MP4, so those (de)muxers are
required for reading/writing HLS media segments.

Fixes functionality with --disable-everything --enable-demuxer=hls
2023-02-18 14:31:23 +05:30
Haihao Xiang 0f407cdea2 avfilter: add QSV variants of the stack filters
Include hstack_qsv, vstack_qsv and xstack_qsv. They may accept input
streams with different sizes.

$ ffmpeg -hwaccel qsv -hwaccel_output_format qsv -i input.mp4 \
-filter_complex "[0:v][0:v]hstack_qsv" -f null -

$ ffmpeg \
-hwaccel qsv -hwaccel_output_format qsv -i input.mp4 \
-hwaccel qsv -hwaccel_output_format qsv -i input.mp4 \
-hwaccel qsv -hwaccel_output_format qsv -i input.mp4 \
-hwaccel qsv -hwaccel_output_format qsv -i input.mp4 \
-filter_complex "[0:v][1:v][2:v][3:v]xstack_qsv=inputs=4:fill=0x000000:layout=0_0_1920x1080|w0_0_1920x1080|0_h0_1920x1080|w0_h0_1920x1080" \
-f null -

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-02-16 11:15:50 +08:00
Stefano Sabatini 3d4dc6aa77 examples: rename transcoding to transcode 2023-02-11 17:49:01 +01:00
Stefano Sabatini 3856f82ef9 examples: rename scaling_video to scale_video 2023-02-11 17:49:01 +01:00
Stefano Sabatini cd8211527e examples: rename resampling audio to resample_audio 2023-02-11 17:49:01 +01:00
Stefano Sabatini 0a69ca656b examples: rename remuxing to remux 2023-02-11 17:49:01 +01:00
Stefano Sabatini ab2ec8ef01 examples: rename qsvdec to qsv_decode 2023-02-11 17:49:01 +01:00
Stefano Sabatini eac4324bfb examples: rename muxing to mux 2023-02-11 17:49:01 +01:00
Stefano Sabatini 7a53ae931d examples: rename metadata to show_metadata 2023-02-11 17:49:01 +01:00
Stefano Sabatini 2e4694707e examples: rename http_multiclient to avio_http_serve_files 2023-02-11 17:49:01 +01:00
Stefano Sabatini 1ae619e8ee examples: rename filtering_video to decode_filter_video 2023-02-11 17:49:01 +01:00
Stefano Sabatini 3367bd56d1 examples: rename filtering_audio to decode_filter_audio 2023-02-11 17:49:01 +01:00
Stefano Sabatini 7f5630a899 examples: rename demuxing_decoding to demux_decode
Follow general scheme VERB_OBJECT.
2023-02-11 17:49:01 +01:00
Stefano Sabatini f0a415c7eb examples: rename avio_reading to avio_read_callback
Adopt general scheme VERB_OBJECT.
2023-02-11 17:49:01 +01:00
Andreas Rheinhardt 59c9dc82f4 avformat/avformat: Move AVOutputFormat internals out of public header
This commit does for AVOutputFormat what commit
20f9727018 did for AVCodec:
It adds a new type FFOutputFormat, moves all the internals
of AVOutputFormat to it and adds a now reduced AVOutputFormat
as first member.

This does not affect/improve extensibility of both public
or private fields for muxers (it is still a mess due to lavd).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2023-02-09 15:24:15 +01:00
Anton Khirnov 63a348659b configure: make flite depend on threads
The filter calls pthreads functions unconditionally.
2023-02-09 12:45:53 +01:00
Anton Khirnov 82da22066c lavc: deprecate CrystalHD decoders
The hardware is old and not relevant today. The decoders also have many
special quirks and are effectively unmaintained.
2023-02-04 13:12:28 +01:00
Haihao Xiang a48c95d3c9 lavfi/deinterlace_qsv: simplify deinterlace_qsv filter
Like what we did for scale_qsv filter, we use QSVVPPContext as a base
context to manage MFX session for deinterlace_qsv filter.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-02-03 10:27:58 +08:00
Paul B Mahol 00994e8be1 avcodec: add media100_to_mjpegb bitstream filter and use it 2023-01-31 17:06:29 +01:00
Haihao Xiang d66312cf27 lavfi/scale_qsv: simplify scale_qsv filter
Use QSVVPPContext as a base context of QSVScaleContext, hence we may
re-use functions defined for QSVVPPContext to manage MFX session for
scale_qsv filter.

In addition, system memory has been taken into account in
QSVVVPPContext, we may add support for non-QSV pixel formats in the

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-01-30 08:48:58 +08:00
Haihao Xiang aecfec6f80 avfilter: add VA-API variants of the stack filters
Include hstack_vaapi, vstack_vaapi and xstack_vaapi. They may accept
input streams with different sizes.  libva2 (VA-API 1.0+) is required.

$ ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -i input.h265 -filter_complex
"[0:v][0:v]hstack_vaapi" -c:v h264_vaapi out.h264

$ ffmpeg \
-hwaccel vaapi -hwaccel_output_format vaapi -i input.h264 \
-hwaccel vaapi -hwaccel_output_format vaapi -i input.h264 \
-hwaccel vaapi -hwaccel_output_format vaapi -i input.h264 \
-hwaccel vaapi -hwaccel_output_format vaapi -i input.h264 \
-filter_complex "[0:v][1:v][2:v][3:v]xstack_vaapi=inputs=4:fill=0x000000:layout=0_0_1920x1080|w0_0_1920x1080|0_h0_1920x1080|w0_h0_1920x1080" \
-c:v hevc_vaapi out.h265

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-01-30 08:48:58 +08:00
Dmitrii Ovchinnikov 5f0a7a9169 libavcodec/amfenc: add AV1 encoding support
Tested-by: Jean-Baptiste Kempf <jb@videolan.org>
2023-01-27 22:38:45 +05:30
Dmitrii Ovchinnikov 23d4f9223a amfenc: Update the min version to for AMF SDK.
Tested-by: Jean-Baptiste Kempf <jb@videolan.org>
2023-01-27 22:35:35 +05:30
Aman Karmani f5f1c1fd6b avcodec/vaapi_encode_h26x: passthrough A53 CC data as H264/HEVC SEI
Signed-off-by: Aman Karmani <aman@tmm1.net>
2023-01-17 10:10:52 +08:00
Derek Buitenhuis 94aa70d757 avformat: Rename IPFS to IPFS gateway
It is a URL rewriter for IPFS gateways, not an actual implementation of
IPFS, and naming it as such was both incorrect and misleading.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2023-01-09 12:14:47 -05:00
Zhao Zhili f0d2ed135c avcodec/mediacodecdec: add AV1 decoding support
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-01-03 19:23:03 +08:00
Lynne 62da0b4a74
configure: update copyright year 2023-01-01 00:24:04 +01:00
James Darnley f1f41d6ff5 configure: support lsan as toolchain 2022-12-20 15:02:45 +01:00
Zhao Zhili e3f2d01d70 avcodec/mediacodecenc: use bsf to handle crop
It's well known that mediacodec encoder requires 16x16 alignment.
Use our bsf to fix the crop info.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-12-17 04:28:27 +08:00
Paul B Mahol 6c814093d8 avfilter/vf_bm3d: switch to TX from lavu 2022-12-04 23:02:07 +01:00
Andreas Rheinhardt 4d9c0b3efa configure: Add (h264|hevc)_sei subsystems
Currently, several components select atsc_a53, despite
not using anything from it themselves. They only select
it because parsing SEI messages adds an indirect dependency.
But using direct dependencies is more natural, so add
dedicated subsystems for them.

It already allows to remove a superfluous dependency of
the HEVC QSV encoder on hevc_sei and atsc_a53.

Adding new subsystems only becomes effective after a reconfiguration.
In order to force this, some needed headers (which are only included
implicitly before this commit) were included explicitly in

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-12-01 11:00:40 +01:00
Lynne ca8aaf24df
binkaudio: convert to lavu/tx 2022-11-24 15:58:36 +01:00
Anton Khirnov 703e76f917 configure: drop support for complex functions
They are not used since 520a5d33f0.
2022-11-23 10:40:55 +01:00
Wenbin Chen efe2b63c89 doc/examples: Add qsv_transcode example
Add qsv_transcode example which shows how to use qsv to do hardware
accelerated transcoding, also show how to dynamically set encoding

Normal usage:
qsv_transcode input.mp4 h264_qsv output.mp4 "g 60"

Dynamic setting usage:
qsv_transcode input.mp4 hevc_qsv output.mp4 "g 60 asyne_depth 1"
100 "g 120"
This command initializes codec with gop_size 60 and change it to
120 after 100 frames

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-11-22 13:52:38 +08:00
Zhao Zhili 0ff18a7d6d avcodec: add MediaCodec encoder
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-11-21 23:56:16 +08:00
Zhao Zhili 4df9cb918e avcodec/mediacodec: add NDK media codec wrapper
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-11-21 23:52:34 +08:00
Zhao Zhili 36a8d1e729 avcodec/libx265: fix build error
x265_sei is available since X265_BUILD 88. Bump required version
to 89 to fix the regression from commit 1f58503013, and remove a
conditional compilation.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-11-18 23:18:21 +08:00
Paul B Mahol 4f6c06e8ff avfilter/af_firequalizer: switch to TX from lavu 2022-11-17 13:28:58 +01:00
Paul B Mahol 59b16355ec avfilter/avf_showspatial: switch to lavu TX
Also try harder to make output constant frame rate.
2022-11-17 12:37:22 +01:00
erankor 6043352bd9 libx265: support ATSC A/53 captions
added a new option 'a53cc' (on by default, as in libx264) for rendering
AV_FRAME_DATA_A53_CC as hevc sei payloads.
the code is a blend of the libx265.c code for writing
AV_FRAME_DATA_SEI_UNREGISTERED with the libx264.c code for writing atsc
a/53 payloads.
2022-11-10 16:28:07 +01:00
Timo Rothenpieler 939273d3b4 avcodec/nvenc: remove unsupported AV1 High Profile 2022-11-10 15:26:43 +01:00
Andreas Rheinhardt fd0e37f126 avcodec/mpegvideo_enc: Move initializing QpelDSPCtx to mpeg4videoenc.c
It is the only encoder supporting quarter samples.
This also allows to remove the qpeldsp dependency from

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-06 17:41:26 +01:00
Andreas Rheinhardt 496b3c6987 avcodec/vc1dec: Remove VC-1 decoders->H.263 decoder dependency
The only thing from the H.263 decoder that is reachable
by the VC-1 decoder is ff_h263_decode_init(); but it does
not even use all of it; e.g. h263dsp is unused and so are
the VLCs initialized in ff_h263_decode_init() (they amount
to about 77KB which are now no longer touched).

Notice that one could also call ff_idctdsp_init()
directly instead of ff_mpv_idct_init(); one could even
do so in ff_vc1_init_common().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-06 17:41:26 +01:00
Andreas Rheinhardt cbe6ef1031 avcodec/vc1dec: Split VC-1 decoders from msmpeg4
The only msmpeg4 code that is ever executed by the VC-1 based
decoders is ff_msmpeg4_decode_init() and what is directly
reachable from it. This is:
a) A call to av_image_check_size(), then ff_h263_decode_init(),
b) followed by setting [yc]_dc_scale_table and initializing
c) Afterwards, some static tables are initialized.
d) Finally, slice_height is set.

The replacement for ff_msmpeg4_decode_init() performs a)
just like now; it also sets [yc]_dc_scale_table,
but it only initializes inter_scantable and intra_scantable
and not permutated_intra_[hv]_scantable: The latter are only
used inside decode_mb callbacks which are only called
in ff_h263_decode_frame() which is unused for VC-1.*

The static tables initialized in c) are not used at all by
VC-1 (the ones that are used have been factored out in
previous commits); this avoids touching 327KiB of .bss.

slice_height is also not used by the VC-1 decoder (setting
it in ff_msmpeg4_decode_init() is probably redundant after

*: It follows from this that the VC-1 decoder is not really
based upon the H.263 decoder either; changing this will
be done in a future commit.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-06 17:41:26 +01:00
Lynne 1aeedd277a
qdm2: convert to lavu/tx 2022-11-06 14:39:42 +01:00
Lynne e6afa61be9
imc: convert to lavu/tx, remove NIH iMDCT and replace with a standard one 2022-11-06 14:39:42 +01:00
Lynne b85e106d5f
libavcodec: remove mdct15
It's not needed nor used by anything anymore, lavu/tx is faster,
and better in every way. RIP.
2022-11-06 14:39:41 +01:00
Lynne 774ea6a00b
vorbisenc: convert to lavu/tx 2022-11-06 14:39:41 +01:00
Lynne 34330adb29
atrac3plus: convert to lavu/tx 2022-11-06 14:39:40 +01:00
Lynne b59e6b5d99
atrac3: convert to lavu/tx 2022-11-06 14:39:40 +01:00
Lynne 5f52094f3d
atrac1: convert to lavu/tx 2022-11-06 14:39:39 +01:00
Lynne 978963a77b
wma: convert to lavu/tx
Converts both the decoder and encoders.
2022-11-06 14:39:39 +01:00
Lynne 6ba0aa1770
on2avc: convert to lavu/tx 2022-11-06 14:39:38 +01:00
Lynne 8cd46c48ac
nellymoserenc: convert to lavu/tx 2022-11-06 14:39:38 +01:00
Lynne 61e1a7d958
nellymoserdec: convert to lavu/tx 2022-11-06 14:39:38 +01:00
Lynne b428003c1c
dcaenc: convert to lavu/tx
The encoder is fixed point, and uses an MDCT only for analysis. Due
to the slightly different rounding, the encoder makes a different
decision, so the tests have to be adjusted as well.
2022-11-06 14:39:37 +01:00
Lynne 055413788f
dca_lbr: convert to lavu/tx
Fully converts the DCA decoder to lavu/tx.
2022-11-06 14:39:37 +01:00
Lynne 2689038f08
dolby_e: convert to lavu/tx 2022-11-06 14:39:36 +01:00
Lynne 1d810b650c
cookdec: convert to lavu/tx 2022-11-06 14:39:36 +01:00
Lynne 8f3e062314
aacenc: convert to lavu/tx 2022-11-06 14:39:35 +01:00
Lynne 5f1111e42e
wmaprodec: convert to lavu/tx 2022-11-06 14:39:34 +01:00
Lynne eb0e25f078
atrac9dec: convert to lavu/tx 2022-11-06 14:39:34 +01:00
Lynne 7af43a46d9
twinvq: convert to lavu/tx 2022-11-06 14:39:33 +01:00
Lynne 60c704677a
vorbisdec: convert to lavu/tx
This also fixes not checking the return values on transform init.

Total decoder speedup on Zen 3: 9%
2022-11-06 14:39:33 +01:00
Lynne 469cd8d7fa
aacdec: convert to lavu/tx and support fixed-point 960-sample decoding
This patch replaces the transform used in AAC with lavu/tx and removes
the limitation on only being able to decode 960-sample files
with the float decoder.
This commit also removes a whole bunch of unnecessary and slow
lifting steps the decoder did to compensate for the poor accuracy
of the old integer transformation code.

Overall float decoder speedup on Zen 3 for 64kbps: 32%
2022-11-06 14:39:33 +01:00
Lynne 4cee7ebd75
ac3: convert to lavu/tx 2022-11-06 14:39:27 +01:00
Timo Rothenpieler 5c288a44ad avcodec/nvenc: add AV1 encoding support
The encoder seems to be trading blows with hevc_nvenc.
In terms of quality at low bitrate cbr settings, it seems to
outperform it even. It produces fewer artifacts and the ones it
does produce are less jarring to my perception.

At higher bitrates I had a hard time finding differences between
the two encoders in terms of subjective visual quality.

Using the 'slow' preset, av1_nvenc outperformed hevc_nvenc in terms
of encoding speed by 75% to 100% while performing above tests.

Needless to say, it always massively outperformed h264_nvenc in terms
of quality for a given bitrate, while also being slightly faster.
2022-11-05 21:17:37 +01:00
Timo Rothenpieler 0957d62fb0 configure: add pkg-config check for chromaprint 2022-11-03 12:37:41 +01:00
Timo Rothenpieler d772419237 configure: add pkg-config check for OpenAL 2022-10-31 18:42:12 +01:00
Martin Storsjö 2eb601e865 configure: Remove a leftover comment about MSVC C99 support
Support for building with older versions of MSVC (with the
c99wrap/c99conv frontend) was removed in

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-10-27 21:49:26 +03:00
Andreas Rheinhardt 22fc0375e8 configure: Remove unnecessary mpeg[12]video_enc->h263dsp dependencies
This effectively reverts 9b78abae19.
The underlying issue has been fixed properly in commit

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-27 19:39:07 +02:00
Andreas Rheinhardt 938c62b368 avcodec/mpegvideo: Don't initialize H264Chroma ctx unnecessarily
It is only used by the decoders' lowres code, so only initialize
it for decoders.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-27 19:37:44 +02:00
Wenbin Chen dc9e4789a3 libavcodec/qsvenc_av1: add av1_qsv encoder
It is available only when libvpl is enabled. MSDK doesn't support av1

sample command:
ffmpeg -f rawvideo -pix_fmt nv12 -s 1920x1080 -i input.yuv \
-c:v av1_qsv output.ivf

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-10-24 13:30:22 +08:00
Anton Khirnov f66e794672 lavu/thread: add an internal function for setting thread name
Linux-only for now.
2022-10-24 02:00:31 +02:00
Andreas Rheinhardt 3cabe958a7 avcodec/eatqi: Don't use IDCTDSP-API unnecessarily
The eatqi decoder uses a custom IDCT and actually does not
use the IDCTDSP API at all. Somehow it was nevertheless
used to simply apply the identity permutation on ff_zigzag_direct.
This commit stops doing so.

Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-24 00:46:53 +02:00
Andreas Rheinhardt a8f34f0877 avcodec/eatgq: Don't use IDCTDSP-API unnecessarily
The eatgq decoder uses a custom IDCT and actually does not
use the IDCTDSP API at all. Somehow it was nevertheless
used to simply apply the identity permutation on ff_zigzag_direct.
This commit stops doing so. It also renames perm to scantable,
because it is only the scantable as given by the spec without
any further permutation performed by us.

Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-24 00:46:49 +02:00
Andreas Rheinhardt c262245fd3 avcodec/eamad: Don't use IDCTDSP-API unnecessarily
The eamad decoder uses a custom IDCT and actually does not
use the IDCTDSP API at all. Somehow it was nevertheless
used to simply apply the identity permutation on ff_zigzag_direct.
This commit stops doing so.

Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-24 00:46:39 +02:00
Andreas Rheinhardt ba85e0ce41 configure: Add idctdsp dependency to codecs that need it
Currently masked by faan.

Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-24 00:15:03 +02:00
James Almer 1f63225f2b avcodec/librav1e: support AV_CODEC_CAP_ENCODER_RECON_FRAME
This bumps the minimum required version to 0.5.0

Signed-off-by: James Almer <jamrial@gmail.com>
2022-10-19 11:15:38 -03:00
James Almer f58f238936 avcodec/librav1e: export extradata on init()
librav1e provides a function to create extradata, so use it instead of
extracting the sequence header OBU from packets.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-10-19 10:13:37 -03:00
Andreas Rheinhardt 28ac2279ad avcodec/snow: Move initializing MotionEstContext to snowenc.c
Only used by the encoder.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-12 10:58:15 +02:00
Andreas Rheinhardt 2a7ee6dda0 configure: Add (dnxhd|snow)_encoder->videodsp dependency
These encoders currently rely on an implicit dependency via mpegvideo.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-12 10:57:24 +02:00
Andreas Rheinhardt 1ed41ec343 configure: Remove unnecessary wmavoice->mdct dependency
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-12 10:57:24 +02:00
Andreas Rheinhardt fe4cb1f718 configure: Remove unnecessary qdm2_decoder->mdct dependency
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-12 10:57:24 +02:00
Andreas Rheinhardt faf16c5ca8 configure: Remove unnecessary binkaudio dependencies
The binkaudio decoders don't need mdct or sinewin at all;
and binkaudio_dct doesn't need rdft directly (but nevertheless
uses it indirectly via dct).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-12 10:57:24 +02:00
Andreas Rheinhardt 7260e69a61 configure: Remove unnecessary me_cmp dependencies
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-12 10:57:24 +02:00
Andreas Rheinhardt c672751e33 configure: Add mpegvideoenc->fdctdsp dependency
Currently masked by an unnecessary me_cmp->fdctdsp dependency.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-12 10:57:24 +02:00
Andreas Rheinhardt 8dcc1eef75 configure: Add missing prores_(aw|ks)_encoder->fdctdsp dependencies
Fixes builds with --disable-everything --disable-faan.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-12 10:57:24 +02:00
Andreas Rheinhardt 382083caed configure: Remove dependencies of inexistant rtjpeg decoder
rtjpeg is a mode of nuv and not a decoder in its own right.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-12 10:57:24 +02:00
Andreas Rheinhardt 5bd55b488f avcodec/ljpegenc: Remove unused IDCTDSPContext
It is basically write-only.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-09 19:28:11 +02:00
Andreas Rheinhardt ef285d59ac configure, avcodec/Makefile: Remove obsolete mpegvideo dependencies
As long as ff_mpeg12_common_init() existed in mpeg12.c,
it added a dependency of mpeg12.o on mpegvideodata.o
(which provides ff_mpeg2_dc_scale_table, which is used
in ff_mpeg12_common_init()). mpegvideodata.o is normally
provided by the mpegvideo subsystem and therefore several
codecs and the MPEG-1/2 parser added a configure dependency
on said subsystem (additionally, the eatqi decoder just
added a Makefile dependency on mpegvideodata.o).

Given that ff_mpeg12_common_init() is no more, these dependencies
can be removed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-04 17:41:34 +02:00
James Almer b92e14147f avcodec: add a bsf to reorder DTS into PTS
Starting with an h264 implementation. Can be extended to support other codecs.

A few caveats:
- OpenGOP streams are currently not supported. The firt packet must be an IDR
- In some streams, a few frames at the end may not get a reordered PTS when
  they reference frames past EOS. The code added to derive timestamps from
  previous frames needs to extended.

Addresses ticket #502.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-10-04 08:40:16 -03:00
Lynne 0bc7ba4488
configure: remove mdct15 from the encoder/decoder's list of requirements 2022-09-28 00:08:48 +02:00
Rémi Denis-Courmont 1b6aee52a5 configure: probe RISC-V Vector extension 2022-09-27 13:19:52 +02:00
Andreas Rheinhardt 2ec59d2973 configure: Remove obsolete APTX decoder dependencies
Forgotten in 18e55de45a.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-18 22:43:47 +02:00
Roman Arzumanyan cc81ab283c libavfilter: add vf_colorrange_cuda, CUDA-accelerated color conversion filter
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2022-09-13 22:59:30 +02:00
Rémi Denis-Courmont ff14e37393 configure/riscv: detect fast CLZ
RISC-V defines the CLZ instruction as part of the ratified Zbb subset
of the (not yet ratified) bit mapulation extension (B). We can detect
it from the __riscv_zbb predefined constant. At least GCC 12 already
supports this correctly.

Note that the macro will be non-zero if supported, zero if enabled
in the compiler flags (e.g. -march=rv64gzbb) but not known to the
compiler, and undefined otherwise.
2022-09-13 16:50:43 -03:00
Anton Khirnov b6196cb2ef lavf/dv: always provide avpriv_dv_* symbols
They are used from libavdevice.
2022-09-05 08:01:17 +02:00
Mohamed Khaled Mohamed 1a5cd79f51 avfilter: add bilateral_cuda filter
GSoC 2022

Signed-off-by: Mohamed Khaled <mohamed.elbassiony00@eng-st.cu.edu.eg>
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2022-09-03 15:18:56 +02:00
Hendrik Leppkes 89ea7a2442 configure: enable the av1_frame_split bsf for the av1 decoder
The BSF is required to make use of the AV1 decoder, thus configure
should also ensure it is built.
2022-08-23 14:30:28 +02:00
Timo Rothenpieler ef2c2a2220 avutil/half2float: use native _Float16 if available
_Float16 support was available on arm/aarch64 for a while, and with gcc
12 was enabled on x86 as long as SSE2 is supported.

If the target arch supports f16c, gcc emits fairly efficient assembly,
taking advantage of it. This is the case on x86-64-v3 or higher.
Same goes on arm, which has native float16 support.
On x86, without f16c, it emulates it in software using sse2 instructions.

This has shown to perform rather poorly:

_Float16 full SSE2 emulation:
frame=50074 fps=848 q=-0.0 size=N/A time=00:33:22.96 bitrate=N/A speed=33.9x

_Float16 f16c accelerated (Zen2, --cpu=znver2):
frame=50636 fps=1965 q=-0.0 Lsize=N/A time=00:33:45.40 bitrate=N/A speed=78.6x

classic half2float full software implementation:
frame=49926 fps=1605 q=-0.0 Lsize=N/A time=00:33:17.00 bitrate=N/A speed=64.2x

Hence an additional check was introduced, that only enables use of
_Float16 on x86 if f16c is being utilized.

On aarch64, a similar uplift in performance is seen:

RPi4 half2float full software implementation:
frame= 6088 fps=126 q=-0.0 Lsize=N/A time=00:04:03.48 bitrate=N/A speed=5.06x

RPi4 _Float16:
frame= 6103 fps=158 q=-0.0 Lsize=N/A time=00:04:04.08 bitrate=N/A speed=6.32x

Since arm/aarch64 always natively support 16 bit floats, it can always
be considered fast there.

I'm not aware of any additional platforms that currently support
_Float16. And if there are, they should be considered non-fast until
proven fast.
2022-08-19 22:09:36 +02:00
Timo Rothenpieler 9ca3b8b7cd compat: add msvc windres wrapper
This is by no means a complete wrapper. It's only designed to fit the
usecase ffmpegs build system has.
2022-08-13 14:42:52 +02:00
Timo Rothenpieler b77fff47d0 configure: always enable gnu_windres if available
Use the appropiate Makefile variable to ensure the resource file is
only built into shared libraries instead.
2022-08-13 14:42:36 +02:00
Haihao Xiang 7158f1e64d configure: add --enable-libvpl option
This allows user to build FFmpeg against Intel oneVPL. oneVPL 2.6
is the required minimum version when building Intel oneVPL code.

It will fail to run configure script if both libmfx and libvpl are

It is recommended to use oneVPL for new work, even for currently available
hardwares [1]

Note the preferred child device type is d3d11va for libvpl on Windows.
The commands below will use d3d11va if d3d11va is available on Windows.
$ ffmpeg -hwaccel qsv -c:v h264_qsv ...
$ ffmpeg -qsv_device 0 -hwaccel qsv -c:v h264_qsv ...
$ ffmpeg -init_hw_device qsv=qsv:hw_any -hwaccel qsv -c:v h264_qsv ...
$ ffmpeg -init_hw_device qsv=qsv:hw_any,child_device=0 -hwaccel qsv -c:v h264_qsv ...

User may use child_device_type option to specify child device type to
dxva2 or derive a qsv device from a dxva2 device
$ ffmpeg -init_hw_device qsv=qsv:hw_any,child_device=0,child_device_type=dxva2 -hwaccel qsv -c:v h264_qsv ...
$ ffmpeg -init_hw_device dxva2=d3d9:0 -init_hw_device qsv=qsv@d3d9 -hwaccel qsv -c:v h264_qsv ...

[1] https://www.intel.com/content/www/us/en/develop/documentation/upgrading-from-msdk-to-onevpl/top.html
2022-08-12 10:43:39 +08:00
Haihao Xiang 3e61b7dd7f qsv: remove mfx/ prefix from mfx headers
The following Cflags has been added to libmfx.pc, so mfx/ prefix is no
longer needed when including mfx headers in FFmpeg.
   Cflags: -I${includedir} -I${includedir}/mfx

Some old versions of libmfx have the following Cflags in libmfx.pc
   Cflags: -I${includedir}

We may add -I${includedir}/mfx to CFLAGS when running 'configure
--enable-libmfx' for old versions of libmfx, if so, mfx headers without
mfx/ prefix can be included too.

If libmfx comes without pkg-config support, we may do a small change to
the settings of the environment(e.g. set -I/opt/intel/mediasdk/include/mfx
instead of -I/opt/intel/mediasdk/include to CFLAGS), then the build can
find the mfx headers without mfx/ prefix

After applying this change, we won't need to change #include for mfx
headers when mfx headers are installed under a new directory.

This is in preparation for oneVPL support (mfx headers in oneVPL are
installed under vpl directory)
2022-08-12 10:43:39 +08:00
Haihao Xiang 7c713ab42c configure: fix the check for MFX_CODEC_VP9
The data structures for VP9 in mfxvp9.h is wrapped by
MFX_VERSION_NEXT, which means those data structures have never been used
in a public release. Actually MFX_CODEC_VP9 and other VP9 stuffs are
added in mfxstructures.h. In addition, mfxdefs.h is included in
mfxvp9.h, so we may use the check in this patch for MFX_CODEC_VP9

This is in preparation for oneVPL support because mfxvp9.h is removed
from oneVPL [1]

[1]: https://github.com/oneapi-src/oneVPL
2022-08-12 10:43:39 +08:00
Haihao Xiang fea5aed279 configure: ensure --enable-libmfx uses libmfx 1.x
Intel's oneVPL is a successor to MediaSDK, but removed some obsolete
features of MediaSDK[1], some early versions of oneVPL still use libmfx
as library name[2]. However some of obsolete features, including OPAQUE
memory, multi-frame encode, user plugins and LA_EXT rate control mode
etc, have been enabled in QSV, so user can not use --enable-libmfx to
enable QSV if using an early version of oneVPL SDK. In order to ensure
user builds FFmpeg against a right version of libmfx, this patch added a
check for version < 2.0 and warning message about the used obsolete

[1] https://spec.oneapi.io/versions/latest/elements/oneVPL/source/VPL_intel_media_sdk.html
[2] https://github.com/oneapi-src/oneVPL
2022-08-12 10:43:39 +08:00
Andreas Rheinhardt 6c4595190e avcodec/flacdsp: Split encoder-only parts into a ctx of its own
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-05 03:28:45 +02:00
Andreas Rheinhardt b0e38c7d1e configure: Add msmpeg4(dec|enc) subsystems
The msmpeg4 decoders/encoders share a common set of prerequisites,
ergo it makes sense to use common subsystems for them. This also
allows to remove the CONFIG_MSMPEG4_DECODER/ENCODER ad-hoc defines
(which violated the CONFIG_ namespace).

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-03 21:18:25 +02:00
Andreas Rheinhardt b10e218df1 configure, avcodec/Makefile: Make IntraX8 select WMV2DSP, fix MIPS build
IntraX8 uses WMV2DSP directly, so it should have a direct dependency
on it. Also remove the indirect Makefile dependency of the VC-1 decoder
on wmv2dsp.o. Notice that since the addition of the MIPS WMV2DSP
implementation building only the VC-1 decoder would fail, because
no Makefile dependency VC1->wmv2dsp_init_mips.o has been added.
This is of course fixed by this commit.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-03 21:17:56 +02:00
Andreas Rheinhardt eb5c5ae658 avcodec/intrax8: Remove unused IDCTDSPContext
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-03 21:10:00 +02:00
Anton Khirnov c6f22940e4 lavc/libx264: support AV_CODEC_CAP_ENCODER_RECON_FRAME
Bump the version requirement to 122, which introduced b_full_recon.
2022-08-02 10:52:15 +02:00
Martin Storsjö 8e6759f10c configure: Check for DXGI_OUTDUPL_FRAME_INFO for the ddagrab filter
The DXGI_OUTDUPL_FRAME_INFO type isn't available in Windows API
subsets other than "desktop", while the IDXGIOutput1 interface is
available for all API subsets.

This fixes compilation for UWP/"Windows Store" configurations (and
older API subsets like Windows Phone).

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-08-01 15:41:25 +03:00
Niklas Haas c688ddc067 avcodec: add common fflcms2 boilerplate
Handling this in general code makes more sense than handling it in
individual codec files, because it would be a lot of unnecessary code
duplication for the plenty of formats that support exporting ICC
profiles (jpg, png, tiff, webp, jxl, ...).

encode.c and decode.c will be in charge of initializing this state as
needed, so we merely need to make sure to uninit it afterwards from the
common destructor path.

Signed-off-by: Niklas Haas <git@haasn.dev>
2022-07-30 11:42:06 +02:00
Marvin Scholz 564d7946de configure: properly require libx264 if enabled
When libx264 can not be found even though it is enabled, it should error
out properly instead of silently disabling it.
2022-07-24 17:41:21 +03:00
Anton Khirnov 760ce4bc0b fftools/ffmpeg: depend on threads
ffmpeg will be switched to a fully threaded architecture, starting with
2022-07-23 11:53:19 +02:00
Timo Rothenpieler 926f355aff avfilter/vsrc_ddagrab: check for existence of DPI_AWARENESS_CONTEXT
Apparently some (broken?) Windows SDK versions define IDXGIOutput5
but not DPI_AWARENESS_CONTEXT. So we need to explicitly check for its
2022-07-19 13:57:38 +02:00
Timo Rothenpieler 61c151a098 avfilter/vsrc_ddagrab: dynamically load SetThreadDpiAwarenessContext
It's a Windows 10 only function, and its presence alone prevents the
binary from loading on older Windows versions.
2022-07-19 01:29:00 +02:00
Timo Rothenpieler f611255480 avfilter: add vsrc_ddagrab 2022-07-18 02:08:27 +02:00
Timo Rothenpieler be983d2354 configure: add missing deps for chromakey_cuda filter
Not sure how those went missing at some point during the review process,
but it went unnoticed since all my test machines obviously have the
2022-07-10 17:42:58 +02:00
dvhh c6fdbe26ef configure: fix SDL2 version check for pkg_config fallback
pkg_config fallback for SDL2 use 2.1.0 as max (excluded) version
where the pkg_config specify 3.0.0
Correcting fallback version to be in line with the pkg_config version

Signed-off-by: dvhh <dvhh@yahoo.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2022-07-09 21:33:38 +02:00
Paul B Mahol 6ed9eaf664 avfilter: add remap opencl filter 2022-07-07 17:52:32 +02:00
Jan Ekström 3bb23a8b3c {configure,avformat/movenc}: enable AC-3 parser for movenc
This simplifies the code to no longer have #ifs in a manner which
does not require handling avpriv_ac3_parse_header returning ENOSYS.

As an existing example, the MPEG-TS muxer already requires the AC-3
parser, and in order to fix existing issues with the current AC-3
movenc code, switching to use the AC-3 parser is required, so this
is an enabling change for that.

Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
2022-06-30 16:14:05 +03:00
ManojGuptaBonda a44fba0b5b AV1 VDPAU hwaccel Decode support
Support for VDPAU accelerated AV1 decoding was added with libvdpau-1.5.
Support for the same in ffmpeg is added with this patch. Profiles
related to VDPAU AV1 can be found in latest vdpau.h present in

Add AV1 VDPAU to list of hwaccels and supported formats
Added file vdpau_av1.c and Modified configure to add VDPAU AV1 support.
Mapped AV1 profiles to VDPAU AV1 profiles. Populated the codec specific
params that need to be passed to VDPAU.

Signed-off-by: Philip Langdale <philipl@overt.org>
2022-06-25 09:05:58 +08:00
Zhao Zhili 58d6463296 configure: select avs2 parser for libdavs2 decoder
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-06-24 15:37:23 +08:00
Nil Admirari cc5844da98 libavutil: Add wchartoutf8(), wchartoansi(), utf8toansi(), getenv_utf8(), 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>
2022-06-21 13:27:46 +03:00
Marton Balint b3cca50638 avformat/librist: bump required version to 0.2.7
This is the first version for which fifo size setting actually works.

Signed-off-by: Marton Balint <cus@passwd.hu>
2022-06-18 16:32:23 +02:00
Matt Oliver dd5a0302d5 avcodec/libx264: Set min build version to 158 for msvc
Was "[PATCH] libx264: Do not explicitly set X264_API_IMPORTS"

Setting X264_API_IMPORTS only affects msvc builds and it breaks
linking to static builds (although is required for shared builds).
This flag is set by x264 in its pkgconfig as required since build
158 (a615f027ed172e2dd5380e736d487aa858a0c4ff) from July 2019.
So this patch updates configure to require a newer x264 build that
correctly sets the imports flag.

The min version requirement of 158 is applied for msvc builds only.

This is also removing the check for 'libx264 without pkg-config'
which was left for compatibility reasons about 7 years ago when
the pkg-config check was introduced by commit

Co-authored-by: softworkz <softworkz@hotmail.com>
Signed-off-by: softworkz <softworkz@hotmail.com>
Signed-off-by: Matt Oliver <protogonoi@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2022-06-11 14:15:16 +02:00
Haihao Xiang f912cefb83 qsv: check for libmfx.pc instead of mfx.pc
This fixed the regression caused by commit 478e1a98a

Reported-by: Timo Rothenpieler <timo@rothenpieler.org>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-05-26 23:21:37 +08:00
Trystan Mata 1cb601ad10 avcodec/mfenc: Dynamically load MFPlat.DLL
Allows non-UWP builds of FFmpeg with MediaFoundation to work on
N editions of Windows which are without MediaFoundation by default.

On UWP target, FFmpeg is linked directly against MediaFoundation since
LoadLibrary is not available.

This commit adresses https://trac.ffmpeg.org/ticket/9788

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-05-25 23:45:42 +03:00
Haihao Xiang 478e1a98a2 qsv: add requirement for the mininal version of libmfx
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>
2022-05-25 15:17:35 +08: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,

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:

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
Christopher Degawa e5163b1d34 configure: extend SDL check to accept all 2.x versions
sdl2 recently changed their versioning, moving the patch level to minor level
and have said that they will instead ship sdl3.pc for 3.0.0

Fixes ticket 9768

Signed-off-by: Christopher Degawa <ccom@randomderp.com>
Signed-off-by: Gyan Doshi <ffmpeg@gyani.pro>
2022-05-12 11:51:07 +05:30
John Stebbins 7f5b57766b lavf/matroskaenc: enable PGS merge auto bsf
PGS segments must be merged to one packet for muxing to mkv

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-05-10 10:03:32 +02:00
Niklas Haas 2cb0cebd11 lavfi: add vf_iccdetect for parsing ICC profiles
This filter is designed to parse embedded ICC profiles and attempt
extracting colorspace tags from them, updating the AVFrame metadata

This is intentionally made a separate filter, rather than being part of
libavcodec itself, so that it's an opt-in behavior for the time being.
This also gives the user more flexibility to e.g. first attach an ICC
profile and then also set the colorspace tags from it.

This makes #9673 possible, though not automatic.

Signed-off-by: Niklas Haas <git@haasn.dev>
2022-04-23 21:51:55 +02:00
Niklas Haas 5cfeaeef0c lavfi: add vf_iccgen for generating ICC profiles
This filter is designed to specifically cover the task of generating ICC
profiles (and attaching them to output frames) on demand. Other tasks,
such as ICC profile loading/stripping, or ICC profile application, are
better left to separate filters (or included into e.g. vf_setparams).

Signed-off-by: Niklas Haas <git@haasn.dev>
2022-04-23 21:51:55 +02:00
Niklas Haas b9a25963f7 lavfi: add ICC profile support via lcms2
This introduces an optional dependency on lcms2 into FFmpeg. lcms2 is a
widely used library for ICC profile handling, which apart from being
used in almost all major image processing programs and video players,
has also been deployed in browsers. As such, it's both widely available
and well-tested.

Add a few helpers to cover our major use cases. This commit merely
introduces the helpers (and configure check), even though nothing uses
them yet.

It's worth pointing out that the reason the cmsToneCurves for each
AVCOL_TRC are cached inside the context, is because constructing a
cmsToneCurve requires evaluating the curve at 4096 (by default) grid
points and constructing a LUT. So, we ideally only want to do this once
per curve. This matters for e.g. ff_icc_profile_detect_transfer, which
essentially compares a profile against all of these generated LUTs.
Re-generating the LUTs for every iteration would be unnecessarily

The same consideration does not apply to e.g. cmsCreate*Profile, which
is a very lightweight operation just involving struct allocation and
setting a few pointers.

The cutoff value of 0.01 was determined by experimentation. The lowest
"false positive" delta I saw in practice was 0.13, and the largest
"false negative" delta was 0.0008. So a value of 0.01 sits comfortaby
almost exactly in the middle.

Signed-off-by: Niklas Haas <git@haasn.dev>
2022-04-23 21:51:55 +02:00
Leo Izen 5f0b4e9c70 avcodec/libjxl: add Jpeg XL encoding via libjxl
This commit adds encoding support to libavcodec
for Jpeg XL images via the external library libjxl.
2022-04-23 19:51:46 +02:00
Leo Izen 458cc7e314 avcodec/libjxl: add Jpeg XL decoding via libjxl
This commit adds decoding support to libavcodec
for Jpeg XL images via the external library libjxl.
2022-04-23 19:51:46 +02:00
Mark Gaiser f889837e00 avformat: Add IPFS protocol support.
This patch adds support for:
- ffplay ipfs://<cid>
- ffplay ipns://<cid>

IPFS data can be played from so called "ipfs gateways".
A gateway is essentially a webserver that gives access to the
distributed IPFS network.

This protocol support (ipfs and ipns) therefore translates
ipfs:// and ipns:// to a http:// url. This resulting url is
then handled by the http protocol. It could also be https
depending on the gateway provided.

To use this protocol, a gateway must be provided.
If you do nothing it will try to find it in your
$HOME/.ipfs/gateway file. The ways to set it manually are:
1. Define a -gateway <url> to the gateway.
2. Define $IPFS_GATEWAY with the full http link to the gateway.
3. Define $IPFS_PATH and point it to the IPFS data path.
4. Have IPFS running in your local user folder (under $HOME/.ipfs).

Signed-off-by: Mark Gaiser <markg85@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-04-12 19:58:33 +02:00
Marton Balint ee50cc18b3 avcodec/vbnenc: add VBN encoder
Signed-off-by: Marton Balint <cus@passwd.hu>
2022-04-10 20:12:23 +02:00
Marton Balint 013d774e22 avcodec/vbndec: add VBN decoder
Add support for decoding Vizrt Binary Image (VBN) files.

LZW-compressed data is not supported yet.

Signed-off-by: Marton Balint <cus@passwd.hu>
2022-04-10 20:12:23 +02:00
Andreas Rheinhardt f4098bbc3b avcodec/bsf: Add FFBitStreamFilter, hide internals of BSFs
This patch is analogous to 20f972701806be20a77f808db332d9489343bb78:
It hides the internal part of AVBitStreamFilter by adding a new
internal structure FFBitStreamFilter (declared in bsf_internal.h)
that has an AVBitStreamFilter as its first member; the internal
part of AVBitStreamFilter is moved to this new structure.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-23 23:45:45 +01:00
Andreas Rheinhardt 20f9727018 avcodec/codec_internal: Add FFCodec, hide internal part of AVCodec
Up until now, codec.h contains both public and private parts
of AVCodec. This exposes the internals of AVCodec to users
and leads them into the temptation of actually using them
and forces us to forward-declare structures and types that
users can't use at all.

This commit changes this by adding a new structure FFCodec to
codec_internal.h that extends AVCodec, i.e. contains the public
AVCodec as first member; the private fields of AVCodec are moved
to this structure, leaving codec.h clean.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-21 01:33:09 +01:00
Andreas Rheinhardt df2edfe1b0 configure: Add missing cri->mjpegdec dependency
The CRI decoder is useless without the MJPEG-decoder
(its init-function always errors out).

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-19 06:54:48 +01:00
Andreas Rheinhardt 30c08b42f2 avcodec/flashsv2enc: Avoid opening and closing z_stream
Instead initialize a z_stream during init and reset it when needed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-19 00:18:36 +01:00
Andreas Rheinhardt c3c2b5423d avcodec/lclenc: Use ff_deflate_init/end() wrappers
They return nicer error messages on error; furthermore,
they also use our allocation functions. It also stops
calling deflateEnd() on a z_stream that might not have been
successfully initialized.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-19 00:18:36 +01:00
Andreas Rheinhardt 1692a97251 avcodec/pngenc: Use ff_deflate_init/end() wrappers
They return nicer error messages.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-19 00:18:36 +01:00
Andreas Rheinhardt e85095b524 avcodec/zmbvenc: Use ff_deflate_init/end() wrappers
They emit better error messages (it does not claim that inflateInit
failed upon an error from deflateInit!) and uses our allocation functions.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-19 00:18:36 +01:00
Andreas Rheinhardt 9cae7f9450 avcodec/zlib_wrapper: Add wrapper for deflateInit()
The rationale is the same as for the wrappers for inflateInit(),
although the case for it is admittedly not so strong because
there are less users of deflateInit().
Also remove an unnecessary inclusion of config.h in
libavformat/protocols.c in order to trigger a request for reconfigure
(which is needed for CONFIG_DEFLATE_WRAPPER to take effect).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-19 00:18:36 +01:00
Andreas Rheinhardt 74c930e1b8 avcodec/pngdec: Don't open and close z_streams unnecessarily
Instead reuse and reset a single z_stream.
Also use FFZStream in decode_zbuf(), because it has nicer error

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-19 00:18:36 +01:00
Andreas Rheinhardt 7ca99e1f15 avcodec/lscrdec: Don't open and close z_streams unnecessarily
Instead reuse and reset a single z_stream.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-19 00:18:36 +01:00
Andreas Rheinhardt aaa3868b10 avcodec/flashsv: Use ff_inflate_init/end()
This fixes the problem of potentially closing a z_stream
that has never been successfully initialized.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-19 00:18:36 +01:00
Andreas Rheinhardt 8231080fd3 avcodec/lcldec: Use ff_inflate_init/end(), cleanup generically
Returns better error messages in case of error and deduplicates
the inflateInit() code and also allows to cleanup generically
in case of errors as it is save to call ff_inflate_end() if
ff_inflate_init() has not been called successfully.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-19 00:18:35 +01:00
Andreas Rheinhardt 7fffa718c3 avcodec/mscc: Use ff_inflate_init/end()
This fixes the problem of potentially closing a z_stream
that has never been successfully initialized.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-19 00:18:35 +01:00
Andreas Rheinhardt 4960c62944 avcodec/mvha: Use ff_inflate_init/end()
This fixes the problem of potentially closing a z_stream
that has never been successfully initialized.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-19 00:18:35 +01:00
Andreas Rheinhardt c1b0b8f9be avcodec/mwsc: Use ff_inflate_init/end()
This fixes the problem of potentially closing a z_stream
that has never been successfully initialized.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-19 00:18:35 +01:00
Andreas Rheinhardt ac692aa8e9 avcodec/rasc: Use ff_inflate_init/end()
This fixes the problem of potentially closing a z_stream
that has never been successfully initialized.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-19 00:18:35 +01:00
Andreas Rheinhardt 79fe1c8f3a avcodec/tscc: Use ff_inflate_init/end()
Returns better error messages in case of error and deduplicates
the inflateInit() code.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-19 00:18:35 +01:00
Andreas Rheinhardt c78d39b641 avcodec/wcmv: Use ff_inflate_init/end()
This fixes the problem of potentially closing a z_stream
that has never been successfully initialized.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-19 00:18:35 +01:00
Andreas Rheinhardt 93c70b8555 avcodec/zerocodec: Use ff_inflate_init/end()
This fixes the problem of potentially closing a z_stream
that has never been successfully initialized.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-19 00:18:35 +01:00
Andreas Rheinhardt 3d4634f1ff avcodec/zmbv: Use ff_inflate_init/end()
Returns better error messages in case of error and deduplicates
the inflateInit() code.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-19 00:18:35 +01:00
Andreas Rheinhardt dd8a55cb3e avcodec/zlib_wrapper: Add wrappers for zlib inflateInit, inflateEnd
It is not documented to be safe to call inflateEnd() on a z_stream
that has never been successfully been initialized by inflateInit(),
but just zeroed. It just happens to work and several codecs rely
on this (they have FF_CODEC_CAP_INIT_CLEANUP set and even call
inflateEnd() when inflateInit() failed or has never been called).
To avoid this, other codecs recorded whether their zstream has been
initialized successfully or not.

This commit adds wrappers for inflateInit() and inflateEnd() that
do what these other codecs do; furthermore, they also take care of
properly setting up the zstream before inflateInit() and emit
an error message in case of error.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-19 00:18:35 +01:00
Martin Storsjö a78f136f3f configure: Use a separate config_components.h header for $ALL_COMPONENTS
This avoids unnecessary rebuilds of most source files if only the
list of enabled components has changed, but not the other properties
of the build, set in config.h.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-03-16 14:12:49 +02:00
Adrian Ratiu bc5ccea3b9 configure: move ranlib -D test after setting defaults
In Gentoo and ChromeOS we want to allow pure LLVM builds without
using GNU tools, so we block any unwanted mixed GNU/LLVM usages
(GNU tools are still kept around in our chroots for projects
like glibc which cannot yet be built otherwise).

The default ${cross_prefix}${ranlib_default} points to GNU and
fails, so move the test a bit later - after the defaults are
set and the proper values get overriden - such that ffmpeg
configure calls the llvm-ranlib we desire. [1]

[1] https://gitweb.gentoo.org/repo/gentoo.git/tree/media-video/ffmpeg/ffmpeg-4.4.1-r1.ebuild?id=7a34377e3277a6a0e2eedd40e90452a44c55f1e6#n477

Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2022-03-11 14:20:14 +02:00
Wu Jianhua f629ea2e18 avutil/cpu: add AVX512 Icelake flag
Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
Reviewed-by: Henrik Gramner <henrik@gramner.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-10 16:45:48 -03:00
Martin Storsjö c619c54e0d configure: Fix detecting/using getauxval
While trying to detect getauxval, this actually never output
HAVE_GETAUXVAL into config.h before.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-03-04 14:29:42 +02:00
James Almer df272928ff configure: stop allowing disabling lzo
The module is now always compiled in.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-02-26 14:22:07 -03:00
James Almer 1dddb930aa avcodec/libsvtav1: update some options and defaults
And bump the minimum required version to 0.9.0

Signed-off-by: James Almer <jamrial@gmail.com>
2022-02-24 20:36:53 -03:00
Paul B Mahol 18ad9fb0c5 avfilter/af_superequalizer: switch rdft to lavu/tx 2022-02-16 17:28:14 +01:00