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

113580 Commits

Author SHA1 Message Date
Andreas Rheinhardt
ca95863758 avcodec/vc1dec: Don't call ff_get_format() twice
It is currently called once in the codecs' init function
and once when (re)initializing the VC-1 decode context
(which happens upon frame size changes as well as before
decoding the first frame). The first one is unnecessary
now that vc1_decode_frame() no longer requires avctx->hwaccel
to be already set for hwaccel to work properly.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-09 08:16:25 +01:00
Andreas Rheinhardt
38f234c06e avcodec/vc1dec: Set pointers for hwaccel even without hwaccel
VC-1 uses a 0x03 escaping scheme like H.26x and our decoder
unescapes data for this purpose, but hardware accelerations
just want the data as-is and therefore get fed the original
data. The pointers to the actual data are only setcorrectly
if avctx->hwaccel is set (after all, they are only used in
this case).

There are two problems with this: The first is that the branch
is pointless; the second is that it is harmful, because
a hardware acceleration may be added after the packet has been
parsed (in case there is a reconfiguration e.g. due to frame
size changes) in which case decoding the first few frames
won't work.

So delete these branches.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-09 08:16:25 +01:00
Andreas Rheinhardt
687a287e14 avcodec/mmaldec: Avoid using AVCodec.pix_fmts
It is entirely unnecessary to use it given that all decoders
here share the same set of supported pixel formats. So just
hardcode this list.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-09 08:16:25 +01:00
Andreas Rheinhardt
89995cfda1 avcodec: Remove redundant pix_fmts from decoders
AVCodec.pix_fmts is only intended for encoders (decoders use
the get_format callback to let the user choose a pix fmt).
So remove them for the decoders for which this is possible
without further complications; keep them for now in the codecs
that actually use them (by passing avctx->codec->pix_fmts to
ff_get_formatt()).

Also notice that some of these lists were wrong; e.g.
317b7b06fd added support for YUV444P16
for cuviddec, but forgot to add it to pix_fmts.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-09 08:16:25 +01:00
Connor Worley
395469c1b0 fate/video: add DXV3 HQ tests
Signed-off-by: Connor Worley <connorbworley@gmail.com>
2024-02-08 20:37:27 +01:00
Connor Worley
5fbb6fc636 fate/video: add DXV3 DXT1 encoding test
Signed-off-by: Connor Worley <connorbworley@gmail.com>
2024-02-08 20:37:27 +01:00
Connor Worley
1eeee68d8e lavc/dxv: fix incorrect back-reference index calculation in DXT5 decoding
This bug causes the DXT5 decoder to produce incorrect block texture data.
After the fix, textures are visually correct and match data decoded by
Resolume Alley (extracted with Nvida Nsight for comparison). Current FATE DXT5
samples did not cover this case.

Signed-off-by: Connor Worley <connorbworley@gmail.com>
2024-02-08 20:36:15 +01:00
Connor Worley
3b6a515c5f lavc/dxv: treat DXT5-tagged files as DXT4
DXV files seem to misnomer DXT5 and really encode DXT4 with
premultiplied alpha. At least, this is what Resolume alley does.

To check, encode some input with alpha as "Normal Quality, With Alpha"
in Alley, then decode the output with this change -- results are true
to the original input compared to git-master.

Signed-off-by: Connor Worley <connorbworley@gmail.com>
2024-02-08 20:36:04 +01:00
Connor Worley
c4e9556cf5 lavc/texturedsp: fix premult2straight inversion
This function should convert premultiplied alpha to straight, but does the opposite.

