Commit graph

53368 commits

Author SHA1 Message Date
Jun Zhao
b326b3a08d lavc/av1_parser: Extract SAR from render_size
Extract the Sample Aspect Ratio (SAR) from render_width_minus_1 and
render_height_minus_1 in the sequence header.

The AV1 specification defines the render dimensions, which can be used
in conjunction with the coded dimensions to determine the pixel aspect
ratio. This ensures consistent aspect ratio handling for AV1 streams
encapsulated in containers like MP4 or MKV, as observed in the updated
FATE tests where SAR changes from 0/1 to 1/1.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2026-01-14 23:56:39 +00:00
Lynne
e51c549f6e
vulkan/dpx: drop using the nontemporal extension
Its rarely respected by implementations, its fairly new (1 year old),
and it has a scuffed define (neither glslc nor glslang enable the
"GL_EXT_nontemporal_keyword" define if its enabled, unlike all other extensions).
2026-01-14 16:13:22 +01:00
Lynne
f2a55af9a4
vulkan_dpx: switch to compile-time SPIR-V generation 2026-01-12 17:28:43 +01:00
Lynne
0f4667fc11
vulkan_prores_raw: clean up and optimize 2026-01-12 17:28:42 +01:00
averne
771b58c0b6
vulkan/prores: fix buffer alignments 2026-01-12 17:28:42 +01:00
Lynne
23ab1b1a66
vulkan/dct: embed DCT scaling values during SPIR-V generation
Instead of relying on rounded off values, use specialization constants
to bake the DCT values into the shader when its compiled.
2026-01-12 17:28:42 +01:00
Lynne
e27b510da8
vulkan_prores: generate SPIR-V at compile-time 2026-01-12 17:28:42 +01:00
Lynne
026e94e339
vulkan_prores_raw: use compile-time SPIR-V generation 2026-01-12 17:28:42 +01:00
Lynne
f2affdfafb
configure/make: support compile-time SPIR-V generation 2026-01-12 17:28:40 +01:00
Soham
ecfabc25c2
avcodec/get_bits: mark unused VLC parameters
This commit marks unused parameters in get_vlc_multi() to fix
-Wunused-parameter warnings when building with -Wall/-Wextra.

No functional changes intended.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-01-12 14:03:25 +01:00
stevxiao
21a3e44fbe avcodec/d3d12va_encode: add Region of Interest (ROI) support
This commit implements ROI (Region of Interest) encoding support for D3D12VA hardware encoders, enabling spatially-adaptive quality control for H.264, HEVC, and AV1 encoders.

Query for `D3D12_VIDEO_ENCODER_RATE_CONTROL_FLAG_ENABLE_DELTA_QP` support during initialization to check whether the hardware support delta QP. If delta QP is supported, then process `AV_FRAME_DATA_REGIONS_OF_INTEREST` side data and generate delta QP maps for each frame.

Sample command line:
ffmpeg.exe -hwaccel d3d12va -hwaccel_output_format d3d12 -i input.mp4 -vf addroi=x=480:y=270:w=960:h=540:qoffset=-1/5 -c:v hevc_d3d12va output.mp4
2026-01-12 02:45:48 +00:00
James Almer
188521c7ad avcodec/lcevc: attach a reference to the source frame to each passed in base picture
This way we can ensure a frame reference will always exists for as long as the
external library needs the base picture.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-01-11 17:59:15 -03:00
Hassan Hany
202b7d29e8 avcodec/pngenc: disable background disposal for non-alpha formats 2026-01-11 00:47:17 +00:00
Andreas Rheinhardt
685011003f avcodec/x86/pngdsp: Remove MMXEXT function overridden by SSSE3
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-01-10 22:47:22 +01:00
Andreas Rheinhardt
31daa7cd87 avcodec/pngdsp: Use proper prefix ff_add_png->ff_png_add
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-01-10 22:47:22 +01:00
Andreas Rheinhardt
5f15c067fe avcodec/pngdsp: Constify
Also constify ff_png_filter_row().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-01-10 22:47:22 +01:00
Andreas Rheinhardt
3bbb3269a1 avcodec/pngdec: Move ff_add_png_paeth_prediction() to pngdsp.c
Also rename it to ff_png_add_paeth_prediction() so that it
has a proper prefix.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-01-10 22:47:22 +01:00
Zhao Zhili
8777fa60e6 avcodec/bswapdsp: improve performance by remove manually unroll
Manually unrolling loops increases code size, which can sometimes
improve performance, but more often than not, it degrades performance.
Keep the C version simple, and add assembly optimizations when needed.

                 x86-clang    x86-gcc-arch-native  x86-msvc     m1-clang      rpi5-clang       pi5-gcc-14
