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