Commit graph

67 commits

Author SHA1 Message Date
He Junyan
35bf824b6d libs: h265parser: select extension profile by profile idc.
the old manner does not consider the profile idc. The profile idc should
play an more important role in recognizing the profile than the other
information. And there is no need to mix profiles of different extensions
together to find the closest profile when the bits stream is not standard,
different extensions support different features and should not be mixed.

The correct way should be recognize the extension category by profile idc
firstly, and then find the closest profile.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1121>
2020-04-28 13:54:11 +00:00
He Junyan
f4ddccb08e libs: h265parser: rename the FormatRangeExtensionProfile
FormatRangeExtensionProfile declares the common bits used for not
only format range extensions profiles, but also for several different
h265 extension profiles, such as high throughput, screen content
coding extensions, etc. And So the old name is not proper.
We also rename the get_h265_extension_profile function.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1121>
2020-04-28 13:54:11 +00:00
He Junyan
e99b962c0f libs: h265parser: Fix a bug for getting extension profile.
We should use the traget ExtensionProfile's IDC to check the
profile_compatibility_flag, rather than the profile_idc in the
stream. The old profile_compatibility_flag check always return
true. This causes that profiles with same constraint flags but
different profile_idc can't be recognized correctly. For example,
the screen-extended-main-444 profile is always be recognized as
the high-throughput-444 profile.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1121>
2020-04-28 13:54:11 +00:00
Seungha Yang
eeb3dd6605 h265parser: Fix some coverity issues
- Remove useless comparison
- Fix invalid memory access

CID: 1461477, 1461476, 1461475, 1461474, 1461279
2020-04-13 12:28:14 +00:00
Seungha Yang
a2f68762b0 h265parser: Add APIs to allow update VPS/SPS/PPS
gst_h265_parser_parse_{vps,sps,pps} APIs were used to parse VPS/SPS/PPS and
also in order to update parser's internal state at once. Meanwhile
gst_h265_parse_{vps,sps,pps} APIs are to parse VPS/SPS/PPS without state update.
This commit introduces new APIs so that only accepted VPS/SPS/PPS by user
can be updated to be used by parser.
2020-04-09 19:33:56 +00:00
Seungha Yang
ce09ceb106 h265parser: Add a helper method to create SEI nal unit
Add an API to create raw SEI nal unit. This would be useful in case
an user want to create SEI nal data and inject the SEI nal data
into bitstream.
2020-04-02 09:20:11 +00:00
Seungha Yang
e65d06dc6a h265parser: Fix registered user data SEI leak
... and add fix for the SEI data in gst_h265_sei_copy()
2020-03-23 15:21:42 +00:00
Seungha Yang
ef14a032c1 h265parser: Do not allocate too large size of memory for registered user data SEI
Don't be confused by the unit of payload size (i.e., bits and bytes)
Also this need a documentation with Since mark
2020-03-23 15:21:42 +00:00
Seungha Yang
353013fcaa h265parser: Store NumDeltaPocs of reference for hardware accelerators
That's the value of NumDeltaPocs[RefRpsIdx] and we might be able to derive
the value from given sps and slice header.
Because well known hardware implementations refer to the value, however,
storing the value makes things easier.

