Commit Graph

111173 Commits

Author SHA1 Message Date
James Almer
199fc04d09 avcodec/evc_ps: use get_bits_long() where needed
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-19 16:25:13 -03:00
Michael Niedermayer
89f98acbf8 avcodec/evc_ps: Check log2_sub_gop_length
Fixes: 1.70141e+38 is outside the range of representable values of type 'int'
Fixes: 59883/clusterfuzz-testcase-minimized-ffmpeg_BSF_EVC_FRAME_MERGE_fuzzer-5557887217565696

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-19 16:00:55 -03:00
James Almer
921596e677 avcodec/evc_ps: make ff_evc_parse_{sps,pps} return an error code
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-19 16:00:55 -03:00
James Almer
5cb9ef9300 avcodec/evc_parse: remove ff_evc_parse_nal_unit()
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-19 12:57:31 -03:00
James Almer
56e52e870d avcodec/evc_frame_merge_bsf: make ff_evc_parse_nal_unit() local to the filter
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-19 12:57:31 -03:00
James Almer
fdd8daf899 avcodec/evc_parser: remove write only variable
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-19 12:57:31 -03:00
James Almer
a5663f2d9a avcodec/evc_parser: make ff_evc_parse_nal_unit() local to the parser
This is in preparation for the following commits.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-19 12:57:31 -03:00
James Almer
ff7a4cdf04 avcodec/evc_parse: split off deriving PoC
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-19 12:57:31 -03:00
James Almer
f7e0af5edc avcodec/evc_parser: stop exporting delay and gop_size
The former is a property a decoder may export, and the latter is only
used in encoding scenarios.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-19 12:57:31 -03:00
James Almer
1e189fed7a avcodec/evc_parse: split off Parameter Set parsing into its own file
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-19 12:57:31 -03:00
James Almer
4afee83d35 fate/lavf-container: add a test to remux raw evc into mp4
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-19 12:57:31 -03:00
James Almer
8ab706677c avcodec/evc_frame_merge_bsf: use av_new_packet()
This ensures the buffer is padded as required by the AVPacket API.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-19 12:57:31 -03:00
James Almer
96fc192733 avcodec/evc_frame_merge: use av_fast_realloc()
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-19 12:57:31 -03:00
Anton Khirnov
1617d1a752 fftools/ffmpeg: pass subtitle decoder dimensions to sub2video
Restores behavior from before 20cacfe493.
Eventually this should be handled similarly to audio/video - with a
filtergraph reset or a manual scaler.
2023-06-19 09:48:56 +02:00
Anton Khirnov
88f80977eb fftools/ffmpeg: use AVFrame to pass subtitles from decoders to filters
Allows to use the same buffering code for all media types. Will also be
important for the following commit.
2023-06-19 09:48:56 +02:00
Anton Khirnov
fa717baaa5 fftools/ffmpeg_enc: constify the subtitle passed to enc_subtitle() 2023-06-19 09:48:56 +02:00
Anton Khirnov
e89a6d1089 fftools/ffmpeg_dec: move InputStream.prev_sub to Decoder
It does not need to be visible outside of decoding code.
2023-06-19 09:48:56 +02:00
Anton Khirnov
a45b9d35b9 fftools/ffmpeg: move fix_sub_duration_heartbeat() to ffmpeg_dec
This way ffmpeg.c does not need to access InputStream.prev_sub and it
can be made private.
2023-06-19 09:48:55 +02:00
Anton Khirnov
01897c1788 fftools/ffmpeg_dec: move decoding to a separate thread
This is only a preparatory step to a fully threaded architecture and
does not yet make decoding truly parallel - the main thread will
currently submit a packet and wait until it has been fully processed by
the decoding thread before moving on. Decoder behavior as observed by
the rest of the program should remain unchanged. That will change in
future commits after encoders and filters are moved to threads and a
thread-aware scheduler is added.
2023-06-19 09:48:55 +02:00
Anton Khirnov
5293adb1a7 fftools/ffmpeg: attach bits_per_raw_sample information to frames
This way avoids encoders reaching into filters or decoders for this
information.
2023-06-19 09:48:55 +02:00
Anton Khirnov
7d4e00ccf0 fftools/ffmpeg_dec: stop using Decoder.pkt
It is only used for flushing the subtitle decoder, so allocate a
dedicated packet for that.

