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

110477 Commits

Author SHA1 Message Date
James Almer
3675dd0e0c fftools: use the new AVFrame interlace flags
Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-04 18:15:00 -03:00
James Almer
36827ea783 avfilter: use the new AVFrame interlace flags in all filters
Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-04 18:14:11 -03:00
James Almer
2f561ba953 avcodec: use the new AVFrame interlace flags in all decoders and encoders
Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-04 18:14:02 -03:00
James Almer
2df4e054d4 avutil/frame: add new interlaced and top_field_first flags
Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-04 17:40:24 -03:00
Zhao Zhili
4006c71d19 avcodec/options_table: reorder nokey after nointra
So the values are in ascending order.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-05-04 12:13:07 +08:00
Zhao Zhili
0d40711f59 avcodec/hevcdec: remove unused variables from hls_slice_data
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-05-04 12:10:23 +08:00
Zhao Zhili
36a56d3cc8 avcodec/avcodec: fix UB NULL+0
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-05-04 12:10:11 +08:00
Niklas Haas
ad417eb5fa doc/filters/libplacebo: fix outdated/wrong note
This has not been the case since c0b93c4f8+48c385fb4c.
2023-05-03 23:40:20 +02:00
Niklas Haas
b80e43bf07 avfilter/vf_libplacebo: add flexible crop exprs
Motivated by a desire to use vf_libplacebo as a GPU-accelerated
cropping/padding/zooming filter. This commit adds support for setting
the `input/target.crop` fields as dynamic expressions.

Re-use the same generic variables available to other scale and crop type
filters, and also add some more that we can afford as a result of being
able to set these properties dynamically.

It's worth pointing out that `out_t/ot` is currently redundant with
`in_t/t` since it will always contain the same PTS values, but I plan on
changing this in the near future.

I decided to also expose `crop_w/crop_h` and `pos_w/pos_h` as variables
in the expression parser itself, since this enables the fairly common
use case of determining dimensions first and then placing the image
appropriately, such as is done in the default behavior (which centers
the cropped/placed region by default).
2023-05-03 23:40:20 +02:00
Niklas Haas
4b11a07550 avfilter/vf_libplacebo: add fillcolor option
In some circumstances, libplacebo will clear the background as a result
of cropping/padding. Currently, this uses the hard-coded default fill
color of black. This option makes this behavior configurable.
2023-05-03 23:40:20 +02:00
Paul B Mahol
d94c6df975 avfilter/af_afreqshift: cache nb_coeffs value 2023-05-03 20:13:26 +02:00
Rémi Denis-Courmont
0e580806d8 riscv/intmath: use builtins for counting ones
As with the earlier bswap change, all versions of GCC and Clang that
support RISC-V support the popcount built-ins, so we can just use them
instead of inline assembler.
2023-05-02 22:08:25 +02:00
Rémi Denis-Courmont
7dcb5e1ab0 riscv/bswap: use compiler builtins
av_bswapXX() are used in context that expect exact size types, notably
variable arguments to av_log(). On Linux RV64, uint_fast32_t is an
unsigned long, so the current inline assembler does not work properly.

Since GCC and Clang gained their byte-swap built-ins before they
supported RISC-V, we can simply defer to them. As an added bonus, the
compiler can do instruction scheduling, which it couldn't with the Zbb
inline assembler.
2023-05-02 22:08:21 +02:00
Anton Khirnov
129c7bf53f fftools/ffmpeg: always use the same path for setting InputStream.[next_]dts
Currently those are set in different ways depending on whether the
stream is decoded or not, using some values from the decoder if it is.
This is wrong, because there may be arbitrary amount of delay between
input packets and output frames (depending e.g. on the thread count when
frame threading is used).

Always use the path that was previously used only for streamcopy. This
should not cause any issues, because these values are now used only for
streamcopy and discontinuity handling.

This change will allow to decouple discontinuity processing from
decoding and move it to ffmpeg_demux. It also makes the code simpler.