Signed-off-by: Connor Worley <connorbworley@gmail.com>
2024-02-08 20:36:04 +01:00
Andreas Rheinhardt
f6ec01147f avfilter/fifo: Remove (a)fifo filters
Obsolete since 4ca1fb9d2a.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-08 14:02:55 +01:00
Andreas Rheinhardt
9ae40f282d avcodec/nvdec: Constify bitstream pointee
Reviewed-by: Timo Rothenpieler <timo@rothenpieler.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-08 14:00:37 +01:00
Haihao Xiang
cd31eac999 lavc/qsvenc: Add workaround for VP9 keyframe
The runtime doesn't set the frame type to MFX_FRAMETYPE_IDR on the
returned mfx bitstream for a keyframe, it set the frame type to
MFX_FRAMETYPE_I only. This patch added workaround for VP9 keyframe to
make the coded stream seekable.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2024-02-08 10:34:02 +08:00
Tong Wu
82e8838165 avcodec/dxva2: fix different 'const' qualifiers warning
Signed-off-by: Tong Wu <tong1.wu@intel.com>
2024-02-08 10:34:02 +08:00
Tong Wu
92ee7461c3 avcodec/d3d12va_decode: fix different 'const' qualifiers warning
Signed-off-by: Tong Wu <tong1.wu@intel.com>
2024-02-08 10:34:02 +08:00
Aleksoid
336d59643a avcodec/d3d12va_vc1: add support for D3D12_VIDEO_DECODE_PROFILE_VC1_D2010 guid.
The VC1_D2010 profile, also known as VC1_VLD2010, has the same functionality
and specification as the VC1_D profile. Support for this profile serves only
as a positive indication that the accelerator has been designed with awareness
of the modifications specified in the August 2010 version of this specification.

Hardware accelerator drivers that expose support for this profile must not
also expose the previously specified VC1_D GUID, unless the accelerator works
properly with existing software decoders that use VC1_D and that do not incorporate
the corrections added to the August 2010 version of this specification.

As a result, we could give VC1_VLD2010 a higher priority and initialize
it first.

Signed-off-by: Aleksoid <Aleksoid1978@mail.ru>
Signed-off-by: Tong Wu <tong1.wu@intel.com>
2024-02-08 10:34:02 +08:00
Wu Jianhua
3372876888 avcodec/x86/vvc/vvcdsp_init: fix unresolved external symbol on ARCH_X86_32
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2024-02-07 22:53:15 +08:00
James Almer
7f92014aca avcodec/nvdec: don't free NVDECContext->bitstream
Ensure all hwaccels that allocate a buffer use NVDECContext->bitstream_internal
instead. Otherwise, if FFHWAccel->end_frame() isn't called before
FFHWAccel->uninit(), an attempt to free a stale pointer to memory not owned by
the hwaccel could take place.

Reviewed-by: Timo Rothenpieler <timo@rothenpieler.org>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-07 11:31:33 -03:00
Lynne
bd3e71b21e
x86/tx_float: enable SIMD for sizes over 131072
The tables for the new sizes were added last year due
to being required for SDR.
However, the assembly was never updated to use them.
2024-02-07 15:20:48 +01:00
Andreas Rheinhardt
e05d3c1a16 avdevice/caca: Allow to list multiple dither option types at once
This can be achieved by using AV_OPT_TYPE_FLAGS instead of
AV_OPT_TYPE_STRING. It also avoids strcmp() when accessing
the option.

Reviewed-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-07 10:25:17 +01:00
Andreas Rheinhardt
ed56ca856c avutil/opt: Fix AV_OPT_TYPE_CONST default value
It uses the int64_t instead of the double member.

