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

118662 Commits

Author SHA1 Message Date
8aa08c9fa0 avcodec/vc1_block, vc1dec: Don't use c_dc_scale(_table)?
It coincides with the luma values.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-07 15:19:02 +01:00
3defca7eae avcodec/rv34: Make ff_rv34_get_start_offset() honor its name
Up until now, it only returned the number of bits for the
start offset, but not the start offset; the GetBitContext
passed to it was unused.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-07 15:19:02 +01:00
f9b8f30680 avcodec/aarch64/vvc: Optimize vvc_avg{8, 10, 12}
This patch replaces integer widening with halving addition, and
multi-step "emulated" rounding shift with a single asm instruction doing
exactly that.

Benchmarks before and after:
A78
avg_8_64x64_neon:                                     2686.2 ( 6.12x)
avg_8_128x128_neon:                                  10734.2 ( 5.88x)
avg_10_64x64_neon:                                    2536.8 ( 5.40x)
avg_10_128x128_neon:                                 10079.0 ( 5.22x)
avg_12_64x64_neon:                                    2548.2 ( 5.38x)
avg_12_128x128_neon:                                 10133.8 ( 5.19x)

avg_8_64x64_neon:                                      897.8 (18.26x)
avg_8_128x128_neon:                                   3608.5 (17.37x)
avg_10_32x32_neon:                                     444.2 ( 8.51x)
avg_10_64x64_neon:                                    1711.8 ( 8.00x)
avg_12_64x64_neon:                                    1706.2 ( 8.02x)
avg_12_128x128_neon:                                  7010.0 ( 7.46x)

A72
avg_8_64x64_neon:                                     5823.4 ( 3.88x)
avg_8_128x128_neon:                                  17430.5 ( 4.73x)
avg_10_64x64_neon:                                    5228.1 ( 3.71x)
avg_10_128x128_neon:                                 16722.2 ( 4.17x)
avg_12_64x64_neon:                                    5379.1 ( 3.51x)
avg_12_128x128_neon:                                 16715.7 ( 4.17x)

avg_8_64x64_neon:                                     2006.5 (10.61x)
avg_8_128x128_neon:                                   9158.7 ( 8.96x)
avg_10_64x64_neon:                                    3357.7 ( 5.60x)
avg_10_128x128_neon:                                 12411.7 ( 5.56x)
avg_12_64x64_neon:                                    3317.5 ( 5.67x)
avg_12_128x128_neon:                                 12358.5 ( 5.58x)

A53
avg_8_64x64_neon:                                     8327.8 ( 5.18x)
avg_8_128x128_neon:                                  31631.3 ( 5.34x)
avg_10_64x64_neon:                                    8783.5 ( 4.98x)
avg_10_128x128_neon:                                 32617.0 ( 5.25x)
avg_12_64x64_neon:                                    8686.0 ( 5.06x)
avg_12_128x128_neon:                                 32487.5 ( 5.25x)

avg_8_64x64_neon:                                     6032.3 ( 7.17x)
avg_8_128x128_neon:                                  22008.5 ( 7.69x)
avg_10_64x64_neon:                                    7738.0 ( 5.68x)
avg_10_128x128_neon:                                 27813.8 ( 6.14x)
avg_12_64x64_neon:                                    7844.5 ( 5.60x)
avg_12_128x128_neon:                                 26999.5 ( 6.34x)

Signed-off-by: Martin Storsjö <martin@martin.st>
2025-03-07 15:51:20 +02:00
7225e307be Added support for direct RGB input to AMF encoder 2025-03-06 15:38:58 +01:00
c7ff7345eb Enable 10-bit output for RGB input in AMF HEVC and AV1
encoders
2025-03-06 15:38:03 +01:00
30a8641465 lsws/ppc/yuv2rgb_altivec: Fix build in non-VSX environments with Clang
Add a check for the existence of the vec_xl() function. Clang provides
the function even with VSX not enabled.
2025-03-06 14:21:38 +01:00
696ea1c223 Don't attempt to parse ADTS from USAC packets.
It's not possible to put USAC into ADTS due to exceeding the
field size (4 bits) for ADTS profile. As such cases where
the frame starts with 0xfff shouldn't be checked.

