Commit Graph

117897 Commits

Author SHA1 Message Date
Niklas Haas
59c39a79ca tests/swscale: rewrite on top of new API
This rewrite cleans up the code to use AVFrames and the new swscale API. The
log format has also been simplified and expanded to account for the new
options. (Not yet implemented)

The self testing code path has also been expanded to test the new swscale
implementation against the old one, to serve as an unchanging reference. This
does not accomplish much yet, but serves as a framework for future work.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2024-11-25 11:03:54 +01:00
Niklas Haas
2a091d4f2e swscale: introduce new, dynamic scaling API
As part of a larger, ongoing effort to modernize and partially rewrite
libswscale, it was decided and generally agreed upon to introduce a new
public API for libswscale. This API is designed to be less stateful, more
explicitly defined, and considerably easier to use than the existing one.

Most of the API work has been already accomplished in the previous commits,
this commit merely introduces the ability to use sws_scale_frame()
dynamically, without prior sws_init_context() calls. Instead, the new API
takes frame properties from the frames themselves, and the implementation is
based on the new SwsGraph API, which we simply reinitialize as needed.

This high-level wrapper also recreates the logic that used to live inside
vf_scale for scaling interlaced frames, enabling it to be reused more easily
by end users.

Finally, this function is designed to simply copy refs directly when nothing
needs to be done, substantially improving throughput of the noop fast path.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2024-11-25 11:03:50 +01:00
Niklas Haas
bf738412e8 swscale/graph: add new high-level scaler dispatch mechanism
This interface has been designed from the ground up to serve as a new
framework for dispatching various scaling operations at a high level. This
will eventually replace the old ad-hoc system of using cascaded contexts,
as well as allowing us to plug in more dynamic scaling passes requiring
intermediate steps, such as colorspace conversions, etc.

The starter implementation merely piggybacks off the existing sws_init() and
sws_scale(), functions, though it does bring the immediate improvement of
splitting up cascaded functions and pre/post conversion functions into
separate filter passes, which allows them to e.g. be executed in parallel
even when the main scaler is required to be single threaded. Additionally,
a dedicated (multi-threaded) noop memcpy pass substantially improves
throughput of that fast path.

Follow-up commits will eventually expand this to move all of the scaling
decision logic into the graph init function, and also eliminate some of the
current special cases.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2024-11-25 11:02:16 +01:00
Niklas Haas
c461dcf291 swscale/internal: expose sws_init_single_context() internally
Used by the graph API swscale wrapper, for now.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2024-11-25 11:02:16 +01:00
Niklas Haas
fb16964009 swscale: organize and better document flags
Group them into an enum rather than random #defines, and document their
behavior a bit more obviously.

Of particular note, I discovered that SWS_DIRECT_BGR is not referenced
anywhere else in the code base. As such, I have moved it to the deprecated
section, alongside SWS_ERROR_DIFFUSION.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2024-11-25 11:02:12 +01:00
Niklas Haas
6a91a165fd swscale: eliminate redundant SwsInternal accesses
This is a purely cosmetic commit aimed at replacing accesses to
SwsInternal.opts by direct access to SwsContext wherever convenient.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2024-11-25 10:59:52 +01:00
Niklas Haas
ed5dd67562 swscale: expose SwsContext publicly
Following in the footsteps of the work in the previous commit, it's now
relatively straightforward to expose the options struct publicly as
SwsContext. This is a step towards making this more user friendly, as
well as following API conventions established elsewhere.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2024-11-25 10:59:49 +01:00
Peter Ross
4472dec51d avformat/mm: add fallthrough comment
Fixes CID 1634888
2024-11-25 17:58:30 +11:00
Anton Khirnov
433cf391f5 fftools/ffmpeg_sched: signal the main thread when a task fails
Avoids a useless -stats_period wait before exiting.

Reported-by: names_are_hard
2024-11-25 05:26:49 +01:00
Anton Khirnov
785ffe67c8 fftools/ffmpeg_sched: rename mux_done_{lock,cond} into finish_*
Their semantics will be changed in the following commit to not be
limited to muxing.
2024-11-25 05:26:49 +01:00
Michael Niedermayer
224b62489d
MAINTAINERS: Remove Guillaume Poirier and Romain Dolbeau
Guillaume no longer has a PPC
Romain has no time