Changes output in fate-cover-art-aiff-id3v2-remux and
fate-cover-art-mp3-id3v2-remux, where attached pictures are now written
in the correct order. This happens because InputStream.dts is no longer
reset to AV_NOPTS_VALUE after decoding, so streamcopy actually sees
valid dts values.
2023-05-02 10:59:24 +02:00
Anton Khirnov
3190bed148 fftools/ffmpeg: constify packets passed to decode*()
They are not modified by these functions.
2023-05-02 10:59:24 +02:00
Anton Khirnov
302aecd06a fftools/ffmpeg: drop InputStream.[next_]pts
They are no longer used for anything.
2023-05-02 10:59:24 +02:00
Anton Khirnov
ae95cd85dc fftools/ffmpeg_filter: stop using InputStream.pts for filter EOF ts
Use InputStream.last_frame_pts/duration instead, which is more accurate.
2023-05-02 10:59:24 +02:00
Anton Khirnov
ef69f6a9d2 fftools/ffmpeg: stop using InputStream.pts for generating video timestamps
This was added in 380db56928 as a
temporary crutch that is not needed anymore. The only case where this
code can be triggered is the very first frame, for which InputStream.pts
is always equal to 0.
2023-05-02 10:59:24 +02:00
Anton Khirnov
d85c6aba0c fftools/ffmpeg: rework audio-decode timestamp handling
Stop using InputStream.dts for generating missing timestamps for decoded
frames, because it contains pre-decoding timestamps and there may be
arbitrary amount of delay between input packets and output frames (e.g.
dependent on the thread count when frame threading is used). It is also
in AV_TIME_BASE (i.e. microseconds), which may introduce unnecessary
rounding issues.

New code maintains a timebase that is the inverse of the LCM of all the
samplerates seen so far, and thus can accurately represent every audio
sample. This timebase is used to generate missing timestamps after
decoding.

Changes the result of the following FATE tests
* pcm_dvd-16-5.1-96000
* lavf-smjpeg
* adpcm-ima-smjpeg
In all of these the timestamps now better correspond to actual frame
durations.
2023-05-02 10:59:24 +02:00
Anton Khirnov
6bbea932ca fftools/ffmpeg: set AVFrame.time_base for decoded frames
Makes it easier to keep track of the timebase the frames are in.
2023-05-02 10:59:24 +02:00
Anton Khirnov
b6e7d64394 fftools/ffmpeg: stop using packet pts for decoded audio frame pts
If input packets have timestamps, they will be propagated to output
frames by the decoder, so at best this block does not do anything.

There can also be an arbitrary amount of delay between packets sent to
the decoder and decoded frames (e.g. due to decoder's intrinsic delay or
frame threading), so deriving any timestamps from packet properties is
wrong.
2023-05-02 10:59:24 +02:00
Anton Khirnov
5b3aeab1bd fftools/ffmpeg_filter: use correct timebase for filter EOF timestamp
It does not need to be equal to demuxer timebase.
2023-05-02 10:59:24 +02:00
Anton Khirnov
0aada80e73 fftools/ffmpeg_filter: keep track of filtergraph input timebase
Will be useful in following commits.
2023-05-02 10:59:24 +02:00
Anton Khirnov
04f0c40c74 fftools/ffmpeg_filter: add InputFilter private data
Move InputFilter.frame_queue to it, which is not accessed outside of
ffmpeg_filter.
2023-05-02 10:59:24 +02:00
Anton Khirnov
1dcae45ecb fftools/ffmpeg_filter: factorize allocating InputFilter 2023-05-02 10:59:24 +02:00
Anton Khirnov
87ced7aee0 fftools/ffmpeg_filter: make graph_desc private
It is not used outside of ffmpeg_filter.
2023-05-02 10:59:24 +02:00
Anton Khirnov
09dd9c5f41 fftools/ffmpeg_filter: add filtergraph private data
Start by moving OutputStream.filtered_frame to it, which really belongs
to the filtergraph rather than the output stream.
2023-05-02 10:59:24 +02:00
Anton Khirnov
aee5b774bf fftools/ffmpeg_filter: make ifilter_parameters_from_frame() static
It is no longer used outside of this file.
2023-05-02 10:59:24 +02:00
Anton Khirnov
38c937e8c4 fftools/ffmpeg: drop undocumented runtime debug-setting
This feature is of highly questionable usefulness and - as the comment
in the code says - is not actually supported by the API.
2023-05-02 10:59:24 +02:00
Anton Khirnov
7e3eb24123 fftools/ffmpeg: move OutputStream.packets_encoded to Encoder
It is no longer used outside of ffmpeg_enc.
2023-05-02 10:59:24 +02:00
Anton Khirnov
6e487a50a1 fftools/ffmpeg: drop OutputStream.error
Only the first component is used in update_video_stats(), so make it a
stack variable in that function.
2023-05-02 10:59:24 +02:00
Anton Khirnov
52b632b65b fftools/ffmpeg: drop OutputStream.pict_type
It is no longer used outside of update_video_stats(), so make it a stack
variable in that function.
2023-05-02 10:59:24 +02:00
Anton Khirnov
f4a60b8ddc fftools/ffmpeg: reduce access to OutputStream.enc_ctx
It will be made private to Encoder in the future.
2023-05-02 10:59:24 +02:00
Anton Khirnov
5a04aae821 fftools/ffmpeg: deprecate -adrift_threshold
This option has had no effect since -async was removed in
3d86a13b47
2023-05-02 10:59:24 +02:00
Anton Khirnov
0ed1eeb744 lavf/dv: use a more granular timebase for audio
One that is fine enough to represent all DV audio sample rates. Audio
packet durations are now sample-accurate.

