1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-07 11:13:41 +02:00
Commit Graph

2661 Commits

Author SHA1 Message Date
James Almer
660e7e6a0e avcodec: add LCEVC decoding support via LCEVCdec
Signed-off-by: James Almer <jamrial@gmail.com>
2024-09-23 10:20:47 -03:00
Lynne
4b4f0b68f8
lavc: add hevc_vulkan hardware encoder
This commit adds a Vulkan hardware HEVC encoder, with full support
of the spec - I, P, and B-frames.
2024-09-17 21:12:32 +02:00
Lynne
12f158ca8f
hw_base_encode_h265: split off SPS/PPS/VPS generation from VAAPI
This commit splits off the base unit generation from VAAPI to allow
sharing with other encoders.
2024-09-17 21:11:06 +02:00
Lynne
f85d94730c
lavc: add h264_vulkan hardware encoder
This commit adds the first Vulkan hardware encoder.

Currently, P, and **B**-frames are supported. This marks the
first implementation to support both.

The encoder has feature-parity with VAAPI.
2024-09-16 14:04:06 +02:00
Lynne
37243b2a08
lavc: add Vulkan video encoding base code
This commit adds the common Vulkan video encoding framework.
It makes full use of the asynchronous features of our new common
hardware encoding code, and of Vulkan.
The code is able to handle anything from H264 to AV1 and MJPEG.
2024-09-16 14:04:05 +02:00
Lynne
4646a74d1e
lavc/Makefile: only compile hw_base_encode_h264.c when actually needed 2024-09-10 04:59:22 +02:00
Lynne
034e25e1a4
hw_base_encode: move VAAPI SPS/PPS constructors to a shared file 2024-09-09 07:05:41 +02:00
Anton Khirnov
3f9ca51015 lavc/opus*: move to opus/ subdir 2024-09-02 11:56:53 +02:00
Matthieu Bouron
0a780d3076 avcodec: add Mediacodec audio decoders support
Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
2024-09-01 12:25:56 +02:00
Anton Khirnov
79afc45c03 lavc/hevcdec: use a ContainerFifo to hold frames scheduled for output
Instead of a single AVFrame.

Will be useful in future commits, where we will want to produce multiple
output frames for a single coded frame.
2024-08-19 21:37:22 +02:00
James Almer
ab5c612137 avcodec/Makefile: use the correct path for aacdec_fixed.o when setting its dependencies
Fixes ticket #11112

Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-31 11:32:56 -03:00
Tong Wu
ba0c14e6bf avcodec: add D3D12VA hardware HEVC encoder
This implementation is based on D3D12 Video Encoding Spec:
https://microsoft.github.io/DirectX-Specs/d3d/D3D12VideoEncoding.html

Sample command line for transcoding:
ffmpeg.exe -hwaccel d3d12va -hwaccel_output_format d3d12 -i input.mp4
-c:v hevc_d3d12va output.mp4

Signed-off-by: Tong Wu <tong1.wu@intel.com>
2024-07-02 14:15:12 +02:00
Tong Wu
aa82340b0c avcodec/vaapi_encode: move the dpb logic from VAAPI to base layer
Move receive_packet function to base. This requires adding *alloc,
*issue, *output, *free as hardware callbacks. HWBaseEncodePicture is
introduced as the base layer structure. The related parameters in
VAAPIEncodeContext are also extracted to HWBaseEncodeContext. Then DPB
management logic can be fully extracted to base layer as-is.

Signed-off-by: Tong Wu <tong1.wu@intel.com>
2024-07-02 14:15:12 +02:00
Thomas Siedel
c75940db29 avcodec: add external enc libvvenc for H266/VVC
Add external encoder VVenC for H266/VVC encoding.
Register new encoder libvvenc.
Add libvvenc to wrap the vvenc interface.
libvvenc implements encoder option: preset,qp,qpa,period,
passlogfile,stats,vvenc-params,level,tier.
Enable encoder by adding --enable-libvvenc in configure step.