CC: Guillaume POIRIER <poirierg@gmail.com>
CC: Romain Dolbeau <romain@dolbeau.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-11-25 03:13:33 +01:00
Michael Niedermayer
6d8285633d
avcodec/mjpegdec: Disallow progressive bayer images
Fixes: Null pointer dereference
Fixes: sample1.dng
Found-by: South East <8billion.people@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-11-25 03:13:33 +01:00
Michael Niedermayer
84569b6c22
avformat/icodec: fix integer overflow with nb_pal
Fixes: runtime error: signed integer overflow
Fixes: 42536949/clusterfuzz-testcase-minimized-fuzzer_loadfile-6199846684393472
Found-by: ossfuzz
Reported-by: Kacper Michajlow
Tested-by: Kacper Michajlow
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-11-25 03:13:33 +01:00
James Almer
40bd6d8355 avcodec/codec_desc: remove Intra Only prop for AAC
xHE-AAC is a profile where some frames depend on other key frames, named IPF.
By setting the codec as Intra Only, all frames output by decoders and all
packets output by encoders/demuxers will be unconditionally flaged as
keyframes, which is incorrect.

Should fix ticket #11272.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-24 20:38:15 -03:00
James Almer
8d2d2519e0 avcodec/mediacodecdec: set set keyframe flag in output frames
Don't depend on the generic code setting this.
This is in preparation for a following change.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-24 20:38:15 -03:00
James Almer
99f87251e0 avcodec/libfdk-aacenc: set keyframe in output packets
Don't depend on the generic code setting this.
This is in preparation for a following change.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-24 20:38:04 -03:00
James Almer
281b7fc02e avcodec/libfdk-aacdec: set keyframe flag and profile in output frames
Don't depend on the generic code setting this.
This is in preparation for a following change.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-24 20:26:50 -03:00
James Almer
495c891e39 avcodec/audiotoolboxnec: set set keyframe flag in output packets
Don't depend on the generic code setting this.
This is in preparation for a following change.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-24 20:26:36 -03:00
James Almer
d3dd14bf5b avcodec/audiotoolboxdec: set set keyframe flag in output frames
Don't depend on the generic code setting this.
This is in preparation for a following change.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-24 20:26:36 -03:00
James Almer
ffdace5ad4 avcodec/aacenc: set keyframe flag in output packets
Don't depend on the generic code setting this.
This is in preparation for a following change.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-24 20:26:32 -03:00
James Almer
faea08b722 avcodec/aac/aacdec: set keyframe flag in output frames
Don't depend on the generic code setting this.
This is in preparation for a following change.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-24 20:26:26 -03:00
James Almer
64bb91fd3b avcodec/aac_parser: set key_frame and profile
This is in preparation for a following change.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-24 20:26:24 -03:00
James Almer
8ddbc26ded avformat/mov: don't unconditionally set all audio packets in fragments as key frames
Some audio codecs, like TrueHD, have non key frames.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-24 20:26:24 -03:00
James Almer
f656c00bd9 avformat/matroskadec: set all frames in a keyframe simple box as keyframes
And not just the first, as it was being done for lacing. The spec states that the
flag applies to everything inside the simple box.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-24 20:26:17 -03:00
James Almer
f938b2b3f5 avformat/test/movenc: set audio packets as key frames
Don't depend on the generic code setting this.
This is in preparation for a following change.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-24 20:14:11 -03:00
James Almer
23a1c021f2 avformat/movenc: write stss boxes for xHE-AAC
This is in preparation for a following change.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-24 20:14:11 -03:00
James Almer
4e6d31755b avformat/spdifdec: parse headers for audio codecs
Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-24 20:14:11 -03:00
Marvin Scholz
ecb7232bac avfilter: fix unused variable warning
The ctxi_dst variable is unused outside of the av_assert1,
causing an unused variable warning. The simplest solution
for this is to avoid the intermediate variable here.
2024-11-24 22:11:12 +01:00
James Almer
ecc7d5db9c avformat/movenc: don't disable edit lists when writing CMAF output
They are needed for audio tracks with priming samples, where negative CTS
offsets can't be used.