Keep Decoder.pkt unused for now, it will be repurposed in future
commits.
2023-06-19 09:48:55 +02:00
Anton Khirnov
1bdd53e2f9 fftools/ffmpeg_filter: make configure_filtergraph() static
It is no longer used outside of ffmpeg_filter.
2023-06-19 09:48:55 +02:00
Anton Khirnov
b1a213ab5d fftools/ffmpeg_filter: reject filtergraphs with zero outputs
Nothing useful can be done with them currently.
2023-06-19 09:48:55 +02:00
Anton Khirnov
a7aa05c599 fftools/ffmpeg_filter: add an AVClass to FilterGraph
Use it for logging.
2023-06-19 09:48:55 +02:00
Anton Khirnov
a934392db0 fftools/ffmpeg_enc: move dup_warning global variable to Encoder 2023-06-19 09:48:55 +02:00
Anton Khirnov
1adad44fc7 fftools/ffmpeg_dec: move InputStream.hwaccel_pix_fmt to Decoder
It is purely decoder-internal state.
2023-06-19 09:48:55 +02:00
Anton Khirnov
174cb3accf fftools/ffmpeg_dec: remove pointless InputStream.hwaccel_retrieve_data
It is always set to hwaccel_retrieve_data() from ffmpeg_hw.c, so that
function can just be called directly instead.
2023-06-19 09:48:55 +02:00
Anton Khirnov
25d96ab6c0 fftools/ffmpeg_hw: inline hwaccel_decode_init() into its caller
The function is now trivial and cannot fail, so all error handling in
its caller can be removed.
2023-06-19 09:48:55 +02:00
Anton Khirnov
6c9cbf7507 fftools/ffmpeg_demux: reindent after previous commit 2023-06-19 09:48:55 +02:00
Anton Khirnov
98766dbbd7 fftools/ffmpeg_demux: move the loop out of add_input_streams()
Make the function process just one input stream at a time and save an
indentation level. Also rename it to ist_add() to be consistent with an
analogous function in ffmpeg_mux_init.
2023-06-19 09:48:55 +02:00
Anton Khirnov
47a14b542e tests/fate: add a test for -streamloop with transcoding video+audio 2023-06-19 09:48:55 +02:00
Anton Khirnov
90a26e75a4 tests/fate: rename ffmpeg-streamloop to ffmpeg-streamloop-copy
Makes it clear that this tests -streamloop with streamcopy, to
distinguish it from further -streamloop tests added in future commits.
2023-06-19 09:48:55 +02:00
Anton Khirnov
df81fb46ee fftools/ffmpeg_dec: simplify process_subtitle()
Its got_output argument always points to 1.
2023-06-19 09:48:55 +02:00
Anton Khirnov
e9eb44ed88 fftools/ffmpeg_dec: drop always-0 InputStream.prev_sub.ret 2023-06-19 09:48:55 +02:00
Anton Khirnov
52d7ea6635 doc/ffmpeg: improve -stats_*_fmt documentation 2023-06-19 09:48:10 +02:00
Martin Storsjö
a33191ff7a fate/cbs: Fix the ffprobe dependency for Windows targets
Signed-off-by: Martin Storsjö <martin@martin.st>
2023-06-19 09:25:32 +03:00
Zhao Zhili
f66e1862e3 avcodec/videotoolboxenc: inherit profile from AVCodecContext
This can happen when user set the avctx->profile field directly
instead of specify profile via option.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-06-19 12:19:37 +08:00
Zhao Zhili
3fafc842f1 avcodec/videotoolboxenc: remove AUTO_PROFILE define
Use FF_PROFILE_UNKNOWN as auto mode.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-06-19 12:19:37 +08:00
Zhao Zhili
315c66af0f avcodec/videotoolboxenc: use int as the type of profile
Other than save a few bytes, it also has the benefit to show the
AV_OPT_TYPE_CONST value in help, e.g.,

  -profile           <int>        E..V....... Profile (from 0 to INT_MAX) (default 0)
     baseline        66           E..V....... Baseline Profile
     ...

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-06-19 12:19:37 +08:00
Zhao Zhili
fb85aa959a avcodec/mediacodecenc: add profile names to options
H.264 high10/high422/high44 are unlikely supported by devices.
It's there for developers to do the experiment.

H.265 main10 works on my device with AV_PIX_FMT_MEDIACODEC.
OMX_COLOR_FormatYUV420Planar16 doesn't work.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-06-19 12:19:29 +08:00
Zhao Zhili
e349b45fa0 fate/cbs: add tests for discard_units
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-06-19 11:52:18 +08:00
Zhao Zhili
4a00cd4fe3 avcodec/filter_units_bsf: reindent after previous commit 2023-06-19 11:52:18 +08:00
Zhao Zhili
dfa0e24e98 avcodec/filter_units_bsf: add skip frame support 2023-06-19 11:52:18 +08:00
Zhao Zhili
4144584010 avcodec/cbs_h2645: add discard_unit implementation for H.265 2023-06-19 11:52:18 +08:00
Zhao Zhili
e7cde0cbd5 avcodec/cbs_h2645: add discarded_unit implementation for H.264 2023-06-19 11:52:18 +08:00
Zhao Zhili
a8aeab107e avcodec/cbs: add API to discard units by AVDiscard 2023-06-19 11:52:18 +08:00
James Almer
5e9986fd2d avformat/evc: use get_ue_golomb_long()
Fixes compilation of shared libraries, as well as correctly parses
width and height values.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-18 23:40:46 -03:00
Michael Niedermayer
9fc141f32d
avformat/jpegxl_anim_dec: Perform operations in a different order
Fixes: OOM
Fixes: 59802/clusterfuzz-testcase-minimized-ffmpeg_dem_JPEGXL_ANIM_fuzzer-5681765466112000

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-06-18 17:54:19 -04:00
Leo Izen
61047f0f82
avformat/jpegxl_anim_dec: avoid overrun with jxlp boxes in container
This switches the jpegxl_collect_codestream_header function to use
avcodec/bytestream2, which better enforces barriers, and should avoid
overrunning buffers with jxlp boxes if the size is zero or if the size
is so small the box is invalid.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-06-18 10:31:05 -04:00
Michael Niedermayer
6f2cf88771
avcodec/hevc_refs: Check that nb_refs stays <= HEVC_MAX_REFS
Fixes: 58528/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5834725318328320
Fixes: index 16 out of bounds for type 'int [16]'

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-06-18 14:29:13 +02:00