1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-08 13:22:53 +02:00
Commit Graph

116344 Commits

Author SHA1 Message Date
James Almer
bef77c6c9c avformat/dump: only print yaw, pitch, and roll if set
Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-04 23:35:08 -03:00
Martin Storsjö
e14cdf9990 hlsenc: Calculate the average and actual maximum bitrate of segments
Previously, the bitrate advertised in the master playlist would only
be based on the nominal values in either AVCodecParameters bit_rate,
or via AVCPBProperties max_bitrate. On top of this, a
fudge factor of 10% is added, to account for container overhead.

Neither of these bitrates may be known, and if the encoder is
running in VBR mode, there is no such value to be known. And
the container overhead may be more or less than the given
constant factor of 10%.

Instead, calculate the maximum bitrate per segment based on
what actually gets output from the muxer, and average bitrate
across all segments.

When muxing of the file finishes, update the master playlist
with these values, exposing both the maximum (which previously
was a guesstimate based on the nominal values) via
EXT-X-STREAM-INF BANDWIDTH, and the average via
EXT-X-STREAM-INF AVERAGE-BANDWIDTH.

This makes it possible to use the hlsenc muxer with VBR
encodes, for VOD style muxing.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-07-04 23:33:27 +03:00
Martin Storsjö
9246cca7f7 hlsenc: When not using HLS_SINGLE_FILE, set vs->size to range_length
This matches what is done in the corresponding case for
HLS_SINGLE_FILE.

Normally, vs->size is already initialized correctly - but when
writing the initial segment, with mp4 files, vs->size has been set
to the size of the init segment, while range_length contains the
real size of the first segment.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-07-04 23:33:26 +03:00
Martin Storsjö
a50b8bb7cd hlsenc: Remove bogus check for if (vs->start_pos) for appending segments
Previously, vs->start_pos was never 0 here, unless using the
-hls_segment_size option, which wasn't allowed for SEGMENT_TYPE_FMP4.
Therefore, this if statement was practically always taken anyway.

Remove this bogus if statement, to allow changing vs->start_pos
to reflect the right value when not using the -hls_segment_size
option.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-07-04 23:33:25 +03:00
Martin Storsjö
52f57568d5 hlsenc: Fix setting vs->start_pos when not using HLS_SINGLE_FILE or hls_segment_size
When not using HLS_SINGLE_FILE or hls_segment_size, we're writing
each segment into a separate file. In that case, the file start pos for
each segment will be zero.

This matches the case in (hls->max_seg_size > 0) above, where we
decide to switch to a new file.

This fixes the calculation of "vs->size = new_start_pos - vs->start_pos"
at the start of hls_write_packet; previously, start_pos would
refer to the byte size of the previous segment file, giving
vs->size entirely bogus values here.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-07-04 23:33:24 +03:00
Martin Storsjö
01312fdfcf hlsenc: Fix the return value accumulation in append_single_file
Both the read_byte variable (which is accumulated into
append_single_file) and the return value are int64_t;
give the ret variable the right corresponding type too.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-07-04 23:33:23 +03:00
Martin Storsjö
affc1acde7 tests: Add a missing dependency for the filter-atempo test
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-07-04 23:03:20 +03:00
Andreas Rheinhardt
b13291f37c avcodec/hw_base_encode: Add missing include
Fixes checkheaders.

Reviewed-by: Sean McGovern <gseanmcg@gmail.com>
Reviewed-by: Tong Wu <wutong1208@outlook.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-07-04 19:45:51 +02:00
Rémi Denis-Courmont
e2af5904f0 lavc/h264dsp: R-V V 8-bit MBAFF loop filter
Performance is (unfortunately) the same as with non-MBAFF, since the
hardware under test does not short-circuit vector tail calculations.
(IMO, a generic solution or work-around should be agreed on, rather
than bespoke approaches all over the place.)
2024-07-04 19:57:42 +03:00
Rémi Denis-Courmont
5a6e333fc7 lavc/h264dsp: R-V V 8-bit luma loop filter
T-Head C908 (cycles):
h264_h_loop_filter_luma_8bpp_c:       297.5
h264_h_loop_filter_luma_8bpp_rvv_i32: 369.2
h264_v_loop_filter_luma_8bpp_c:       862.7
h264_v_loop_filter_luma_8bpp_rvv_i32: 199.7

Performance in the horizontal scenario seems worse than scalar. x86
SSE2 and AVX optimisations are similarly affected. This is presumably
caused by unlucky inputs from checkasm, such that the C code
short-circuits almost all filter calculations.
2024-07-04 19:57:42 +03:00
Gyan Doshi
03175b587c doc/filter: fix grammar in tiltandshift filter 2024-07-04 15:21:17 +05:30
Ramiro Polla
61e851381f swscale/yuv2rgb/x86: remove mmx/mmxext yuv2rgb functions
These functions are either slower or barely faster than the C LUT
yuv2rgb code.
2024-07-04 11:12:47 +02:00
Ramiro Polla
7eb37c142a avdevice/v4l2: add limited support for multiplanar API
This commit adds support for V4L2's multiplanar API, but only when the
number of planes is 1.

