Commit graph

66 commits

Author SHA1 Message Date
Benjamin Gaignard
cd14b0892e codecparsers: av1: Clip max tile rows and cols values
Clip tile rows and cols to 64 as describe in AV1 specification
to avoid writing outside array range but preserve sb_cols
and sb_rows value which are used to futher computation.

Fixes ZDI-CAN-22226 / CVE-2023-44429

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5702>
2023-11-29 15:48:50 +00:00
Benjamin Gaignard
f525de6d00 Revert "codecparsers: av1: Clip max tile rows and cols values"
This reverts commit b76a801f57.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5702>
2023-11-29 15:48:50 +00:00
Michael Grzeschik
23a4b72631 codecparsers: h264bitwriter: Fix trace typo
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5661>
2023-11-14 14:41:37 -05:00
Stéphane Cerveau
fdc3db68cd codecparsers: introduce h265 level enum
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5644>
2023-11-13 16:37:46 +00:00
Benjamin Gaignard
1db83d3f74 codecparsers: av1: Clip max tile rows and cols values
Clip tile rows and cols to 64 as describe in AV1 specification.

Fixes ZDI-CAN-22226 / CVE-2023-44429

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3015

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5634>
2023-11-10 13:45:43 +00:00
Nicolas Dufresne
ff91a3d8d6 h265parser: Fix possible overflow using max_sub_layers_minus1
This fixes a possible overflow that can be triggered by an invalid value of
max_sub_layers_minus1 being set in the bitstream. The bitstream uses 3 bits,
but the allowed range is 0 to 6 only.

Fixes ZDI-CAN-21768, CVE-2023-40476

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2895

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5364>
2023-09-20 14:11:55 +00:00
Seungha Yang
6785c7d378 av1parser: Fix segmentation params update
Even if the segmentation feature value is not updated,
the parsed "segmentation_update_map" and "segmentation_temporal_update"
values should not be cleared as it's referenced during lower
level bitstream parsing. Also, don't use assert() in parser
unless it's clearly impossible condition.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5334>
2023-09-16 07:50:41 +09:00
Aleksandr Slobodeniuk
a98330636a h264/h265parser: clarify some gtk-doc annotations
Needed for the documentation since the transfer
is not obvious.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5287>
2023-09-08 13:41:01 +00:00
Akihiro Sagawa
3c7ba382db codecparsers: Fix MPEG-1 aspect ratio table
The values defined in ISO/IEC 11172-2 are different from those used so far.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5272>
2023-09-06 12:24:37 +00:00
Seungha Yang
d84c13ab0d h265parser: Allow partially broken hvcC data
Ignores parsing error on the last nalu of the array if the nalu type
is not VPS/SPS/PPS

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2905
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5188>
2023-08-23 10:43:18 +00:00
Fabian Orccon
d07ffae343 h264parser: Write Unregistered User Data
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5071>
2023-08-08 02:47:41 +00:00
Fabian Orccon
216f9d66a0 h265parser: Write Unregistered User Data
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5070>
2023-07-25 18:28:26 +00:00
Fabian Orccon
dd47fa53d8 h265parse: Parse SEI unregistered user data
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5070>
2023-07-25 18:28:26 +00:00
Stéphane Cerveau
2974c18a5c codecparsers: keep naming consistency in GST_H264_LEVEL
GST_H264_LEVEL_2 should be used instead of GST_H264_LEVEL_2_0

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4737>
2023-06-26 10:47:36 +00:00
Benjamin Gaignard
465d146864 codecparser: AV1: fix reference frame ordering
In AV1 specifications earliest_order_hint is initialized at
beginning of the process and not before each frame ordering.

