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-2011, 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 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 | |
---|
35 | |
---|
36 | /** \file TDecTop.h |
---|
37 | \brief decoder class (header) |
---|
38 | */ |
---|
39 | |
---|
40 | #ifndef __TDECTOP__ |
---|
41 | #define __TDECTOP__ |
---|
42 | |
---|
43 | #include "../TLibCommon/CommonDef.h" |
---|
44 | #include "../TLibCommon/TComList.h" |
---|
45 | #include "../TLibCommon/TComPicYuv.h" |
---|
46 | #include "../TLibCommon/TComPic.h" |
---|
47 | #include "../TLibCommon/TComTrQuant.h" |
---|
48 | #include "../TLibCommon/TComDepthMapGenerator.h" |
---|
49 | #include "../TLibCommon/TComResidualGenerator.h" |
---|
50 | #include "../TLibCommon/SEI.h" |
---|
51 | |
---|
52 | #include "TDecGop.h" |
---|
53 | #include "TDecEntropy.h" |
---|
54 | #include "TDecSbac.h" |
---|
55 | #include "TDecCAVLC.h" |
---|
56 | |
---|
57 | // ==================================================================================================================== |
---|
58 | // Class definition |
---|
59 | // ==================================================================================================================== |
---|
60 | |
---|
61 | class TAppDecTop ; |
---|
62 | |
---|
63 | |
---|
64 | class CamParsCollector |
---|
65 | { |
---|
66 | public: |
---|
67 | CamParsCollector (); |
---|
68 | ~CamParsCollector (); |
---|
69 | |
---|
70 | Void init ( FILE* pCodedScaleOffsetFile ); |
---|
71 | Void uninit (); |
---|
72 | Void setSlice ( TComSlice* pcSlice ); |
---|
73 | |
---|
74 | private: |
---|
75 | Bool xIsComplete (); |
---|
76 | Void xOutput ( Int iPOC ); |
---|
77 | |
---|
78 | private: |
---|
79 | Bool m_bInitialized; |
---|
80 | FILE* m_pCodedScaleOffsetFile; |
---|
81 | |
---|
82 | Int** m_aaiCodedOffset; |
---|
83 | Int** m_aaiCodedScale; |
---|
84 | Int* m_aiViewOrderIndex; |
---|
85 | Int* m_aiViewReceived; |
---|
86 | UInt m_uiCamParsCodedPrecision; |
---|
87 | Bool m_bCamParsVaryOverTime; |
---|
88 | Int m_iLastViewId; |
---|
89 | Int m_iLastPOC; |
---|
90 | UInt m_uiMaxViewId; |
---|
91 | }; |
---|
92 | |
---|
93 | |
---|
94 | /// decoder class |
---|
95 | class TDecTop |
---|
96 | { |
---|
97 | private: |
---|
98 | Int m_iGopSize; |
---|
99 | Bool m_bGopSizeSet; |
---|
100 | int m_iMaxRefPicNum; |
---|
101 | |
---|
102 | #if DCM_DECODING_REFRESH |
---|
103 | Bool m_bRefreshPending; ///< refresh pending flag |
---|
104 | UInt m_uiPOCCDR; ///< temporal reference of the CDR picture |
---|
105 | #if DCM_SKIP_DECODING_FRAMES |
---|
106 | UInt m_uiPOCRA; ///< temporal reference of the random access point |
---|
107 | #endif |
---|
108 | #endif |
---|
109 | |
---|
110 | UInt m_uiValidPS; |
---|
111 | TComList<TComPic*> m_cListPic; // Dynamic buffer |
---|
112 | TComSPS m_cSPS; |
---|
113 | #if FLEX_CODING_ORDER |
---|
114 | TComSPS m_cNewSPS; |
---|
115 | #endif |
---|
116 | TComPPS m_cPPS; |
---|
117 | TComSlice* m_apcSlicePilot; |
---|
118 | |
---|
119 | SEImessages *m_SEIs; ///< "all" SEI messages. If not NULL, we own the object. |
---|
120 | |
---|
121 | // functional classes |
---|
122 | TComPrediction m_cPrediction; |
---|
123 | TComTrQuant m_cTrQuant; |
---|
124 | TDecGop m_cGopDecoder; |
---|
125 | TDecSlice m_cSliceDecoder; |
---|
126 | TDecCu m_cCuDecoder; |
---|
127 | TDecEntropy m_cEntropyDecoder; |
---|
128 | TDecCavlc m_cCavlcDecoder; |
---|
129 | TDecSbac m_cSbacDecoder; |
---|
130 | TDecBinCABAC m_cBinCABAC; |
---|
131 | TComLoopFilter m_cLoopFilter; |
---|
132 | TComAdaptiveLoopFilter m_cAdaptiveLoopFilter; |
---|
133 | #if MTK_SAO |
---|
134 | TComSampleAdaptiveOffset m_cSAO; |
---|
135 | #endif |
---|
136 | #if DEPTH_MAP_GENERATION |
---|
137 | TComDepthMapGenerator m_cDepthMapGenerator; |
---|
138 | #endif |
---|
139 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
140 | TComResidualGenerator m_cResidualGenerator; |
---|
141 | #endif |
---|
142 | |
---|
143 | Bool m_bIsDepth; |
---|
144 | Int m_iViewIdx; |
---|
145 | #if SONY_COLPIC_AVAILABILITY |
---|
146 | Int m_iViewOrderIdx; |
---|
147 | #endif |
---|
148 | TAppDecTop* m_pcTAppDecTop; |
---|
149 | CamParsCollector* m_pcCamParsCollector; |
---|
150 | |
---|
151 | #if DCM_SKIP_DECODING_FRAMES |
---|
152 | Bool isRandomAccessSkipPicture(Int& iSkipFrame, Int& iPOCLastDisplay); |
---|
153 | #endif |
---|
154 | TComPic* m_pcPic; |
---|
155 | UInt m_uiSliceIdx; |
---|
156 | UInt m_uiLastSliceIdx; |
---|
157 | UInt m_uiPrevPOC; |
---|
158 | Bool m_bFirstSliceInPicture; |
---|
159 | Bool m_bFirstSliceInSequence; |
---|
160 | |
---|
161 | public: |
---|
162 | TDecTop(); |
---|
163 | virtual ~TDecTop(); |
---|
164 | |
---|
165 | Void create (); |
---|
166 | Void destroy (); |
---|
167 | |
---|
168 | void setPictureDigestEnabled(bool enabled) { m_cGopDecoder.setPictureDigestEnabled(enabled); } |
---|
169 | |
---|
170 | Void init( TAppDecTop* pcTAppDecTop, Bool bFirstInstance = true ); |
---|
171 | #if DCM_SKIP_DECODING_FRAMES |
---|
172 | #if FLEX_CODING_ORDER |
---|
173 | Bool decode (Bool bEos, TComBitstream* pcBitstream, UInt& ruiPOC, TComList<TComPic*>*& rpcListPic, NalUnitType& reNalUnitType, TComSPS& cComSPS, Int& iSkipFrame, Int& iPOCLastDisplay, Bool& bNewPictureType); |
---|
174 | #else |
---|
175 | Bool decode (Bool bEos, TComBitstream* pcBitstream, UInt& ruiPOC, TComList<TComPic*>*& rpcListPic, NalUnitType& reNalUnitType, TComSPS& cComSPS, Int& iSkipFrame, Int& iPOCLastDisplay); |
---|
176 | |
---|
177 | #endif |
---|
178 | #else |
---|
179 | Void decode ( Bool bEos, TComBitstream* pcBitstream, UInt& ruiPOC, TComList<TComPic*>*& rpcListPic, NalUnitType& reNalUnitType, TComSPS& cComSPS ); |
---|
180 | #endif |
---|
181 | |
---|
182 | TComSPS *getSPS() { return (m_uiValidPS & 1) ? &m_cSPS : NULL; } |
---|
183 | |
---|
184 | Void deletePicBuffer(); |
---|
185 | |
---|
186 | Void deleteExtraPicBuffers( Int iPoc ); |
---|
187 | #if AMVP_BUFFERCOMPRESS |
---|
188 | Void compressMotion ( Int iPoc ); |
---|
189 | #endif |
---|
190 | |
---|
191 | Void setViewIdx(Int i) { m_iViewIdx = i ;} |
---|
192 | Int getViewIdx() { return m_iViewIdx ; } |
---|
193 | #if SONY_COLPIC_AVAILABILITY |
---|
194 | Void setViewOrderIdx(Int i) { m_iViewOrderIdx = i ;} |
---|
195 | Int getViewOrderIdx() { return m_iViewOrderIdx ; } |
---|
196 | #endif |
---|
197 | |
---|
198 | Void setToDepth(Bool b) { m_bIsDepth = b ;} |
---|
199 | Bool getIsDepth() { return m_bIsDepth ;} |
---|
200 | |
---|
201 | Void setCamParsCollector( CamParsCollector* pcCamParsCollector ) { m_pcCamParsCollector = pcCamParsCollector; } |
---|
202 | |
---|
203 | TComList<TComPic*>* getListPic () { return &m_cListPic; } |
---|
204 | TAppDecTop* getDecTop ( ){ return m_pcTAppDecTop ;} |
---|
205 | #if DEPTH_MAP_GENERATION |
---|
206 | TComDepthMapGenerator* getDepthMapGenerator () { return &m_cDepthMapGenerator; } |
---|
207 | #endif |
---|
208 | |
---|
209 | Void setSPS (TComSPS cSPS ); |
---|
210 | |
---|
211 | UInt getCodedPictureBufferSize() { return m_cSPS.getCodedPictureBufferSize() ; } |
---|
212 | |
---|
213 | Void executeDeblockAndAlf(Bool bEos, TComBitstream* pcBitstream, UInt& ruiPOC, TComList<TComPic*>*& rpcListPic, Int& iSkipFrame, Int& iPOCLastDisplay); |
---|
214 | |
---|
215 | protected: |
---|
216 | Void xGetNewPicBuffer (TComSlice* pcSlice, TComPic*& rpcPic); |
---|
217 | |
---|
218 | };// END CLASS DEFINITION TDecTop |
---|
219 | |
---|
220 | |
---|
221 | #endif // __TDECTOP__ |
---|
222 | |
---|