Following is the list of hardware implementations
* DXVA2: ucNumDeltaPocsOfRefRpsIdx
* NVDEC/VDPAU: NumDeltaPocsOfRefRpsIdx
2020-03-07 12:20:03 +09:00
Seungha Yang
959320264a h265parser: Add helper macro for nal type classification
Add some macros to remove code duplication and to make it more readable
2020-03-05 23:22:34 +09:00
Jan Schmidt
69ef74d96a h265parser: Skip unused bits in an SEI.
Alternative approach to 18b54f8d34
that skips all bits in a broken SEI correctly.
2020-02-25 09:33:47 +00:00
Stéphane Cerveau
98f8bb4e7e Revert "h265parser: Skip unused SEI bits differently"
This reverts commit 18b54f8d34.
2020-02-25 09:33:47 +00:00
Dylan Yip
0c798c8771 h265parse: Fix offset by one error in pic timing SEI
Offset by one error causes a free/malloc error when parsing pic timing
SEI messages.
2020-02-25 09:33:47 +00:00
Yeongjin Jeong
3f2240498b h265parser: Add simple GstH265Profile/string public utilites
It makes more simplifies the conversion between GstH265Profile and string.
2019-12-20 15:43:55 +00:00
Aaron Boxer
6d3429af34 documentation: fixed a heap o' typos 2019-11-05 09:11:25 -05:00
Seungha Yang
6f2ab31d10 h265parser: Calculate short term RPS size in slice header
The calculated size of short_term_ref_pic_set is not a part of
HEVC syntax but the value is used by some stateless decoders
(e.g., vaapi, dxva, vdpau and nvdec) for the purpose of skipping
parsing the syntax by the accelerator.
2019-10-12 02:44:35 +00:00
Wangfei
4bc46b902d h265parse lib: fix missing condition when parse PPS
Follow h265 spec(04/2015), log2_max_transform_skip_block_size_minus2
should get with condition when transform_skip_enabled_flag is 1.
2019-08-31 23:22:44 +00:00
Aaron Boxer
40212aaf00 h265parse: add support for SEI registered user data 2019-08-26 18:14:17 -04:00
Jan Schmidt
18b54f8d34 h265parser: Skip unused SEI bits differently
3-byte emulation bytes can confuse the current code that skips
bits at the end of an SEI. Use a simpler method that's also
quicker because it skips all remaining bits in one go instead
of 1 bit at a time.
2019-07-30 17:37:49 +00:00
Seungha Yang
567258be29 h265parser: Add more profiles to known type
"High Throughput", "Multiview", "Scalable", "3D", "Screen Content Coding",
and "Scalable format range extensions" profiles can be supported
via h265parser APIs now.
2019-06-13 23:05:09 -04:00
Dong Il Park
1af22f3561 h265parser: Use vps_timing_info when not present in vui
The same timing_info will be present at vps or vui.
When the timeing_info is present in the VPS, vui_timing_info
, when present, shall be equal to vps_timing_info, and when
not present, is inferred to be equal to vps_timing_info.
2019-06-14 02:15:46 +00:00
Tim-Philipp Müller
0d59589935 codecparsers: fix debug category initialisation
Make thread-safe.
2019-05-25 15:29:25 +02:00
Thibault Saunier
7fe3f36ac8 Minor documentation fixes 2019-05-13 11:36:27 -04:00
Seungha Yang
bd91ebd6e4 h265parser: Add parsing mastering display colour volume SEI message
... and content light level SEI message. Those SEI messages are required
for HDR rendering.
2019-05-03 19:44:15 +00:00
Wangfei
3a0a82a783 h265parser: parse range extension message in SPS/PPS.
Range extension message may exist in some extension-profile clips.
2019-04-30 16:09:24 +08:00
Mathieu Duponchelle
55bb8966e1 h265parse: forward time codes
This transforms time code SEIs into GstVideoTimeCodeMeta
2019-04-01 10:02:33 +00:00
Guillaume Desmottes
64643fdfb4 h265parser: parse SEI recovery point
Copied the implementation from h264parser and adapted it to the HEVC
syntax.

https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/790
2018-12-02 02:07:39 +00:00
Seungha Yang
52f2054386 h265parser: Various update of vps parsing
* Add FIXME for future correction of HRDParames parsing.
Spec. defines that the number of HRDParames could be up to
"vps_num_layer_sets_minus1 + 1" (i.e., 1024).

* Add parsing vps_base_layer_{internal,available}_flag.

* Fix possible invalid vps_extension parsing.

Fixes #798
2018-11-07 18:24:59 +09:00
Seungha Yang
0916e2bb56 h265parser: Fix wrong maximum range check in gst_h265_parse_vps()
Fix validation of some syntax.

