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