Commit graph

52771 commits

Author SHA1 Message Date
Leo Izen
2c8835dd72
avcodec/libjxldec: submit frame after file is complete
This commit causes the libjxl decoder wrapper to hold onto the decoded
frame until the trailing metadata after the frame is possibly complete
before it submits the frame. This allows EXIF and other metadata boxes
that occur after the frame is fully rendered to be attached to it as
side data.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2025-09-25 12:40:57 -04:00
Niklas Haas
96065d1261 avcodec/aom_film_grain: fix AVCOL_*_NB range check
These should also exclude the _NB values themselves.
2025-09-25 11:08:37 +00:00
Lynne
0599d508c9
prores_raw: use MKBETAG for the frame header tag
Equivalent, but more explicit. All values in the header are big endian.
2025-09-25 19:14:12 +09:00
Lynne
bc4d03c530
prores_raw: set profile based on the codec tag
This is the same as what the parser does.
2025-09-25 19:14:08 +09:00
Andreas Rheinhardt
cb5dbb30ca avcodec/tiff_common: Remove unused ff_tadd_*_metadata() funcs
Unused since ad77345a5d.

Reviewed-by: Leo Izen <leo.izen@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-09-25 06:47:30 +02:00
Andreas Rheinhardt
371931250a avcodec/ohdec: Check mutex/conditions initialization
Reviewed-by: Zhao Zhili <quinkblack@foxmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-09-25 05:29:58 +02:00
Andreas Rheinhardt
748fa0a9bb avcodec/ohdec: Switch to RefStruct API for internal refcounting
It avoids allocations and corresponding error conditions.

Reviewed-by: Zhao Zhili <quinkblack@foxmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-09-25 05:29:26 +02:00
Andreas Rheinhardt
320133aafc avcodec/ohdec: Release decoder on allocation failure
Normally, the OH_AVCodec is wrapped inside an AVBuffer
to be freed in its free callback; yet when creating
the AVBuffer fails, the decoder is never destroyed.

Reviewed-by: Zhao Zhili <quinkblack@foxmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-09-25 05:28:16 +02:00
Stadelmann, Daniel
56c14f2311 avcodec/libmpeghdec: add MPEG-H 3DA Fraunhofer IIS mpeghdec decoder
Adds a wrapper around the Fraunhofer IIS MPEG-H 3D Audio mpeghdec [1]
decoder shared library.

[1] https://github.com/Fraunhofer-IIS/mpeghdec

Signed-off-by: Stadelmann, Daniel <daniel.stadelmann@iis.fraunhofer.de>
2025-09-24 08:25:42 +02:00
rcombs
e5f82ab868 Revert "lavc/libsvtav1: set packet durations"
This reverts commit 5c9b2027bc.

This doesn't actually work the way it'd appeared to in testing;
the output was based on frame *encode latency*.
2025-09-23 20:22:33 -07:00
Andreas Rheinhardt
17d5759bd9 avcodec/x86/apv_dsp: Don't export arrays unnecessarily
The const here is unnecessary, because everything inside
SECTION_RODATA is automatically const and using it exports
these objects from the object file because const is a macro
in x86inc.asm.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-09-24 01:21:32 +00:00
Andreas Rheinhardt
7c78a63476 avcodec/mpegaudiodec_float: Don't set AVCodec.sample_fmts directly
It is deprecated and doing so gives warnings from Clang.
Use CODEC_SAMPLEFMTS instead.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-09-23 22:16:02 +00:00
rcombs
5c9b2027bc lavc/libsvtav1: set packet durations 2025-09-23 14:32:47 +00:00
Krzysztof Pyrkosz
03c054d43c avcodec/aarch64/vvc: Implement dmvr_v_8
A72
dmvr_v_8_12x20_neon:                                   207.0 ( 4.15x)
dmvr_v_8_20x12_neon:                                   170.4 ( 4.37x)
dmvr_v_8_20x20_neon:                                   273.4 ( 4.58x)

A53
dmvr_v_8_12x20_neon:                                   450.6 ( 4.21x)
dmvr_v_8_20x12_neon:                                   342.8 ( 3.70x)
dmvr_v_8_20x20_neon:                                   550.9 ( 3.79x)
2025-09-23 11:20:20 +00:00
Krzysztof Pyrkosz
56a638d836 avcodec/aarch64/vvc: Unroll vvc_bdof_grad_filter_8x_neon
Before and after:
A53:
apply_bdof_8_16x8_neon:                               2733.1 ( 4.88x)
apply_bdof_8_16x16_neon:                              5458.6 ( 4.86x)
apply_bdof_10_16x8_neon:                              2789.8 ( 4.64x)
apply_bdof_10_16x16_neon:                             5523.8 ( 4.68x)
apply_bdof_12_16x8_neon:                              2792.8 ( 4.58x)
apply_bdof_12_16x16_neon:                             5519.5 ( 4.63x)

