1 | /* The copyright in this software is being made available under the BSD |
---|
2 | * License, included below. This software may be subject to other third party |
---|
3 | * and contributor rights, including patent rights, and no such rights are |
---|
4 | * granted under this license. |
---|
5 | * |
---|
6 | * Copyright (c) 2010-2013, ITU/ISO/IEC |
---|
7 | * All rights reserved. |
---|
8 | * |
---|
9 | * Redistribution and use in source and binary forms, with or without |
---|
10 | * modification, are permitted provided that the following conditions are met: |
---|
11 | * |
---|
12 | * * Redistributions of source code must retain the above copyright notice, |
---|
13 | * this list of conditions and the following disclaimer. |
---|
14 | * * Redistributions in binary form must reproduce the above copyright notice, |
---|
15 | * this list of conditions and the following disclaimer in the documentation |
---|
16 | * and/or other materials provided with the distribution. |
---|
17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may |
---|
18 | * be used to endorse or promote products derived from this software without |
---|
19 | * specific prior written permission. |
---|
20 | * |
---|
21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS |
---|
25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
---|
31 | * THE POSSIBILITY OF SUCH DAMAGE. |
---|
32 | */ |
---|
33 | |
---|
34 | /** \file TDecTop.h |
---|
35 | \brief decoder class (header) |
---|
36 | */ |
---|
37 | |
---|
38 | #ifndef __TDECTOP__ |
---|
39 | #define __TDECTOP__ |
---|
40 | |
---|
41 | #include "TLibCommon/CommonDef.h" |
---|
42 | #include "TLibCommon/TComList.h" |
---|
43 | #include "TLibCommon/TComPicYuv.h" |
---|
44 | #include "TLibCommon/TComPic.h" |
---|
45 | #include "TLibCommon/TComTrQuant.h" |
---|
46 | #include "TLibCommon/SEI.h" |
---|
47 | |
---|
48 | #include "TDecGop.h" |
---|
49 | #include "TDecEntropy.h" |
---|
50 | #include "TDecSbac.h" |
---|
51 | #include "TDecCAVLC.h" |
---|
52 | #include "SEIread.h" |
---|
53 | |
---|
54 | struct InputNALUnit; |
---|
55 | |
---|
56 | //! \ingroup TLibDecoder |
---|
57 | //! \{ |
---|
58 | |
---|
59 | // ==================================================================================================================== |
---|
60 | // Class definition |
---|
61 | // ==================================================================================================================== |
---|
62 | |
---|
63 | #if H_MV |
---|
64 | class TAppDecTop; |
---|
65 | #endif |
---|
66 | |
---|
67 | /// decoder class |
---|
68 | class TDecTop |
---|
69 | { |
---|
70 | private: |
---|
71 | Int m_iMaxRefPicNum; |
---|
72 | |
---|
73 | Int m_pocCRA; ///< POC number of the latest CRA picture |
---|
74 | Bool m_prevRAPisBLA; ///< true if the previous RAP (CRA/CRANT/BLA/BLANT/IDR) picture is a BLA/BLANT picture |
---|
75 | Int m_pocRandomAccess; ///< POC number of the random access point (the first IDR or CRA picture) |
---|
76 | |
---|
77 | TComList<TComPic*> m_cListPic; // Dynamic buffer |
---|
78 | #if H_MV |
---|
79 | static ParameterSetManagerDecoder m_parameterSetManagerDecoder; // storage for parameter sets |
---|
80 | #else |
---|
81 | ParameterSetManagerDecoder m_parameterSetManagerDecoder; // storage for parameter sets |
---|
82 | #endif |
---|
83 | |
---|
84 | TComSlice* m_apcSlicePilot; |
---|
85 | |
---|
86 | SEIMessages m_SEIs; ///< List of SEI messages that have been received before the first slice and between slices |
---|
87 | |
---|
88 | // functional classes |
---|
89 | TComPrediction m_cPrediction; |
---|
90 | TComTrQuant m_cTrQuant; |
---|
91 | TDecGop m_cGopDecoder; |
---|
92 | TDecSlice m_cSliceDecoder; |
---|
93 | TDecCu m_cCuDecoder; |
---|
94 | TDecEntropy m_cEntropyDecoder; |
---|
95 | TDecCavlc m_cCavlcDecoder; |
---|
96 | TDecSbac m_cSbacDecoder; |
---|
97 | TDecBinCABAC m_cBinCABAC; |
---|
98 | SEIReader m_seiReader; |
---|
99 | TComLoopFilter m_cLoopFilter; |
---|
100 | TComSampleAdaptiveOffset m_cSAO; |
---|
101 | |
---|
102 | Bool isSkipPictureForBLA(Int& iPOCLastDisplay); |
---|
103 | Bool isRandomAccessSkipPicture(Int& iSkipFrame, Int& iPOCLastDisplay); |
---|
104 | TComPic* m_pcPic; |
---|
105 | UInt m_uiSliceIdx; |
---|
106 | Int m_prevPOC; |
---|
107 | Bool m_bFirstSliceInPicture; |
---|
108 | Bool m_bFirstSliceInSequence; |
---|
109 | #if H_MV |
---|
110 | // For H_MV m_bFirstSliceInSequence indicates first slice in sequence of the particular layer |
---|
111 | Int m_layerId; |
---|
112 | Int m_viewId; |
---|
113 | TComPicLists* m_ivPicLists; |
---|
114 | std::vector<TComPic*> m_refPicSetInterLayer; |
---|
115 | #if H_3D |
---|
116 | Bool m_isDepth; |
---|
117 | #endif |
---|
118 | #endif |
---|
119 | |
---|
120 | public: |
---|
121 | TDecTop(); |
---|
122 | virtual ~TDecTop(); |
---|
123 | |
---|
124 | Void create (); |
---|
125 | Void destroy (); |
---|
126 | |
---|
127 | void setDecodedPictureHashSEIEnabled(Int enabled) { m_cGopDecoder.setDecodedPictureHashSEIEnabled(enabled); } |
---|
128 | |
---|
129 | Void init(); |
---|
130 | #if H_MV |
---|
131 | Bool decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay, Bool newLayer ); |
---|
132 | #else |
---|
133 | Bool decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay); |
---|
134 | #endif |
---|
135 | |
---|
136 | Void deletePicBuffer(); |
---|
137 | |
---|
138 | #if H_MV |
---|
139 | Void endPicDecoding(Int& poc, TComList<TComPic*>*& rpcListPic, std::vector<Int>& targetDecLayerIdSet); |
---|
140 | #else |
---|
141 | Void executeLoopFilters(Int& poc, TComList<TComPic*>*& rpcListPic); |
---|
142 | #endif |
---|
143 | |
---|
144 | |
---|
145 | #if H_MV |
---|
146 | TComPic* getPic ( Int poc ); |
---|
147 | TComList<TComPic*>* getListPic () { return &m_cListPic; } |
---|
148 | Void setIvPicLists ( TComPicLists* picLists) { m_ivPicLists = picLists; } |
---|
149 | |
---|
150 | Int getCurrPoc () { return m_apcSlicePilot->getPOC(); } |
---|
151 | Void setLayerId ( Int layer) { m_layerId = layer; } |
---|
152 | Int getLayerId () { return m_layerId; } |
---|
153 | Void setViewId ( Int viewId ) { m_viewId = viewId; } |
---|
154 | Int getViewId () { return m_viewId; } |
---|
155 | #if H_3D |
---|
156 | Void setIsDepth ( Bool isDepth ) { m_isDepth = isDepth; } |
---|
157 | Bool getIsDepth () { return m_isDepth; } |
---|
158 | #endif |
---|
159 | #endif |
---|
160 | |
---|
161 | protected: |
---|
162 | Void xGetNewPicBuffer (TComSlice* pcSlice, TComPic*& rpcPic); |
---|
163 | Void xCreateLostPicture (Int iLostPOC); |
---|
164 | |
---|
165 | Void xActivateParameterSets(); |
---|
166 | #if H_MV |
---|
167 | TComPic* xGetPic( Int layerId, Int poc ); |
---|
168 | Bool xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay, Bool newLayerFlag ); |
---|
169 | #else |
---|
170 | Bool xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay); |
---|
171 | #endif |
---|
172 | Void xDecodeVPS(); |
---|
173 | Void xDecodeSPS(); |
---|
174 | Void xDecodePPS(); |
---|
175 | Void xDecodeSEI( TComInputBitstream* bs, const NalUnitType nalUnitType ); |
---|
176 | |
---|
177 | };// END CLASS DEFINITION TDecTop |
---|
178 | |
---|
179 | |
---|
180 | //! \} |
---|
181 | |
---|
182 | #endif // __TDECTOP__ |
---|
183 | |
---|