/src/vvdec/source/Lib/DecoderLib/HLSyntaxReader.h
Line | Count | Source |
1 | | /* ----------------------------------------------------------------------------- |
2 | | The copyright in this software is being made available under the Clear BSD |
3 | | License, included below. No patent rights, trademark rights and/or |
4 | | other Intellectual Property Rights other than the copyrights concerning |
5 | | the Software are granted under this license. |
6 | | |
7 | | The Clear BSD License |
8 | | |
9 | | Copyright (c) 2018-2026, Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. & The VVdeC Authors. |
10 | | All rights reserved. |
11 | | |
12 | | Redistribution and use in source and binary forms, with or without modification, |
13 | | are permitted (subject to the limitations in the disclaimer below) provided that |
14 | | the following conditions are met: |
15 | | |
16 | | * Redistributions of source code must retain the above copyright notice, |
17 | | this list of conditions and the following disclaimer. |
18 | | |
19 | | * Redistributions in binary form must reproduce the above copyright |
20 | | notice, this list of conditions and the following disclaimer in the |
21 | | documentation and/or other materials provided with the distribution. |
22 | | |
23 | | * Neither the name of the copyright holder nor the names of its |
24 | | contributors may be used to endorse or promote products derived from this |
25 | | software without specific prior written permission. |
26 | | |
27 | | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY |
28 | | THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND |
29 | | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
30 | | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
31 | | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR |
32 | | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
33 | | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
34 | | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
35 | | BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER |
36 | | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
37 | | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
38 | | POSSIBILITY OF SUCH DAMAGE. |
39 | | |
40 | | |
41 | | ------------------------------------------------------------------------------------------- */ |
42 | | |
43 | | /** \file HLSyntaxReader.h |
44 | | * \brief Reader for high level syntax |
45 | | */ |
46 | | |
47 | | #pragma once |
48 | | |
49 | | #include "DecoderLib/VLCReader.h" |
50 | | #include "CommonLib/Slice.h" |
51 | | |
52 | | namespace vvdec |
53 | | { |
54 | | |
55 | | class AUDReader: public VLCReader |
56 | | { |
57 | | public: |
58 | 0 | AUDReader(){}; |
59 | 0 | virtual ~AUDReader(){}; |
60 | | void parseAccessUnitDelimiter( InputBitstream* bs, uint32_t& picType ); |
61 | | }; |
62 | | |
63 | | class FDReader : public VLCReader |
64 | | { |
65 | | public: |
66 | 0 | FDReader(){}; |
67 | 0 | virtual ~FDReader(){}; |
68 | | void parseFillerData( InputBitstream* bs, uint32_t& fdSize ); |
69 | | }; |
70 | | |
71 | | class HLSyntaxReader : public VLCReader |
72 | | { |
73 | | public: |
74 | 0 | HLSyntaxReader() = default; |
75 | | virtual ~HLSyntaxReader() = default; |
76 | | |
77 | | void parseVPS ( VPS* pcVPS ); |
78 | | void parseDCI ( DCI* dci ); |
79 | | void parseSPS ( SPS* pcSPS, const ParameterSetManager* parameterSetManager ); |
80 | | void parsePPS ( PPS* pcPPS, const ParameterSetManager* parameterSetManager ); |
81 | | bool parseAPS ( APS* pcAPS ); |
82 | | void parsePictureHeader ( PicHeader* picHeader, const ParameterSetManager* parameterSetManager, bool readRbspTrailingBits ); |
83 | | void parseSliceHeader ( Slice* pcSlice, std::shared_ptr<PicHeader>& picHeader, const ParameterSetManager* parameterSetManager, const int prevTid0POC, bool& firstSliceInPic ); |
84 | | |
85 | | private: |
86 | | void parseAlfAps ( APS* pcAPS ); |
87 | | void parseLmcsAps ( APS* pcAPS ); |
88 | | void parseScalingListAps ( APS* pcAPS ); |
89 | | void parseVUI ( VUI* pcVUI, unsigned vuiPayloadSize ); |
90 | | void parseConstraintInfo ( ConstraintInfo *cinfo ); |
91 | | void parseProfileTierLevel ( ProfileTierLevel *ptl, bool profileTierPresentFlag, int maxNumSubLayersMinus1 ); |
92 | | void parseOlsHrdParameters ( GeneralHrdParams* generalHrd, std::vector<OlsHrdParams>& olsHrd, uint32_t firstSubLayer, uint32_t tempLevelHigh ); |
93 | | void parseGeneralHrdParameters( GeneralHrdParams *generalHrd ); |
94 | | template<typename HeaderT> |
95 | | void parsePicOrSliceHeaderRPL ( HeaderT* header, const SPS* sps, const PPS* pps ); |
96 | | void parseRefPicList ( ReferencePictureList* rpl, int rplIdx, const SPS* pcSPS ); |
97 | | void copyRefPicList ( const SPS* pcSPS, const ReferencePictureList* source_rpl, ReferencePictureList* dest_rpl ); |
98 | | |
99 | | void checkAlfNaluTidAndPicTid ( const Slice* pcSlice, const PicHeader* picHeader, const ParameterSetManager* parameterSetManager); |
100 | | |
101 | | template<typename HeaderT> |
102 | | void parsePredWeightTable ( HeaderT* sh_or_ph, const SPS* sps, const PPS* pps, std::array<int, 2> numRefIdxActive = { 0, 0 } ); // numRefIdxActive is only needed, when parsing the HeaderT = Slice |
103 | | void parseScalingList ( ScalingList *scalingList, bool aps_chromaPresentFlag ); |
104 | | void decodeScalingList ( ScalingList* scalingList, uint32_t id, uint32_t scalingListPredIdDelta, bool scalingListCopyModeFlag, bool scalingListPredModeFlag ); |
105 | | void alfFilterCoeffs ( AlfSliceParam& alfSliceParam, const bool isChroma, const int altIdx ); |
106 | | void dpb_parameters ( int maxSubLayersMinus1, bool subLayerInfoFlag, SPS *pcSPS ); |
107 | | void parseExtraPHBitsStruct ( SPS *sps, int numBytes ); |
108 | | void parseExtraSHBitsStruct ( SPS *sps, int numBytes ); |
109 | | |
110 | | bool xMoreRbspData(); |
111 | | }; |
112 | | |
113 | | } |