aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/hevc_ps.c
Commit message (Collapse)AuthorAgeFilesLines
* lavc/hevc*: move to hevc/ subdirAnton Khirnov2024-06-041-2076/+0
|
* avcodec/hevc_ps: Fix UB 1 << 31Andreas Rheinhardt2024-06-021-1/+1
| | | | | Reviewed-by: Tomas Härdin <git@haerdin.se> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavc/hevc_ps: compactify ShortTermRPSAnton Khirnov2024-05-311-3/+3
| | | | | | Do not use larger fields than needed, use size-1 bitfields for flags. Reduces sizeof(HEVCSPS) by 1280 bytes.
* lavc/hevc_ps: reduce the size of ShortTermRPS.usedAnton Khirnov2024-05-311-14/+19
| | | | | | | It is currently an array of 32 uint8_t, each storing a single flag. A single uint32_t is sufficient. Reduces sizeof(HEVCSPS) by 1792 bytes.
* lavc/hevc_ps: do not store delta_poc_s[01] in ShortTermRPSAnton Khirnov2024-05-311-2/+2
| | | | | | | | | They are only used in vulkan_hevc and are not actually needed, as they can be computed from delta_poc. Reduces sizeof(HEVCSPS) by 16kB. Also, fix a typo (s0->s1) in the code being touched.
* lavc/hevc_ps: fix variable signedness in ff_hevc_decode_short_term_rps()Anton Khirnov2024-05-311-2/+4
| | | | | | It is actually supposed to go negative in the loop over num_negative pics, but underflow does not break anything as the result is then assigned to a signed int.
* lavc/hevc_ps/HEVCSPS: change flags into uint8_tAnton Khirnov2024-05-311-48/+47
| | | | | | | Reduces sizeof(HEVCSPS) by 64 bytes. Also improve flag names: drop redundant suffixes and prefixes, and consistently use disabled/enabled.
* lavc/hevc_ps: reduce the size of used_by_curr_pic_lt_sps_flagAnton Khirnov2024-05-311-1/+3
| | | | | It is currently an array of 32 uint8_t, each storing a single flag. A single uint32_t is sufficient.
* avcodec/hevc_ps: --typoMichael Niedermayer2024-04-031-1/+1
| | | | | | | | | Fixes: null pointer dereference Fixes: 67737/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-4858162608930816 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avutil/common: Don't auto-include mem.hAndreas Rheinhardt2024-03-311-0/+1
| | | | | | | | | | | There are lots of files that don't need it: The number of object files that actually need it went down from 2011 to 884 here. Keep it for external users in order to not cause breakages. Also improve the other headers a bit while just at it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/hevc_ps: don't use a fixed sized buffer for parameter set raw dataJames Almer2024-03-291-68/+72
| | | | | | Allocate it instead, and use it to compare sets instead of the parsed struct. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/hevc_ps: fix the problem of memcmp losing effectivenessTong Wu2024-03-291-4/+15
| | | | | | | | | | | HEVCHdrParams* receives a pointer which points to a dynamically allocated memory block. It causes the memcmp always returning 1. Add a function to do the comparision. A condition is also added to avoid malloc(0). Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Tong Wu <tong1.wu@intel.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/hevc_ps: fix setting HEVCHdrParams fieldsJames Almer2024-03-211-20/+24
| | | | | | | | These were defined in a way compatible with the Vulkan HEVC acceleration, which expects bitmasks, yet the fields were being overwritting on each loop with the latest read value. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/hevc_ps: allocate only the required HEVCHdrParams within a VPSJames Almer2024-03-211-1/+13
| | | | | | | Fixes: timeout Fixes: 64033/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5332101272305664 Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/hevc_ps: Check cpb_cnt_minus1 before storing itMichael Niedermayer2023-10-191-3/+4
| | | | | | | | Fixes: index 32 out of bounds for type 'uint32_t [32]' Fixes: 63003/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-4685160840560640 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/hevc_ps: Use RefStruct API for parameter setsAndreas Rheinhardt2023-10-071-46/+34
| | | | | | | | | | Avoids allocations and error checks for these allocations; e.g. syncing buffers across threads can't fail any more and needn't be checked. It also gets rid of casts and indirections. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* hevc_ps: fix fixed_rate checkllyyr2023-09-101-1/+2
| | | | | | | Fixes: fc429d785e9e24c5520ce716d4bc3b5547e581eb Since fc429d785e9e24c5520ce716d4bc3b5547e581eb splits the fixed_rate flag into general and within_cvs, check for both.
* hevc_ps: fix cpb_cnt_minus1 initializationllyyr2023-09-101-4/+2
| | | | | | | | | | | Fixes: fc429d785e9e24c5520ce716d4bc3b5547e581eb cpb_cnt used to be initialized to 1 before fc429d785e9e24c5520ce716d4bc3b5547e581eb so cpb_cnt_minus1 should be initialized to 0. Also add +1 to the decode_sublayer_hrd call to account for the change to the offset
* avcodec/defs: Add AV_PROFILE_* defines, deprecate FF_PROFILE_* definesAndreas Rheinhardt2023-09-071-6/+6
| | | | | | | | | These defines are also used in other contexts than just AVCodecContext ones, e.g. in libavformat. Furthermore, given that these defines are public, the AV-prefix is the right one, so deprecate (and not just move) the FF-macros. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/hevc_ps: Improve PPS SCC extension bit depth checkAndreas Rheinhardt2023-07-101-4/+6
| | | | | | | | | | | | From the spec: "It is a requirement of bitstream conformance that the value of luma_bit_depth_entry_minus8 shall be equal to the value of bit_depth_luma_minus8"; similarly for chroma. Also fixes Coverity ticket #1529226 (complaining about the fact that chroma_bit_depth_entry is checked twice). Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/hevc_ps: Constify VPS, SPS pointers when parsing PPSAndreas Rheinhardt2023-06-301-8/+9
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/hevc_ps: remove a unused variableJames Almer2023-05-281-1/+1
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* hevc_ps: expose sps_extension_present_flagLynne2023-05-291-1/+2
|
* hevc_ps: expose conformance_window_flagLynne2023-05-291-1/+2
|
* hevc_ps: expose sublayer_ordering_info_flagLynne2023-05-291-4/+4
|
* hevc_ps: expose vui_present flagLynne2023-05-291-3/+3
|
* hevc_ps: expose rps fieldsLynne2023-05-291-19/+18
|
* hevc_ps: expose log2_diff_max_min_transform_block_sizeLynne2023-05-291-10/+10
|
* hevc_ps: expose pps_extension_present_flagLynne2023-05-291-1/+2
|
* hevc_ps: expose vps_idLynne2023-05-291-1/+1
|
* hevc_ps: expose pps_idLynne2023-05-291-1/+1
|
* hevc_ps: expose SPS and VPS headersLynne2023-05-291-48/+52
|
* avcodec/hevc_ps: add proper bound checks around cm_ref_layer_id in ↵Clement Lecigne2023-05-171-5/+15
| | | | | | | colour_mapping_table. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/hevc_ps: check for out of range bitdepth in SPSJames Almer2023-04-301-2/+12
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/hevc_ps: Avoid signed overflow before check on QPMichael Niedermayer2023-05-011-3/+3
| | | | | | | | Fixes: signed integer overflow: -2147483648 - 5 cannot be represented in type 'int' Fixes: 58066/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5312995835379712 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/hevc_ps: Check depth to be within 8 to 16Michael Niedermayer2023-05-011-0/+4
| | | | | | | | Fixes: assertion failure in bitreader Fixes: 45982/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-627318668066816 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/hevc_ps: use get_ue_golomb() for some SPS Screen Content Coding ↵James Almer2023-04-301-7/+14
| | | | | | | | | extension fields Also remove the _minus1 part of the name to be in line with the rest of the decoder. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/hevc_ps: use get_{ue,se}_golomb() for some PPS Range extension fieldsJames Almer2023-04-281-7/+7
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/hevc_ps: use get_ue_golomb() for some PPS Screen Content Coding ↵James Almer2023-04-281-7/+14
| | | | | | | | | | extension fields Also remove the _minus8 part of the name to be in line with the rest of the decoder, and fix the storage type for pps_palette_predictor_initializer, to support hbd values. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/hevcdec: further constrain some slice header field valuesJames Almer2023-04-221-2/+8
| | | | | | | | num_ref_idx_l0_active_minus1, num_ref_idx_l1_active_minus1, num_ref_idx_l0_default_active_minus1, and num_ref_idx_l1_default_active_minus1 are all in the range 0 to 14, inclusive. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/hevc_ps: use get_ue_golomb() for some PPS multilayer extension fieldsJames Almer2023-04-201-14/+13
| | | | | | | Also remove the _plus* and _minus* parts of some of these to be in line with other similar fields in the decoder. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/hevc_ps: further constrain allowed num_ref_loc_offsets valuesJames Almer2023-04-201-6/+7
| | | | | | | The spec says: "The value of num_ref_loc_offsets shall be in the range of 0 to vps_max_layers_minus1, inclusive". Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/hevc_ps: Check num_ref_loc_offsetsMichael Niedermayer2023-04-141-0/+4
| | | | | | | | Fixes: Writing arbitrarily over the array end Fixes: 57812/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-4536557859373056 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavc/hevc_ps: Add SPS/PPS parse support for HEVC extension syntaxLinjie Fu2023-02-271-12/+277
| | | | | | | | | | | | 1. Add extension syntax according to 7.3.2.2.3/7.3.2.3.3 in T-REC-H.265-201911. 2. Keep using parsed PPS when bitstream overread for compatibility. For example, the clip PS_A_VIDYO_3.bit in FATE test has incomplete extension syntax which will be overread and un-decodable if without this change. 3. Format brace in pps_range_extensions(). Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com> Signed-off-by: Fei Wang <fei.w.wang@intel.com>
* lavc/avcodec: Add HEVC Screen Content Coding Extensions profileLinjie Fu2023-02-271-0/+2
| | | | | | | | Described in HEVC spec A.3.7. Bump minor version and add APIchanges entry for new added profile. Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com> Signed-off-by: Fei Wang <fei.w.wang@intel.com>
* avcodec/(h264|hevc)_ps: Factor common VUI code outAndreas Rheinhardt2022-12-011-46/+8
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/h264data: Deduplicate H.26[45] aspect ratio tableAndreas Rheinhardt2022-12-011-22/+3
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/hevc_ps: Fix wrong copyright yearsAndreas Rheinhardt2022-07-091-2/+2
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/hevc_ps: Remove unused-but-set variableAndreas Rheinhardt2022-07-031-3/+0
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/hevc_ps: Don't use show_bits_long() unnecessarilyAndreas Rheinhardt2022-06-241-1/+1
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>