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 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 | Bool m_bIsUsedAsLongTerm; // long term picture is used as reference before |
---|
64 | TComPicSym* m_apcPicSym; // Symbol |
---|
65 | |
---|
66 | TComPicYuv* m_apcPicYuv[2]; // Texture, 0:org / 1:rec |
---|
67 | |
---|
68 | TComPicYuv* m_pcPicYuvPred; // Prediction |
---|
69 | TComPicYuv* m_pcPicYuvResi; // Residual |
---|
70 | Bool m_bReconstructed; |
---|
71 | Bool m_bNeededForOutput; |
---|
72 | UInt m_uiCurrSliceIdx; // Index of current slice |
---|
73 | Int* m_pSliceSUMap; |
---|
74 | Bool* m_pbValidSlice; |
---|
75 | Int m_sliceGranularityForNDBFilter; |
---|
76 | Bool m_bIndependentSliceBoundaryForNDBFilter; |
---|
77 | Bool m_bIndependentTileBoundaryForNDBFilter; |
---|
78 | TComPicYuv* m_pNDBFilterYuvTmp; //!< temporary picture buffer when non-cross slice/tile boundary in-loop filtering is enabled |
---|
79 | Bool m_bCheckLTMSB; |
---|
80 | |
---|
81 | Int m_numReorderPics[MAX_TLAYER]; |
---|
82 | Window m_conformanceWindow; |
---|
83 | Window m_defaultDisplayWindow; |
---|
84 | |
---|
85 | std::vector<std::vector<TComDataCU*> > m_vSliceCUDataLink; |
---|
86 | |
---|
87 | SEIMessages m_SEIs; ///< Any SEI messages that have been received. If !NULL we own the object. |
---|
88 | |
---|
89 | #if H_MV |
---|
90 | Int m_layerId; |
---|
91 | Int m_viewId; |
---|
92 | #if H_3D |
---|
93 | Int m_viewIndex; |
---|
94 | Bool m_isDepth; |
---|
95 | Int** m_aaiCodedScale; |
---|
96 | Int** m_aaiCodedOffset; |
---|
97 | #endif |
---|
98 | #endif |
---|
99 | #if H_3D_QTLPC |
---|
100 | Bool m_bReduceBitsQTL; |
---|
101 | #endif |
---|
102 | #if H_3D_NBDV |
---|
103 | UInt m_uiRapRefIdx; |
---|
104 | RefPicList m_eRapRefList; |
---|
105 | Int m_iNumDdvCandPics; |
---|
106 | #endif |
---|
107 | #if MTK_NBDV_TN_FIX_E0172 |
---|
108 | 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 |
---|
109 | #endif |
---|
110 | #if MTK_TEXTURE_MRGCAND_BUGFIX_E0182 |
---|
111 | Int m_aiTexToDepRef [2][MAX_NUM_REF]; |
---|
112 | #endif |
---|
113 | public: |
---|
114 | TComPic(); |
---|
115 | virtual ~TComPic(); |
---|
116 | |
---|
117 | Void create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, Window &conformanceWindow, Window &defaultDisplayWindow, |
---|
118 | Int *numReorderPics, Bool bIsVirtual = false ); |
---|
119 | |
---|
120 | virtual Void destroy(); |
---|
121 | |
---|
122 | UInt getTLayer() { return m_uiTLayer; } |
---|
123 | Void setTLayer( UInt uiTLayer ) { m_uiTLayer = uiTLayer; } |
---|
124 | |
---|
125 | #if H_MV |
---|
126 | Void setLayerId ( Int layerId ) { m_layerId = layerId; } |
---|
127 | Int getLayerId () { return m_layerId; } |
---|
128 | Void setViewId ( Int viewId ) { m_viewId = viewId; } |
---|
129 | Int getViewId () { return m_viewId; } |
---|
130 | #if H_3D |
---|
131 | Void setViewIndex ( Int viewIndex ) { m_viewIndex = viewIndex; } |
---|
132 | Int getViewIndex () { return m_viewIndex; } |
---|
133 | |
---|
134 | Void setIsDepth ( Bool isDepth ) { m_isDepth = isDepth; } |
---|
135 | Bool getIsDepth () { return m_isDepth; } |
---|
136 | |
---|
137 | Void setScaleOffset( Int** pS, Int** pO ) { m_aaiCodedScale = pS; m_aaiCodedOffset = pO; } |
---|
138 | Int** getCodedScale () { return m_aaiCodedScale; } |
---|
139 | Int** getCodedOffset() { return m_aaiCodedOffset; } |
---|
140 | #endif |
---|
141 | #endif |
---|
142 | #if H_3D_QTLPC |
---|
143 | Bool getReduceBitsFlag () { return m_bReduceBitsQTL; } |
---|
144 | Void setReduceBitsFlag ( Bool bFlag ) { m_bReduceBitsQTL = bFlag; } |
---|
145 | #endif |
---|
146 | Bool getUsedByCurr() { return m_bUsedByCurr; } |
---|
147 | Void setUsedByCurr( Bool bUsed ) { m_bUsedByCurr = bUsed; } |
---|
148 | Bool getIsLongTerm() { return m_bIsLongTerm; } |
---|
149 | Void setIsLongTerm( Bool lt ) { m_bIsLongTerm = lt; } |
---|
150 | Void setCheckLTMSBPresent (Bool b ) {m_bCheckLTMSB=b;} |
---|
151 | Bool getCheckLTMSBPresent () { return m_bCheckLTMSB;} |
---|
152 | |
---|
153 | TComPicSym* getPicSym() { return m_apcPicSym; } |
---|
154 | TComSlice* getSlice(Int i) { return m_apcPicSym->getSlice(i); } |
---|
155 | Int getPOC() { return m_apcPicSym->getSlice(m_uiCurrSliceIdx)->getPOC(); } |
---|
156 | TComDataCU*& getCU( UInt uiCUAddr ) { return m_apcPicSym->getCU( uiCUAddr ); } |
---|
157 | |
---|
158 | TComPicYuv* getPicYuvOrg() { return m_apcPicYuv[0]; } |
---|
159 | TComPicYuv* getPicYuvRec() { return m_apcPicYuv[1]; } |
---|
160 | |
---|
161 | TComPicYuv* getPicYuvPred() { return m_pcPicYuvPred; } |
---|
162 | TComPicYuv* getPicYuvResi() { return m_pcPicYuvResi; } |
---|
163 | Void setPicYuvPred( TComPicYuv* pcPicYuv ) { m_pcPicYuvPred = pcPicYuv; } |
---|
164 | Void setPicYuvResi( TComPicYuv* pcPicYuv ) { m_pcPicYuvResi = pcPicYuv; } |
---|
165 | |
---|
166 | UInt getNumCUsInFrame() { return m_apcPicSym->getNumberOfCUsInFrame(); } |
---|
167 | UInt getNumPartInWidth() { return m_apcPicSym->getNumPartInWidth(); } |
---|
168 | UInt getNumPartInHeight() { return m_apcPicSym->getNumPartInHeight(); } |
---|
169 | UInt getNumPartInCU() { return m_apcPicSym->getNumPartition(); } |
---|
170 | UInt getFrameWidthInCU() { return m_apcPicSym->getFrameWidthInCU(); } |
---|
171 | UInt getFrameHeightInCU() { return m_apcPicSym->getFrameHeightInCU(); } |
---|
172 | UInt getMinCUWidth() { return m_apcPicSym->getMinCUWidth(); } |
---|
173 | UInt getMinCUHeight() { return m_apcPicSym->getMinCUHeight(); } |
---|
174 | |
---|
175 | UInt getParPelX(UChar uhPartIdx) { return getParPelX(uhPartIdx); } |
---|
176 | UInt getParPelY(UChar uhPartIdx) { return getParPelX(uhPartIdx); } |
---|
177 | |
---|
178 | Int getStride() { return m_apcPicYuv[1]->getStride(); } |
---|
179 | Int getCStride() { return m_apcPicYuv[1]->getCStride(); } |
---|
180 | |
---|
181 | Void setReconMark (Bool b) { m_bReconstructed = b; } |
---|
182 | Bool getReconMark () { return m_bReconstructed; } |
---|
183 | Void setOutputMark (Bool b) { m_bNeededForOutput = b; } |
---|
184 | Bool getOutputMark () { return m_bNeededForOutput; } |
---|
185 | |
---|
186 | Void setNumReorderPics(Int i, UInt tlayer) { m_numReorderPics[tlayer] = i; } |
---|
187 | Int getNumReorderPics(UInt tlayer) { return m_numReorderPics[tlayer]; } |
---|
188 | #if MTK_SONY_PROGRESSIVE_MV_COMPRESSION_E0170 |
---|
189 | Void compressMotion(int scale); |
---|
190 | #else |
---|
191 | Void compressMotion(); |
---|
192 | #endif |
---|
193 | UInt getCurrSliceIdx() { return m_uiCurrSliceIdx; } |
---|
194 | Void setCurrSliceIdx(UInt i) { m_uiCurrSliceIdx = i; } |
---|
195 | UInt getNumAllocatedSlice() {return m_apcPicSym->getNumAllocatedSlice();} |
---|
196 | Void allocateNewSlice() {m_apcPicSym->allocateNewSlice(); } |
---|
197 | Void clearSliceBuffer() {m_apcPicSym->clearSliceBuffer(); } |
---|
198 | |
---|
199 | Window& getConformanceWindow() { return m_conformanceWindow; } |
---|
200 | Window& getDefDisplayWindow() { return m_defaultDisplayWindow; } |
---|
201 | |
---|
202 | Void createNonDBFilterInfo (std::vector<Int> sliceStartAddress, Int sliceGranularityDepth |
---|
203 | ,std::vector<Bool>* LFCrossSliceBoundary |
---|
204 | ,Int numTiles = 1 |
---|
205 | ,Bool bNDBFilterCrossTileBoundary = true); |
---|
206 | Void createNonDBFilterInfoLCU(Int tileID, Int sliceID, TComDataCU* pcCU, UInt startSU, UInt endSU, Int sliceGranularyDepth, UInt picWidth, UInt picHeight); |
---|
207 | Void destroyNonDBFilterInfo(); |
---|
208 | |
---|
209 | Bool getValidSlice (Int sliceID) {return m_pbValidSlice[sliceID];} |
---|
210 | Bool getIndependentSliceBoundaryForNDBFilter () {return m_bIndependentSliceBoundaryForNDBFilter;} |
---|
211 | Bool getIndependentTileBoundaryForNDBFilter () {return m_bIndependentTileBoundaryForNDBFilter; } |
---|
212 | TComPicYuv* getYuvPicBufferForIndependentBoundaryProcessing() {return m_pNDBFilterYuvTmp;} |
---|
213 | std::vector<TComDataCU*>& getOneSliceCUDataForNDBFilter (Int sliceID) { return m_vSliceCUDataLink[sliceID];} |
---|
214 | |
---|
215 | #if H_MV |
---|
216 | Void print( Bool legend ); |
---|
217 | #endif |
---|
218 | #if H_3D_NBDV |
---|
219 | Int getNumDdvCandPics() {return m_iNumDdvCandPics; } |
---|
220 | Int getDisCandRefPictures(Int iColPOC); |
---|
221 | Void setRapRefIdx(UInt uiRapRefIdx) {m_uiRapRefIdx = uiRapRefIdx;} |
---|
222 | Void setRapRefList(RefPicList eRefPicList) {m_eRapRefList = eRefPicList;} |
---|
223 | Void setNumDdvCandPics (Int i) {m_iNumDdvCandPics = i; } |
---|
224 | UInt getRapRefIdx() {return m_uiRapRefIdx; } |
---|
225 | RefPicList getRapRefList() {return m_eRapRefList; } |
---|
226 | #endif |
---|
227 | #if MTK_NBDV_TN_FIX_E0172 |
---|
228 | Void checkTemporalIVRef(); |
---|
229 | Bool isTempIVRefValid(Int currCandPic, Int iTempRefDir, Int iTempRefIdx); |
---|
230 | #endif |
---|
231 | #if MTK_TEXTURE_MRGCAND_BUGFIX_E0182 |
---|
232 | Void checkTextureRef( ); |
---|
233 | Int isTextRefValid(Int iTextRefDir, Int iTextRefIdx); |
---|
234 | #endif |
---|
235 | /** transfer ownership of seis to this picture */ |
---|
236 | void setSEIs(SEIMessages& seis) { m_SEIs = seis; } |
---|
237 | |
---|
238 | /** |
---|
239 | * return the current list of SEI messages associated with this picture. |
---|
240 | * Pointer is valid until this->destroy() is called */ |
---|
241 | SEIMessages& getSEIs() { return m_SEIs; } |
---|
242 | |
---|
243 | /** |
---|
244 | * return the current list of SEI messages associated with this picture. |
---|
245 | * Pointer is valid until this->destroy() is called */ |
---|
246 | const SEIMessages& getSEIs() const { return m_SEIs; } |
---|
247 | |
---|
248 | };// END CLASS DEFINITION TComPic |
---|
249 | |
---|
250 | #if H_MV |
---|
251 | class TComPicLists |
---|
252 | { |
---|
253 | private: |
---|
254 | TComList<TComList<TComPic*>*> m_lists; |
---|
255 | #if H_3D |
---|
256 | TComVPS* m_vps; |
---|
257 | #endif |
---|
258 | public: |
---|
259 | Void push_back( TComList<TComPic*>* list ) { m_lists.push_back( list ); } |
---|
260 | Int size () { return (Int) m_lists.size(); } |
---|
261 | #if H_3D_ARP |
---|
262 | TComList<TComPic*>* getPicList ( Int layerIdInNuh ); |
---|
263 | #endif |
---|
264 | TComPic* getPic ( Int layerIdInNuh, Int poc ); |
---|
265 | TComPicYuv* getPicYuv( Int layerIdInNuh, Int poc, Bool recon ); |
---|
266 | #if H_3D |
---|
267 | Void setVPS ( TComVPS* vps ) { m_vps = vps; }; |
---|
268 | TComPic* getPic ( Int viewIndex, Bool depthFlag, Int poc ); |
---|
269 | TComPicYuv* getPicYuv( Int viewIndex, Bool depthFlag, Int poc, Bool recon ); |
---|
270 | #endif |
---|
271 | |
---|
272 | Void print( ); |
---|
273 | |
---|
274 | }; // END CLASS DEFINITION TComPicLists |
---|
275 | |
---|
276 | #endif |
---|
277 | //! \} |
---|
278 | |
---|
279 | #endif // __TCOMPIC__ |
---|