1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00
Commit Graph

119955 Commits

Author SHA1 Message Date
a2272aff76 avcodec/ituh263enc: Don't use array unnecessarily
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-21 22:08:51 +02:00
d95041dffe avcodec/ituh263dec: Remove redundant store
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-21 22:08:51 +02:00
5507da21e6 avcodec/ituh263dec: Don't process unnecessarily many coefficients
Overriding the number of coefficients is only necessary if
ac_pred is in used, not for h263_aic alone (for which only
the DC coefficient is predicted) as it is done here.

And since d50635cd24
the H.263 unquantize-intra functions override the number of
coefficients in case of ac_pred, so we don't have to do this here.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-21 22:08:51 +02:00
ea4b9a121d avcodec/rv10: Perform RV20 check only for RV20
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-21 22:08:51 +02:00
f5fc31acec avcodec/rv10: Perform RV20 initialization during init
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-21 22:08:51 +02:00
8e0f064a11 avcodec/mpeg4videodec: Don't zero blocks twice
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-21 22:08:51 +02:00
204d03c803 configure: Fix a regression when probing link.exe
The version ident is printed on stdout for link.exe and redirecting
stdout to /dev/null will cause the output of link.exe to be paged.

This caused configure to hang for some configurations and by
extension some FATE clients. You might want to check if you run
affected configurations automated in FATE clients or similar setups.

Fixes: 45a30e0361
Signed-off-by: Martin Storsjö <martin@martin.st>
2025-06-21 22:37:44 +03:00
32153fac84 avfilter/af_aresample: rework activate logic to follow the advised flow more strictly
This should prevent the possibility of audio data accumulating.

The commit also cleans up and simplifies the code a bit so all frame producers
(filter_frame(), flush_frame()) functions follow similar logic as
ff_inlink_consume_frame() for the return code.

Signed-off-by: Marton Balint <cus@passwd.hu>
2025-06-21 20:24:57 +02:00
a21429e134 avfilter/af_aresample: make aresample return FFERROR_NOT_READY when no progress can be made
FF_FILTER_FORWARD_WANTED() already sets the ready status as needed.

Signed-off-by: Marton Balint <cus@passwd.hu>
2025-06-21 20:24:57 +02:00
ffcdd2cdc1 avfilter/af_aresample: merge request_frame into activate function
No functional change.

Signed-off-by: Marton Balint <cus@passwd.hu>
2025-06-21 20:24:57 +02:00
28a7b9c863 avfilter/split: consume all frames before forwarding inlink status
Signed-off-by: Marton Balint <cus@passwd.hu>
2025-06-21 20:24:30 +02:00
606efaa2cf fftools/ffmpeg_filter: simplify control flow in read_frames
No functional change.

Signed-off-by: Marton Balint <cus@passwd.hu>
2025-06-21 20:24:30 +02:00
daef348574 avfilter/x86/f_ebur128: implement AVX peak calculation
Stereo only, for simplicity. Slightly faster than the C code.
2025-06-21 17:28:39 +02:00
3b26b782ee avfilter/f_ebur128: move peak detection to reusable DSP function
True peak and sample peak share almost the same logic. Define this logic in
a separate function for reusability, and so we can write SIMD versions.
2025-06-21 17:21:58 +02:00
4c046517e7 avfilter/f_ebur128: move variable declarations to usage site
This is actually allowed by non-ancient versions of C.
2025-06-21 17:21:58 +02:00
f362bacd27 avfilter/f_ebur128: lift sample peak calculation out of main loop
This is substantially faster (~55%) than the transposed loop, and also
avoids an unnecessary macro.
2025-06-21 17:21:58 +02:00
229393d8dc avfilter/f_ebur128: move true peak calculation out of main loop
Easier to read, less convoluted, and ~30% faster. Most importantly, this
avoids repeating the redundant recalculation of the true peak on every
single sample, by moving the FIND_PEAK() loop out of the main loop. (Note
that FIND_PEAK() does not depend on the current sample index at all, so
there is no reason for it to ever be recomputed here)
2025-06-21 17:21:58 +02:00
a96175e76f avfilter/f_ebur128: remove pointless macro
This macro is not shortening the code nor aiding readability.
2025-06-21 17:21:58 +02:00
53e03ec8af avfilter/x86/f_ebur128: add x86 AVX implementation
Processes two channels in parallel, using 128-bit XMM registers.