-------------------------------------------------------------------------------------------------------------
bswap_buf_c      57.3 ( 1.00x)  19.4 ( 1.00x)   55.4 ( 1.00x)   0.5 ( 1.00x)  143.5 ( 1.00x)   59.8 ( 1.00x)
bswap_buf_this*  49.0 ( 1.17x)  12.5 ( 1.56x)   17.7 ( 3.13x)   0.3 ( 2.04x)   57.9 ( 2.48x)   73.5 ( 0.81x)
bswap_buf_sse2   28.4 ( 2.02x)  24.3 ( 0.80x)   25.5 ( 2.18x)   -              -               -
bswap_buf_ssse3  24.6 ( 2.32x)  16.0 ( 1.22x)   19.0 ( 2.92x)   -              -               -
bswap_buf_avx2   21.2 ( 2.70x)  11.1 ( 1.74x)   11.2 ( 4.95x)   -              -               -

bswap_buf_c: C implementation before this patch
bswap_buf_this: C implementation after this patch

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2026-01-10 18:56:26 +00:00
Ramiro Polla
272c273d30 Revert "avcodec/jpeglsdec: Check get_bits_left() before decoding a picture"
This check has been made redundant by f80224ed19 and fe7fbf3a22.

This reverts commit 4bc3008d04.
2026-01-08 23:05:28 +00:00
Ramiro Polla
2170f397ea Revert "avcodec/mjpegdec: Check for for the bitstream end in mjpeg_decode_scan_progressive_ac()"
This commit has been made redundant by 909faca929, which is run more
often (once per mb instead of once per line).

This reverts commit 3782656631.
2026-01-08 22:33:01 +00:00
Georgii Zagoruiko
8acdffa22c aarch64/vvc: Optimisations of put_luma_v() functions for 10/12-bit
RPi4 (auto-vectorisation is on)
put_luma_v_10_4x4_c:                                   303.3 ( 1.00x)
put_luma_v_10_4x4_neon:                                 55.7 ( 5.45x)
put_luma_v_10_8x8_c:                                  1106.7 ( 1.00x)
put_luma_v_10_8x8_neon:                                163.8 ( 6.76x)
put_luma_v_10_16x16_c:                                2242.1 ( 1.00x)
put_luma_v_10_16x16_neon:                              672.7 ( 3.33x)
put_luma_v_10_32x32_c:                                7057.3 ( 1.00x)
put_luma_v_10_32x32_neon:                             2731.3 ( 2.58x)
put_luma_v_10_64x64_c:                               25699.8 ( 1.00x)
put_luma_v_10_64x64_neon:                            12145.6 ( 2.12x)
put_luma_v_10_128x128_c:                             90694.6 ( 1.00x)
put_luma_v_10_128x128_neon:                          44862.4 ( 2.02x)
put_luma_v_12_4x4_c:                                   304.4 ( 1.00x)
put_luma_v_12_4x4_neon:                                 55.6 ( 5.47x)
put_luma_v_12_8x8_c:                                  1107.4 ( 1.00x)
put_luma_v_12_8x8_neon:                                164.7 ( 6.72x)
put_luma_v_12_16x16_c:                                2235.8 ( 1.00x)
put_luma_v_12_16x16_neon:                              672.5 ( 3.32x)
put_luma_v_12_32x32_c:                                7049.2 ( 1.00x)
put_luma_v_12_32x32_neon:                             2731.6 ( 2.58x)
put_luma_v_12_64x64_c:                               25706.5 ( 1.00x)
put_luma_v_12_64x64_neon:                            12145.0 ( 2.12x)
put_luma_v_12_128x128_c:                             90672.5 ( 1.00x)
put_luma_v_12_128x128_neon:                          44857.1 ( 2.02x)

