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 | #endif |
---|
92 | public: |
---|
93 | TComPic(); |
---|
94 | virtual ~TComPic(); |
---|
95 | |
---|
96 | Void create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, Window &conformanceWindow, Window &defaultDisplayWindow, |
---|
97 | Int *numReorderPics, Bool bIsVirtual = false ); |
---|
98 | |
---|
99 | virtual Void destroy(); |
---|
100 | |
---|
101 | UInt getTLayer() { return m_uiTLayer; } |
---|
102 | Void setTLayer( UInt uiTLayer ) { m_uiTLayer = uiTLayer; } |
---|
103 | |
---|
104 | #if H_MV |
---|
105 | Void setLayerId ( Int layerId ) { m_layerId = layerId; } |
---|
106 | Int getLayerId () { return m_layerId; } |
---|
107 | Void setViewId ( Int viewId ) { m_viewId = viewId; } |
---|
108 | Int getViewId () { return m_viewId; } |
---|
109 | #endif |
---|
110 | Bool getUsedByCurr() { return m_bUsedByCurr; } |
---|
111 | Void setUsedByCurr( Bool bUsed ) { m_bUsedByCurr = bUsed; } |
---|
112 | Bool getIsLongTerm() { return m_bIsLongTerm; } |
---|
113 | Void setIsLongTerm( Bool lt ) { m_bIsLongTerm = lt; } |
---|
114 | Void setCheckLTMSBPresent (Bool b ) {m_bCheckLTMSB=b;} |
---|
115 | Bool getCheckLTMSBPresent () { return m_bCheckLTMSB;} |
---|
116 | |
---|
117 | TComPicSym* getPicSym() { return m_apcPicSym; } |
---|
118 | TComSlice* getSlice(Int i) { return m_apcPicSym->getSlice(i); } |
---|
119 | Int getPOC() { return m_apcPicSym->getSlice(m_uiCurrSliceIdx)->getPOC(); } |
---|
120 | TComDataCU*& getCU( UInt uiCUAddr ) { return m_apcPicSym->getCU( uiCUAddr ); } |
---|
121 | |
---|
122 | TComPicYuv* getPicYuvOrg() { return m_apcPicYuv[0]; } |
---|
123 | TComPicYuv* getPicYuvRec() { return m_apcPicYuv[1]; } |
---|
124 | |
---|
125 | TComPicYuv* getPicYuvPred() { return m_pcPicYuvPred; } |
---|
126 | TComPicYuv* getPicYuvResi() { return m_pcPicYuvResi; } |
---|
127 | Void setPicYuvPred( TComPicYuv* pcPicYuv ) { m_pcPicYuvPred = pcPicYuv; } |
---|
128 | Void setPicYuvResi( TComPicYuv* pcPicYuv ) { m_pcPicYuvResi = pcPicYuv; } |
---|
129 | |
---|
130 | UInt getNumCUsInFrame() { return m_apcPicSym->getNumberOfCUsInFrame(); } |
---|
131 | UInt getNumPartInWidth() { return m_apcPicSym->getNumPartInWidth(); } |
---|
132 | UInt getNumPartInHeight() { return m_apcPicSym->getNumPartInHeight(); } |
---|
133 | UInt getNumPartInCU() { return m_apcPicSym->getNumPartition(); } |
---|
134 | UInt getFrameWidthInCU() { return m_apcPicSym->getFrameWidthInCU(); } |
---|
135 | UInt getFrameHeightInCU() { return m_apcPicSym->getFrameHeightInCU(); } |
---|
136 | UInt getMinCUWidth() { return m_apcPicSym->getMinCUWidth(); } |
---|
137 | UInt getMinCUHeight() { return m_apcPicSym->getMinCUHeight(); } |
---|
138 | |
---|
139 | UInt getParPelX(UChar uhPartIdx) { return getParPelX(uhPartIdx); } |
---|
140 | UInt getParPelY(UChar uhPartIdx) { return getParPelX(uhPartIdx); } |
---|
141 | |
---|
142 | Int getStride() { return m_apcPicYuv[1]->getStride(); } |
---|
143 | Int getCStride() { return m_apcPicYuv[1]->getCStride(); } |
---|
144 | |
---|
145 | Void setReconMark (Bool b) { m_bReconstructed = b; } |
---|
146 | Bool getReconMark () { return m_bReconstructed; } |
---|
147 | Void setOutputMark (Bool b) { m_bNeededForOutput = b; } |
---|
148 | Bool getOutputMark () { return m_bNeededForOutput; } |
---|
149 | #if H_MV |
---|
150 | Void setPicOutputFlag(Bool b) { m_bPicOutputFlag = b; } |
---|
151 | Bool getPicOutputFlag() { return m_bPicOutputFlag ; } |
---|
152 | #endif |
---|
153 | |
---|
154 | Void setNumReorderPics(Int i, UInt tlayer) { m_numReorderPics[tlayer] = i; } |
---|
155 | Int getNumReorderPics(UInt tlayer) { return m_numReorderPics[tlayer]; } |
---|
156 | Void compressMotion(); |
---|
157 | UInt getCurrSliceIdx() { return m_uiCurrSliceIdx; } |
---|
158 | Void setCurrSliceIdx(UInt i) { m_uiCurrSliceIdx = i; } |
---|
159 | UInt getNumAllocatedSlice() {return m_apcPicSym->getNumAllocatedSlice();} |
---|
160 | Void allocateNewSlice() {m_apcPicSym->allocateNewSlice(); } |
---|
161 | Void clearSliceBuffer() {m_apcPicSym->clearSliceBuffer(); } |
---|
162 | |
---|
163 | Window& getConformanceWindow() { return m_conformanceWindow; } |
---|
164 | Window& getDefDisplayWindow() { return m_defaultDisplayWindow; } |
---|
165 | |
---|
166 | Bool getSAOMergeAvailability(Int currAddr, Int mergeAddr); |
---|
167 | |
---|
168 | /* field coding parameters*/ |
---|
169 | |
---|
170 | Void setTopField(bool b) {m_isTop = b;} |
---|
171 | bool isTopField() {return m_isTop;} |
---|
172 | Void setField(bool b) {m_isField = b;} |
---|
173 | bool isField() {return m_isField;} |
---|
174 | |
---|
175 | #if H_MV |
---|
176 | Void print( Bool legend ); |
---|
177 | #endif |
---|
178 | /** transfer ownership of seis to this picture */ |
---|
179 | void setSEIs(SEIMessages& seis) { m_SEIs = seis; } |
---|
180 | |
---|
181 | /** |
---|
182 | * return the current list of SEI messages associated with this picture. |
---|
183 | * Pointer is valid until this->destroy() is called */ |
---|
184 | SEIMessages& getSEIs() { return m_SEIs; } |
---|
185 | |
---|
186 | /** |
---|
187 | * return the current list of SEI messages associated with this picture. |
---|
188 | * Pointer is valid until this->destroy() is called */ |
---|
189 | const SEIMessages& getSEIs() const { return m_SEIs; } |
---|
190 | |
---|
191 | };// END CLASS DEFINITION TComPic |
---|
192 | |
---|
193 | #if H_MV |
---|
194 | class TComPicLists |
---|
195 | { |
---|
196 | private: |
---|
197 | TComList<TComList<TComPic*>*> m_lists; |
---|
198 | public: |
---|
199 | Void push_back( TComList<TComPic*>* list ) { m_lists.push_back( list ); } |
---|
200 | Int size () { return (Int) m_lists.size(); } |
---|
201 | TComPic* getPic ( Int layerIdInNuh, Int poc ); |
---|
202 | TComPicYuv* getPicYuv( Int layerIdInNuh, Int poc, Bool recon ); |
---|
203 | |
---|
204 | Void print( ); |
---|
205 | |
---|
206 | }; // END CLASS DEFINITION TComPicLists |
---|
207 | |
---|
208 | #endif |
---|
209 | //! \} |
---|
210 | |
---|
211 | #endif // __TCOMPIC__ |
---|