In theory, we could go up to YMM registers to process 4 channels, but this is
not a gain except for relatively high channel counts (e.g. 7.1), and also
complicates the sample load/store operations considerably.

I decided to only add an AVX variant, since the C code is not substantially
slower enough to justify a separate function just for ancient CPUs.
2025-06-21 17:21:36 +02:00
deab15e76a avfilter/f_ebur128: split off C implementation to separate function
I decided to separate out the peak measurement loop to avoid bloating
the signature, and since it's only conditionally used.
2025-06-21 17:19:50 +02:00
c7d2b0a7a1 avfilter/f_ebur128: move weights and cache to EBUR128DSPContext 2025-06-21 17:19:50 +02:00
1da0a70b09 avfilter/f_ebur128: use a single packed array for the integrator cache
Instead of having a planar array for each channel, use a single packed array.
This will help processing multiple channels in parallel, as we can directly
load all channels' data in a single load instruction.

Also improves memory locality of data, as the loop order is:

for (samples) {
    for (channels) {
        process sample
    }
}
2025-06-21 17:19:50 +02:00
2679e687ec avfilter/f_ebur128: use structs for biquad weights
Simplifies the code a bit. In particular, the copy to the stack is marginally
faster.
2025-06-21 17:19:50 +02:00
2d9435d76f avfilter/f_ebur128: simplify sample cache array
We don't need an X sample cache anymore, and we also can simplify the
access macro slightly.
2025-06-21 17:19:50 +02:00
c5f3033a86 avfilter/f_ebur128: use transformed direct form II
Instead of direct form I. See af_biquads.c for math. Also eliminate
an unnecessary indirection.
2025-06-21 17:19:50 +02:00
8aa6df663e avformat/whip: replace AV_OPT_FLAG_DECODING_PARAM to ENCODING
Signed-off-by: Jack Lau <jacklau1222@qq.com>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-06-21 12:57:19 +08:00
214248e2d6 avformat/whip: mark as experimental
This patch doesn't effect WHIP usage via command, as WHIP always
needs to be explicitly specified

Signed-off-by: Jack Lau <jacklau1222@qq.com>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-06-21 12:05:13 +08:00
177b92df2b avformat/tls_openssl: fix warnings when openssl is lower version
api doc: https://docs.openssl.org/1.0.2/man3/BIO_s_mem

In higher versions (openssl 1.0.2 and higher),
the function signature is BIO *BIO_new_mem_buf(const void *buf, int len),
so passing a const string doesn't cause an warnings.
However, in lower versions of OpenSSL,
the function signature becomes BIO *BIO_new_mem_buf(void *buf, int len),
which leads to warnings.

OpenSSL guarantees that it will not modify the string,
so it's safe to cast the pem_str to (void *) to avoid this warning.

Signed-off-by: Jack Lau <jacklau1222@qq.com>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-06-21 12:01:14 +08:00
64e6f5d5fa avformat/mov: set array entry count after the array is allocated in heif_add_stream()
Ensures no bogus values being preserved after returning.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-06-20 13:25:15 -03:00
7039a37e35 avfilter/vf_libplacebo: add reset_sar option
This was requested by users of `vf_libplacebo`, to mirror the existing
option on the other `vf_scale_*` family of filters. While we have
`vf_normalize`, it was not as useful in the event that the content
stretching was actually desired.

Bridges an important usability gap between `vf_scale` and `vf_libplacebo`
that made mixing and matching the filters needlessly difficult.
2025-06-20 15:13:25 +02:00
c0698840c4 avfilter/vf_libplacebo: correctly update SAR to reflect scaled result
This aligns the behavior of vf_libplacebo with other filters in the
vf_scale family, that forward any change in the SAR as a result of
changing the output resolution to the output frame / link, and updates
the ff_scale_adjust_dimensions() call to continue working as intended.

The new behavior reflects the documentation of vf_libplacebo, which
described this behavior despite that not being the way the filter worked
up to this point.