Apple M4 (auto-vectorisation is on):
put_luma_v_10_4x4_c:                                    25.6 ( 1.00x)
put_luma_v_10_4x4_neon:                                  3.1 ( 8.18x)
put_luma_v_10_8x8_c:                                    34.7 ( 1.00x)
put_luma_v_10_8x8_neon:                                 10.5 ( 3.32x)
put_luma_v_10_16x16_c:                                 103.9 ( 1.00x)
put_luma_v_10_16x16_neon:                               42.3 ( 2.45x)
put_luma_v_10_32x32_c:                                 399.7 ( 1.00x)
put_luma_v_10_32x32_neon:                              161.8 ( 2.47x)
put_luma_v_10_64x64_c:                                1276.7 ( 1.00x)
put_luma_v_10_64x64_neon:                              840.1 ( 1.52x)
put_luma_v_10_128x128_c:                              4981.3 ( 1.00x)
put_luma_v_10_128x128_neon:                           3008.0 ( 1.66x)
put_luma_v_12_4x4_c:                                    23.6 ( 1.00x)
put_luma_v_12_4x4_neon:                                  2.0 (11.84x)
put_luma_v_12_8x8_c:                                    31.8 ( 1.00x)
put_luma_v_12_8x8_neon:                                 12.4 ( 2.55x)
put_luma_v_12_16x16_c:                                 100.8 ( 1.00x)
put_luma_v_12_16x16_neon:                               44.9 ( 2.25x)
put_luma_v_12_32x32_c:                                 331.1 ( 1.00x)
put_luma_v_12_32x32_neon:                              175.2 ( 1.89x)
put_luma_v_12_64x64_c:                                1227.1 ( 1.00x)
put_luma_v_12_64x64_neon:                              712.7 ( 1.72x)
put_luma_v_12_128x128_c:                              5149.1 ( 1.00x)
put_luma_v_12_128x128_neon:                           2809.3 ( 1.83x)
2026-01-08 17:35:55 +00:00
Ramiro Polla
165448f7d1 avcodec/mjpegdec: remove buggy_avid field from MJpegDecodeContext
This field has been unused since b6c04b6821.
2026-01-08 16:29:32 +00:00
Ruikai Peng
f1dbef3e38 avcodec/mjpegdec: avoid negative len in APP parser
The APP parser can read a fixed number of bytes without checking len,
making len negative and passing it to bytestream2_skipu(), which takes
an unsigned size. This can advance the buffer by a huge amount and
results in undefined behavior.

Add small len guards in the fixed-size AVI1/LJIF paths and only skip
the tail if len > 0.

Signed-off-by: Ruikai Peng <ruikai@pwno.io>
2026-01-07 17:33:02 +00:00
Andreas Rheinhardt
1461dfcde7 avcodec/amfdec: Check correct value, return error upon error
Found via an unused-variable warning from GCC.
Also just forward the error from amf_init_frames_context().

This bug has been introduced in
4479d28103.

Reviewed-by: Jan Ekström <jeebjp@gmail.com>
Reviewed-by: Mikhail Mironov <mikhail.mironov@amd.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-01-07 17:32:06 +01:00
Cosmin Stejerean
56bc8fd0a1 avcodec/dovi_rpu(enc|dec) - fix parsing and writing of L11 DoVi metadata
sharpness, noise_reduction, mpeg_noise_reduction,
frame_rate_conversion, brightness and color are not actual fields in
L11 metadata, this appears to be based on perhaps an out of date
patent specification. Instead the two bytes are considered
reserved.

Drop reading them and write out 0s, the fields will be deprecated from
the struct in a future commit and scheduled for removal.
2026-01-07 13:14:11 +00:00
Leo Izen
ec42a0aec0
avcodec/exif: avoid overflow with supplemental extra IFDs
If extra IFDs occur outside of the top level, we don't allocate enough
buffer space for them. This commit changes our calculation to include
their size always, and then we shrink the allocated buffer once every
IFD is written (by at most 192 bytes).

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2026-01-07 04:01:51 -05:00
Andreas Rheinhardt
90920a645e avcodec/vc1dec: Reduce size of allocation
blk_mv_type is only set for block 0-3, not for chroma blocks,
so it only needs four elements per MB.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-01-06 00:02:16 +01:00
Timo Rothenpieler
b5d6cfd55b avcodec/notchlc: zero-initialize history buffer
Otherwise a specially crafted bitstream can potentially read
uninitialized stack memory.

Fixes #YWH-PGM40646-37
2026-01-05 13:30:38 +00:00
Timo Rothenpieler
7f44dcfbfb avcodec/notchlc: actually use HISTORY_SIZE to initialize history 2026-01-05 13:30:38 +00:00
Ramiro Polla
1debadd58e avcodec/mjpegdec: use GetByteContext instead of GetBitContext where possible
JPEG is mostly byte-aligned. We only really need GetBitContext while
decoding the image data.

Suggested-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-01-05 13:14:15 +00:00
Ramiro Polla
6f6826d2e0 avcodec/mxpegdec: remove unnecessary scope and indentation 2026-01-05 13:14:15 +00:00
Ramiro Polla
fdff03425b avcodec/mjpegdec: fix indentation for previous commit 2026-01-05 13:14:15 +00:00
Ramiro Polla
a84627aca9 avcodec/mjpegdec: add mjpeg_parse_len() helper
And check for length field in a consistent manner.
2026-01-05 13:14:15 +00:00
Ramiro Polla
abb0247017 avcodec/mjpegdec: improve check for length in ff_mjpeg_decode_dqt() 2026-01-05 13:14:15 +00:00
Zhao Zhili
840183d823 aarch64/hpeldsp_neon: fix out-of-bounds read
Fix #21141

