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-2014, 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 TComPic.h |
---|
35 | \brief picture class (header) |
---|
36 | */ |
---|
37 | |
---|
38 | |
---|
39 | #ifndef __TCOMPIC__ |
---|
40 | #define __TCOMPIC__ |
---|
41 | |
---|
42 | // Include files |
---|
43 | #include "CommonDef.h" |
---|
44 | #include "TComPicSym.h" |
---|
45 | #include "TComPicYuv.h" |
---|
46 | #include "TComBitStream.h" |
---|
47 | #include "SEI.h" |
---|
48 | |
---|
49 | //! \ingroup TLibCommon |
---|
50 | //! \{ |
---|
51 | |
---|
52 | // ==================================================================================================================== |
---|
53 | // Class definition |
---|
54 | // ==================================================================================================================== |
---|
55 | |
---|
56 | /// picture class (symbol + YUV buffers) |
---|
57 | class TComPic |
---|
58 | { |
---|
59 | private: |
---|
60 | UInt m_uiTLayer; // Temporal layer |
---|
61 | Bool m_bUsedByCurr; // Used by current picture |
---|
62 | Bool m_bIsLongTerm; // IS long term picture |
---|
63 | TComPicSym* m_apcPicSym; // Symbol |
---|
64 | |
---|
65 | TComPicYuv* m_apcPicYuv[2]; // Texture, 0:org / 1:rec |
---|
66 | |
---|
67 | TComPicYuv* m_pcPicYuvPred; // Prediction |
---|
68 | TComPicYuv* m_pcPicYuvResi; // Residual |
---|
69 | Bool m_bReconstructed; |
---|
70 | Bool m_bNeededForOutput; |
---|
71 | #if H_MV |
---|
72 | Bool m_bPicOutputFlag; // Semantics variable |
---|
73 | #endif |
---|
74 | UInt m_uiCurrSliceIdx; // Index of current slice |
---|
75 | Bool m_bCheckLTMSB; |
---|
76 | |
---|
77 | Int m_numReorderPics[MAX_TLAYER]; |
---|
78 | Window m_conformanceWindow; |
---|
79 | Window m_defaultDisplayWindow; |
---|
80 | |
---|
81 | bool m_isTop; |
---|
82 | bool m_isField; |
---|
83 | |
---|
84 | std::vector<std::vector<TComDataCU*> > m_vSliceCUDataLink; |
---|
85 | |
---|
86 | SEIMessages m_SEIs; ///< Any SEI messages that have been received. If !NULL we own the object. |
---|
87 | |
---|
88 | #if H_MV |
---|
89 | Int m_layerId; |
---|
90 | Int m_viewId; |
---|
91 | #if H_3D |
---|
92 | Int m_viewIndex; |
---|
93 | Bool m_isDepth; |
---|
94 | Int** m_aaiCodedScale; |
---|
95 | Int** m_aaiCodedOffset; |
---|
96 | #endif |
---|
97 | #endif |
---|
98 | #if H_3D_QTLPC |
---|
99 | Bool m_bReduceBitsQTL; |
---|
100 | #endif |
---|
101 | #if H_3D_NBDV |
---|
102 | UInt m_uiRapRefIdx; |
---|
103 | RefPicList m_eRapRefList; |
---|
104 | Int m_iNumDdvCandPics; |
---|
105 | Bool m_abTIVRINCurrRL [2][2][MAX_NUM_REF]; //whether an inter-view reference picture with the same view index of the inter-view reference picture of temporal reference picture of current picture exists in current reference picture lists |
---|
106 | Int m_aiTexToDepRef [2][MAX_NUM_REF]; |
---|
107 | #endif |
---|
108 | public: |
---|
109 | TComPic(); |
---|
110 | virtual ~TComPic(); |
---|
111 | |
---|
112 | Void create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, Window &conformanceWindow, Window &defaultDisplayWindow, |
---|
113 | Int *numReorderPics, Bool bIsVirtual = false ); |
---|
114 | |
---|
115 | virtual Void destroy(); |
---|
116 | |
---|
117 | UInt getTLayer() { return m_uiTLayer; } |
---|
118 | Void setTLayer( UInt uiTLayer ) { m_uiTLayer = uiTLayer; } |
---|
119 | |
---|
120 | #if H_MV |
---|
121 | Void setLayerId ( Int layerId ) { m_layerId = layerId; } |
---|
122 | Int getLayerId () { return m_layerId; } |
---|
123 | Void setViewId ( Int viewId ) { m_viewId = viewId; } |
---|
124 | Int getViewId () { return m_viewId; } |
---|
125 | #if H_3D |
---|
126 | Void setViewIndex ( Int viewIndex ) { m_viewIndex = viewIndex; } |
---|
127 | Int getViewIndex () { return m_viewIndex; } |
---|
128 | |
---|
129 | Void setIsDepth ( Bool isDepth ) { m_isDepth = isDepth; } |
---|
130 | Bool getIsDepth () { return m_isDepth; } |
---|
131 | |
---|
132 | Void setScaleOffset( Int** pS, Int** pO ) { m_aaiCodedScale = pS; m_aaiCodedOffset = pO; } |
---|
133 | Int** getCodedScale () { return m_aaiCodedScale; } |
---|
134 | Int** getCodedOffset() { return m_aaiCodedOffset; } |
---|
135 | #endif |
---|
136 | #endif |
---|
137 | #if H_3D_QTLPC |
---|
138 | Bool getReduceBitsFlag () { return m_bReduceBitsQTL; } |
---|
139 | Void setReduceBitsFlag ( Bool bFlag ) { m_bReduceBitsQTL = bFlag; } |
---|
140 | #endif |
---|
141 | Bool getUsedByCurr() { return m_bUsedByCurr; } |
---|
142 | Void setUsedByCurr( Bool bUsed ) { m_bUsedByCurr = bUsed; } |
---|
143 | Bool getIsLongTerm() { return m_bIsLongTerm; } |
---|
144 | Void setIsLongTerm( Bool lt ) { m_bIsLongTerm = lt; } |
---|
145 | Void setCheckLTMSBPresent (Bool b ) {m_bCheckLTMSB=b;} |
---|
146 | Bool getCheckLTMSBPresent () { return m_bCheckLTMSB;} |
---|
147 | |
---|
148 | TComPicSym* getPicSym() { return m_apcPicSym; } |
---|
149 | TComSlice* getSlice(Int i) { return m_apcPicSym->getSlice(i); } |
---|
150 | Int getPOC() { return m_apcPicSym->getSlice(m_uiCurrSliceIdx)->getPOC(); } |
---|
151 | TComDataCU*& getCU( UInt uiCUAddr ) { return m_apcPicSym->getCU( uiCUAddr ); } |
---|
152 | |
---|
153 | TComPicYuv* getPicYuvOrg() { return m_apcPicYuv[0]; } |
---|
154 | TComPicYuv* getPicYuvRec() { return m_apcPicYuv[1]; } |
---|
155 | |
---|
156 | TComPicYuv* getPicYuvPred() { return m_pcPicYuvPred; } |
---|
157 | TComPicYuv* getPicYuvResi() { return m_pcPicYuvResi; } |
---|
158 | Void setPicYuvPred( TComPicYuv* pcPicYuv ) { m_pcPicYuvPred = pcPicYuv; } |
---|
159 | Void setPicYuvResi( TComPicYuv* pcPicYuv ) { m_pcPicYuvResi = pcPicYuv; } |
---|
160 | |
---|
161 | UInt getNumCUsInFrame() { return m_apcPicSym->getNumberOfCUsInFrame(); } |
---|
162 | UInt getNumPartInWidth() { return m_apcPicSym->getNumPartInWidth(); } |
---|
163 | UInt getNumPartInHeight() { return m_apcPicSym->getNumPartInHeight(); } |
---|
164 | UInt getNumPartInCU() { return m_apcPicSym->getNumPartition(); } |
---|
165 | UInt getFrameWidthInCU() { return m_apcPicSym->getFrameWidthInCU(); } |
---|
166 | UInt getFrameHeightInCU() { return m_apcPicSym->getFrameHeightInCU(); } |
---|
167 | UInt getMinCUWidth() { return m_apcPicSym->getMinCUWidth(); } |
---|
168 | UInt getMinCUHeight() { return m_apcPicSym->getMinCUHeight(); } |
---|
169 | |
---|
170 | UInt getParPelX(UChar uhPartIdx) { return getParPelX(uhPartIdx); } |
---|
171 | UInt getParPelY(UChar uhPartIdx) { return getParPelX(uhPartIdx); } |
---|
172 | |
---|
173 | Int getStride() { return m_apcPicYuv[1]->getStride(); } |
---|
174 | Int getCStride() { return m_apcPicYuv[1]->getCStride(); } |
---|
175 | |
---|
176 | Void setReconMark (Bool b) { m_bReconstructed = b; } |
---|
177 | Bool getReconMark () { return m_bReconstructed; } |
---|
178 | Void setOutputMark (Bool b) { m_bNeededForOutput = b; } |
---|
179 | Bool getOutputMark () { return m_bNeededForOutput; } |
---|
180 | #if H_MV |
---|
181 | Void setPicOutputFlag(Bool b) { m_bPicOutputFlag = b; } |
---|
182 | Bool getPicOutputFlag() { return m_bPicOutputFlag ; } |
---|
183 | #endif |
---|
184 | |
---|
185 | Void setNumReorderPics(Int i, UInt tlayer) { m_numReorderPics[tlayer] = i; } |
---|
186 | Int getNumReorderPics(UInt tlayer) { return m_numReorderPics[tlayer]; } |
---|
187 | #if H_3D |
---|
188 | Void compressMotion(Int scale); |
---|
189 | #else |
---|
190 | Void compressMotion(); |
---|
191 | #endif |
---|
192 | UInt getCurrSliceIdx() { return m_uiCurrSliceIdx; } |
---|
193 | Void setCurrSliceIdx(UInt i) { m_uiCurrSliceIdx = i; } |
---|
194 | UInt getNumAllocatedSlice() {return m_apcPicSym->getNumAllocatedSlice();} |
---|
195 | Void allocateNewSlice() {m_apcPicSym->allocateNewSlice(); } |
---|
196 | Void clearSliceBuffer() {m_apcPicSym->clearSliceBuffer(); } |
---|
197 | |
---|
198 | Window& getConformanceWindow() { return m_conformanceWindow; } |
---|
199 | Window& getDefDisplayWindow() { return m_defaultDisplayWindow; } |
---|
200 | |
---|
201 | Bool getSAOMergeAvailability(Int currAddr, Int mergeAddr); |
---|
202 | |
---|
203 | /* field coding parameters*/ |
---|
204 | |
---|
205 | Void setTopField(bool b) {m_isTop = b;} |
---|
206 | bool isTopField() {return m_isTop;} |
---|
207 | Void setField(bool b) {m_isField = b;} |
---|
208 | bool isField() {return m_isField;} |
---|
209 | |
---|
210 | #if H_MV |
---|
211 | Void print( Bool legend ); |
---|
212 | #endif |
---|
213 | #if H_3D_NBDV |
---|
214 | Int getNumDdvCandPics() {return m_iNumDdvCandPics; } |
---|
215 | Int getDisCandRefPictures(Int iColPOC); |
---|
216 | Void setRapRefIdx(UInt uiRapRefIdx) {m_uiRapRefIdx = uiRapRefIdx;} |
---|
217 | Void setRapRefList(RefPicList eRefPicList) {m_eRapRefList = eRefPicList;} |
---|
218 | Void setNumDdvCandPics (Int i) {m_iNumDdvCandPics = i; } |
---|
219 | UInt getRapRefIdx() {return m_uiRapRefIdx; } |
---|
220 | RefPicList getRapRefList() {return m_eRapRefList; } |
---|
221 | Void checkTemporalIVRef(); |
---|
222 | Bool isTempIVRefValid(Int currCandPic, Int iTempRefDir, Int iTempRefIdx); |
---|
223 | Void checkTextureRef( ); |
---|
224 | Int isTextRefValid(Int iTextRefDir, Int iTextRefIdx); |
---|
225 | #endif |
---|
226 | /** transfer ownership of seis to this picture */ |
---|
227 | void setSEIs(SEIMessages& seis) { m_SEIs = seis; } |
---|
228 | |
---|
229 | /** |
---|
230 | * return the current list of SEI messages associated with this picture. |
---|
231 | * Pointer is valid until this->destroy() is called */ |
---|
232 | SEIMessages& getSEIs() { return m_SEIs; } |
---|
233 | |
---|
234 | /** |
---|
235 | * return the current list of SEI messages associated with this picture. |
---|
236 | * Pointer is valid until this->destroy() is called */ |
---|
237 | const SEIMessages& getSEIs() const { return m_SEIs; } |
---|
238 | |
---|
239 | };// END CLASS DEFINITION TComPic |
---|
240 | |
---|
241 | #if H_MV |
---|
242 | class TComPicLists |
---|
243 | { |
---|
244 | private: |
---|
245 | TComList<TComList<TComPic*>*> m_lists; |
---|
246 | #if H_3D |
---|
247 | TComVPS* m_vps; |
---|
248 | #endif |
---|
249 | public: |
---|
250 | Void push_back( TComList<TComPic*>* list ) { m_lists.push_back( list ); } |
---|
251 | Int size () { return (Int) m_lists.size(); } |
---|
252 | #if H_3D_ARP |
---|
253 | TComList<TComPic*>* getPicList ( Int layerIdInNuh ); |
---|
254 | #endif |
---|
255 | TComPic* getPic ( Int layerIdInNuh, Int poc ); |
---|
256 | TComPicYuv* getPicYuv( Int layerIdInNuh, Int poc, Bool recon ); |
---|
257 | #if H_3D |
---|
258 | Void setVPS ( TComVPS* vps ) { m_vps = vps; }; |
---|
259 | TComPic* getPic ( Int viewIndex, Bool depthFlag, Int poc ); |
---|
260 | TComPicYuv* getPicYuv( Int viewIndex, Bool depthFlag, Int poc, Bool recon ); |
---|
261 | #endif |
---|
262 | |
---|
263 | Void print( ); |
---|
264 | |
---|
265 | }; // END CLASS DEFINITION TComPicLists |
---|
266 | |
---|
267 | #endif |
---|
268 | //! \} |
---|
269 | |
---|
270 | #endif // __TCOMPIC__ |
---|