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

118850 Commits

Author SHA1 Message Date
3869862b00 avcodec/mpeg12: Avoid temporary stack VLC array during RL VLC init
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:26:07 +01:00
0facdafd1e avcodec/vlc: Merge VLCElem and RL_VLC_ELEM
It will simplify creating RL-VLCs (which until now used
a stack-based VLC as temporary buffer).

Notice that there would be another option to merge them, namely:
struct VLCElem {
    union {
        VLCBaseType sym;
        int16_t level;
    };
    int8_t len;
    uint8_t run;
};

The main difference to the current patch is that this would change
the type of the length field of VLCElem to int8_t from int16_t.
It turns out that that this would entail additional sign extensions
on ppc, see https://godbolt.org/z/behWYEYE7. I have therefore refrained
from doing so, although it would make the patch simpler.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:26:07 +01:00
54d582e749 avcodec/pcm: Avoid AVCodec.sample_fmts for decoders
These fields are meant to be for encoders; just use a local
table in pcm_decode_init() to convert from AVCodecID to AVSampleFormat
and also use it to provide sample_size.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:19:12 +01:00
05ab776210 avcodec/pcm: Reindent after the previous commit
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:18:15 +01:00
c6d7436508 avcodec/pcm: Use dedicated init function for F16LE, F24LE
This avoids a switch and allows to simply use
a dedicated private context for them.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:18:14 +01:00
e76daf6279 avcodec/pcm: Don't allocate LUT when unused
Instead use a dedicated context for the few decoders that
use the LUT. Also use a dedicated init function for them.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:11:47 +01:00
f2168f4d86 avcodec/pcm: Remove duplication from FFCodec define macros
Also align it in preparation of a slightly longer macro.

Reviewed-by: Ramiro Polla <ramiro.polla@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:05:39 +01:00
485e5388e9 avcodec/pcm: Cache sample_size value
No need to go through two switches per packet.

Reviewed-by: Ramiro Polla <ramiro.polla@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 02:58:09 +01:00
5247090b0d avcodec/pcm: Remove always-false check
All codecs here have a valid sample size at this point.
This check has (presumably) been added for DVD PCM,
but even for them the check was always-true after
381e195b46 (and the DVD
code was later moved out altogether). So just remove
this check and the leftover DVD comment.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 02:57:35 +01:00
1eafbf8203 avcodec/exrdec: restore applying color transfer characteristics for float16 samples
Regression since 0e917389fe.
This change also reverts commit 431805c096.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-03-16 11:38:13 -03:00
b5be0c0aa9 avcodec/eamad: Don't store transient macroblock indices in context
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-16 04:24:32 +01:00
f6366cb5ea avcodec/eamad: Optimize processing escape codes
Said escape code is only six bits long, so that one has at least 25 - 6
bits in the bitstream reader's cache after reading it; therefore the
whole following 16 bits (containing the actual code) are already in the
bitstream reader's cache, making it unnecessary to reload the cache.

This is the eamad analogue of fe9bc1cc45.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-16 04:24:32 +01:00
2e5f01e064 avcodec/mdec: Don't update cache unnecessarily
It won't be used anyway.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-16 04:24:32 +01:00
9aeb6940a2 avcodec/mdec: Optimize processing escape codes
Said escape code is only six bits long, so that one has at least 25 - 6
bits in the bitstream reader's cache after reading it; therefore the
whole following 16 bits (containing the actual code) are already in the
bitstream reader's cache, making it unnecessary to reload the cache.