Adding full support for the multiplanar API would require a device that
actually uses more than 1 plane, which I have not found yet.
2024-07-04 11:09:53 +02:00
James Almer
cf7e2c5e05 avformat/mov: add more checks for infe atom size
Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-03 19:54:31 -03:00
James Almer
235ba14cc0 avformat/mov: check for EOF inside the infe list parsing loop
Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-03 19:54:31 -03:00
James Almer
a9a5d000aa avformat/mov: check extent_offset calculation for overflow
Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-03 19:54:31 -03:00
James Almer
c49898a6b1 avformat/mov: check that iloc offset values fit on an int64_t
Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-03 19:54:31 -03:00
Rémi Denis-Courmont
4a2de380b7 lavc/vc1dsp: fuse multiply-adds in R-V V inv_trans_8
T-Head C908 (cycles)             before   after
vc1dsp.vc1_inv_trans_4x8_rvv_i32: 240.0   228.0
vc1dsp.vc1_inv_trans_8x4_rvv_i32: 235.2   224.2
vc1dsp.vc1_inv_trans_8x8_rvv_i32: 340.7   327.2
2024-07-03 18:16:36 +03:00
Rémi Denis-Courmont
78e1565f84 lavc/vc1dsp: fuse multiply-adds in R-V V inv_trans_4
T-Head C908 (cycles):            before   after
vc1dsp.vc1_inv_trans_4x4_rvv_i32: 128.0   120.0
vc1dsp.vc1_inv_trans_4x8_rvv_i32: 244.0   240.0
vc1dsp.vc1_inv_trans_8x4_rvv_i32: 239.2   235.2
2024-07-03 18:16:36 +03:00
Leo Izen
d69e522523
avcodec/pngenc: fix mDCv typo
When mDCv support was added, there was a typo in both variable names
and also the MKTAG itself, incorrectly listing it as mDVc. The tag name
stands for Mastering Display Color Volume so mDCv is correct.

Typo originally introduced in 7894904141.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
Reported-by: Ramiro Polla <ramiro.polla@gmail.com>
2024-07-03 10:21:17 -04:00
Leo Izen
c1af34c25b
avcodec/pngdec: fix mDCv typo
When mDCv support was added, there was a typo in both variable names
and also the MKTAG itself, incorrectly listing it as mDVc. The tag name
stands for Mastering Display Color Volume so mDCv is correct. See other
files such as av1dec.c which uses mdcv.

Typo originally introduced in c7a57b0f70.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
Reported-by: Ramiro Polla <ramiro.polla@gmail.com>
2024-07-03 10:21:06 -04:00
James Almer
d241edc2b4 fftools/ffmpeg_opt: add missing codec type to some options
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-03 08:26:44 -03:00
Anton Khirnov
901f7e3f72 fftools/ffmpeg_mux_init: make encoder_opts local to ost_add()
It is no longer needed after this function returns.
2024-07-03 11:38:52 +02:00
Anton Khirnov
9a7686e545 fftools/ffmpeg_mux_init: apply encoder options manually
Do not pass an options dictionary to the avcodec_open2() in enc_open().

This is cleaner and more robust, as previously various bits of code
would try to interpret the contents of the options dictionary, with
varying degrees of correctness. Now they can just access the encoder
AVCodecContext directly.

Cf. 372c78dd42 - analogous change for
decoding.

A non-progressive field order is now written on the container level in
interlaced ProRes encoding tests.
2024-07-03 11:38:52 +02:00
Anton Khirnov
f1664aabb1 fftools/ffmpeg: rewrite checking whether codec AVOptions have been used
Share the code between encoding and decoding. Instead of checking every
stream's options dictionary (which is also used for other purposes),
track all used options in a dedicated dictionary.
2024-07-03 11:38:52 +02:00
Rajiv Harlalka
fc446eea05 tests/fate/filter-audio.mak: add test for atempo audio filter
Signed-off-by: Rajiv Harlalka <rajivharlalka009@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2024-07-03 11:37:40 +02:00
Yotam Ofek
a9c05eb657 avcodec/aaccoder_twoloop: remove unread max scaler 2024-07-03 02:51:37 +02:00
Yotam Ofek
b5ad997e72 avcodec/aaccoder_twoloop: remove unused macro
seems the `sclip` macro was never used
2024-07-03 02:51:09 +02:00
Marvin Scholz
ac60ad1872 avcodec/aacdec_usac: Fix array size
The array in ff_aac_usac_mdst_filt_cur that is passed to that has a size
of 7 elements, not 6 and the code in the function accesses the array at
index 6, which would be out of bounds if the size was actually 6.

