Commit graph

51161 commits

Author SHA1 Message Date
James Almer
2d3281b9dd avcodec/hevc/sei: remove unused inline function
It's also a pointless indirection.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-13 12:49:52 -03:00
James Almer
66014c79ab avcodec/h2645_sei: move some common SEI syncing code to ff_h2645_sei_ctx_replace()
Instead of duplicating it across all supported decoders.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-13 12:49:52 -03:00
Leo Izen
18883fbcab
avcodec/jpegxl_parser: fix reading lz77-pair as initial entropy symbol
The JPEG XL parser has an entropy decoder inside, which supports LZ77
length-distance pairs. If the first symbol from the entropy stream is an
LZ77 pair, the bitstream is invalid, so we should abort immediately rather
than attempt to read it anyway (which would read from the uninitialized
starting window).

Reported-by: Kacper Michajłow <kasper93@gmail.com>
Found-by: ossfuzz
Fixes: 368725676/clusterfuzz-testcase-minimized-fuzzer_protocol_file-6022251122589696-cut
Fixes: 42537758/clusterfuzz-testcase-minimized-fuzzer_protocol_file-5818969469026304-cut
Signed-off-by: Leo Izen <leo.izen@gmail.com>
2024-11-13 10:26:28 -05:00
James Almer
97c5cc3a5c Revert "avcodec/h2645_sei: fix parsing AOM grain provider_oriented_code"
This reverts commit 24141a7140.
It was a change made by looking at an old spec version.
2024-11-11 17:11:15 -03:00
James Almer
e33b162c7d avcodec/h2645_sei: use the RefStruct API for film_grain_characteristics
And ensure the buffer is synced between threads.
Based on a patch by Dale Curtis <dalecurtis@chromium.org>

Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-11 16:10:15 -03:00
James Almer
fd4a2c9b02 avcodec/aom_film_grain: allocate film grain metadata dynamically
This removes the ABI breaking use of sizeof(AVFilmGrainParams), and achieves the
same size reduction to decoder structs as 08b1bffa49.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-11 16:10:15 -03:00
James Almer
24141a7140 avcodec/h2645_sei: fix parsing AOM grain provider_oriented_code
The value is 16 bits big endian, not a single byte.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-11 16:10:10 -03:00
James Almer
91b6ba653e Revert "avcodec/h2645: allocate film grain metadata dynamically"
AVFilmGrainAFGS1Params, the offending struct, is using sizeof(AVFilmGrainParams)
when it should not. This change also forgot to make the necessary changes to the
frame threading sync code.
Both of these will be fixed by the following commit.

H274FilmGrainDatabase will be handled later.

This reverts commit 08b1bffa49.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-11 15:26:21 -03:00
James Almer
9ec042c1aa avcodec/x86/vvc: add prototypes for OF functions
And wrap the implemtation in preprocessor checks.
Should fix ticket #11282.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-11 19:34:11 +08:00
Frank Plowman
1e5f24d1a6 lavc/vvc: Remove floating point logic
This was the only floating point logic in the native VVC decoder.

Signed-off-by: Frank Plowman <post@frankplowman.com>
2024-11-11 19:31:00 +08:00
Zhao Zhili
994368be8f x86/vvc: Fix build error for arch x86_32
There were static functions which built for x86_32, but the simd
functions they reference only available for x86_64.
2024-11-11 19:30:09 +08:00
Nuo Mi
c49001e338 avcodec/cbs_h266: Fix regression in DVB clip introduced by 93281630a7
This commit introduced a regression to VVC_HDR_UHDTV1_OpenGOP_3840x2160_50fps_HLG10_mosaic.ts.

Root Cause:
The AV_CEIL_RSHIFT(a, b) macro uses bit tricks that work only when -a is a negative value.
However, due to integer promotion rules, this behavior does not extend to the unsigned int type.

See "6.3.1.1 Boolean, characters, and integers" in the "ISO/IEC 9899" for details.