Co-authored-by: Christian Bartnik chris10317h5@gmail.com
Signed-off-by: Thomas Siedel <thomas.ff@spin-digital.com>
2024-06-15 21:00:05 +08:00
Andreas Rheinhardt
dd8fb0aaae avcodec/hevc/Makefile: Move rules for lavc/* files to lavc/Makefile
If any of these files (say A) would be changed in such a way
that A acquires a new dependency on another file B, building B
would need to be added to all the rules that lead to A being built.
Yet currently the rules for several files are spread over
the lavc Makefile and the Makefile of the lavc/hevc subdir, making
it more likely to be forgotten. So move the rules for these files
to the lavc/Makefile.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-09 10:59:33 +02:00
Anton Khirnov
e4601cc339 lavc/hevc*: move to hevc/ subdir 2024-06-04 11:46:27 +02:00
Andreas Rheinhardt
06d1840b56 configure, avcodec/Makefile: Add h264parse->h264data,golomb dependencies
Fixes standalone compilation of the dts2pts BSF.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-13 14:32:21 +02:00
Andreas Rheinhardt
07c1bd5feb avcodec/Makefile: Fix intrax8 objects
Forgotten in d1d30edf42.
This fixes standalone compilation of the VC-1 based
decoders when using shared builds (for static builds,
nothing pulls in msmpeg4data.o, yet for shared builds
the default behaviour of linkers is different, leading
to undefined references because msmpeg4data.o relies
on stuff from mpeg4video.o).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-07 23:53:26 +02:00
Andreas Rheinhardt
8b7f089e4b avcodec/Makefile: Correct name of cbd2_dpcm decoder
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-07 23:53:26 +02:00
Andreas Rheinhardt
db2cd9cabf avcodec/Makefile, v408(dec|enc): Remove remnants of AYUV codecs
Forgotten in 9ee59b63f5.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-07 23:53:26 +02:00
Lynne
ae7c6cc17d
aac: move aacdec.c to aac/aacdec.c 2024-04-23 08:31:40 +02:00
Lynne
e93793bf3c
aacdec: fully detemplate decoder core 2024-04-23 08:31:38 +02:00
Lynne
f55b587820
aacdec: move aacdec_common to aac/aacdec_tab
Start to clean up the decoder.
Also renames a confusingly named file.
2024-04-23 08:31:18 +02:00
Niklas Haas
f140935005 avcodec/dovi_rpuenc: add ff_dovi_configure()
We need to set up the configuration struct appropriately based on the
codec type, colorspace metadata, and presence/absence of an EL (though,
we currently don't support an EL).

When present, we use the signalled RPU data header to help infer (and
validate) the right values.

Behavior can be controlled by a new DOVIContext.enable flag.
2024-04-22 12:17:51 +02:00
Niklas Haas
f131086a70 avcodec/dovi_rpu: split into dovi_rpu.c and dovi_rpudec.c
To allow compiling the decoding objects without the encoding objects and
vice versa. Common helpers that users of both APIs need are put into the
shared dovi_rpu.c.
2024-04-22 12:17:05 +02:00
Niklas Haas
783734d979 configure: rename dovi_rpu subsystem to dovi_rpudec
To distinguish it from the to-be-added dovi_rpuenc.
2024-04-22 12:17:05 +02:00
Andreas Rheinhardt
2135a40b1c avcodec/decode: Add new ProgressFrame API
Frame-threaded decoders with inter-frame dependencies
use the ThreadFrame API for syncing. It works as follows:

During init each thread allocates an AVFrame for every
ThreadFrame.

Thread A reads the header of its packet and allocates
a buffer for an AVFrame with ff_thread_get_ext_buffer()
(which also allocates a small structure that is shared
with other references to this frame) and sets its fields,
including side data. Then said thread calls ff_thread_finish_setup().
From that moment onward it is not allowed to change any
of the AVFrame fields at all any more, but it may change
fields which are an indirection away, like the content of
AVFrame.data or already existing side data.

After thread A has called ff_thread_finish_setup(),
another thread (the user one) calls the codec's update_thread_context
callback which in turn calls ff_thread_ref_frame() which
calls av_frame_ref() which reads every field of A's
AVFrame; hence the above restriction on modifications
of the AVFrame (as any modification of the AVFrame by A after
ff_thread_finish_setup() would be a data race). Of course,
this av_frame_ref() also incurs allocations and therefore
needs to be checked. ff_thread_ref_frame() also references
the small structure used for communicating progress.

This av_frame_ref() makes it awkward to propagate values that
only become known during decoding to later threads (in case of
frame reordering or other mechanisms of delayed output (like
show-existing-frames) it's not the decoding thread, but a later
thread that returns the AVFrame). E.g. for VP9 when exporting video
encoding parameters as side data the number of blocks only
becomes known during decoding, so one can't allocate the side data
before ff_thread_finish_setup(). It is currently being done afterwards
and this leads to a data race in the vp9-encparams test when using
frame-threading. Returning decode_error_flags is also complicated
by this.

To perform this exchange a buffer shared between the references
is needed (notice that simply giving the later threads a pointer
to the original AVFrame does not work, because said AVFrame will
be reused lateron when thread A decodes the next packet given to it).
One could extend the buffer already used for progress for this
or use a new one (requiring yet another allocation), yet both
of these approaches have the drawback of being unnatural, ugly
and requiring quite a lot of ad-hoc code. E.g. in case of the VP9
side data mentioned above one could not simply use the helper
that allocates and adds the side data to an AVFrame in one go.

The ProgressFrame API meanwhile offers a different solution to all
of this. It is based around the idea that the most natural
shared object for sharing information about an AVFrame between
decoding threads is the AVFrame itself. To actually implement this
the AVFrame needs to be reference counted. This is achieved by
putting a (ownership) pointer into a shared (and opaque) structure
that is managed by the RefStruct API and which also contains
the stuff necessary for progress reporting.
The users get a pointer to this AVFrame with the understanding
that the owner may set all the fields until it has indicated
that it has finished decoding this AVFrame; then the users are
allowed to read everything. Every decoder may of course employ
a different contract than the one outlined above.

Given that there is no underlying av_frame_ref(), creating
references to a ProgressFrame can't fail. Only
ff_thread_progress_get_buffer() can fail, but given that
it will replace calls to ff_thread_get_ext_buffer() it is
at places where errors are already expected and properly
taken care of.

The ProgressFrames are empty (i.e. the AVFrame pointer is NULL
and the AVFrames are not allocated during init at all)
while not being in use; ff_thread_progress_get_buffer() both
sets up the actual ProgressFrame and already calls
ff_thread_get_buffer(). So instead of checking for
ThreadFrame.f->data[0] or ThreadFrame.f->buf[0] being NULL
for "this reference frame is non-existing" one should check for
ProgressFrame.f.

This also implies that one can only set AVFrame properties
after having allocated the buffer. This restriction is not deep:
if it becomes onerous for any codec, ff_thread_progress_get_buffer()
can be broken up. The user would then have to get a buffer
himself.

In order to avoid unnecessary allocations, the shared structure
is pooled, so that both the structure as well as the AVFrame
itself are reused. This means that there won't be lots of
unnecessary allocations in case of non-frame-threaded decoding.
It might even turn out to have fewer than the current code
(the current code allocates AVFrames for every DPB slot, but
these are often excessively large and not completely used;
the new code allocates them on demand). Pooling relies on the
reset function of the RefStruct pool API, it would be impossible
to implement with the AVBufferPool API.

Finally, ProgressFrames have no notion of owner; they are built
on top of the ThreadProgress API which also lacks such a concept.
Instead every ThreadProgress and every ProgressFrame contains
its own mutex and condition variable, making it completely independent
of pthread_frame.c. Just like the ThreadFrame API it is simply
presumed that only the actual owner/producer of a frame reports
progress on said frame.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-19 13:18:04 +02:00
Leo Izen
7c338f470f avcodec, avformat/ffjni: fix duplicate JNI symbols
Use SHLIBOBJS and STLIBOBJS in the Makefiles for avcodec and avformat,
and add a stub ffjni.c to libavformat, which allows the symbols to be
duplicated for shared builds but not static builds.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
2024-04-04 21:51:21 +02:00
Antoine Soulier via ffmpeg-devel
240fd04db2 avcodec/liblc3: add encoding/decoding support of LC3 audio codec
The LC3 audio codec is the default codec of Bluetooth LE audio.
This is a wrapper over the liblc3 library (https://github.com/google/liblc3).

Signed-off-by: Antoine Soulier <asoulier@google.com>
2024-04-04 17:47:31 +02:00
Andreas Rheinhardt
e123295cc8 avcodec/proresdec2: Rename to proresdec
Once upon a time, there used to be a LGPL and a GPL ProRes decoder
in FFmpeg; the current decoder evolved from the second of these.
But given that it is now the only ProRes decoder we have, it's file
should simply be named proresdec.c (which also brings it in line with
its header).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-03 19:10:30 +02:00
Anton Khirnov
1d843ae6c7 lavc: rename avpacket.c to packet.c
For consistency with its API header packet.h.
2024-03-29 09:01:54 +01:00
Andreas Rheinhardt
e465cebfee avcodec/Makefile: Remove redundant dependencies on hevc_data.o
hevc_data.c only provides ff_hevc_diag_scan tables and
neither the QSV HEVC encoder nor the HEVC parser use these
directly and the indirect dependency is already accounted
for in the dependencies of the hevcparse subsystem since
b0c61209cd, so remove these
spurious dependencies.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-29 00:39:11 +01:00
Lynne
ecdc94b97f
vulkan_av1: port to the new stable API
Co-Authored-by: Dave Airlie <airlied@redhat.com>
2024-03-25 08:54:40 +01:00
Niklas Haas
5d7f234e7e avcodec/hevcdec: apply AOM film grain synthesis
Following the usual logic for H.274 film grain.
2024-03-23 18:55:21 +01:00
Niklas Haas
2e24c12aa1 avcodec/h2645_sei: decode AFGS1 T.35 SEI
I restricted this SEI to HEVC for now, until I see a H.264 sample.
2024-03-23 18:55:21 +01:00
Martin Storsjö
c31d232656 libavcodec: Don't include libavcodec/x86/vvc/Makefile on any architecture
This currently builds files in the libavcodec/x86/{vvc,h26x}
subdirectories, which is somewhat unexpected when building for
another architecture than x86.

The regular arch subdirectories are handled with

    -include $(SRC_PATH)/$(1)/$(ARCH)/Makefile

in the toplevel Makefile. Switch this to a similar optional
inclusion, using $(ARCH).

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-03-10 23:46:48 +02:00
Andreas Rheinhardt
2dfdee3969 avcodec/xvmc: Remove header
Forgotten in a12cd3be98.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-07 16:33:23 +01:00
James Almer
5b23b18d40 avcodec: remove deprecated FF_CODEC_CRYSTAL_HD
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:30 -03:00
Andreas Rheinhardt
51b2343ef9 avcodec/hq_hqadata: Move data in a header
It is only used by hq_hqa.c, so said header can simply
be included there.
Also move the code to initialize the VLCs to hq_hqa.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-07 09:15:18 +01:00
Andreas Rheinhardt
1e98cc4787 avcodec/bsf/mp3_header_decompress: Remove BSF
This BSF is supposed to be used in conjunction with mp3_header_compress,
which has been removed more than ten years ago in commit
c6080d8900. It mangled the headers
by removing the CRC field as well as fields that are supposed
to stay constant for the entirety of a stream (which are put into
extradata). This made these files unplayable; they need to be
decompressed with the BSF first (which does not happen automatically).
Even in this case the CRC does not get restored.

I am not aware that such compressed files exist at all; therefore
this commit removes the BSF completely.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-02 02:47:50 +01:00
Andreas Rheinhardt
5a4702cba9 avcodec/Makefile: Add missing AV1 decoder->av1_parse.o dependency
Needed for ff_av1_framerate().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-01 01:33:03 +01:00
Jan Ekström
e06ce6d2b4 {avcodec,tests}: rename the bundled Mesa AV1 vulkan video headers
This together with adjusting the inclusion define allows for the
build to not fail with latest Vulkan-Headers that contain the
stabilized Vulkan AV1 decoding definitions.

Compilation fails currently as the AV1 header is getting included
via hwcontext_vulkan.h -> <vulkan/vulkan.h> -> vulkan_core.h, which
finally includes vk_video/vulkan_video_codec_av1std.h and the decode
header, leading to the bundled header to never defining anything
due to the inclusion define being the same.

This fix is imperfect, as it leads to additional re-definition
warnings for things such as
VK_STD_VULKAN_VIDEO_CODEC_AV1_DECODE_SPEC_VERSION. , but it is
not clear how to otherwise have the bundled version trump the
actually standardized one for a short-term compilation fix.
2024-02-18 13:16:37 +02:00
Wu Jianhua
70889620f2 avcodec/vvcdec: reuse h26x/2656_inter.asm to enable x86 optimizations
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2024-02-01 19:54:28 +08:00
Anton Khirnov
887a7817b6 lavc: move bitstream filters into bsf/ subdir 2024-01-29 18:40:14 +01:00
Connor Worley
dfbbd11a4b lavc/dxvenc: add DXV encoder with support for DXT1 texture format
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2024-01-23 21:31:22 +01:00
Nuo Mi
49db9fc171 vvcdec: add vvc_data
Co-authored-by: Xu Mu <toxumu@outlook.com>
Co-authored-by: Frank Plowman <post@frankplowman.com>
Co-authored-by: Shaun Loo <shaunloo10@gmail.com>
Co-authored-by: Wu Jianhua <toqsxw@outlook.com>
2024-01-03 16:31:59 +08:00
Wu Jianhua
ffa158edbd avcodec: add D3D12VA hardware accelerated VC1 decoding
The command below is how to enable d3d12va:
ffmpeg -hwaccel d3d12va -i input.mp4 output.mp4

Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
Signed-off-by: Tong Wu <tong1.wu@intel.com>
2023-12-21 16:15:23 +08:00
Wu Jianhua
c6c05dd34a avcodec: add D3D12VA hardware accelerated MPEG-2 decoding
The command below is how to enable d3d12va:
ffmpeg -hwaccel d3d12va -i input.mp4 output.mp4

Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
Signed-off-by: Tong Wu <tong1.wu@intel.com>
2023-12-21 16:15:23 +08:00
Wu Jianhua
b16fd96c5f avcodec: add D3D12VA hardware accelerated AV1 decoding
The command below is how to enable d3d12va:
ffmpeg -hwaccel d3d12va -i input.mp4 output.mp4

Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
Signed-off-by: Tong Wu <tong1.wu@intel.com>
2023-12-21 16:15:23 +08:00
Wu Jianhua
326288c70a avcodec: add D3D12VA hardware accelerated VP9 decoding
The command below is how to enable d3d12va:
ffmpeg -hwaccel d3d12va -i input.mp4 output.mp4

Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
Signed-off-by: Tong Wu <tong1.wu@intel.com>
2023-12-21 16:15:23 +08:00