Fixes #798
2018-11-07 16:06:11 +09:00
Nicolas Dufresne
7d1be36561 h265parser: Stop considering 6 bytes NAL complete
This is only TRUE for EOS / EOB NALs. Before this patch, passing
any valid 6 bytes of a NAL would make the parser pretend this NAL is
complete.
2018-11-06 07:26:03 +00:00
Guillaume Desmottes
6dd997541c h265parser: allow partial matching on range extension profile
Best to return a valid profiles rather than no profile if bitstream uses
a not standard profile.

https://bugzilla.gnome.org/show_bug.cgi?id=793876
2018-03-05 13:22:12 -05:00
Guillaume Desmottes
9f25fcdfc9 h265parse: add support for 'Format range extensions profiles'
Those profiles have been introduced in version 2 of the HEVC spec
(A.3.5).

https://bugzilla.gnome.org/show_bug.cgi?id=793876
2018-03-05 13:22:12 -05:00
Guillaume Desmottes
977af86e8b h265parser: parse extra profile fields
Those fields have been introduced in version 2 and later to define new
profiles like the format range extensions profiles (A.3.5).

NOTE: This patch breaks the parser ABI, rebuild needed.

https://bugzilla.gnome.org/show_bug.cgi?id=793876
2018-03-05 13:21:33 -05:00
Guillaume Desmottes
d252f503fc h265parser: decouple GstH265Profile and GstH265ProfileIDC
We used to have the same enum to represent H265 profiles and idc values.
Those are no longer the same with extension profiles defined from
version 2 of the spec.
Split those enums so the semantic of each is clearer and we'll be able
to add extension profiles to GstH265Profile.

Also add gst_h265_profile_tier_level_get_profile() to retrieve the
GstH265Profile from the GstH265ProfileTierLevel. It will be used to
implement the detection of extension profiles.

https://bugzilla.gnome.org/show_bug.cgi?id=793876
2018-03-05 13:19:42 -05:00
Tim-Philipp Müller
2445021120 codecparsers: make debug categories static
They're only used internally. The VP9 parser's debug
category symbol was accidentally exported.
2017-08-11 14:34:34 +01:00
Thibault Saunier
78022a6e0c docs: Port all docstring to gtk-doc markdown 2017-04-12 12:57:57 -03:00
Scott D Phillips
cf0d45c100 codecparsers: h265: Fix initialization of slice_deblocking_filter_disabled_flag
H.265 7.4.7.1 says:

> When slice_deblocking_filter_disabled_flag is not present, it is
> inferred to be equal to pps_deblocking_filter_disabled_flag.

https://bugzilla.gnome.org/show_bug.cgi?id=762351
2016-02-20 10:55:46 +02:00
Víctor Manuel Jáquez Leal
c8b3d84757 codecparser: h265: initialize parsing structures
Initialize to 0 these parse structures before filling them: GstH265SEIMessage,
GstH265NalUnit, GstH265VPS, GstH265PPS, GstH265SPS and GstH265SliceHdr.

When calling the functions which fill those structures, they may fail, leaving
unitialized those structures. This situation may lead to future problems, such
as a segmentation fault when freeing, for example.

This patch initializes to zero these structures, before filling them.

https://bugzilla.gnome.org/show_bug.cgi?id=755161
2015-10-29 11:26:36 +02:00
Sreerenj Balachandran
fcd42b7d77 codecparsers: h265: Fix the selection of Active Ref Pic Set
If short_term_ref_pic_set_sps_flag is FALSE, the ShortTermRefPicSet
structure is supposed to derive from slice header. Which means,
CurrRpsIdx is equal to num_short_term_ref_pic_sets. But the number
of refpicsets communicated via sps header is only num_short_term_ref_pic_sets - 1.
And we are using slice_header structure to reference the last entry, which is
ShortTermRefPicSet[num_short_term_ref_pic_sets].

