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

119767 Commits

Author SHA1 Message Date
9b9a287872 doc/examples/qsv_decode: use av_err2str
Signed-off-by: Marvin Scholz <epirat07@gmail.com>
2025-05-22 22:26:30 +02:00
e93a43b511 doc/examples/filter_audio: use av_err2str
Signed-off-by: Marvin Scholz <epirat07@gmail.com>
2025-05-22 22:26:30 +02:00
977d1a24bc vulkan/ffv1: fix sync issue in cached bitstream reader/writer
The issue is that there is an explicit lack of synchronization as only the very
first invocation writes symbols and updates the state, which other invocations
then store.
2025-05-23 05:23:44 +09:00
b9b44e15b5 rtpdec: Set bitrate for pcm-mulaw audio
Signed-off-by: Marvin Scholz <epirat07@gmail.com>
Co-authored-by: Marvin Scholz <epirat07@gmail.com>
2025-05-22 22:11:37 +02:00
f566392f66 libavformat/rtpdec_opus: add fmtp parsing of sprop-maxcapturerate
Co-authored-by: Marvin Scholz <epirat07@gmail.com>
Signed-off-by: Marvin Scholz <epirat07@gmail.com>
2025-05-22 22:11:37 +02:00
2a180c7150 libavformat/rtpdec_opus: Set duration field on Opus AVPacket
This commit will properly set the duration field of Opus AVPackets.
Currently, duration is set to 0 on Opus packets from the RTP demuxer.

The Ogg muxer depends on the duration field to properly compute the page granule
value. Without a proper duration, the granule will be wrong, and result in
negative pts values in ogg files.

See oggenc.c:657 (ogg_write_packet_internal)

This commit calculates using the opus_duration function, which was copied
from oggparseopus.c

I moved this functionality and the existing opus extradata functionality
(added by me in 6c24f2b) into a new rtpdec_opus.c file.

Reviewed-by: Tristan Matthews <tmatth@videolan.org>
Signed-off-by: Marvin Scholz <epirat07@gmail.com>
2025-05-22 22:10:46 +02:00
36ec9217e6 avformat/dhav: fix backward scanning for get_duration and optimize seeking
The backwards scanning done for incomplete final packets should not
assume a specific alignment at the end of the file. Truncated files
result in hundreds of thousands of seeks if the final packet does not
fall on a specific byte boundary, which can be extremely slow.
For example, with HTTP, each backwards seek results in a separate
HTTP request.

This changes the scanning to check for the end tag 1 byte at a time
and buffers the last 1 MiB to avoid additional seek operations.

Co-authored-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Justin Ruggles <justinr@vimeo.com>
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2025-05-22 16:11:16 +01:00
c8b09fb0ac avutil/refstruct: Remove redundant check
We now require C11.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-22 15:12:54 +02:00
4099d53759 avfilter/vf_interlace_vulkan: fix FPS and PTS calculation
ol->frame_rate is 0/0, so we need to calcalute the correct value based on
the il->frame_rate instead. Also adjust the time base, PTS and frame_duration
values accordingly. (Logic taken from vf_tinterlace.c)
2025-05-21 16:10:55 +02:00
f1b3e51950 avcodec/amfenc_h264: improve B-frame usability and simplify options
- Query GPU caps for B-frame support and warn if unsupported.
- Make `-max_b_frames` optional
- Drop explicit `-pa_lookahead_buffer_depth` requirement in
adaptive mode.
2025-05-21 15:42:30 +02:00
2a5ee83442 avcodec/atrac3: Use av_unreachable() instead of av_assert1(0)
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-21 12:02:52 +02:00
328ba54efa avcodec/4xm: Use av_unreachable() instead of av_assert0(0)
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-21 12:02:52 +02:00
5653e0b1fa avcodec/mjpegenc_common: Use av_unreachable() instead of av_assert0(0)
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-21 12:02:52 +02:00
85fb3453f8 avcodec/adpcm: Use av_unreachable() instead of av_assert0()
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-21 12:02:52 +02:00
0bdb69119a avcodec/vp9: Replace av_assert(0) by av_unreachable()
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-21 12:02:52 +02:00
2282a3740b avcodec/rv20enc: Use av_assert1() instead of av_assert0()
There is really no good reason to perform these checks in
release builds.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-21 12:02:52 +02:00
a35917268d avcodec/mpegvideo encs: Add put_bits_assume_flushed() to encode_header
This allows the compiler to remove the implicit "Do I need to output
the PutBitContext buffer here?" checks.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-21 12:02:52 +02:00
5d0e8fa4bb avcodec/vlc: Make assert check more strict
The earlier code allowed callers to use arbitrary values as
symbols_size as long as no symbols were present.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-21 12:02:52 +02:00
ef58de7fdc avcodec/mpegvideo_{dec,motion}: Mark unreachable code as unreachable
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-21 12:02:52 +02:00
57696f7c2b avcodec/wmaenc: Use av_unreachable() instead of av_assert0(0)
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-21 12:02:52 +02:00
831a0d0c6b avcodec/speedhqenc: Use av_unreachable() for unreachable condition
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-21 12:02:46 +02:00
2df9c8da72 avcodec/e?ac3enc: Inform compiler about PutBitContext being blank
This turned out to be very beneficial: For GCC 13, the codesize
of ac3_output_frame_header went down from 4522B to 1247B and
from 10762B to 9298B for eac3_output_frame_header. For Clang 17,
the numbers went down from 3923B to 2477B and from 8338B to 6548B
(always with -O3).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-21 12:02:25 +02:00
4484e9b373 avcodec/put_bits: Allow to mark places where PutBitContext is flushed
This will allow the compiler to optimize the "is the cache full?"
branches away from some put_bits().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-21 12:02:25 +02:00
988e319b40 avcodec/dolby_e_parse: Use av_unreachable instead of av_assert0(0)
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-21 12:02:25 +02:00
22e6e4e914 avcodec/utvideoenc: Remove always-false pixel format check
Mark it as unreachable instead.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-21 12:02:10 +02:00
d7d1379d06 avcodec/vlc: Make code more readable with av_unreachable()
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-21 12:01:43 +02:00
fc520ccb07 avcodec/pcm-dvdenc: Mark unreachable default cases as unreachable
Fixes a Clang warning when asserts are disabled:
"variable 'quant' is used uninitialized whenever switch default is taken
[-Wsometimes-uninitialized]"

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-21 12:01:30 +02:00
7a27357636 avcodec/mpeg4videodec: Mark impossible switch case as unreachable
Alternative to 8fc649b931.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-21 11:36:09 +02:00
b5824a6dab avcodec/proresenc_anatoliy: Mark impossible case as unreachable
Alternative fix for fix Coverity issue 1440385 (instead of
6106177ad6).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-21 11:35:31 +02:00
fc9e2a92c1 avcodec/amrwbdec: Mark default switch as unreachable
Alternative fix for Coverity issue #1473499
instead of a3bb269db9.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-21 11:16:25 +02:00
004cc60f0e avutil/avassert: Add av_unreachable() and av_assume() macros
Useful to let the compiler and static analyzers know that
something is unreachable without adding an av_assert
(which would be either dead for the compiler or add runtime
overhead) for this.
The implementation used here enforces the use of a message
to provide a reason why a particular code is supposed to be
unreachable.

