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

120146 Commits

Author SHA1 Message Date
4440e499ba avfilter/avfilter: always forward request frame in filter_activate_default
Even if all inputs are blocked an activate callback should request a frame on
some if its inputs if a frame is requested on any of its outputs.

Signed-off-by: Marton Balint <cus@passwd.hu>
2025-07-03 21:41:54 +02:00
a85835bfb8 fate/filter-video: add ffprobe test for dual output select filter
Signed-off-by: Marton Balint <cus@passwd.hu>
2025-07-03 21:41:54 +02:00
a736ac72bb avfilter/avfilter: fix forwarding EOF for simple API filters in filter_activate_default
EOF only need to be forwarded back if all outputs have reached EOF.

Fixes infinte loop with ffprobe -f lavfi -i "smptebars=d=1,select=n=2:e=1[out0][out1]"
Regression since d9e41ead82.

Fixes ticket #10959.
Fixes ticket #11366.

Signed-off-by: Marton Balint <cus@passwd.hu>
2025-07-03 21:41:53 +02:00
29e696c9c0 avfilter/filters: simplify FF_FILTER_FORWARD_WANTED_ANY
The status check is unneeded because an outlink with a nonzero status should
always return 0 for ff_outlink_frame_wanted(). Also use unsigned for index
because nb_outputs is unsigned as well.