apply_bdof_8_16x8_neon:                               2571.8 ( 5.12x)
apply_bdof_8_16x16_neon:                              5173.3 ( 5.12x)
apply_bdof_10_16x8_neon:                              2635.1 ( 4.87x)
apply_bdof_10_16x16_neon:                             5243.0 ( 4.89x)
apply_bdof_12_16x8_neon:                              2613.0 ( 4.89x)
apply_bdof_12_16x16_neon:                             5231.7 ( 4.90x)

A78:
apply_bdof_8_16x8_neon:                                565.3 ( 8.43x)
apply_bdof_8_16x16_neon:                              1109.5 ( 8.60x)
apply_bdof_10_16x8_neon:                               568.2 ( 7.92x)
apply_bdof_10_16x16_neon:                             1114.1 ( 8.08x)
apply_bdof_12_16x8_neon:                               570.2 ( 7.87x)
apply_bdof_12_16x16_neon:                             1116.3 ( 8.03x)

apply_bdof_8_16x8_neon:                                541.4 ( 8.81x)
apply_bdof_8_16x16_neon:                              1065.9 ( 8.97x)
apply_bdof_10_16x8_neon:                               543.2 ( 8.32x)
apply_bdof_10_16x16_neon:                             1071.5 ( 8.39x)
apply_bdof_12_16x8_neon:                               544.2 ( 8.25x)
apply_bdof_12_16x16_neon:                             1074.1 ( 8.37x)
2025-09-23 11:20:11 +00:00
asivery
97bfb606e3 avformat/aeadec, avcodec/atrac1: Fix 8 and 4-channel ATRAC1 support
Signed-off-by: asivery <asivery@protonmail.com>
(cherry picked from commit 81cdf42222961c2959f1ede2d86fea0d1dcbbfcb)
2025-09-22 23:46:29 +00:00
Paul B Mahol
e0638cee0a avcodec/adpcm: improve decooding output for 4-bit ADPCM IMA WAV
(cherry picked from commit f11422f1a6251e2b3c42b4044efbc722b863778d)
2025-09-22 23:46:29 +00:00
Paul B Mahol
066432ebcf avcodec: add ADPCM IMA Escape audio decoder
(cherry picked from commit 4a663e78c4421da226e7d480d6767de803ee2122)
2025-09-22 23:46:29 +00:00
Paul B Mahol
5d6c9a15eb avcodec: add ADPCM Circus decoder
(cherry picked from commit cdd3d794c7e01e4d6f485e7b975a4b9107d3f2fd)
2025-09-22 23:46:29 +00:00
Paul B Mahol
f6dfb20302 avcodec: add ADPCM PSXC audio decoder
(cherry picked from commit a4055b5cc6d77c26867948e24de6bdfd5c0e6a3b)
2025-09-22 23:46:29 +00:00
Paul B Mahol
a4f778890b avcodec/adpcm: fix non-4bit adpcm ima wav decoding
(cherry picked from commit f4e05abeded46515bd7b4248fc7d65df82d9af2a)
2025-09-22 23:46:29 +00:00
Paul B Mahol
30fc5b1baa avcodec: add ADPCM IMA Magix decoder
(cherry picked from commit 2ec3ad2122484ce2c84f6ba055c5ebc1661c5b14)
2025-09-22 23:46:29 +00:00
Paul B Mahol
58c0711fca avcodec: add ADPCM IMA HVQM2 decoder
(cherry picked from commit 480e36592d5fc27a47e378d62570824613f26b7b)
2025-09-22 23:46:29 +00:00
Paul B Mahol
1943b31cdd avcodec/adpcm: fix overflow in mono ADPCM IMA HVQM4
(cherry picked from commit 6a9b0f7272a0725abbe6f887f766fb5f1f119a66)
2025-09-22 23:46:29 +00:00
Paul B Mahol
5fc9c79f53 avcodec: add ADPCM Silicon Graphics N64 decoder
(cherry picked from commit 13484237fdf19c9d927b8a64b81d00100a4178c3)
2025-09-22 23:46:29 +00:00
Paul B Mahol
648b5d017d avcodec: add ADPCM IMA PDA decoder
(cherry picked from commit ab9f7513d55cfd87d1a1ce22d02abffbfb9bb296)
2025-09-22 23:46:29 +00:00
Paul B Mahol
424dbb03ae avcodec: add ADPCM IMA HVQM4 decoder
Signed-off-by: Paul B Mahol <onemda@gmail.com>
(cherry picked from commit bae3cecfa6f1fbc765d95d84ef4a377aedbca8bb)
2025-09-22 23:46:29 +00:00
Paul B Mahol
e95171fbff avcodec: add AHX parser
(cherry picked from commit ddcb47c4c512bf49b22cc6b2d07fade0f96377e3)
2025-09-22 23:46:29 +00:00
Paul B Mahol
b2e821310b avcodec: add AHX decoder
(cherry picked from commit 039dc23d185214b8b0ef2bbccae197ceb5ad42a2)
2025-09-22 23:46:29 +00:00
Andreas Rheinhardt
c9168717bf avcodec/h274: Make H274FilmGrainDatabase a shared object
Right now, the private contexts of every decoder supporting
H.274 film grain synthesis (namely H.264, HEVC and VVC)
contain a H274FilmGrainDatabase; said structure is very large
700442B before this commit) and takes up the overwhelming
majority of said contexts: Removing it reduces sizeof(H264Context)
by 92.88%, sizeof(HEVCContext) by 97.78% and sizeof(VVCContext)
by 99.86%. This is especially important for H.264 and HEVC
when using frame-threading.

