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