This largely undoes commit 76fbb0052d. To
avoid breaking the issue fixed by that commit, resync audio timestamps
against video if they get more than one frame apart. The sample from
issue #8762 still works correctly after this commit.

Slightly changes the results of the lavf-dv seektest, due to the audio
timebase being more granular.
2023-05-02 10:57:21 +02:00
Anton Khirnov
aae5ba31ca lavf/dv: shorten code by using a local variable 2023-05-02 10:57:21 +02:00
Anton Khirnov
c7a852b638 lavf/dv: do not set video timebase more than once
Current code will call avpriv_set_pts_info() for each video frame,
possibly setting a different timebase if the stream framerate changes.
This violates API conventions, as the timebase is supposed to stay
constant after stream creation.

Change the demuxer to set a single timebase that is fine enough to
handle all supported DV framerates.

The seek tests change slightly because the new timebase is more
granular.
2023-05-02 10:57:21 +02:00
Paul B Mahol
5617465916 avfilter/af_anlms: improve documentation and extend option 2023-05-01 20:07:06 +02:00
Paul B Mahol
f09280dfc4 avfilter/af_arls: improve documentation and extend option 2023-05-01 20:07:05 +02:00
James Almer
159f8b8d71 avfilter/audio: move a variable declaration outside of an unrelated deprecated block
Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-01 13:57:09 -03:00
Paul B Mahol
eaf15b5882 avfilter/vf_waveform: cc2b3201e7 missed same for >8 bits 2023-05-01 14:55:32 +02:00
James Almer
e7c690a046 avcodec/hevc_ps: check for out of range bitdepth in SPS
Signed-off-by: James Almer <jamrial@gmail.com>
2023-04-30 20:41:55 -03:00
Michael Niedermayer
bf3f91c425
avcodec/hevc_ps: Avoid signed overflow before check on QP
Fixes: signed integer overflow: -2147483648 - 5 cannot be represented in type 'int'
Fixes: 58066/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5312995835379712

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-01 00:48:32 +02:00
Michael Niedermayer
69eb8197af
tools/target_dec_fuzzer: Adjust threshold for rka
Fixes: Timeout
Fixes: 57993/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RKA_fuzzer-5825782785376256

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-01 00:48:32 +02:00
Michael Niedermayer
cb8180aa66
avcodec/hevc_ps: Check depth to be within 8 to 16
Fixes: assertion failure in bitreader
Fixes: 45982/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-627318668066816

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-01 00:48:32 +02:00
Michael Niedermayer
e2e34c7731
avcodec/wavarc: Check order before using it to write the list
Fixes: out of array access
Fixes: 45982/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVARC_fuzzer-6247711015043072
Fixes: 45982/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVARC_fuzzer-6487578428964864
Fixes: 45982/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVARC_fuzzer-6651587794960384
Fixes: 45982/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVARC_fuzzer-6686265824378880

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-01 00:48:32 +02:00
Michael Niedermayer
957106a24d
avcodec/bonk: decode multiple passes in intlist_read() at once
This makes the worst case much faster

Fixes: Timeout
Fixes: 51363/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BONK_fuzzer-5660734784143360
Fixes: 57957/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BONK_fuzzer-5874095467397120

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-01 00:48:32 +02:00
Michael Niedermayer
e734e16544
avcodec/cavsdec: Check bits left before picture allocation
Fixes: Timeout
Fixes: 57893/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CAVS_fuzzer-5091726540013568

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-01 00:48:32 +02:00
Michael Niedermayer
f6dffe6fc4
tools/target_dec_fuzzer: Adjust threshold for APE
Fixes: Timeout
Fixes: 57889/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5262308950802432

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-01 00:48:32 +02:00
Michael Niedermayer
b2a3279dbe
avcodec/apedec: Factor constant sign out of loop in long_filter_high_3800()
930 -> 850 cycles

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-01 00:48:32 +02:00