Fixes ticket #11031.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-22 20:50:05 -03:00
Darren Mo
865c73c86f avformat/mov: Populate packet duration using stts atom instead of guessing
Fixes tickets #7855 and #11312.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-22 20:50:05 -03:00
James Almer
b328bf8f7e avformat/mov: rename MOVCtts.duration to offset
The value is a timestamp offset, not a duration.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-22 20:50:05 -03:00
Scott Theisen
0dceced45c avformat/mpegts: add DVB descriptor_tag values already in use
Signed-off-by: Marton Balint <cus@passwd.hu>
2024-11-22 21:11:18 +01:00
James Almer
46c6ca3ed1 avcodec/libfdk-aacenc: export CPB properties
Needed to signal the muxer that the stream is VBR.

Finishes fixing ticket #11303.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-22 10:57:03 -03:00
James Almer
944212acad avformat/movenc: don't write a calculated avgBitrate when the provided one is unset
avgBitrate == 0 is used to signal a VBR track, so if that value is propagated by an
encoder, don't overwrite it with a calculated value based on track size.

Part of a fix for ticket #11303.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-22 10:57:03 -03:00
James Almer
5813e5aa34 avformat/hevc: fix writing hvcC when no arrays are provided in hvcC-formatted input
Don't reject extradata with missing PS NALUs if array_completeness is not
requested.

Fixes a regression since a696b28886.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-22 10:52:31 -03:00
James Almer
f0051604c7 avformat/movenc: don't write PS NALUs in hvcC for codec tag hvc1
array_completeness shall be 1 for those tracks.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-22 10:49:32 -03:00
Pavel Koshevoy
46cb7b8d9d avutil/frame: also align data pointers in av_frame_get_buffer()
This avoids unpleasant surprises to av_frame_get_buffer callers
that explicitly specified 64-byte alignment and didn't get
AVFrame.data pointers that are 64-byte aligned.

For example, see https://github.com/sekrit-twc/zimg/issues/212

Although the zscale issue has already been resolved by other means
it would still be prudent to improve the behavior of av_frame_get_buffer
to fix any unknown and future instances of similar issues.

Co-authored-by: James Almer <jamrial@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-22 10:43:55 -03:00
James Almer
ea91d978e3 avutil/frame: fix setting plane_padding
STRIDE_ALIGN is a lavc define and is not necessarely 32. And align may be <= 0 at the
point plane_padding is being set.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-22 10:43:55 -03:00
James Almer
09122bd15c avutil/frame: use size_t for total_size in get_video_buffer()
Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-22 10:43:55 -03:00
Niklas Haas
2d077f9acd swscale/internal: group user-facing options together
This is a preliminary step to separating these into a new struct. This
commit contains no functional changes, it is a pure search-and-replace.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2024-11-21 12:49:56 +01:00
Niklas Haas
10d1be2621 swscale/internal: use static_assert for enforcing offsets
Instead of sprinkling av_assert0 into random init functions.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2024-11-21 12:47:43 +01:00
Niklas Haas
55d5eae411 swscale/options: cosmetic changes
Reorganize the list, fix whitespace, make indentation consistent, and
rename some descriptions for clarity, consistency or informativeness.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2024-11-21 12:47:14 +01:00
Peter Ross
f298507323 avcodec/mm: decode raw chunk type and skip unknown audio chunk type 2024-11-21 19:41:12 +11:00
Peter Ross
66124bc368 avcodec/mm: don't fail if x offset exceeds frame width 2024-11-21 19:41:12 +11:00
Peter Ross
63ea1660fa avcodec/mm: decode partial palette 2024-11-21 19:41:12 +11:00
Peter Ross
ac2442f0a7 avcodec/mm: set audio pts proportionally to audio offset 2024-11-21 19:41:12 +11:00
Marth64
3528bfed45 avformat/smoothstreamingenc: check return value of avcodec_parameters_copy()
Written in the dominant style of the surrounding code block.

Reviewed-by: ePirat <epirat07@gmail.com>
Signed-off-by: Marth64 <marth64@proxyid.net>
2024-11-20 23:36:13 -06:00
Scott Theisen
be784e95ac avformat/mpegts: add support for ATSC E-AC-3 streams
ATSC A/52:2018 Digital Audio Compression (AC-3, E-AC-3), Annex G
defines stream_type 0x87 for E-AC-3 bit streams.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-11-21 00:59:09 +01:00
Michael Niedermayer
7051825b01
doc/developer: Document relationship between git accounts and MAINTAINERS
This should have been documented long ago and i thought it was

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-11-20 21:28:14 +01:00
Michael Niedermayer
edc4855f77
doc/infra: Document trac backup system
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-11-20 21:28:13 +01:00