FFMPEG parser does the same.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1011>
2023-06-16 01:30:40 +00:00
Seungha Yang
e9d8bf7532 h264parser: Define level enum values
... and stop duplicating it

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4595>
2023-05-17 21:29:25 +00:00
Nicolas Dufresne
dacb2a2b51 h264parser: Fix return value parsing short header
The appropriate return value for incomplete NAL header should be
GST_H264_PARSER_NO_NAL_END. This tells the parser element to
gather more data. Previously, it would assume the NAL is corrupted
and would drop the data, potentially causing stream corruption.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3234>
2023-03-17 21:25:49 +00:00
Tim-Philipp Müller
81716a1097 gst-plugins-bad: re-indent with GNU indent 2.2.12
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4182>
2023-03-17 03:18:54 +00:00
Seungha Yang
5227b3c9a6 h265parser: Add an API for HEVCDecoderConfigurationRecord parsing
Add a method for HEVC configuration data parsing

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2759>
2023-03-06 12:50:41 +00:00
Nicolas Dufresne
9aa41aa35e h264bitwriter: Remove second_chroma_qp_index_offset cast
That API pps->second_chroma_qp_index_offset has been fixed to reflect
the sign of field in the spec.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3966>
2023-02-20 16:40:02 +00:00
Mengkejiergeli Ba
bca3a3c923 h264parser: Fix the type of a parameter
From spec, the value of second_chroma_qp_index_offset is in the range of
-12 to +12 inclusive. Fix its type from guint8 to gint8.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3966>
2023-02-20 16:40:01 +00:00
Mengkejiergeli Ba
b2fcc177f5 av1parser, h265parser: Fix some code defects
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3953>
2023-02-19 11:23:00 +00:00
Mengkejiergeli Ba
585d2d93f6 codecparsers: {h264,h265}bitwriter: Remove redundant condition checks
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3967>
2023-02-15 16:00:04 +08:00
Sebastian Dröge
5119ca25e4 av1parser: Don't consider unknown metadata OBUs a bitstream error
Just don't parse them.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1774

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3898>
2023-02-09 14:52:58 +00:00
Tim-Philipp Müller
4051581ed8 codecparsers: vp9parser: use single allocation for parser structs
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3790>
2023-01-27 23:50:19 +00:00
U. Artie Eoff
d071ea714d vp9parser: remove checks for g_new0 result
The g_new0 aborts the process if it fails.  Thus,
there is no need to check if the g_new0 call succeeded.

This should silence a resource leak warning by static
scan.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3788>
2023-01-25 17:36:54 +00:00
Tim-Philipp Müller
32384c0c69 libs: codecparsers: drop use of GSlice
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3695>
2023-01-24 15:25:07 +00:00
Seungha Yang
979ff4616e h264parser: Update doc for GST_H264_FRMAE_PACKING_TOP_BOTTOM
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1318>
2022-12-12 21:43:14 +00:00
Brad Hards
29dd254f7a h264parser: typo fix in enum value
Old value is marked deprecated, new enum with same entry is added. Should be binary compatible.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1318>
2022-12-12 21:43:14 +00:00
He Junyan
25f90c828a h264parser: Fix a typo in pred_weight_table parsing.
When setting default values, the reference list number of l1 is wrong.

Fix: https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/issues/336
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3464>
2022-11-25 14:13:46 +00:00
Seungha Yang
55ca832d70 av1parser: Don't print warning for expected OBU drop
Dropping an OBU which is not in selected operation point is an
expected condition.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3430>
2022-11-19 11:58:01 +00:00
Seungha Yang
3ef2955c7d av1parser: Remove impossible condition
unsigned integer cannot be negative

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3430>
2022-11-19 11:58:01 +00:00
Matthew Waters
f77f27f4c9 vp9parser: initialize subsampling to -1
The default value of 0 is a valid subsampling value and could be
confused with an 'unset' value.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3260>
2022-10-28 00:06:07 +00:00
He Junyan
2408ca2f18 h265bitwriter: Correct the all API to byte aligned.
In fact, all the h265 bit writer have byte aligned output. So we
change the API from bit size in unit to byte size, which is easy
to use.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3193>
2022-10-27 12:15:43 +00:00
He Junyan
c294ba82e6 h264bitwriter: Correct the all API to byte aligned.
In fact, all the h264 bit writer have byte aligned output except
the slice header. So we change the API from bit size in unit to
byte size, which is easy to use. For slice header, we add a extra
"trail_bits_num" to return the unaligned bits number.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3193>
2022-10-27 12:15:43 +00:00
He Junyan
9dc76185fc bitwriter: Fix a nal conversion bug when input is not byte aligned.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3193>
2022-10-27 12:15:43 +00:00
Seungha Yang
2c5a050ae7 codecparsers: {h264,h265}bitwriter: Don't install headers yet
Those APIs are quite early stage of development, and we might want to
change them in the near future

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3275>
2022-10-27 06:15:56 +00:00
Stéphane Cerveau
fb09c028e3 h265parse: fix typo in member of GstH265SPS
Rename sps_extnsion_params to sps_extension_params