The performance improved a little bit.
On A76:
                              Before            After
put_pixels_tab[0][1]_neon:    32.4 ( 3.91x)     31.6 ( 3.99x)
put_pixels_tab[0][3]_neon:    88.0 ( 4.50x)     74.6 ( 5.31x)
put_pixels_tab[1][1]_neon:    33.5 ( 2.52x)     31.2 ( 2.71x)
put_pixels_tab[1][3]_neon:    30.5 ( 3.61x)     21.7 ( 5.08x)

On A55:
                             Before            After
put_pixels_tab[0][1]_neon:   175.2 ( 2.41x)    138.7 ( 3.04x)
put_pixels_tab[0][3]_neon:   334.3 ( 2.71x)    296.1 ( 3.07x)
put_pixels_tab[1][1]_neon:   168.3 ( 1.78x)     94.1 ( 3.19x)
put_pixels_tab[1][3]_neon:   112.3 ( 2.20x)     90.0 ( 2.74x)
2026-01-04 03:22:55 +00:00
Andreas Rheinhardt
fb72a3d567 avcodec/vc1_block: Simplify vc1_coded_block_pred()
Make it already apply the prediction, avoiding the pointer indirection.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-01-02 18:39:48 +01:00
Andreas Rheinhardt
0d2ab41ec8 avcodec/h261: Remove H261Context
It only contains a single field, so add this directly to MPVContext
and remove private_ctx. This avoids an indirection in
ff_h261_loop_filter().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-01-02 18:39:48 +01:00
Andreas Rheinhardt
3946e57797 avcodec/mpegvideo: Move permutated_intra scans to {H263Dec,MPVEnc}Ctx
Only used by these two.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-01-02 18:39:48 +01:00
Andreas Rheinhardt
c9c452688b avcodec/wmv2dec: Avoid indirection
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-01-02 18:39:48 +01:00
Andreas Rheinhardt
90191e8ab9 avcodec/wmv2: Remove WMV2Context
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-01-02 18:39:48 +01:00
Andreas Rheinhardt
f02f948ed0 avcodec/wmv2dsp: Modify IDCTDSPContext directly
This allows to remove ff_wmv2_common_init() altogether.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-01-02 18:39:48 +01:00
Andreas Rheinhardt
34c9438bbe avcodec/wmv2dsp: Move mspel motion functions out of WMV2DSPContext
They are only used by the decoder (which has them twice, because
the IntraX8Context contains a WMV2DSPContext whose put_mspel_pixels
functions were unused), so move them there.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-01-02 18:39:48 +01:00
Andreas Rheinhardt
956bfec115 avcodec/wmv2: Move ff_msmpel_motion() to the decoder
mspel is not supported by the encoder.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-01-02 18:39:48 +01:00
Andreas Rheinhardt
70b58e770d avcodec/msmpeg4: Mark unreachable code as unreachable
Reviewed-by: Ramiro Polla <ramiro.polla@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-01-02 18:39:22 +01:00
Andreas Rheinhardt
1674ff14e9 avcodec/wmv2dec: Mark unreachable code as unreachable
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-01-02 18:30:43 +01:00
Andreas Rheinhardt
224473b676 avcodec/wmv2dec: Don't put skip_type in context
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-01-02 18:30:43 +01:00
Andreas Rheinhardt
11b32b780f avcodec/msmpeg4: Avoid branch
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-01-02 18:30:43 +01:00
Andreas Rheinhardt
4f4cbed928 avcodec/msmpeg4: Initialize WMV2 generically
WMV1 and WMV2 use other scantables and therefore
ff_msmpeg4_common_init() reinitializes them. Yet WMV2
also uses a different IDCT overwriting the ordinary one,
so that the IDCT permutation changes and therefore
ff_wmv2_common_init() (called after ff_msmpeg4_common_init())
needs to reinitialize the scantables again.

Avoid this by calling ff_wmv2_common_init() in
ff_msmpeg4_common_init().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-01-02 18:30:43 +01:00
Andreas Rheinhardt
15e1e61888 avcodec/wmv2: Don't initialize BlockDSPContext redundantly
ff_mpv_common_init() already does it for us.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-01-02 18:30:43 +01:00
Ramiro Polla
ee5d6e7ee1 avcodec/jpeglsdec: propagate error from ff_jpegls_decode_picture()
Fixes fe7fbf3a22
2026-01-01 23:57:08 +00:00