1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00
Commit Graph

204 Commits

Author SHA1 Message Date
Michael Niedermayer
5feceed008
avcodec/hevc_ps: Check cpb_cnt_minus1 before storing it
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>
2023-10-19 20:46:55 +02:00
Andreas Rheinhardt
2db94a96c8 avcodec/hevc_ps: Use RefStruct API for parameter sets
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>
2023-10-07 22:34:28 +02:00
llyyr
ded4478b8b hevc_ps: fix fixed_rate check
Fixes: fc429d785e

Since fc429d785e splits the fixed_rate
flag into general and within_cvs, check for both.
2023-09-10 20:05:07 +01:00
llyyr
06241c3154 hevc_ps: fix cpb_cnt_minus1 initialization
Fixes: fc429d785e

cpb_cnt used to be initialized to 1 before
fc429d785e 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
2023-09-10 20:04:56 +01:00
Andreas Rheinhardt
8238bc0b5e avcodec/defs: Add AV_PROFILE_* defines, deprecate FF_PROFILE_* defines
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>
2023-09-07 00:39:02 +02:00
Andreas Rheinhardt
f6dc85ae16 avcodec/hevc_ps: Improve PPS SCC extension bit depth check
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>
2023-07-10 12:31:06 +02:00
Andreas Rheinhardt
686156f366 avcodec/hevc_ps: Constify VPS, SPS pointers when parsing PPS
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-06-30 17:47:53 +02:00
James Almer
246bec23a9 avcodec/hevc_ps: remove a unused variable
Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-28 23:24:51 -03:00
Lynne
21719c29a2
hevc_ps: expose sps_extension_present_flag 2023-05-29 00:41:35 +02:00
Lynne
8b2d46ee3d
hevc_ps: expose conformance_window_flag 2023-05-29 00:41:34 +02:00
Lynne
cc5fab5c48
hevc_ps: expose sublayer_ordering_info_flag 2023-05-29 00:41:34 +02:00
Lynne
32fcb17e42
hevc_ps: expose vui_present flag 2023-05-29 00:41:33 +02:00
Lynne
f58db8e534
hevc_ps: expose rps fields 2023-05-29 00:41:33 +02:00
Lynne
abdd87d44e
hevc_ps: expose log2_diff_max_min_transform_block_size 2023-05-29 00:41:33 +02:00
Lynne
4e1f3ab184
hevc_ps: expose pps_extension_present_flag 2023-05-29 00:41:32 +02:00
Lynne
d0b02c3aff
hevc_ps: expose vps_id 2023-05-29 00:41:31 +02:00
Lynne
3bc866159c
hevc_ps: expose pps_id 2023-05-29 00:41:31 +02:00
Lynne
fc429d785e
hevc_ps: expose SPS and VPS headers 2023-05-29 00:41:31 +02:00
Clement Lecigne
96c30affba avcodec/hevc_ps: add proper bound checks around cm_ref_layer_id in colour_mapping_table.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-17 17:51:36 -03:00
James Almer
e7c690a046 avcodec/hevc_ps: check for out of range bitdepth in SPS
Signed-off-by: James Almer <jamrial@gmail.com>
2023-04-30 20:41:55 -03:00
Michael Niedermayer
bf3f91c425
avcodec/hevc_ps: Avoid signed overflow before check on QP
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>
2023-05-01 00:48:32 +02:00
Michael Niedermayer
cb8180aa66
avcodec/hevc_ps: Check depth to be within 8 to 16
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>
2023-05-01 00:48:32 +02:00
James Almer
45fc89bb14 avcodec/hevc_ps: use get_ue_golomb() for some SPS Screen Content Coding 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>
2023-04-30 18:29:34 -03:00
James Almer
41dd50ad0d avcodec/hevc_ps: use get_{ue,se}_golomb() for some PPS Range extension fields
Signed-off-by: James Almer <jamrial@gmail.com>
2023-04-28 20:15:57 -03:00
James Almer
df3fd3accd avcodec/hevc_ps: use get_ue_golomb() for some PPS Screen Content Coding 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>
2023-04-28 20:15:57 -03:00
James Almer
95a78c08c1 avcodec/hevcdec: further constrain some slice header field values
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>
2023-04-22 11:15:06 -03:00
James Almer
0760528af2 avcodec/hevc_ps: use get_ue_golomb() for some PPS multilayer extension fields
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>
2023-04-20 09:53:30 -03:00
James Almer
7fece7676b avcodec/hevc_ps: further constrain allowed num_ref_loc_offsets values
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>
2023-04-20 09:53:30 -03:00
Michael Niedermayer
80ac1fd148
avcodec/hevc_ps: Check num_ref_loc_offsets
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>
2023-04-14 17:56:44 +02:00
Linjie Fu
56e3cd23d4 lavc/hevc_ps: Add SPS/PPS parse support for HEVC extension syntax
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>
2023-02-27 13:42:06 +08:00
Linjie Fu
f459377543 lavc/avcodec: Add HEVC Screen Content Coding Extensions profile
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>
2023-02-27 13:42:06 +08:00
Andreas Rheinhardt
8bf18018a3 avcodec/(h264|hevc)_ps: Factor common VUI code out
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-12-01 11:00:41 +01:00
Andreas Rheinhardt
881e8bcc51 avcodec/h264data: Deduplicate H.26[45] aspect ratio table
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-12-01 11:00:41 +01:00
Andreas Rheinhardt
12392ffee5 avcodec/hevc_ps: Fix wrong copyright years
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-09 20:10:11 +02:00
Andreas Rheinhardt
bdaff63723 avcodec/hevc_ps: Remove unused-but-set variable
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-03 11:41:23 +02:00
Andreas Rheinhardt
48a0cd06e3 avcodec/hevc_ps: Don't use show_bits_long() unnecessarily
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-24 18:28:36 +02:00
Michael Niedermayer
ad20a4f92b avcodec/hevc_ps: Change scaling_list_dc_coef to 8 bit
Suggested-by: James
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-12-19 20:07:56 +01:00
Michael Niedermayer
f1700bd8bb avcodec/hevc_ps: check scaling_list_dc_coef
Fixes: signed integer overflow: 2147483640 + 8 cannot be represented in type 'int'
Fixes: 28449/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5686013259284480