https://bugzilla.gnome.org/show_bug.cgi?id=754834
2015-09-10 21:12:30 +02:00
Sreerenj Balachandran
81435c8891 codecparsers: h265 : Fix default scaling list values
Fix the default_scaling_list values based on Table 7-6

https://bugzilla.gnome.org/show_bug.cgi?id=754834
2015-09-10 21:10:17 +02:00
XuGuangxin
54c2620bdb codecparsers: h265: Fix tile row and column parsing
Section 6.5.1:  Coding tree block raster and tile scanning conversion process
Follow the equations 6-3 and 6-4

This will provide correct offset_max in slice_header for parsing
num_entry_point_offsets.

https://bugzilla.gnome.org/show_bug.cgi?id=754024

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-08-26 12:24:02 +03:00
lyb
497f372668 codecparsers: h265: Add APIs for up-right-diagonal/raster scan conversion
As per  7-42 and 7-43 the ScalingFactor's scanIdx is 0,
which is "up-right-diagonal" scan. Add APIs for converting
up-right-diagonal to raster and vise versa.

https://bugzilla.gnome.org/show_bug.cgi?id=754024
2015-08-24 21:28:08 +03:00
XuGuangxin
26e350f0bf codecparsers: h265: Fix the range of delta_chroma_log2_weight_denom
Being more strict on specification, According to 7.4.7.3,
delta_chroma_log2_weight_denom should be in the range of
[(0 - luma_log2_weight_denom), (7 - luma_log2_weight_denom)]

https://bugzilla.gnome.org/show_bug.cgi?id=754024
2015-08-24 21:21:29 +03:00
Sreerenj Balachandran
8a6cc4ed27 codecparsers: h265: Fix the range of delta_chroma_log2_weight_denom
ChromaLog2WeightDenom = luma_log2_weight_denom + delta_chroma_log2_weight_denom

The value of ChromaLog2WeightDenom should be in the range of 0 to 7 and
the value luma_log2_weight_denom  should be also in the range of 0 to 7.
Which means , delta_chroma_log2_weight_denom can have values in the range
between -7 and 7.

https://bugzilla.gnome.org/show_bug.cgi?id=753552
2015-08-12 14:11:31 +02:00
Sreerenj Balachandran
b6b2e04501 codecparsers: h265: Fix the parsing of ref_pic_lists_modification
https://bugzilla.gnome.org/show_bug.cgi?id=753552
2015-08-12 14:11:26 +02:00
Sreerenj Balachandran
e6e0702821 codecparser: h265: Fix nal unit size checking
The EOS and EOB nals have the size 2 which is the size of
nal unit header itself. The gst_h265_parser_identify_nalu()
is not required to scan start code again in this case.

In other cases, for a valid nalunit the minimum required size
is 3 bytes (2 byte header and at least 1 byte RBSP payload)
2015-04-30 21:47:38 +02:00
Sreerenj Balachandran
af7ff2bd95 codecparser: h265: Calculate crop rectangle dimensions 2015-04-30 21:46:31 +02:00
Sreerenj Balachandran
877e69c9ec codecparser: h265: Fix parsing multiple SEI messages in a single SEI Nal
An SEI Nal can have more than one SEI message.

Change in API: the gst_h265_parser_parse_sei()
2015-04-30 21:45:39 +02:00
Sreerenj Balachandran
8407622c93 codecparser: h265: Fix the number of tile rows/columns parsing
The possible minimum value for num_tile_columns_minus1 and num_tile_rows_minus1
is zero (7.4.3.3).

https://bugzilla.gnome.org/show_bug.cgi?id=748641
2015-04-29 19:16:48 +02:00
Sreerenj Balachandran
989643ff7c codecparsers: h265: add helpers to convert quantization matrices
Add utility functions to convert quantization matrices from zig-zag scan
order into raster scan order and vice-versa

https://bugzilla.gnome.org/show_bug.cgi?id=747613
2015-04-26 21:46:25 +02:00