Commit Graph

115042 Commits

Author SHA1 Message Date
Anton Khirnov e903c31fd1 fftools/ffmpeg_filter: pass keep_pix_fmt through OutputFilterOptions
Reduces the need to access OutputStream, which will allow decoupling
filtering from encoding in future commits.
2024-04-09 10:34:18 +02:00
Anton Khirnov b3864e7a08 fftools/ffmpeg_filter: pass ts offset through OutputFilterOptions
Reduces the need to access OutputFile, which will allow decoupling
filtering from encoding in future commits.
2024-04-09 10:34:18 +02:00
Anton Khirnov 651c79da36 fftools/ffmpeg_filter: check that filter type matches output stream type
For simple filtergraphs. For complex filtergraphs they always match.
2024-04-09 10:34:18 +02:00
Anton Khirnov 8e35e33d42 fftools/ffmpeg_filter: stop accessing AVCodecContext.codec
Instead pass the encoder through a newly-added output options struct,
analogous to previously added input options.

Will allow decoupling filtering from encoding in future commits.
2024-04-09 10:34:18 +02:00
Anton Khirnov 8c33085313 fftools/ffmpeg_filter: do not pass OutputStream to set_channel_layout()
It only needs a list of allowed layouts and the requested layout.
2024-04-09 10:34:18 +02:00
Anton Khirnov d7cde009ce lavfi/avfilter: add an "auto" constant to the threads option
Analogous to the same constant in avfiltergraph and avcodec.
Cf. f599ae88c2.
2024-04-09 10:34:18 +02:00
Anton Khirnov b0e1bc6298 lavfi/vf_scale: fix AVOption flags for "size"/"s" 2024-04-09 10:34:18 +02:00
James Almer b0ef9e35e8 x86/ac3dsp: clear the upper 32 bits for input arguments where needed
Fixes checkasm on win64.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-04-08 13:45:58 -03:00
Andreas Rheinhardt 17414abb69 avcodec/mpegvideo_dec, h264_slice: Return proper error codes
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-08 15:00:02 +02:00
Andreas Rheinhardt 7f0efe2324 avcodec/mpeg12dec: Remove redundant mpeg_enc_ctx_allocated
Use context_initialized from the underlying MpegEncContext
instead. Also don't check before ff_mpv_common_end()
in mpeg_decode_end().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-08 15:00:02 +02:00
Andreas Rheinhardt 94295bb574 avcodec/mpegvideo: Remove pointless check
Possible since 315c956cbd.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-08 15:00:02 +02:00
Andreas Rheinhardt 6f2f496822 avcodec/mpegvideo_dec: Move getting Picture slot into alloc_picture()
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-08 15:00:02 +02:00
Andreas Rheinhardt b7cf2d0efc avcodec/mpegvideo_dec: Factor allocating dummy frame out
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-08 15:00:02 +02:00
Andreas Rheinhardt b00c697654 avcodec/mpegvideo_dec: Remove redundant code to reset keyframe flag
These AVFrames are blank and therefore the flag is already unset.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-08 15:00:02 +02:00
Andreas Rheinhardt da4cca5fc0 avcodec/mpegvideo_dec: Remove obsolete current_picture_ptr reuse code
Obsolete since at least 74d623914f.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-08 15:00:02 +02:00
Andreas Rheinhardt 00e48e6da8 avcodec/mpeg12dec: Remove unnecessary FFCodec.close
The ipu decoder never calls ff_mpv_common_init() or allocates
anything else that would need to be freed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-08 15:00:02 +02:00
Andreas Rheinhardt f48313526b avcodec/mpegvideo_dec: Don't emit non-keyframe warning for H.261
H.261 does not have keyframes (or indeed frame types) at all,
so this warning is not warranted.