Fixes: CID1603196
2024-07-03 02:48:27 +02:00
Michael Niedermayer
c296d4fdec
avfilter/vf_avgblur: Check plane instead of AVFrame
Fixes: CID1551694 Use after free (false positive based on assuming that out == in and one is freed and one used)

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-02 21:57:25 +02:00
Michael Niedermayer
34f821e448
avfilter/drawutils: Fix depthb computation
Fixes: CID1496940 Logically dead code

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-02 21:57:24 +02:00
Michael Niedermayer
aab0c344c5
avfilter/avf_showcwt: Check av_parse_video_rate() for failure
Fixes: CID1539147 Unused value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-02 21:57:24 +02:00
Michael Niedermayer
0d0373de3b
avformat/rdt: Check pkt_len
Fixes: CID1473553 Untrusted loop bound

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-02 21:57:24 +02:00
Michael Niedermayer
ca237a841e
avformat/mpeg: Check len in mpegps_probe()
Fixes: CID1473590 Untrusted loop bound

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-02 21:57:23 +02:00
Michael Niedermayer
64df7d4c1e
avformat/mov: Check requested_sample before using it
I am not sure the case described by coverity is possible
but its more robust checking the argument first

Fixes: CID1598441 Improper use of negative value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-02 21:57:23 +02:00
Michael Niedermayer
a469e48b6d
avformat/mxfenc: resurrects the error print
Fixes: CID1524681 Logically dead code

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-02 21:57:23 +02:00
Michael Niedermayer
4c285bb278
avdevice/dshow: Check ICaptureGraphBuilder2_SetFiltergraph() for failure
Fixes: CID1591939 Logically dead code

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-02 21:57:22 +02:00
Michael Niedermayer
86cd7c68bc
avcodec/mfenc: check IMFSample_ConvertToContiguousBuffer() for failure
Fixes: CID1591911 Logically dead code

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-02 21:57:22 +02:00
Michael Niedermayer
63ecce9ba8
avcodec/vc1_loopfilter: Factor duplicate code in vc1_b_h_intfi_loop_filter()
Fixes: CID1435168

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-02 21:57:22 +02:00
Michael Niedermayer
97ae47f9e9
avcodec/vvc/ctu: Remove dead ret check
Fixes: CID1560040 Logically dead code

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-02 21:57:21 +02:00
Michael Niedermayer
d22a33710a
avcodec/vvc/dec: Remove constant eos_at_start
Fixes: CID1560041 'Constant' variable guards dead code

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-02 21:57:21 +02:00
Michael Niedermayer
4824156fa0
avformat/img2dec: assert no pipe on ts_from_file
Help coverity with CID1500302 Uninitialized scalar variable

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-02 21:57:21 +02:00
Michael Niedermayer
385784a148
avcodec/cbs_jpeg: Try to move the read entity to one side in a test
The checked entity should be alone on one side of the check, this avoids
complex considerations of overflows.
This fixes a issue of bad style in our code and a coverity issue.

Fixes: CID1439654 Untrusted pointer read

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-02 21:57:20 +02:00
Michael Niedermayer
4bca147415
fftools/ffplay: Check vulkan_params
Fixes: CID1550133 Unchecked return value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-02 21:57:20 +02:00
Michael Niedermayer
ed364444f1
fftools/ffmpeg_sched: Remove dead assignments in sch_dec_send()
Fixes: CID1592383 Unused value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-02 21:57:20 +02:00
Michael Niedermayer
68f6063e04
fftools/ffmpeg_mux_init: Cleanup on error return in set_dispositions()
Fixes: CID1539099 Resource leak

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-02 21:57:19 +02:00
Michael Niedermayer
7b48360907
fftools/ffmpeg_mux: Remove unneeded initialization
Not sure this change makes sense, the code is more robust with ret set

Fixes: CID1559178 Unused value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-02 21:57:19 +02:00
Michael Niedermayer
935d9a5712
fftools/ffmpeg_enc: Initialize Decoder
Fixes: CID1591439 Uninitialized pointer read

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-02 21:57:19 +02:00
Michael Niedermayer
462bd44b03
fftools/ffmpeg_enc: Initialize fd
Fixes: CID1520677 Uninitialized pointer read

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-02 21:57:18 +02:00
Michael Niedermayer
97b2ab15de
fftools/ffmpeg_enc: simplify opaque_ref check
Found-while-revieweing: CID1520670 Dereference after null check

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-02 21:57:18 +02:00