Reported-by: Frank Plowman <post@frankplowman.com>
2024-11-11 19:30:09 +08:00
Peter Ross
2f34b159b4 avcodec/eatgq: decode motion vector macroblocks
Signed-off-by: Peter Ross <pross@xvid.org>
2024-11-10 12:31:19 +11:00
Anton Khirnov
13129f1af4 lavc: deprecate the omx encoders
They have not been relevant for a long time, and support for this API is
also being dropped from other projects.
2024-11-09 02:46:17 +01:00
Peter Ross
2bbbf36fe2 avcodec/rv60: set populate_ipred src parameter to const 2024-11-09 08:50:59 +11:00
Peter Ross
006718c475 avcodec/rv60: align calc_sel_qp with reference decoder
Fixes ticket #11290.
2024-11-09 08:50:59 +11:00
Peter Ross
c8c6319ce1 avcodec/rv60: prevent decode_cu_r deadlock
Fixes ticket #11289 (deadlock).
2024-11-09 08:50:59 +11:00
Peter Ross
4d4d171afb avcodec/rv60: prevent decode_cu_r segfault
Fixes ticket #11289 (crash).
2024-11-09 08:50:59 +11:00
Peter Ross
923f45430c avcodec/rv60: check init_get_bits8 return value
Fixes CID 1634471
2024-11-09 08:50:58 +11:00
Peter Ross
d51a920556 avcodec/rv60: negative qp guard
Fixes CID 1634472
2024-11-09 08:50:58 +11:00
Osamu Watanabe
82467b635e
avcodec/jpeg2000: Improve FF_DWT97_INT to pass ISO/IEC 15444-4 conformance tests
Fixes https://trac.ffmpeg.org/ticket/10123

Signed-off-by: Pierre-Anthony Lemieux <pal@palemieux.com>
2024-11-08 08:30:07 -08:00
Marth64
11c703be31 avcodec/mpeg12dec: set FF_CODEC_PROPERTY_CLOSED_CAPTIONS in mpeg_set_cc_format()
When Closed Captions are discovered, this method is always invoked.
Therefore, use it to set the property instead of repeating the statement.

Signed-off-by: Marth64 <marth64@proxyid.net>
2024-11-07 21:27:04 -06:00
Araz Iusubov
f63f164125 avcodec/amfenc: GOP size check
Fix for the error with an invalid GOP size parameter.
2024-11-07 15:11:10 +01:00
Cameron Gutman
8503c64aa8 avcodec/amfenc: add support for QueryOutput wait
Enable waiting in QueryOutput() based on driver support to reduce
unnecessary delays.

Fix for issue #10622

Co-authored-by: Araz Iusubov <Primeadvice@gmail.com>
2024-11-06 19:38:36 +01:00
Araz Iusubov
eedcf939d8 avcodec/amfenc: Color information update
Processing of transfer characteristic SMPTE2084 and 8-bit depth added
on AMF side and will appear in one of upcoming releases.
2024-11-06 19:38:11 +01:00
Kacper Michajłow
7b20985d8d
avcodec/jpegxl_parser: check entropy_decoder_read_symbol return value
Found by OSS-Fuzz.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2024-11-05 08:44:43 -05:00
Michael Niedermayer
ebffb8b68e
avcodec/ffv1enc: Tighter maxsize
This allows using smaller buffers

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-11-03 19:20:40 +01:00
Peter Ross
33802e7c32 avcodec/rv60: RealVideo 6.0 decoder
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: Peter Ross <pross@xvid.org>
2024-11-03 10:53:15 +11:00
Timo Rothenpieler
d724584d68 avcodec/nvenc: set bitstreamRestrictionFlag when neccesary
This mimics the behaviour of libx264 for setting this flag.

Fixes #11131
2024-11-01 17:59:27 +01:00
Fei Wang
e726fdeb05 lavc/vaapi_dec: Add VVC decoder
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
2024-11-01 12:13:07 +08:00
Fei Wang
4dc18c78cd lavc/vvc_dec: Add hardware decode API
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
2024-11-01 12:13:07 +08:00
Fei Wang
a94aa2d61e lavc/vvc_ps: Add alf raw syntax into VVCALF
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
2024-11-01 12:13:07 +08:00
Fei Wang
15a75e8e04 lavc/vvc_refs: Define VVC_FRAME_FLAG* to h header
So that hardware decoder can use the flags too.

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
2024-11-01 12:13:07 +08:00
Fei Wang
6bb5dc2ae7 lavc/cbs_h266: Add NumSlicesInTile to H266RawPPS
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
2024-11-01 12:13:07 +08:00
Fei Wang
e543a22c38 lavc/cbs_h266: Add SliceTopLeftTileIdx to H266RawPPS
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
2024-11-01 12:13:07 +08:00
Fei Wang
f42978fe29 lavc/vaapi_decode: Use a more meaningful variable name
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
2024-11-01 12:13:07 +08:00
Fei Wang
1d8c31d5e2 lavc/vaapi_dec: Create VA parameters dynamically
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
2024-11-01 12:13:07 +08:00
Peter Ross
492a3b4b89 avcodec/vp56: decode interlace content
Modification of patch submitted by Aurelien Jacobs (November 2007).