Reviewed-by: James Almer <jamrial@gmail.com>
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-12-19 20:07:56 +01:00
Linjie Fu
0d83fcc07b lavc/hevc_ps: parse constraint flags for HEVC REXT
Parse all the constraint flags according to ITU-T Rec. H.265 (02/2018).

They have to be passed to hw decoders to determine the exact profile for Range
Extension HEVC.

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
2020-02-24 00:09:51 +00:00
Andriy Gelman
80e1c93c87 avcodec/hevc_ps: Remove dead code in vps_id check
Since reading 4 bits always returns a value in the range [0, 15], the
check for vps_id >= HEVC_MAX_VPS_COUNT, where HEVC_MAX_VPS_COUNT = 16, is redundant.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-09-26 11:20:14 -03:00
James Almer
7c644989a5 avcodec/hevc_ps: fix range of num_tile_{columns,rows}_minus1
From 7.4.3.3.1:

num_tile_columns_minus1 shall be in the range of 0 to PicWidthInCtbsY - 1, inclusive.
num_tile_rows_minus1 shall be in the range of 0 to PicHeightInCtbsY - 1, inclusive.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-07-05 16:30:40 -03:00
Michael Niedermayer
3b2082c663 avcodec/hevc_ps: Change num_tile_rows/columns checks to sps->ctb_height/weight
Suggested-by: James Almer <jamrial@gmail.com>
Reviewed-by: James Almer <jamrial@gmail.com
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-06-30 17:53:00 +02:00
Michael Niedermayer
c692051252 avcodec/hevc_ps: Fix integer overflow with num_tile_rows and num_tile_columns
Fixes: signed integer overflow: -2147483648 - 1 cannot be represented in type 'int'
Fixes: 14880/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5130977304641536

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>
2019-06-30 17:52:13 +02:00
Philip Langdale
f4ea930a11 avcodec/hevc_ps: Expose all SPS and PPS range extension flags
We need all the flags to be exposed to be able to pass them on to
HW decoders. I did not attempt to nuance any of the warnings about
flags being unsupported as there's no way, at the point we extract
flags, to say whether an HW decoder is being used.
2019-02-16 08:47:36 -08:00
Zhao Zhili
70d2bab80b lavc/hevc_ps: fix crop info for monochrome
The values of SubWidthC and SubHeightC are 1 in the ITU-T H.265. The
current code use the value of 2.

Signed-off-by: James Almer <jamrial@gmail.com>
2018-08-22 14:01:12 -03:00
Jun Zhao
d746a2e3cf lavc/hevc_ps: use skip_bits instead of get_bits when skip bits.
use skip_bits when want to skip some bits.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
2018-07-13 20:18:40 +08:00
Jun Zhao
896854b233 lavc/hevc_ps: Refine sps_range_extension parse.
Signed-off-by: Jun Zhao <mypopydev@gmail.com>
2018-07-13 20:15:15 +08:00
Carl Eugen Hoyos
085fe9822d lavc/hevc_ps: Use correct pix_fmt AV_PIX_FMT_GRAY9 for 9-bit 4:0:0 input. 2018-05-25 20:46:11 +02:00
Timo Rothenpieler
9e857aa00e avcodec/nvdec_hevc: add support for new extended sps/pps flags from SDK 8.1 2018-04-13 09:21:07 +02:00
Michael Niedermayer
4a75a75c62 avcodec/hevc_ps: Check log2_sao_offset_scale_*
Fixes: 4868/clusterfuzz-testcase-minimized-6236542906400768
Fixes: runtime error: shift exponent 126 is too large for 32-bit type 'int'

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-01-30 22:08:32 +01:00