This ensures the sample at https://crbug.com/396190942 is
properly detected as USAC content.

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
2025-03-06 00:31:20 +01:00
72cff47be7 avcodec/exr: Fix potential effective-type violation
Storing the values via a union of an uint32_t and a float makes
said union the effective type of the destination. This means that
it may only be read via such a union which is of course not what
our users do/expect. So store the values via AV_WN32A instead
which disables effective type analysis (for compilers that perform it).

This also fixes a -Wdeclaration-after-statement warning
introduced in 0e917389fe.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-05 17:59:40 +01:00
431805c096 avcodec/exr: Remove write-only gamma_table
Forgotten in 0e917389fe.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-05 17:59:24 +01:00
5560a20d77 avcodec/exr: use the correct step value for plane pointers
Fixes a regression since 0e917389fe.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-03-05 12:59:34 -03:00
0e917389fe avcodec/exr: do not output 32bit floats when a file stores 16bit floats
exr should not do a internal pixel format convert

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-03-05 03:29:25 +01:00
56cfbe3c9f avformat/mpegenc, mpegts. mxfenc: Mark (de)muxers declarations as internal
Otherwise compilers might emit code that presumes there to be
a GOT which can't be fixed by the linker.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-05 00:24:54 +01:00
57f184221d avutil/attributes_internal: Add EXTERN macro for extern+hidden
This is inspired by the equivalent dav1d attribute introduced
by Henrik Gramner in e4c4af02f3de5e6cea6f81272a2981c0fa7bae28.
Also already use it to beautify declarations.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-05 00:24:54 +01:00
19e907cd72 avcodec: Remove leftover alpha declarations
Forgotten in cdd139d760.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-05 00:06:52 +01:00
883120aaf0 avcodec/mpeg12dec: Use proper logcontext
When used with the "mpegvideo" or "mpeg1video" decoder (which do not
have a private class) this would lead to the log callback receiving
a non-NULL object with a NULL AVClass pointer. The default log callback
handles this gracefully, yet it is probably an API violation.

Reviewed-by: Ramiro Polla <ramiro.polla@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-05 00:04:04 +01:00
9e2773034b avformat/rtp_av1: Add necessary headers
Also use a void* instead of an AVFormatContext as logctx in parse_leb.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-04 15:34:38 +01:00
f76195ff65 avcodec/vc1dec: Don't initialize inter_scantable
It is unused.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-04 13:00:14 +01:00
ca56526d7f avcodec/mpegvideo_enc: Reindent after the previous commit
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-04 13:00:14 +01:00
772df65356 avcodec/mpegvideo_enc: Don't do unnecessary work for AMV
Up until now, the initialization of AMV's matrices happened
after the initialization for MJPEG matrices, overwriting
the earlier data. This commit changes this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-04 13:00:13 +01:00
8d87162254 avcodec/mpeg12dec: Really disable scratchpad allocations
ba341be095 disabled them for
the main thread only, not the slice threads.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-04 13:00:13 +01:00
4f2becc2dc avcodec/mpeg4videodec: Avoid copying packed bitstream data
This is possible because the packet is reference-counted
and because we never combine the data from several packets.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-04 12:58:30 +01:00
e3ebc1073e avcodec/mpegvideo: Move bitstream_buffer to mpeg4videodec
This is possible by moving the code using it to open a GetBitContext
from h263dec.c to mpeg4videodec.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-04 12:58:30 +01:00
e4470a8e30 avcodec/h263dec: Don't call ff_thread_finish_setup() unnecessarily
All hwaccels for MPEG-4/H.263 are run serially even when frame-threading
is in use. Therefore there is no gain in calling
ff_thread_finish_setup() in this case right before outputting
the frame.

