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

203 Commits

Author SHA1 Message Date
Andreas Rheinhardt
8fb89790af avcodec/h264_ps: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-10 13:51:37 +01:00
Andreas Rheinhardt
787351a68e avcodec/h264_ps: Use RefStruct API for SPS/PPS
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 avoids having to keep
H264ParamSets.pps and H264ParamSets.pps_ref and PPS.sps
and PPS.sps_ref in sync and gets rid of casts and indirections.

(The removal of these checks and the syncing code even more
than offset the additional code for RefStruct.)

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-07 22:34:20 +02:00
Lynne
20de09a6de
h264_ps: expose scaling_matrix_present_mask
Vulkan requires it.
It technically also requires use_default_scaling_matrix_mask,
but we can just be explicit and give it the matrix we fill in as-non
default.
2023-05-29 00:41:30 +02:00
Lynne
d13b1c42f6
h264_ps: expose bit rate and CPB size fields 2023-05-29 00:41:30 +02:00
Lynne
de6fce727c
h264_ps: expose max_dec_frame_buffering 2023-05-29 00:41:30 +02:00
Lynne
6718b37e5d
h264_ps: set pic_scaling_matrix_present_flag 2023-05-29 00:41:29 +02:00
Lynne
02f38af2dd
h264_ps: expose pps_id 2023-05-29 00:41:29 +02: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
1e38e7fd14 avcodec/h264_ps: Don't output invalid chroma location
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
8d481b0234 avcodec/h264_ps: Don't error out on unknown aspect ratio
Values 17..254 are actually only reserved and not invalid.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-12-01 11:00:41 +01:00
rcombs
c534d9f72a lavc/h264_ps: always include the stop bit in [s|p]ps->data
The VideoToolbox hwaccel needs the entire NAL (including the stop bit),
but ff_h2645_packet_split may remove it. Detect this case by looking for
bit counts divisible by 8 and insert a stop-bit-only 0x80 byte.

Signed-off-by: rcombs <rcombs@rcombs.me>
2022-06-01 19:38:50 -05:00
Andreas Rheinhardt
27f22f3383 all: Remove unnecessary libavcodec/internal.h inclusions
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-02-08 06:16:26 +01:00
Andreas Rheinhardt
f0a7db12a2 avcodec/h264_ps: Remove ALLOW_INTERLACED cruft
Since e1027aba68,
ALLOW_INTERLACED is no longer defined in h264_ps.c,
leading to a warning when encountering an SPS compatible
with MBAFF. This warning was always nonsense, because
ff_h264_decode_seq_parameter_set() is also used by the parser
and it makes no sense for the parser to warn about missing
decoder features; after all, it is not a parser's job
to warn when a feature is unsupported by a decoder
(and in this case it is even weirder, because even if the H.264
decoder is disabled, the warning will only be shown for MBAFF
sequence parameter sets). So remove the warning in h264_ps.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 20:35:05 +01:00
Anton Khirnov
b6f3334a13 lavc/h264: replace MAX_DELAYED_PIC_COUNT by H264_MAX_DPB_FRAMES 2022-01-26 15:23:30 +01:00
Andreas Rheinhardt
cbb6ba2e86 avcodec/cavsdec, h264*, hevc_parser: Use get_ue_golomb_31 where possible
instead of get_ue_golomb(). The difference between the two is that the
latter also has to take into account the case in which the read code is
more than 9 bits (four preceding zeroes + at most five value bits) long,
leading to more code.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-07-29 05:11:54 +02:00
Anton Khirnov
5e316096fa h264_ps: make the PPS hold a reference to its SPS
It represents the relationship between them more naturally and will be
useful in the following commits.