The content of said film grain database does not depend on
any input parameter; it is shareable between all its users and
could be hardcoded in the binary (but isn't, because it is so huge).

This commit adds a database with static storage duration to h274.c
and uses it instead of the elements in the private contexts above.
It is still lazily initialized as-needed; a mutex is used
for the necessary synchronization. An alternative would be to use
an AV_ONCE to initialize the whole database either in the decoders'
init function (which would be wasteful given that most videos
don't use film grain synthesis) or in ff_h274_apply_film_grain().

Reviewed-by: Niklas Haas <ffmpeg@haasn.dev>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-09-22 04:54:22 +02:00
Krzysztof Pyrkosz
f1a155d975 avcodec/aarch64/vvc: Optimize dmvr_hv_10
Before and after on A53:
dmvr_hv_10_12x20_neon:                                1838.2 ( 3.02x)
dmvr_hv_10_20x12_neon:                                1330.2 ( 1.83x)
dmvr_hv_10_20x20_neon:                                2148.2 ( 1.85x)
dmvr_hv_12_12x20_neon:                                1839.2 ( 3.02x)
dmvr_hv_12_20x12_neon:                                1330.6 ( 1.83x)
dmvr_hv_12_20x20_neon:                                2147.2 ( 1.85x)

dmvr_hv_10_12x20_neon:                                1755.0 ( 3.17x)
dmvr_hv_10_20x12_neon:                                1165.8 ( 2.09x)
dmvr_hv_10_20x20_neon:                                1876.1 ( 2.12x)
dmvr_hv_12_12x20_neon:                                1754.4 ( 3.17x)
dmvr_hv_12_20x12_neon:                                1167.8 ( 2.09x)
dmvr_hv_12_20x20_neon:                                1878.8 ( 2.12x)
2025-09-21 19:39:27 +00:00
Henrik Gramner
82b5a0faba vp9: Remove 8bpc AVX asm for inverse transforms
There's very little performance difference vs SSE2/SSSE3 and most
systems will use the AVX2 implementations anyway.

This reduces code size and compilation time by a significant amount.
2025-09-19 23:12:59 +00:00
Henrik Gramner
0b5d46ee1c vp9: Add 8bpc AVX2 asm for inverse transforms 2025-09-19 23:12:59 +00:00
Michael Niedermayer
647138334a avcodec/exif: check count in exif_decode_tag()
Fixes: out of array access
Fixes: integer overflow
Fixes: poc_heap_bof

Found-by: *2ourc3 (Salim LARGO)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-09-18 11:06:16 +00:00
Michael Niedermayer
88e04205b3 avcodec/exif: Do not leave uninitialized pointers on errors in exif_clone_entry()
No testcase, but this looks like it could free garbage pointers

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-09-18 11:06:16 +00:00
Michael Niedermayer
742b0d4675 avcodec/exif: Use av_fast_mallocz() in av_exif_clone_ifd()
using fast realloc leaves the entries uninitialized and frees garbage pointers on
errors

Fixes: bug_triggering_file

Found-by: *2ourc3, 5pider
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-09-18 11:06:16 +00:00
Andreas Rheinhardt
8accbbdf9a avcodec/vvc/data: Mark tables as hidden
This allows compilers to optimize accesses like
ff_vvc_diag_scan_x[2][2][x] by baking the offset derived
from [2][2] into the relocation (so that it is performed
at link-time).

Reviewed-by: Wu Jianhua <toqsxw@outlook.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-09-17 22:48:39 +02:00
Cameron Gutman
a0936b9769 avcodec/vaapi_encode: skip AVBR if HRD parameters are set
AVBR does not use VAEncMiscParameterTypeHRD, so attempting to set
rc_buffer_size and bit_rate together will cause the rc_buffer_size
to be ignored if the VAAPI driver supports AVBR. We should prefer
regular VBR for that case.

Signed-off-by: Cameron Gutman <aicommander@gmail.com>
2025-09-17 06:40:16 +00:00
James Almer
ca72b2d712 avcodec/tiffenc: support writing Orientation tag
Signed-off-by: James Almer <jamrial@gmail.com>
2025-09-17 02:17:09 +00:00
James Almer
fdb5f709b7 avcodec/h2645_sei: add missing ambient_viewing_environment copy in ff_h2645_sei_ctx_replace()
Signed-off-by: James Almer <jamrial@gmail.com>
2025-09-16 15:42:03 -03:00
James Almer
26f4230082 avcodec/decode: sync initial_pict_type and intra_only_flag with thread worker's avctx
Regression since 5acbdd2264, which removed
setting both values from PerThreadContext.
Given the pthread code calls ff_decode_receive_frame_internal() on the frame,
any value set before it will be overwritten, so instead sync each thread's
DecodeContext and let ff_decode_receive_frame_internal() handle these values.

Fixes issue #20534.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-09-16 15:41:50 -03:00
Jan Ekström
8dcc65a0fc avcodec/packet: add functionality to prepend to AVPacketLists
Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
2025-09-16 16:28:12 +03:00
James Almer
57a29f2e7d avcodec/x86/pngdsp: add missing emms at the end of add_png_paeth_prediction
Fixes unpredictable behavior with floats.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-09-15 22:18:52 -03:00
Andreas Rheinhardt
f33e62a8b4 avcodec/mjpegdec: Move reference dimension check to mxpegdec.c
Only the mxpeg sets reference at all.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-09-15 17:52:22 +02:00
Andreas Rheinhardt
b5cfabf0f5 avcodec/mjpegdec: Avoid using HpelDSPContext
It is quite big and we only need one function from it.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-09-15 17:52:22 +02:00
Andreas Rheinhardt
124c856d38 avcodec/mjpegdec: Move initializing HpelDSPContext to mxpegdec.c
Only the mxpeg decoder uses it (and the reference/bitmask feature
of ff_mjpeg_decode_sos()). So only initialize it for mxpeg which
allows to remove the mjpeg->hpeldsp dependency.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-09-15 17:52:22 +02:00
Andreas Rheinhardt
b11c8b76df avcodec/mjpegdec: Avoid mixing return value and error code, avoid branch
mjpeg_decode_dc() currently has a special return value (0xfffff)
for the case of invalid data; this value does not overlap with
the ordinary return values, yet the compiler can't prove this
(at least on x86 where an asm version of NEG_USR32 is used
inside get_xbits()), so the non-error return value has to be checked
for being the special value even if mjpeg_decode_dc() is inlined.

This commit avoids this by separating error code and ordinary return
value. It also means that the ljpeg functions return the proper
error code and not -1 in case of invalid data.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-09-15 17:52:22 +02:00
Andreas Rheinhardt
3b1673db6a avcodec/mjpegdec: Avoid superfluous secondary error message
Up until now, a DC error in decode_block() or decode_dc_progressive()
would lead to a warning from mjpeg_decode_dc() and a (less verbose)
error from the caller. Upgrade the former to an error status (all
callers treat is an error) and remove the latter.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-09-15 17:52:22 +02:00
Andreas Rheinhardt
a6c899bc6b avcodec/mjpegdec: Remove pointless information from logmessage
There is no reason to add the address of an element of
MJpegDecodeContext (which makes logmessage nonreproducible).
Also avoid always printing a zero.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-09-15 17:52:22 +02:00
Andreas Rheinhardt
ac64c52b96 avcodec/encode: Remove redundant av_image_check_size2()
The dimensions have already been checked during init.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-09-15 17:52:21 +02:00