Also remove an always-true check while at it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-08 15:00:02 +02:00
Andreas Rheinhardt 518f79f2a8 avcodec/mpeg12dec: Don't pretend MPEG-1/2 to support alpha
(FF_PTR_ADD has to be kept although MPEG-1/2 only supports
YUV pixel formats because our decoder also supports decoding
to AV_PIX_FMT_GRAY8 depending upon CONFIG_GRAY.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-08 15:00:02 +02:00
Andreas Rheinhardt 1a5452655a avcodec/mpeg12dec: Remove redundant check
This code only gets executed for the first field.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-08 15:00:01 +02:00
Andreas Rheinhardt a9709b3c83 avcodec/mpegvideo_dec, mpeg12dec: Move MPEG1/2 code to mpeg12dec.c
Up until now, ff_mpv_frame_start() offsets the data of the current
picture and doubles the linesizes of all pictures if the current
picture is field-based so that data and linesize allow to address
the current field only.

This is done based upon the current picture_structure value.
Only two mpegvideo-based decoders ever set this field: mpeg1/2
and VC-1; but the latter only does it after ff_mpv_frame_start()
(when using hardware-acceleration and in order to signal it to
the DXVA2 hwaccel) in which case no offset is applied in
ff_mpv_frame_start(). So only one decoder actually wants this
offset*; therefore move the code performing it to mpeg12dec.c.

*: VC-1 doubles linesize when using field_mode (not only the picture's
linesize, but also uvlinesize and linesize), yet it does not offset
anything. This is further proof that this should not be performed
generically.

Also move MPEG-1/2 specific setting of the top-field-first flag.
(The change here implies that the AVFrame in current_picture
may have different top-field-first flags than the AVFrame
from current_picture_ptr, but this doesn't matter as only
the latter's are used.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-08 15:00:01 +02:00
Andreas Rheinhardt ca7b2c393a avcodec/mpeg12: Remove always-false check
Forgotten in 7800cc6e82.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-08 15:00:01 +02:00
Andreas Rheinhardt 66923165d5 avcodec/mpegutils: Move definitions to better places
FRAME_SKIPPED -> h263dec.h
CANDIDATE_MB_TYPE_* -> mpegvideoenc.h
INPLACE_OFFSET -> mpegvideoenc.h
enum OutputFormat -> mpegvideo.h

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-08 15:00:01 +02:00
Andreas Rheinhardt 908a73df31 avcodec/mpegvideo_enc: Don't update current_picture unnecessarily
current_picture is not changed after frame_start() at all
and it therefore does not need to be updated (i.e. copied to the
slice thread contexts) a second time.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-08 15:00:01 +02:00
James Almer 1f049d5627 avcodec/vvc/dec: fix typo
Signed-off-by: James Almer <jamrial@gmail.com>
2024-04-08 09:10:04 -03:00
James Almer 9eca5b8369 avcodec/vvc/ps: reset sps_id_used on flush
Signed-off-by: James Almer <jamrial@gmail.com>
2024-04-08 08:56:53 -03:00
Geoff Hill ee1bc723de avcodec/ac3: Implement sum_square_butterfly_float for aarch64 NEON
Signed-off-by: Geoff Hill <geoff@geoffhill.org>
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-04-08 13:36:40 +03:00
Geoff Hill 42e88f18f3 avcodec/ac3: Implement sum_square_butterfly_int32 for aarch64 NEON
Signed-off-by: Geoff Hill <geoff@geoffhill.org>
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-04-08 13:36:40 +03:00
Geoff Hill 69cb34f885 avcodec/ac3: Implement ac3_extract_exponents for aarch64 NEON
Signed-off-by: Geoff Hill <geoff@geoffhill.org>
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-04-08 13:36:40 +03:00
Geoff Hill 6f6bd10531 avcodec/ac3: Implement ac3_exponent_min for aarch64 NEON
Signed-off-by: Geoff Hill <geoff@geoffhill.org>
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-04-08 13:36:40 +03:00
Geoff Hill b69486ea18 avcodec/ac3: Implement float_to_fixed24 for aarch64 NEON
Signed-off-by: Geoff Hill <geoff@geoffhill.org>
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-04-08 13:36:28 +03:00
Andreas Rheinhardt 2d33d6bfcc avcodec/dv: Don't pretend initializing work chunks can fail
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-07 21:59:32 +02:00
Andreas Rheinhardt f3c8d0399a avcodec/huffyuvdec: Use assert to check for things that can't fail
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-07 21:59:32 +02:00
Andreas Rheinhardt a6d6c8442c avcodec/huffyuvdec: Use bytestream API for byte-aligned reads
This also allows to remove the padding from these buffers.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-07 21:59:32 +02:00
Andreas Rheinhardt a6979e3bd2 avcodec/huffyuvenc: Deduplicate options
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-07 21:59:32 +02:00
Andreas Rheinhardt 5110d16f5a avcodec/huffyuvenc: Avoid code duplication
This also fixes misindentated code.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-07 21:59:32 +02:00
Andreas Rheinhardt d517c9e51b avcodec/huffyuvenc: Avoid duplicate variables
Also simplify assigningfake strides.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-07 21:59:32 +02:00
Andreas Rheinhardt 0e5af493fc avcodec/huffyuv: Return proper error code
Also forward said error code in the encoder.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-07 21:59:32 +02:00
Andreas Rheinhardt cf96c0295e avcodec/huffyuv(dec|enc): Use union for temp/temp16
These pointers already point to the same buffers, so using
a union is possible and avoids the overhead of syncing the
pointers (and saves some memory).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-07 21:59:32 +02:00
Andreas Rheinhardt eef5d60ac6 avcodec/huffyuv: Inline common alloc/free functions in their callers
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-07 21:59:32 +02:00
Andreas Rheinhardt cebf1d59a5 avcodec/huffyuvdec: Don't zero unnecessarily
A decoder's private data has already been zeroed (apart from options)
before init is called.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-07 21:59:32 +02:00
Frank Plowman 2d79ae3f8a lavc/vvc: Error if SPS ID is duplicated within CVS
Key line from the spec is:

"All SPS NAL units with a particular value of sps_seq_parameter_set_id
in a CVS shall have the same content."

Prior to this patch, the VVC decoder's behaviour on encountering a
duplicated SPS ID (within the entire bitstream, not restricted to
a CVS) was simply to replace the entry in the SPS lookup table with the
new data.  Illegal bitstreams with multiple SPSs in the same CVS sharing
an ID but differing elsewhere could cause all manner of issues.

The patch tracks which SPS IDs have been used in the given CVS using the
new sps_id_used field of VVCParamSets.  If it encounters an SPS with an
ID already in use and whose content differs from the previous SPS, it
throws an AVERROR_INVALIDDATA.

Signed-off-by: Frank Plowman <post@frankplowman.com>
2024-04-07 10:13:45 +08:00
Andreas Rheinhardt 0dbf45120a avcodec/libdav1d: Don't cast const away unnecessarily
Possible since c89f6ae689.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-06 18:44:06 +02:00
Stefano Sabatini 1cb1f29a04 lavf/lrc: fix comments in headers 2024-04-06 12:59:56 +02:00
Antoine SOULIER 4865ea48cc avcodec/liblc3dec: retrieve duration of the last packet from the demuxer
Use the packet duration field to invalid last samples of the last frame.
2024-04-06 09:55:57 +02:00
Antoine SOULIER 6de00dc5f1 avcodec/liblc3dec: fix extradata size 2024-04-06 09:40:37 +02:00
Antoine SOULIER ad3fcfd0f2 avcodec/liblc3dec: fix typo in macro name, fix compilation 2024-04-06 09:40:32 +02:00
Oneric 57c545090d avocdec/ass: simplify linebreaks
ff_ass_subtitle_header_* still used explicit CRLF linebreaks
eventhough they will get normalised to LF later since commit
7bf1b9b357. Just directly use LF.
2024-04-06 09:26:30 +02:00
Oneric 0fc975c0d3 avcodec/ass,webvttdec: implement more portable curly brace escapes
Unlike what the old comment suggested, standard ASS has no character
escape mechanism, but a closing curly bracket doesn't even need one.

For manual authored sub files using a full-width variant of an
appropriate font and with scaling and spacing modifiers is a common
workaround.
This is not an option here, but we can still make things much less bad.
Now the desired opening bracket still shows up in libass, and
standard renders will merely display a backslash in its place
instead of stripping the following text like before.
2024-04-06 09:25:03 +02:00
Oneric baa64fa4e6 avcodec/ass,webvttdec: fix handling of backslashes
Backslashes cannot be escaped by a backslash in any ASS renderer,
but unless followed by specific characters it is just printed out.
Insert a word-joiner character after a backslash to break up
active sequences without changing the visual output.
2024-04-06 09:24:47 +02:00
Oneric 7b8b4cdd96 avcodec/webvttdec: honour bidi marks 2024-04-06 09:23:51 +02:00