Allows significantly more frames in fate-h264-attachment-631 to be
decoded.
2020-04-10 15:52:41 +02:00
Anton Khirnov
ad9052c4f8 h264_ps: pass AVCodecContext as void* where possible
Makes sure it is only used for logging and nothing else.
2020-03-27 13:43:40 +01:00
Anton Khirnov
6eae7e5644 h264dec: do not export the chroma sample location immediately on parsing the SPS
This SPS is not necessarily the one that will be used. Export the chroma
location along with all the other SPS properties.
2020-03-20 09:16:05 +01:00
Andriy Gelman
018a42790c avcodec/h264_ps: Return error if pps has FMO parameters
FMO is not supported and fields related to FMO are not parsed, meaning
that any fields which follow will be corrupt.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-02-12 23:31:37 -03:00
Michael Niedermayer
d9751a1162 avcodec/h264_ps: Show VUI and SPS overread messages just once per frame thread
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-02-12 10:25:25 +01:00
Michael Niedermayer
77ba9e3252 avcodec/h264_ps: Provide more details with "Truncated VUI" Message
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-31 18:43:50 +01:00
Michael Niedermayer
7c6f2bfdb2 avcodec/h264_ps: Check offset_for_non_ref_pic, offset_for_top_to_bottom_field and offset_for_ref_frame
Fixes: signed integer overflow: -2147483648 + -1 cannot be represented in type 'int'
Fixes: 14444/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_fuzzer-5675880333967360

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-05-12 16:32:16 +02:00
James Almer
a42e761b96 avcodec/h264_ps: use get_se_golomb_long() to parse some sps fields
All three may be up to 32 bits wide.

Signed-off-by: James Almer <jamrial@gmail.com>
2019-04-24 18:34:51 -03:00
Michael Niedermayer
b796c5ae92 avcodec/h264_ps: Move MAX_LOG2_MAX_FRAME_NUM to header so it can be used in h264_sei
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-06-11 00:51:20 +02:00
Kieran Kunhya
77748d12a0 h264: Make Truncating SPS/PPS message debug. 2017-11-04 18:14:00 +00:00
James Almer
07596e45c5 avcodec/h264dec: export cropping information instead of handling it internally
This merges commit c3e84820d6 from libav,
originally written by Anton Khirnov and skipped in
fc63d5ceb3.

 libavcodec/h264_picture.c |  3 ---
 libavcodec/h264_ps.c      |  9 ---------
 libavcodec/h264_slice.c   | 25 +++++++++++++++++++------
 libavcodec/h264dec.c      | 13 +------------
 libavcodec/h264dec.h      |  9 +++++----
 5 files changed, 25 insertions(+), 34 deletions(-)
2017-05-26 11:15:45 -03:00
Clément Bœsch
883fe17e3b Merge commit 'ff9db5cfd14558df9cfcc54d6c062bc34bf1f341'
* commit 'ff9db5cfd14558df9cfcc54d6c062bc34bf1f341':
  lavc: Use a stricter check for the color properties values

Merged-by: Clément Bœsch <u@pkh.me>
2017-04-08 14:41:10 +02:00
Clément Bœsch
e3287077ec Merge commit '67deba8a416d818f3d95aef0aa916589090396e2'
* commit '67deba8a416d818f3d95aef0aa916589090396e2':
  Use avpriv_report_missing_feature() where appropriate

Merged-by: Clément Bœsch <cboesch@gopro.com>
2017-03-31 10:40:34 +02:00
Michael Niedermayer
4f727fbc73 avcodec/h264_ps: Fix runtime error: signed integer overflow: 2147483647 + 26 cannot be represented in type 'int'
Fixes: 902/clusterfuzz-testcase-4561155144024064

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Reviewed-by: "Ronald S. Bultje" <rsbultje@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-23 15:25:48 +01:00
Clément Bœsch
b6e88bf323 Merge commit 'b96f0ab3d29cdd9ea9ddabfb2052f72bf8615661'
* commit 'b96f0ab3d29cdd9ea9ddabfb2052f72bf8615661':
  h264: Kill broken disabled cruft

Merged-by: Clément Bœsch <u@pkh.me>
2017-03-19 15:56:19 +01:00
Michael Niedermayer
dc0b9b218c avcodec/h264_ps: Forward errors from decode_scaling_list()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-11 02:50:22 +01:00
Michael Niedermayer
9568b2e425 avcodec/h264_ps: Check chroma_qp_index_offset
Fixes: 647/clusterfuzz-testcase-5195745823031296

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Reviewed-by: BBB
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-23 02:37:55 +01:00
Michael Niedermayer
cbd622be99 avcodec/h264_ps: Check delta scale for validity
Fixes: signed integer overflow: 5 + 2147483646 cannot be represented in type 'int'
Fixes: 634/clusterfuzz-testcase-5285420445204480

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-21 15:31:06 +01:00
Michael Niedermayer
59e5b05ef6 avcodec/h264_ps: Fix runtime error: signed integer overflow: -1094995528 * 2 cannot be represented in type 'int'
Fixes: 615/clusterfuzz-testcase-5488002644049920
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-19 22:55:04 +01:00
Vittorio Giovara
ff9db5cfd1 lavc: Use a stricter check for the color properties values
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2016-12-02 11:36:42 -05:00
Hendrik Leppkes
cca4fd4778 Merge commit 'a8cbe5a0ccebf60a8a8b0aba5d5716dd54c1595c'
* commit 'a8cbe5a0ccebf60a8a8b0aba5d5716dd54c1595c':
  h264_ps: export actual height in MBs as SPS.mb_height

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-11-17 15:17:21 +01:00
Diego Biurrun
67deba8a41 Use avpriv_report_missing_feature() where appropriate 2016-11-08 17:54:34 +01:00
Diego Biurrun
b96f0ab3d2 h264: Kill broken disabled cruft 2016-08-17 12:16:42 +02:00
James Almer
9ee1f03365 Merge commit '70b1dcef2d859ae6b3e21d61de928c3dd0cf1aa4'
* commit '70b1dcef2d859ae6b3e21d61de928c3dd0cf1aa4':
  h264: tighten the valid range for ref_frame_count