As an aside, also fixes a bug where the AVFrame SAR was inconsistent
with the AVFilterLink SAR when the s->nb_inputs > 1 condition was met.
2025-06-20 15:13:25 +02:00
f883b7cf93 avfilter/vf_libplacebo: list AV_PIX_FMT_VULKAN first
Under normal circumstances, this change does not affect anything, as the vast
majority of filters either support only vulkan or only software formats.
However, when a filter supports both (such as vf_libplacebo itself, and
possibly vf_scale in the future), linking together two such filter instances
without an explicit format will default matching the input format, resulting
in a redundant round trip through host RAM.

This change bumps up AV_PIX_FMT_VULKAN to the first entry in the format list,
ensuring that it gets preferred whenever possible.
2025-06-20 15:13:25 +02:00
88ac69631e wasm/hevc: Add sao_edge_filter
hevc_sao_edge_8_8_c:                                   124.5 ( 1.00x)
hevc_sao_edge_8_8_simd128:                              18.1 ( 6.89x)
hevc_sao_edge_16_8_c:                                  478.6 ( 1.00x)
hevc_sao_edge_16_8_simd128:                             48.9 ( 9.79x)
hevc_sao_edge_32_8_c:                                 2021.1 ( 1.00x)
hevc_sao_edge_32_8_simd128:                            187.4 (10.79x)
hevc_sao_edge_48_8_c:                                 4295.5 ( 1.00x)
hevc_sao_edge_48_8_simd128:                            397.4 (10.81x)
hevc_sao_edge_64_8_c:                                 7245.5 ( 1.00x)
hevc_sao_edge_64_8_simd128:                            709.5 (10.21x)

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-06-20 21:09:39 +08:00
fe45f5537b wasm/hevc: Add sao_band_filter
hevc_sao_band_8_8_c:                                    63.0 ( 1.00x)
hevc_sao_band_8_8_simd128:                              10.4 ( 6.06x)
hevc_sao_band_16_8_c:                                  230.4 ( 1.00x)
hevc_sao_band_16_8_simd128:                             22.9 (10.07x)
hevc_sao_band_32_8_c:                                  900.4 ( 1.00x)
hevc_sao_band_32_8_simd128:                             81.5 (11.05x)
hevc_sao_band_48_8_c:                                 2009.1 ( 1.00x)
hevc_sao_band_48_8_simd128:                            170.2 (11.80x)
hevc_sao_band_64_8_c:                                 3535.0 ( 1.00x)
hevc_sao_band_64_8_simd128:                            297.5 (11.88x)

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-06-20 21:09:17 +08:00
9c7b019284 fftools/ffplay_renderer: Use new vulkan queue API
Fixes deprecation warning.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-06-20 20:39:15 +08:00
45a30e0361 configure: Make MSVC version grabbing more robust
When running plain "cl", to get the MSVC version, it prints the
version header on stderr, while the usage instructions are printed
on stdout. Usually, the version on stderr gets flushed first,
so "head -n1" gets the line it expects, but some times (in particular
when running MSVC wrapped in wine), it can get the usage line
first.

Redirect stdout to /dev/null, so we only grab the version among
the lines printed to stderr. This should make the version number
grabbing more robust.