This is the mdec analogue of fe9bc1cc45.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-16 04:24:32 +01:00
de562e8069 avcodec/mdec: Remove write-only block_last_index
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-16 04:24:32 +01:00
461b86fe7d avcodec/intrax8: Stop setting write-only block_last_index
These values are only used by the mpegvideo unquantize functions,
yet these are not active when intrax is in use. Furthermore,
given that ff_intrax8_decode_picture() decodes multiple
macroblocks in a given call, it makes no sense to return
any value (that was in practice the maximum of the indices
of all the macroblocks decoded).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-16 04:24:32 +01:00
1a564c1aff avcodec/vc1_block: Stop setting write-only block_last_index
It is only used by the mpegvideo unquantize functions which
this decoder does not use at all.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-16 04:24:32 +01:00
594b97e433 avcodec/mpegvideo_dec: Mark init, flush, close functions as av_cold
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-16 04:24:32 +01:00
248a6578a3 avcodec/msmpeg4enc: Inline constant
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-16 04:24:32 +01:00
c88614662c avcodec/d3d12va_encode: use the correct specifier to log size_t values
Signed-off-by: James Almer <jamrial@gmail.com>
2025-03-15 21:06:33 -03:00
3f57063c58 avcodec/ffv1dec: set the FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM capability
Will prevent decoding frame data during probing.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-03-15 18:43:18 -03:00
63fa1f52b9 swscale/swscale_unscaled: make the fast planar copy path work with more formats
dst_depth - src_depth where the result is 6 or 7 in a high bd path means this
is only executed for 16 -> 10 and 16 -> 9.
This patch makes this path general, supporting arbitrary formats as long as
dst_depth > src_depth > 8.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-03-15 18:43:18 -03:00
819dec697a swscale/swscale_unscaled: account for semi planar formats with data in the msb
Fixes fate failures introduced by recent tests that exercise the faulty code.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-03-15 18:43:18 -03:00
26c5d8cf5d lavc/vvc: Fix NumEntryPoints derivation
If pps_single_slice_per_subpic_flag is 1,
slice_{width,height}_in_tiles are undefined and we must instead get the
dimensions of the slice by referring to the corresponding subpicture.

Signed-off-by: Frank Plowman <post@frankplowman.com>
2025-03-15 10:46:32 +08:00
2da40904f3 avcodec/x86/hevc/dsp_init: Rename ff_hevc_put_hevc->ff_hevc_put
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-15 02:30:56 +01:00
44ed8f61d7 avcodec/aom_film_grain: Cast const away to suppress compiler warning
av_frame_side_data_add() typically takes ownership of
the provided AVBufferRef reference and therefore
uses a parameter of type AVBufferRef**; yet with
the AV_FRAME_SIDE_DATA_FLAG_NEW_REF, it creates
new references instead, without touching the given
reference. Therefore it is safe to cast const away.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-15 02:30:56 +01:00
ae84aa775f swscale/utils: split off format code into new file
utils.c is getting quite crowded, and I need a new place to dump a lot of
format handling code for the ongoing rewrite. Rather than bloating this file
even more, start splitting format handling helpers off into a new file.

This also renames the existing utils.h header, which didn't really contain
anything except the SwsFormat definition anyway (the prototypes for what should
have been in utils.h are all still in the legacy swscale_internal.h).
2025-03-14 19:50:44 +01:00
e4c8e80a2e avcodec/x86/constants: Move constants only used by cavsdsp to it
And make them static.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-14 11:42:41 +01:00
437cbd25e0 avcodec/ffv1: Implement jeromes idea of making remap flip optional
This also makes remap optional (which is a good idea even if we decide to keep flip fixed)