(This code can currently not be reached: av_opt_get() calls
av_opt_find2() with NULL as unit in which case AV_OPT_TYPE_CONST
options are never returned, leading av_opt_get() to always
return AVERROR_OPTION_NOT_FOUND when searching for AV_OPT_TYPE_CONST*.
For the same reason the code read_number() will never be called
from get_number() when searching for an option of type
AV_OPT_TYPE_CONST. The other callers of read_number() also only
call it with types other than AV_OPT_TYPE_CONST.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-07 10:23:00 +01:00
Andreas Rheinhardt
8b83b52d0f avformat/nutenc: Fix indentation
Forgotten after 82beb46e65.
Also use loop-scope for iterators while at it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-07 10:22:19 +01:00
Andreas Rheinhardt
1a52cbd404 avfilter/ccfifo: Improve included headers
We don't need to include fifo.h, because we don't need AVFifo
as a complete type. Also add the other used headers directly.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-07 10:22:19 +01:00
Andreas Rheinhardt
9b67c5a684 avfilter/ccfifo: Inline trivial functions
Besides being extremly simple this also avoids including
ff_ccfifo_ccdetected() unnecessarily (it is only used by decklink).
This is possible because this is not avpriv, but duplicated into
lavd if necessary.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-07 10:22:19 +01:00
Andreas Rheinhardt
71e1da4522 avformat/mux: Don't allocate priv_pts separately
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-07 10:22:18 +01:00
Andreas Rheinhardt
ad9f644505 avformat/avformat: Avoid av_strdup(NULL)
It is not documented to be safe.
Also copy these lists in a more generic manner.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-07 10:22:18 +01:00
Andreas Rheinhardt
569ad285a5 avformat/options: Only allocate AVCodecContext for demuxers
The muxer's AVCodecContext is currently used for exactly one thing:
To store a time base in it that has been derived via heuristics
in avformat_transfer_internal_stream_timing_info(); said time base
can then be read back via av_stream_get_codec_timebase().
But one does not need a whole AVCodecContext for that, a simple
AVRational is enough.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-07 10:22:18 +01:00
Andreas Rheinhardt
76ef2b9337 avformat/avformat: Remove obsolete comment
Forgotten in 3f991325b5,
obsolete since 3749eede66.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-07 10:22:18 +01:00
Andreas Rheinhardt
1d5ba34249 avformat/avformat: Remove dead check, write-only assignment
For muxers, the internal AVCodecContext is basically unused
except in avformat_transfer_internal_stream_timing_info()
(which sets time_base and ticks_per_frame) and
av_stream_get_codec_timebase() (a getter for time_base).
This makes ticks_per_frame write-only, so don't set it.

Also remove an always-false check for the AVCodecContext's
codec_tag.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-07 10:22:18 +01:00
Marth64
97fb84d74e doc/formats: clarify meaning of igndts as per definition in avformat.h
Signed-off-by: Marth64 <marth64@proxyid.net>
2024-02-07 00:55:40 +01:00
Frank Plowman
5076fa30ab lavc/vvc: Validate alf_list indexes
Signed-off-by: Frank Plowman <post@frankplowman.com>
2024-02-06 22:10:06 +08:00
James Almer
e7a9dd03ab avcodec/libaomdec: print libaomdec version in verbose level
info level will be too noisy if several instances of the decoder are fired
at the same time, as will be the case with tiled AVIF.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-06 10:34:50 -03:00
James Almer
48f4a29bae avcodec/libdav1d: print libdav1d version in verbose level
info level will be too noisy if several instances of the decoder are fired
at the same time, as will be the case with tiled AVIF.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-06 10:34:50 -03:00
Frank Plowman
a42f884cd2 lavc/vvc: Fix slice_idx out-of-bounds memset
If the number of CTUs reduces between one picture and the next, the
slice_idx table is reduced in size in the frame_context_for_each_tl call
on vvcdec.c:321.  When initialising the slice_idx table on vvcdec.c:325,
the old code uses fc->tab.sz.ctu_count when calculating the table size.
fc->tab.sz.ctu_count holds the old ctu count at this point however, not
being updated to hold the new ctu count until vvcdec.c:342.  This causes
an out-of-bounds write.

Patch fixes the problem by using pps->ctb_count, which was just used
when allocating the table, in place of fc->tab.sz.ctu_count when
initialising the table.

Signed-off-by: Frank Plowman <post@frankplowman.com>
2024-02-06 19:45:43 +08:00
Niklas Haas
aa1a194a7e avfilter/vsrc_testsrc: switch to YUV colorspace negotiation API
Instead of overriding the frame properties in fill_picture(), advertise
the supported YUV colorspace and range at format negotiation time. (The
correct metadata will now be set automatically by ff_get_video_buffer)
2024-02-06 11:30:10 +01:00
Niklas Haas
ce81237d63 avfilter: pass link YUV colorspace to ff_draw_init2
This makes all ff_draw_* based filters aware of YUV colorspaces and
ranges. Needed for YUVJ removal. Also fixes a bug where e.g. vf_pad
would generate a limited range background even after conversion to
full-scale grayscale.

The FATE changes were a consequence of the aforementioned bugfix - the
gray scale files are output as full range (due to conversion by
libswscale, which hard-codes gray = full), and appropriately tagged as
such, but before this change the padded version incorrectly used
a limited range (16) black background for these formats.
2024-02-06 11:30:10 +01:00
Cosmin Stejerean
8264f3612c .mailmap: update my mailmap entry 2024-02-06 10:34:15 +01:00
Leo Izen
c0de7ac520
avcodec/libjxlenc: support negative linesizes
libjxl doesn't support negative strides, but JPEG XL has an orientation
flag inside the codestream. We can use this to work around the library
limitation, by taking the absolute value of the negative row stride,
sending the image up-side-down, and telling the library that the image
has a vertical-flip orientation.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2024-02-05 12:28:02 -05:00
Niklas Haas
789109ab21 avfilter/vf_tiltandshift: check outlink->color_range
In addition to YUVJ pixfmts.
2024-02-05 15:20:48 +01:00
Nuo Mi
88a040386a avcodec/vvcdec: fix seeking for open GOP
how to reproduce:
wget https://media.xiph.org/video/derf/y4m/students_cif.y4m
vvencapp --input students_cif.y4m --preset faster --output students.266
MP4Box -add students.266:fps=30000/1001:par=12:11 -new students.mp4
ffplay students.mp4
2024-02-05 21:43:18 +08:00
Anton Khirnov
f80d91c051 tests/fate/ffmpeg: add a test for the issue fixed in previous commit 2024-02-05 11:55:12 +01:00
Anton Khirnov
931192226b fftools/ffmpeg_mux: fix terminating muxer on streamcopy with -t
Reported-by: Andreas Rheinhardt
2024-02-05 11:55:12 +01:00
Marton Balint
71ea90638e avutil/thread: fix pthread_setname_np parameters for NetBSD and Apple
Signed-off-by: Marton Balint <cus@passwd.hu>
2024-02-05 09:42:30 +01:00
Paul B Mahol
d3111486f9 MAINTAINERS: remove myself from here
Once it became fully non-transparent and service of shady practices
behind closed doors, I can not be here any more.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-02-04 22:22:42 +01:00
Brad Smith
fd16d8c68c avutil/thread: add support for setting thread name on *bsd and solaris
FreeBSD/DragonFly/Solaris use pthread_setname_np(). OpenBSD uses pthread_set_name_np().

Signed-off-by: Brad Smith <brad@comstyle.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2024-02-04 20:45:10 +01:00
Alessandro Ros
49ab7f8997 avformat/flvenc: fix stereo flag when writing PCMA/PCMU
Currently, when writing PCMA or PCMU tracks with FLV or RTMP, the
stereo flag and sample rate flag inside RTMP audio messages are
overridden, making impossible to distinguish between mono and stereo
tracks. This patch fixes the issue by restoring the same flag mechanism
of all other codecs, that takes into consideration the right channel
count and sample rate.

Signed-off-by: Alessandro Ros <aler9.dev@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2024-02-04 20:28:47 +01:00
Mark Thompson
fa580a0f17 lavc/d3d12va: Improve behaviour on missing decoder support
Distinguish between a decoder being entirely missing and a decoder which
requires features which are not present in the incomplete implementation
in libavcodec and therefore can't be used.
2024-02-04 19:18:58 +00:00
Marton Balint
52cc89dc45 avfilter/yadif_common: fix timestamps with very small timebases
Yadif filter assumed that the output timebase is always half of the input
timebase. This is not true if halving the input time base is not representable
as an AVRational causing the output timestamps to be invalidly scaled in such a
case.

So let's use av_reduce instead of av_mul_q when calculating the output time
base and if the conversion is inexact then let's fall back to the original
timebase which probably makes more parctical sense than using x/INT_MAX.

Fixes invalidly scaled pts_time values in this command line:
ffmpeg -f lavfi -i testsrc -vf settb=tb=1/2000000000,yadif,showinfo -f null none

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-02-04 20:04:18 +01:00
Marton Balint
268062fa15 avfilter/yadif_common: factorize some part of the config_output and the uninit functions
This unifies slightly diverged code and ensures that cc_fifo is always initialized.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-02-04 20:04:18 +01:00
Marton Balint
8fccd6d510 avutil/rational: increase av_d2q precision
Fixes parsing small timebases from expressions (where the expression API
converts the result to double), like in this command line:

ffprobe -f lavfi -i testsrc=d=1,settb=1/2000000000 -show_streams -show_entries stream=time_base

Before the patch timebase was parsed as 1/1999999999.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-02-04 20:04:18 +01:00
Cosmin Stejerean
976cf2343d tests/fate/mov: add a test for reading and writing amve box 2024-02-04 14:03:45 -03:00