Fixes ticket #5581 and #5582.
2024-10-31 17:49:48 +11:00
Thomas Guillem
44a0a0c050 avcodec/decode: clean-up if get_hw_frames_parameters fails
Fixes the following assert:

[00007f1df83d17e0] vaapi generic error: avcodec_get_hw_frames_parameters failed: -22
Assertion p_dst->hwaccel_threadsafe || (!dst->hwaccel && !dst->internal->hwaccel_priv_data) failed at libavcodec/pthread_frame.c:349

Reproduced from VLC with VAAPI, when fallbacking from hw to sw.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-10-30 21:31:17 +08:00
Pierre-Anthony Lemieux
839f6d38a0
jpeg2000dec: fix tile-part header state reset
Fixes https://trac.ffmpeg.org/ticket/11266
2024-10-27 10:26:00 -07:00
Zhao Zhili
7fe9d12f25 avcodec/mediacodecdec_common: Workaround MTK broken crop implementation
MediaTek SOC return broken crop info, e.g.,
width: int32(3840) height: int32(2160) crop: Rect(0, 0, 318, 238)

It will notify the right crop info with infoOutputFormatChanged, but
too late.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-10-27 11:35:13 +08:00
Zhao Zhili
0ee18ff23d avcodec/mediacodecenc: Extract configOBUs from AV1CodecConfigurationRecord
MediaCodec can generate AV1CodecConfigurationRecord, which shouldn't
be put into packet->data. Skip four bytes and extract configOBUs
if it exist.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-10-27 11:35:05 +08:00
James Almer
707e2184ca avformat/riff: map Y416 fourcc to RAWVIDEO decoder
As defined in https://learn.microsoft.com/en-us/windows/win32/medfound/10-bit-and-16-bit-yuv-video-formats#422-formats

Signed-off-by: James Almer <jamrial@gmail.com>
2024-10-26 00:04:55 -03:00
James Almer
faec8763e8 avformat/riff: map Y210 and Y216 fourcc to RAWVIDEO decoder
As defined in https://learn.microsoft.com/en-us/windows/win32/medfound/10-bit-and-16-bit-yuv-video-formats#422-formats

Signed-off-by: James Almer <jamrial@gmail.com>
2024-10-25 19:41:07 -03:00
Dale Curtis
08b1bffa49 avcodec/h2645: allocate film grain metadata dynamically
Film grain support adds a huge amount of overhead to the H264Context
structure for a feature that is rarely used. On low end devices or
pages that have lots of media this bloats memory usage rapidly.

This changes the static film grain metadata allocations to be dynamic
which reduces the H264Context size from 851808 bytes to 53444 bytes.

Bug: https://crbug.com/359358875
Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Niklas Haas <git@haasn.dev>
2024-10-25 01:02:35 +02:00
Michael Niedermayer
2c71366d3b
avcodec/ffv1: Implement new slice tiling
This fixes corner cases (requires version 4 or a spec update)

Fixes: Ticket5548

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-10-24 23:01:14 +02:00
Michael Niedermayer
d147b3d7ec
avcodec/rangecoder: only perform renorm check/loop for callers that need it
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-10-24 23:01:14 +02:00
James Almer
ae0ab5b7ce avcodec/vulkan_video: add mapping for AV_PIX_FMT_Y216
Signed-off-by: James Almer <jamrial@gmail.com>
2024-10-23 20:06:03 -03:00
James Almer
e46a506ae0 avcodec/vulkan_video: add proper maps for XV3{0,6}
Forgotten after fd8b0dcfed.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-10-23 20:06:03 -03:00
Nuo Mi
b611410569 avcodec/vvc/thread: Check frame to be non NULL
Fixes: NULL pointer dereference
Fixes: 71303/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VVC_fuzzer-4875859050168320

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reported-by: Michael Niedermayer <michael@niedermayer.cc>
2024-10-20 20:36:15 +08:00