At least all relevant versions of MSVC seem to print this specifically
to stderr, not stdout (so we don't risk to miss it); checked down
to MSVC 2010.

Signed-off-by: Martin Storsjö <martin@martin.st>
2025-06-19 23:24:18 +03:00
ee1f79b0fa avformat/sbgdec: fix leak in sbg_read_header()
In sbg_read_header(), if avformat_new_stream() failed, it returns
without cleanup, which may cause memory leaks. Replace return statement
with goto so that we would first clean up then return.

Signed-off-by: Lidong Yan <502024330056@smail.nju.edu.cn>
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: James Almer <jamrial@gmail.com>
2025-06-17 11:27:28 -03:00
8087777e66 avcodec/liboapvenc: set the encoder output to OAPV_CFG_VAL_AU_BS_FMT_NONE format
The only AU without bitstream format.

Signed-off-by: Dawid Kozinski <d.kozinski@samsung.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2025-06-17 10:03:10 -03:00
5d380e4431 configure: Update liboapv version requirement
Changed the minimum required version of liboapv from 0.1.13 to 0.1.13.1

Signed-off-by: Dawid Kozinski <d.kozinski@samsung.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2025-06-17 10:02:44 -03:00
53da090ab7 configure: fix Microsoft tools detection
LLVM tools print installation path upon execution. If one uses LLVM
tools bundled with Microsoft Visual Studio installation, they would be
incorrectly detected as Microsoft's ones.

Microsoft tools can have localized names, so a more specific string
check is not feasible, but luckily we can test if "Microsoft" is at the
beginning of the line, as it is always the case.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2025-06-17 11:51:33 +03:00
38073187bd avcodec/tests/dct: add CONFIG_PRORES_DECODER guard
Only enable the proresdsp check when the prores decoder is enabled.

This fixes fate when configuring with --disable-everything
2025-06-17 16:41:14 +10:00
2663d97336 configure: add celp_math component
libavcodec/tests/celp_math depends on libavcodec/celp_math.o

This fixes fate when configuring with --disable-everything
2025-06-17 16:39:36 +10:00
e5bb448543 vulkan: maintain compatibility with old headers
Previous patch to fix these issues was incomplete.
2025-06-17 13:26:13 +09:00
d71c863132 fate/video: Add media100 test
Tests both the Media 100 decoder (using the media100_to_mjpegb BSF
implicitly) as well as using said BSF, followed by the MJPEGB decoder.

(We currently hit a bug when remuxing: The demuxer treats compressorname
as encoded in a Mac character encoding (Mac OS Roman?) and converts
it to UTF-8, yet the muxer just writes it.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-17 00:35:13 +02:00
ecd7c9244d avcodec/amfdec,rkmppdec: Use correct extradata with BSFs
Otherwise the extradata used would be ISOBMFF if the input is
even though we use the *_mp4toannexb BSFs to convert it to
annex B to feed it to the actual decoder.

(The mediacodec decoders also use said BSFs, yet they process
the extradata in a way that works even when using the ISOBMFF
extradata; in fact, using the converted extradata would break
their check for whether to warn for missing extradata for
the ISOBMFF without-in-band-header profiles.

Furthermore, there are several users of the *_mp4toannexb BSFs
that don't ever touch extradata. They have not been touched.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-17 00:35:13 +02:00
9102a90a95 Revert "avcodec/decode: Fix avcodec parameters when bsfs are enable by decoder"
This reverts commit 1c17061397.

The commit intended to provide certain codecs using *_mp4toannexb
bitstream filters with updated (annex B) extradata (even when
the user-supplied one was ISOBMFF), yet BSFs are allowed to change
way more. The media100_to_mjpegb BSF used by the media100 decoder
changes the codec id; the commit being reverted therefore changed
AVCodecContext.codec_id which is an API violation and broke
media100 decoding with the FFmpeg cli tool.

This commit also made changes from the internal BSF externally
visible. extradata is documented to be "owned by the codec and
freed in avcodec_free_context()" which does not include replacing
it with something else in avcodec_open2() and may surprise users
who think that AVCodecContext.extradata is immutable before
avcodec_free_context(). It also incurred a memdup which is completely
unnecessary for most decoders.

Therefore this commit is reverted. The problem it tried to solve
will be solved differently in the next commit.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-17 00:35:13 +02:00
730ffc5d35 avfilter/vf_overlay: Hoist calculations out of loop
Also use const where appropriate.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-17 00:33:09 +02:00
a4b3474de6 avfilter/vf_overlay: Keep dst_step in bytes
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-17 00:33:09 +02:00
48427b012d avfilter/vf_overlay: Use correct alpha when > 8 bits
When chroma subsampling is in use, the filter averages
the corresponding (non subsampled) alpha values to get
the actual alpha value. When vertical subsampling is
in use, the next line is accessed via a[src->linesize[3]],
yet a is an uint16_t* for >8 bit formats and linesize
is always in bytes, so that this actually uses the second
line below the current one. This is fixed in this commit.

No FATE test needed updates, because the filter-overlay-yuv420p10
and filter-overlay-yuv444p10 tests use a yuv420p test file
that has constant opacity after conversion to yuva.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-17 00:33:09 +02:00
b3edc84872 avfilter/vf_overlay: Pass variable type directly in macro
Improves readability.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-17 00:33:09 +02:00