Conflicts:
libavcodec/h264_ps.c

Merged-by: James Almer <jamrial@gmail.com>
2016-08-01 13:02:20 -03:00
James Almer
8c7932884d Merge commit 'f638b67e5790735f34620bf82025c9b9d6fc7216'
* commit 'f638b67e5790735f34620bf82025c9b9d6fc7216':
  h264: move the parameter set definitions to a new header file

Conflicts:
libavcodec/h264_parse.h
libavcodec/h264_ps.c
libavcodec/h264dec.h

Merged-by: James Almer <jamrial@gmail.com>
2016-08-01 12:58:09 -03:00
Clément Bœsch
15b26e88cb Merge commit '9df889a5f116c1ee78c2f239e0ba599c492431aa'
* commit '9df889a5f116c1ee78c2f239e0ba599c492431aa':
  h264: rename h264.[ch] to h264dec.[ch]

Merged-by: Clément Bœsch <u@pkh.me>
2016-07-29 11:01:36 +02:00
Carl Eugen Hoyos
9bd35a76fc lavc/h264_ps: Be more verbose when truncating likely oversized PPS. 2016-07-24 20:21:37 +02:00
Anton Khirnov
a8cbe5a0cc h264_ps: export actual height in MBs as SPS.mb_height
Currently, SPS.mb_height is actually what the spec calls
PicHeightInMapUnits, which is half the frame height when interlacing is
allowed. Calling this 'mb_height' is quite confusing, and there are at
least two associated bugs where this field is treated as the actual
frame height - in the h264 parser and in the code computing maximum
reordering buffer size for a given level.

Fix those issues (and avoid possible future ones) by exporting the real
frame height in this field.
2016-07-11 16:29:57 +02:00
Clément Bœsch
b4abf0e396 Merge commit 'a833ff68f6bf9dc72c3ef0ddf830ebed743c0703'
* commit 'a833ff68f6bf9dc72c3ef0ddf830ebed743c0703':
  h264: Fix decoding delay for Intra only streams

Merged-by: Clément Bœsch <u@pkh.me>
2016-07-09 14:06:11 +02:00
Benoit Fouet
879330c561 h264: make H264ParamSets sps const 2016-06-30 09:24:39 +02:00
Benoit Fouet
4cc1ce4a91 h264: straighten dimensions check ff_h264_decode_seq_parameter_set
The MBS only flag was not taken into account when checking macroblock dimensions.
Also removes the unneeded check in init_dimensions for slices.
2016-06-30 09:24:39 +02:00
Benoit Fouet
3e8cda1eb1 h264_ps: change decode_scaling_matrices so that it takes const {s,p}ps
In order to be able to make SPS const in H264ParamSets,
modify decode_scaling_matrices so that it returns if the scaling
matrix are present in the SPS, instead of altering the input SPS
structure.
2016-06-30 09:24:39 +02:00
Clément Bœsch
8ef57a0d61 Merge commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb'
* commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb':
  cosmetics: Fix spelling mistakes

Merged-by: Clément Bœsch <u@pkh.me>
2016-06-21 21:55:34 +02:00
Anton Khirnov
70b1dcef2d h264: tighten the valid range for ref_frame_count
This field (which the spec calls max_num_ref_frames) must be less than
or equal to MaxDpbFrames, which is at most 16.
2016-06-21 11:14:07 +02:00