Effect on compression (using 2 rawlsb, golomb rice, large context model with ACES_OT_VWG_SampleFrames

-rw-r----- 1 michael michael 499101306 Mär 11 14:58 float-303503-try3d-m2.nut
-rw-r----- 1 michael michael 503700199 Mär 11 14:57 float-303503-try3d-m1.nut
-rw-r----- 1 michael michael 518150578 Mär 11 14:57 float-303503-try3d-m0.nut
(the test above used the rawlsb patch, which is not applied yet)

Reviewed-by: Jerome Martinez <jerome@mediaarea.net>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-03-14 02:04:25 +01:00
dcf6142794 avcodec/ffv1enc: add space for the remap table to max_size
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-03-14 02:03:59 +01:00
a90ff81287 avcodec/ffv1enc: Factor set_micro_version() out of ff_ffv1_write_extradata()
and call it from ff_ffv1_encode_init()

setting micro version from code writing the extradata is messy, this should
be cleaner

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-03-14 02:03:59 +01:00
e0aedeb72e avformat/webvttdec: Add webvtt extension and MIME type
The webvtt extension is sometimes used in HLS playlists.

Signed-off-by: softworkz <softworkz@hotmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-03-14 02:03:59 +01:00
0978fea7fa avcodec/vlc: Reduce debug logging
Signed-off-by: softworkz <softworkz@hotmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-03-14 02:03:58 +01:00
52eb0e18db avfilter/vsrc_testsrc: use aligned macros for writing
Signed-off-by: James Almer <jamrial@gmail.com>
2025-03-13 15:00:10 -03:00
c3b60e0df7 tests/fate/pixfmt: add conversion tests with semi planar YUV formats
Signed-off-by: James Almer <jamrial@gmail.com>
2025-03-13 15:00:10 -03:00
228713ef5d swscale/input: add support for UYYVYY411
Signed-off-by: James Almer <jamrial@gmail.com>
2025-03-13 15:00:05 -03:00
154c00514d lavc/videotoolboxenc: add hevc main42210 and p210
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-03-13 18:34:22 +08:00
958c46800e avcodec/mjpegenc: Reconstify mjpeg encoder
It has been deconstified in 2c2dfd9149
because the FFCodec is touched in av_codec_init_static because
of its get_supported_config callback. Yet this is easily remedied:
Only call get_supported_config to set pix_fmts if the codec does
not already have it set.

This also fixes a mismatch between the declaration of ff_mjpeg_encoder
in allcodecs.c and the definition in mjpegenc.c. Said mismatch is
actually undefined behaviour.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-13 02:20:06 +01:00
ed1b76cdb7 avcodec/allcodecs: Don't wrap supported_framerates
Only two encoders (the native MPEG-1/2 ones) provide
supported_framerates and they don't implement the
get_supported_config callback. It is highly unlikely that
any codec will set supported_framerates dynamically at all,
so remove the code querying for frame rates.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-13 02:20:06 +01:00
bfbceb7d55 avcodec/tests/avcodec: Silence deprecation warnings
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-13 02:20:05 +01:00
c8be309719 avcodec/codec_internal: Add inlined version of av_codec_is_(de|en)coder
These functions check whether the AVCodec* is NULL, but this
has already been checked at a lot of places in our codebase,
so that it boils down to checking the is_decoder flag.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-13 02:16:27 +01:00
47d7c6cd15 avcodec/codec_internal: Add dedicated is_decoder flag to FFCodec
Allows to simplify av_codec_is_decoder() and av_codec_is_encoder().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-13 02:16:27 +01:00
3e19e5062c avcodec/decode: Move is_open check to avcodec_receive_frame()
It also applies to scenarios where ff_encode_receive_frame()
is used. Also remove the redundant av_codec_is_decoder().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-13 02:16:27 +01:00
fed6612415 avcodec/cuviddec: use pre-existing chroma format information
Fixes #11505
2025-03-13 01:47:02 +01:00
4c7d0f88f5 avcodec/Makefile: remove redundant object
It's already listed in OBJS-$(CONFIG_JNI), which should cover all cases
STLIBOBJS does and more.
2025-03-13 01:28:50 +01:00
34aa8449b8 avcodec/pthread*: Mark init, free, flush functions as av_cold
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-12 17:00:24 +01:00
8abac5898b avcodec/sbcdec_data: Merge data into header
sbcdec_data.h is only included by sbcdec.c, so this won't
cause the data to be included multiple times in the binary.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-12 17:00:24 +01:00
a6c58450da all: Fix doxy comments wrongly designated as trailing ///<
The ///< or /**< form of doxygen comments are only to be used
when the documentation follows the member and the comment
block starts on the same line as the member. This commit
fixes wrong uses of them; in particular, this fixes the comment
for mb_height in H.264 SPS's structure which was wrongly added
to mb_width.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-12 17:00:24 +01:00
e99faf28d5 avcodec/vc2enc: Avoid excessive inlining
There is no reason to inline put_vc2_ue_uint() everywhere;
only one call site is actually hot: The one in encode_subband()
(which accounts for 35735040 of 35739495 calls to said function
in a FATE run). Uninline all the others.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-12 16:58:53 +01:00
fcd5df5904 fftools/ffmpeg_opt: Remove unused alt_bsf
Forgotten in 6325aede08.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-12 16:58:16 +01:00