Fix comment about vui_parameters_present_flag

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3072>
2022-10-04 10:01:12 +00:00
Thibault Saunier
bc9c1e3956 meson: Namespace the plugins_doc_dep/libraries variables
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2970>
2022-09-01 21:17:35 +00:00
Benjamin Gaignard
5ae05bb42a codecparsers: Defering computation of pps and sps fields
While possible defer computataion of pps and sps fields until
slice parsing since it may happens that bitstreams don't encoded
them in expected order.
A example weird ordered bitstreams is VPSSPSPPS_A_MainConcept_1
conformance test.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2575>
2022-07-22 16:13:47 -04:00
Nicolas Dufresne
74a811e718 codecparsers: h265: Introduce long_term_ref_pic_set_size
This is the size of the `if( long_term_ref_pics_present_flag )` inside
slice_segment_header( ) syntax. This size in bit, and after de-emulation
is needed by some HW.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1079>
2022-07-22 10:21:02 -04:00
Seungha Yang
72975fbd6d h264parser: Add an API for AVCDecoderConfigurationRecord parsing
Add a method for AVC configuration date parsing

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2449>
2022-06-15 19:58:59 +00:00
He Junyan
e2392e2e3e h264parser: Fix memory leaks in parse_user_data_unregistered().
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2551>
2022-06-06 19:21:58 +00:00
Andoni Morales Alastruey
cb7e1a6576 h264parse: fix leak in user data unregistered
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1458>
2022-06-03 08:29:05 +00:00
Andoni Morales Alastruey
64a92b549d Fix documentation
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1458>
2022-06-03 08:29:05 +00:00
Andoni Morales Alastruey
ca2eb9f65f h264parse: add support Precision Time Stamp in SEI messages
Expose User Data Unregistered as a new Meta and add
API to parse Precision Time Stamp (ST 0604).

Fixes #927

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1458>
2022-06-03 08:29:05 +00:00
Seungha Yang
be84fc23ca h265parser: Add a new NAL parsing API to handle malformed packets
Add gst_h265_parser_identify_and_split_nalu_hevc() method to
handle a case where packetized stream contains start-code prefix.
This new method behaves similar to exisiting gst_h265_parser_identify_nalu_hevc()
but it will scan start-code prefix to split given data into
NAL units.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2394>
2022-05-10 03:58:51 +09:00
He Junyan
9ec4041a51 codecparsers: bitwriter: Calculate PicSizeInCtbsY when writing slice header.
The slice->pps->PicWidthInCtbsY/PicHeightInCtbsY values are calculated when
 we parse the slice header. But they are not calculated in bitwriter and so
 may not have valid value when writing slice header.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2287>
2022-04-26 16:04:15 +00:00
He Junyan
abf19020a4 codecparsers: bitwriter: Fix some coverity issues of H265 bitwriter.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2287>
2022-04-26 16:04:15 +00:00
He Junyan
d9d03e1dba codecparsers: bitwriter: Add the common bit writer functions for H265.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1831>
2022-04-22 07:35:17 +00:00