Removing this call also allows to revert commit
39a5c0ac06.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-04 12:58:30 +01:00
79d6657e13 avcodec/mpeg12dec: Don't initialize unused parts of ScanTable
The MPEG-1/2 decoders don't need ScanTable.raster_end
(as the coefficients are unquantized as they are parsed).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-04 12:58:30 +01:00
e6657d499a avcodec/h26[134]dec: Always report the buffer to be completely consumed
It is pointless to try to report the true number because
decode_simple_internal() always treats the buffer as
completely consumed for video codecs anyway.
(Apart from that: The h263dec code would report to only
have consumed the header data in case decoding is aborted
due to skip_frame which makes no sense.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-04 12:58:30 +01:00
78b26225ba avcodec/mpeg4videoenc: Remove dead FF_BUG_MS code
Added in 59fa3f96f4,
yet avctx->workaround_bugs is never copied to
MpegEncContext.workaround_bugs, so this code is dead
(it seems that this was true even when it was added).
Furthermore, workaround_bugs is flagged as decoder-only,
so just remove the code.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-04 12:58:30 +01:00
1adc84136e avcodec/vc1: Add max_b_frames field to VC1Context
Don't reuse MpegEncContext.max_b_frames, which is supposed
to be encoder-only.

Reviewed-by: Ramiro Polla <ramiro.polla@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-04 12:56:35 +01:00
9202179754 avcodec/mpegvideo_dec: Move syncing DivX-stuff to mpeg4videodec.c
It is only used by MPEG-4 (and is used in h263dec.c and can therefore
not just be moved to Mpeg4DecContext...).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-04 12:53:50 +01:00
4c0960e968 avcodec/mpegvideo_dec: Don't sync max_b_frames
Only the VC-1 decoder (which does not use frame-threading)
and encoders use it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-04 12:53:50 +01:00
592d75dbeb avcodec/rv34: Don't update block_index unnecessarily
It is unused by RV30 and RV40.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-04 12:53:50 +01:00
ab38ff9161 avcodec/mips/mpegvideo_mmi: Don't check alternate_scan unnecessarily
Forgotten in 4f7aeffd8c.

Reviewed-by: Ramiro Polla <ramiro.polla@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-04 12:53:15 +01:00
2de9168b56 avcodec/msmpeg4dec: Remove redundant check
Since d50635cd24 the
dct_unquantize_h263_intra functions have set the number of
coefficients to 63 in case of ac_pred, so ff_msmpeg4_decode_block()
doesn't have to bump it on its own.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-04 12:53:15 +01:00
18fc118f65 avcodec/msmpeg4dec: Avoid branch
A non-LTO-compiler can't optimize this away.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-04 12:53:15 +01:00
4912a2d88e avcodec/msmpeg4dec: Don't process unnecessarily many coefficients
This code has been added in f5957f3fe2
when support for WMV1 has been added. It was needed for decoding
inter macroblocks, as WMV1 uses a different scantable and
the ScanTable and ScanTable.raster_end was not yet introduced
(the H263 unquantize function instead used a hardcoded version
of ff_zigzag_direct's raster_end). In other words,
there is no reason to continue to do so for WMV1 inter blocks.
(Apart from that: WMV1 inter blocks don't use
dct_unquantize_h263_inter any more, as unquantizing happens
when parsing the block via specialized RL VLC tables.)

It is also not needed for WMV1/2 intra blocks (for non-ac_pred
it uses the correct ScanTable used by the h263 unquantize
intra function; for ac_pred, the number is overridden)
as well as for WMV2 inter-blocks (raster_end is not really
used in this case; the ordinary ScanTable is used in case
abt_type is zero, otherwise there are two different ScanTables
and block_last_index is overridden in wmv2dec.c).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-04 12:53:15 +01:00
db8546dff7 avcodec/mpeg12dec: Remove write-only assignments
This decoder unquantizes while parsing blocks
and does not use dct_unquantize_mpeg1_intra
(which uses *_dc_scale) at all.

repeat_field was unused since
e0a3d744a0.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-04 12:53:15 +01:00
3474475e58 avcodec/h261dec: Inline constant
The value here has been set in ff_set_qscale() from
ff_mpeg1_dc_scale_table, all of whose entries are 8.

Reviewed-by: Ramiro Polla <ramiro.polla@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-04 12:51:54 +01:00
9c16d54a16 avcodec/h261dec: Remove dead check
H.261 does not have non-reference frames.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-04 12:51:54 +01:00
a5d590963c tests/fate/vcodec: Test H.261 loop-filter
Increases coverage.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-04 12:51:54 +01:00
57ade06ffe tests/fate/vcodec: Test using mpeg2-quantizers for MPEG-4
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-04 12:51:54 +01:00
c960b42efc tests/fate/vcodec: Test alternate_scan
Encoding was untested before this.
Notice that the filesize degradation is partially due to
mpegvideo no longer using progressive_sequence and
progressive_frame.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-04 12:51:54 +01:00
a885351ad0 avcodec/vc1dec: Reenable debug-info output for field pictures
Effectively reverts c59b5e3d1e.
This is possible now that ff_print_debug_info2() uses
the MPVPicture dimensions.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-04 12:51:54 +01:00
973c7a0c65 avcodec/mpegvideo_dec: Use picture-dimensions in ff_print_debug_info()
It will allow to avoid the special case for VC-1 field pictures.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-04 12:51:54 +01:00
d4fd475005 avcodec/motion_est: Avoid branches for put(_no_rnd) selection
MotionEstContext contains pointers (to function pointers) that
have been set on a per-frame basis depending upon no_rounding
in ff_me_init_pic() to avoid branches like these. Also makes
MotionEstContext more independent of MpegEncContext.

Reviewed-by: Ramiro Polla <ramiro.polla@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-04 12:45:33 +01:00
b3ba961df6 avcodec/mpegvideo_enc: Add AV_CODEC_CAP_DR1
The mpegvideo-based encoders do one uncommon thing with
the packet's data given by ff_alloc_packet(): They potentially
reallocate it. But this only affects the internal buffer
and is not user-facing at all, so one can nevertheless
use the AV_CODEC_CAP_DR1 for them.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-04 12:45:33 +01:00
ab768b88e0 avcodec/mpegvideo_enc: Don't set qscale_table value prematurely
When there are multiple candidates for macroblock type, the encoder
tries them all. In order to do so, it keeps several sets of states
containing the variables that get modified when encoding
the macroblock and in the end uses the best of these.

Yet one variable was set, but not included in this state:
The current macroblock's qscale value in the current picture's
qscale_table. This may currently be set multiple times in
mpv_reconstruct_mb(), yet it is read when adaptive_quant is true.
Currently, the value read can be the value set by the last attempt
to write the current macroblock and not the initial value.

Fix this by only setting the qscale_table value in one place
outside of mpv_reconstruct_mb() (where it does not belong at all).

Reviewed-by: Ramiro Polla <ramiro.polla@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-04 12:44:18 +01:00
3e9777dc75 aarch64/hevcdsp_idct_neon: Add implementation for idct dc 12
Reduce binary size at the same time. The performance compared to clang -O3
is the same.

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-03-04 17:01:58 +08:00
5977bff569 aarch64/hevcdsp_idct_neon: Optimize idct dc
clang does better than the assembly code before the patch, especially
for small size:

hevc_idct_4x4_dc_8_c:                                   11.2 ( 1.00x)
hevc_idct_4x4_dc_8_neon:                                15.5 ( 0.73x)
hevc_idct_4x4_dc_10_c:                                  12.0 ( 1.00x)
hevc_idct_4x4_dc_10_neon:                               15.2 ( 0.79x)
hevc_idct_8x8_dc_8_c:                                   13.2 ( 1.00x)
hevc_idct_8x8_dc_8_neon:                                18.2 ( 0.73x)
hevc_idct_8x8_dc_10_c:                                  13.5 ( 1.00x)
hevc_idct_8x8_dc_10_neon:                               17.2 ( 0.78x)
hevc_idct_16x16_dc_8_c:                                 41.8 ( 1.00x)
hevc_idct_16x16_dc_8_neon:                              37.8 ( 1.11x)
hevc_idct_16x16_dc_10_c:                                41.8 ( 1.00x)
hevc_idct_16x16_dc_10_neon:                             37.8 ( 1.11x)
hevc_idct_32x32_dc_8_c:                                130.2 ( 1.00x)
hevc_idct_32x32_dc_8_neon:                             132.2 ( 0.98x)
hevc_idct_32x32_dc_10_c:                               130.2 ( 1.00x)
hevc_idct_32x32_dc_10_neon:                            132.2 ( 0.98x)

This patch basically clone what the compiler does, so the performance
is the same.

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-03-04 17:01:58 +08:00
5a32496962 avcodec/libuavs3d: process extradata
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-03-04 17:01:58 +08:00
2d7966aee1 avformat/isom_tags: Add tag for AVS3
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-03-04 17:01:58 +08:00
a053516e64 avformat/movenc: Add AVS3 support
'avs3' is registered at mp4ra.org. The Avs3ConfigurationBox 'av3c'
inside 'avs3' hasn't been registered yet, but is specified by the
AVS3 spec.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-03-04 17:01:58 +08:00