Signed-off-by: Marton Balint <cus@passwd.hu>
2025-07-03 21:41:53 +02:00
f3b7aa6c22 avfilter: factorize requesting an input frame from multi output filters
Signed-off-by: Marton Balint <cus@passwd.hu>
2025-07-03 21:41:53 +02:00
01ffe103e5 avcodec/rv34: Fix spelling mistake
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 20:35:32 +02:00
fa02dea036 avcodec/rv34: Don't report progress unnecessarily
ff_mpv_frame_end() already does it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 20:35:32 +02:00
abc54c25be avcodec/mpegvideo: Move loop_filter to {H263Dec,MPVEnc,VC1}Context
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 20:35:32 +02:00
60f51bdaac avcodec/mpegvideo: Move partitioned_frame to {H263Dec,MPVEnc}Context
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 20:35:32 +02:00
0984724d1e avcodec/mpeg_er: Allow to skip setting partitioned_frame, p[pb]_time
Instead of setting these unconditionally (they are always zero
for H.261, MPEG-1/2, RV30/40, VC-1), add a variant of
ff_mpeg_er_frame_start() that sets them and remove setting them
from ff_mpeg_er_frame_start(). Also pass these values via parameters
instead of reading them from the MPVContext itself.
This will allow to move them from MPVContext.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 20:35:31 +02:00
3c06d87c93 avcodec/mpegvideo: Move fields to {H263Dec,MPVEnc}Context when possible
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 20:35:31 +02:00
00ea78f426 avcodec/flvdec: Binarize h263_flv
It used to be a tri-state encoding both whether to use FLV picture
headers and whether to use the FLV way of encoding escape values,
but the former is now unnecessary due to the switch to a function
pointer for reading the header. So binarize h263_flv.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 20:35:31 +02:00
532ae5dc7d avcodec/ituh263enc: Inline value of h263_flv
It is always two when we encode FLV1.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 20:35:31 +02:00
c660f45f8e avcodec/h263dec: Use function ptr for decode_picture_header
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 20:35:31 +02:00
3b6d1a6ee1 avcodec/msmpeg4dec: Move ff_msmpeg4_decode_init() down
Will avoid a forward declaration lateron.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 20:35:31 +02:00
502a6ea123 avcodec/mpegvideo: Move SLICE_* defs to h263dec.h, h261dec.c
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 20:35:31 +02:00
2089d39735 avcodec/mpegvideo: Move mb_skip_run to {RV34Dec,MPVEnc}Context
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 20:35:31 +02:00
d5fa282936 avcodec/mpeg12dec: Put mb_skip_run on the stack
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 20:35:31 +02:00
9f42725d75 avcodec/mpegvideo: Move mb_num_left to {H263,RV34}DecContext
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 20:35:31 +02:00
7db6267b30 avcodec/mpegvideo: Move fields only used by H.263 decoders to H263DecCtx
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 20:35:31 +02:00
f1c56c08ed avcodec/mpeg12dec: Don't use MPVContext.block
Instead add the necessary blocks directly into Mpeg12SliceContext.
This allows to completely remove MPVContext.block.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 20:35:31 +02:00
e40b0ebb2e avcodec/mpeg12dec: Move MpegEncContext.gb to Mpeg12SliceContext
It was its last user.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 20:35:31 +02:00
27d785746c avcodec/mpegvideo: Add missing headers
These files currently rely on implicit inclusions of avassert.h
and/or mathops.h via get_bits.h.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 20:35:31 +02:00
3a96a3c949 avcodec/mpeg12dec: Add Mpeg12SliceContext
This is in preparation for removing the GetBitContext
from MPVContext.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 20:35:31 +02:00
8a4accc24d avcodec/h263dec: Stop using MpegEncContext.gb
Add a GetBitContext to H263DecContext instead. This is in preparation
for removing MpegEncContext.gb.
Also move last_resync_gb to H263DecContext.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 20:35:31 +02:00
77add26918 avcodec/h263dec: Don't use MpegEncContext.block
Instead add the necessary blocks directly to H263DecContext
(only six are needed, not 12 as ff_mpv_common_init()
currently allocates).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 20:35:31 +02:00
b2be342ab6 avcodec/h263dec: Remove redundant block parameter from decode_mb
With the exception of mpeg4_decode_studio_mb(), all decode_mb
functions implicitly presumed that the block provided as
argument coincides with MpegEncContext.block (they zeroed the latter
and then used the former to decode the block); mpeg4_decode_studio_mb()
meanwhile did not use the provided block at all (it uses blocks of
int32_t). So remove said parameter.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 20:35:31 +02:00
584d50c5f3 avcodec/h263dec: Add H263DecContext
This is in preparation for moving the fields only used
by H.263-based decoders from MPVContext to H263DecContext.
For now only the decode_mb function pointer has been moved
(to be able to switch said callback to use an H263DecContext*).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 20:35:23 +02:00
3f5c2043cc avcodec/mpegvideo: Move dct_precision to Mpeg4DecContext
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 20:34:51 +02:00
758c8dffc9 avcodec/{h263,mpeg4video}dec: Pass MPVContext*, not Mpeg4DecContext*
The code in h263dec.c is not supposed to know that the MPEG-4
decoder uses an Mpeg4DecContext as private context at all
(said context is only exposed in a header so that hardware
accelerations can access it and for the parser to use).
Passing an MPVContext* directly also allows to remove
the indirection via AVCodecContext.priv_data.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 20:34:51 +02:00
91e9578025 avcodec/mpeg4videodec: Avoid unnecessary indirections
This basically reverts d4967c04e0.
Said commit was based on the false premise that it would
be an aliasing violation to upcast a pointer to structure
to a pointer to a bigger structure containing the original
structure as its first element, but this is just not true.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 20:34:51 +02:00
273de7f60c avcodec/mpegvideo: Move unrestricted_mv to MotionEstContext
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 20:34:51 +02:00
05510dac6b avcodec/mpegvideo: Move flipflop_rounding to {MSMPEG4Dec,MPVEnc}Context
Forgotten in 9964212545.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 20:34:51 +02:00
ee81e28469 avcodec/mpeg12dec: Deduplicate variables
This situation was created in merge commit
71d008ebe4.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 20:34:51 +02:00
94cfbf0238 avcodec/vc1: Don't use MpegEncContext.block
Instead add the necessary blocks directly to VC1Context
(only six are needed, not 12 as ff_mpv_common_init()
currently allocates).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 20:34:51 +02:00
fe2dbb12b0 avcodec/vc1: Stop using MpegEncContext.gb
Add a GetBitContext to VC1Context instead. This is in preparation
for removing MpegEncContext.gb.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 20:34:51 +02:00
aa4a5b1e33 avcodec/intrax8: Don't pretend to need more than one int16_t[64]
Intrax8 needs only a single block.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 20:34:51 +02:00
25e4baeed4 avcodec/rv34: Don't use MpegEncContext.block
These decoders only need a single 4x4 block; put it in RV34DecContext.
This is in preparation for removing MpegEncContext.block.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 20:34:51 +02:00
0e6d59871f avcodec/rv34: Don't use MpegEncContext.gb
This is in preparation for removing MpegEncContext.gb.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 20:34:51 +02:00
86ee71f4e9 avcodec/mpeg12dec: Remove unused function parameter
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 20:34:51 +02:00
b38f23663e avcodec/mpeg12dec: Put GetBitContext on the stack where advantageous
This is in preparation for no longer using MpegEncContext.gb.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 20:34:51 +02:00
21c88b29f7 avcodec/h261dec: Don't use MpegEncContext.block
Instead put it into H261DecContext. This is in preparation
for removing MpegEncContext.block.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 20:34:51 +02:00
80ed868296 avcodec/h261dec: Stop using MpegEncContext.gb
This is in preparation for removing said field from MpegEncContext.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 20:34:51 +02:00
fabbe79170 avcodec/mpegvideodec: Remove size expectation from ff_mpv_reconstruct_mb
In the common case of decoding 420 content, only six blocks are used
and it makes perfect sense for the caller to only have that many.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 20:34:51 +02:00
4fc874ef08 avcodec/mpeg_er: Don't use MpegEncContext.block
It is unused (because unquantizing/the idct has been disabled)
apart from FF_DEBUG_DCT_COEFF debug code which makes no sense
when this function is called via error resilience. So pass a NULL
as block when calling ff_mpv_reconstruct_mb() from mpeg_er_decode_mb()
and disable the debug code in this scenario.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 20:34:51 +02:00
8cff637cf0 avcodec/mpegvideo_dec: Reindent after the previous commit
Also use dedicated variables for the accesses.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 20:34:51 +02:00
261d8eb5dd avcodec/mpegvideo_dec: Factor debugging dct coefficients out
This allows to hint to the compiler that the branch is likely
not taken by marking the factored out function as av_cold.
It is also in preparation for further commits.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 20:34:51 +02:00
0723fcce51 avcodec/mpegvideo: Add MPVContext typedef
MpegEncContext is also used for decoding, so it is a misnomer.
This commit therefore adds MPVContext as typedef for it in order
to gradually switch the code to the new name (in line with
MPVEncContext).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 20:34:51 +02:00
3b87a480fe avcodec/mpegvideoenc: Allocate blocks as part of MPVEncContext
This avoids mpegvideo.c having to deal with the fact that
the encoders use two sets of blocks and is in preparation
for not allocating blocks at all.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 20:34:51 +02:00
1c258b5581 avcodec/ituh263dec: Only initialize ff_h263_rl_inter when needed
The H.263 decoder itself does not need max_run/max_level
of this RLTable, only the MPEG-4 decoder does.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-07-03 20:34:51 +02:00