Reviewed-by: Ramiro Polla <ramiro.polla@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-21 10:45:23 +02:00
b6f84cd72a avcodec/svq3: Improve returning last picture
Use av_frame_move_ref() instead of av_frame_ref().
This allows to remove the separate variable for whether
we have already returned the delayed last pic. It also
makes stream looping work when looping multiple times;
previously the delayed pic was only output the first time,
because last_frame_output was never reset.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-21 03:10:52 +02:00
b98128898a tests/fate/qt: Use passthrough fps_mode for svq3-watermark
The file has buggy timestamps (it uses B-frames, yet pts==dts)
and therefore the last frame is currently discarded by FFmpeg cli.
Using -fps_mode passthrough avoids this and provides coverage
of the SVQ3 draining logic.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-21 03:10:52 +02:00
f362a19096 avcodec/svq3: Allocate picture buffers during init
Also allocate them jointly.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-21 03:10:52 +02:00
b8ec4f7b20 avcodec/svq3: Allocate motion_val jointly
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-21 03:10:52 +02:00
eacde6ee7b avcodec/svq3: Deduplicate allocating dummy frame
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-21 03:10:52 +02:00
cb54eca41a avcodec/svq3: Improve returned error codes
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-21 03:10:52 +02:00
0468b866ca avcodec/svq3: Factor out decoding extradata
Reduces indentation and avoids an extra variable for whether
a sequence header has been found.
It also fixes potential undefined behaviour:
NULL + 0 is undefined and happens when no extradata is available.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-21 03:10:52 +02:00
0b3dae6c63 avcodec/mpeg12enc: Combine put_bits()
This is a 16bit field in the spec, so using a single
put_bits() to write it is more natural.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-21 03:10:22 +02:00
f5f890fee4 avcodec/mpeg12dec: Remove nonsense comment
Everything in mpeg12dec.c is about decoding.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-21 03:10:05 +02:00
562192e283 avcodec/mpeg12dec: Remove redundant save_width/height
These have been added in 29644cb504
in 2007 at a time when the MPEG-1/2 parser just set
the AVCodecContext's dimensions when encountering a sequence header,
so that the checks for the coded dimensions didn't trigger.
Yet this is no more and so we can simply remove these redundant checks.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-21 03:09:55 +02:00
56497671dd avcodec/mpeg12dec: Set save_chroma_format also for VCR2
Otherwise the MpegEncContext would be unnecessarily reinitialized
once (this does not affect the output for an intra-only variant
like VCR2) in mpeg_decode_postinit().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-21 03:09:45 +02:00
a1e4be5740 avcodec/mpegvideo_dec: Move ff_mpv_report_decode_progress() to h263dec.c
It is its only user. Also make it static and call it
before ff_mpeg_draw_horiz_band().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-21 02:54:22 +02:00
e12cbf6095 avcodec/tests/avcodec: Check only frame-mt decoders set update_thread_ctx
Possible since 554b52b1b3.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-21 02:44:15 +02:00
a6f7b32085 avcodec/ratecontrol: Fix wrong sizeof expression
Fixes Coverity issue #1644200.
Introduced in 89a8033fc9.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-21 02:44:06 +02:00
36af32f9e5 avcodec/tests/.gitignore: Add apv test tool
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-21 02:43:22 +02:00
bd63c374d2 avformat/avformat: Remove outdated io_close2 documentation
The io_close callback has been removed in
d6799ee0e4.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-21 02:43:08 +02:00
66f5323652 avcodec/rv60dec: Avoid branch when decoding cbp16
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-21 02:41:55 +02:00
d5a9f7bdd4 avcodec/cuviddec: only flush cuvid when output queue is empty 2025-05-21 01:16:19 +02:00
431e2cae87 avcodec/cuviddec: print error when queueing frames fails 2025-05-21 01:15:29 +02:00