[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 | * |
---|
[56] | 6 | * Copyright (c) 2010-2012, 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 | |
---|
| 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 | |
---|
[56] | 47 | //! \ingroup TLibCommon |
---|
| 48 | //! \{ |
---|
| 49 | |
---|
[2] | 50 | class SEImessages; |
---|
| 51 | |
---|
| 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 | |
---|
[5] | 67 | #if DEPTH_MAP_GENERATION |
---|
[2] | 68 | TComPicYuv* m_pcPredDepthMap; // estimated depth map |
---|
[5] | 69 | #endif |
---|
[56] | 70 | |
---|
[5] | 71 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
[2] | 72 | TComPicYuv* m_pcOrgDepthMap; // original depth map |
---|
[5] | 73 | #endif |
---|
| 74 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
[2] | 75 | TComPicYuv* m_pcResidual; // residual buffer (coded or inter-view predicted residual) |
---|
[5] | 76 | #endif |
---|
| 77 | |
---|
[2] | 78 | TComPicYuv* m_pcPicYuvPred; // Prediction |
---|
| 79 | TComPicYuv* m_pcPicYuvResi; // Residual |
---|
| 80 | Bool m_bReconstructed; |
---|
[56] | 81 | Bool m_bNeededForOutput; |
---|
[2] | 82 | UInt m_uiCurrSliceIdx; // Index of current slice |
---|
[5] | 83 | |
---|
[56] | 84 | Bool m_usedForTMVP; |
---|
| 85 | |
---|
| 86 | Int* m_pSliceSUMap; |
---|
| 87 | Bool* m_pbValidSlice; |
---|
| 88 | Int m_sliceGranularityForNDBFilter; |
---|
| 89 | Bool m_bIndependentSliceBoundaryForNDBFilter; |
---|
| 90 | Bool m_bIndependentTileBoundaryForNDBFilter; |
---|
| 91 | TComPicYuv* m_pNDBFilterYuvTmp; //!< temporary picture buffer when non-cross slice/tile boundary in-loop filtering is enabled |
---|
| 92 | std::vector<std::vector<TComDataCU*> > m_vSliceCUDataLink; |
---|
| 93 | |
---|
[2] | 94 | SEImessages* m_SEIs; ///< Any SEI messages that have been received. If !NULL we own the object. |
---|
[56] | 95 | #if HHI_INTERVIEW_SKIP |
---|
| 96 | TComPicYuv* m_pcUsedPelsMap; |
---|
| 97 | #endif |
---|
[21] | 98 | #if SONY_COLPIC_AVAILABILITY |
---|
| 99 | Int m_iViewOrderIdx; |
---|
| 100 | #endif |
---|
[2] | 101 | Int** m_aaiCodedScale; |
---|
| 102 | Int** m_aaiCodedOffset; |
---|
| 103 | |
---|
| 104 | public: |
---|
| 105 | TComPic(); |
---|
| 106 | virtual ~TComPic(); |
---|
[56] | 107 | |
---|
| 108 | Void create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, Bool bIsVirtual = false ); |
---|
| 109 | virtual Void destroy(); |
---|
| 110 | |
---|
| 111 | UInt getTLayer() { return m_uiTLayer; } |
---|
| 112 | Void setTLayer( UInt uiTLayer ) { m_uiTLayer = uiTLayer; } |
---|
[2] | 113 | |
---|
[56] | 114 | Bool getUsedByCurr() { return m_bUsedByCurr; } |
---|
| 115 | Void setUsedByCurr( Bool bUsed ) { m_bUsedByCurr = bUsed; } |
---|
| 116 | Bool getIsLongTerm() { return m_bIsLongTerm; } |
---|
| 117 | Void setIsLongTerm( Bool lt ) { m_bIsLongTerm = lt; } |
---|
[5] | 118 | |
---|
[2] | 119 | TComPicSym* getPicSym() { return m_apcPicSym; } |
---|
| 120 | TComSlice* getSlice(Int i) { return m_apcPicSym->getSlice(i); } |
---|
| 121 | TComSlice* getCurrSlice() { return m_apcPicSym->getSlice(m_uiCurrSliceIdx); } |
---|
[77] | 122 | #if VIDYO_VPS_INTEGRATION |
---|
| 123 | TComVPS* getVPS() { return m_apcPicSym->getSlice(m_uiCurrSliceIdx)->getVPS(); } |
---|
| 124 | #endif |
---|
[2] | 125 | TComSPS* getSPS() { return m_apcPicSym->getSlice(m_uiCurrSliceIdx)->getSPS(); } |
---|
| 126 | Int getPOC() { return m_apcPicSym->getSlice(m_uiCurrSliceIdx)->getPOC(); } |
---|
[56] | 127 | Int getViewId() { return m_apcPicSym->getSlice(m_uiCurrSliceIdx)->getViewId(); } |
---|
[2] | 128 | TComDataCU*& getCU( UInt uiCUAddr ) { return m_apcPicSym->getCU( uiCUAddr ); } |
---|
[56] | 129 | |
---|
[2] | 130 | TComPicYuv* getPicYuvOrg() { return m_apcPicYuv[0]; } |
---|
| 131 | TComPicYuv* getPicYuvRec() { return m_apcPicYuv[1]; } |
---|
[56] | 132 | #if HHI_INTERVIEW_SKIP |
---|
| 133 | TComPicYuv* getUsedPelsMap() { return m_pcUsedPelsMap; } |
---|
| 134 | #endif |
---|
| 135 | |
---|
[5] | 136 | #if DEPTH_MAP_GENERATION |
---|
[2] | 137 | TComPicYuv* getPredDepthMap() { return m_pcPredDepthMap; } |
---|
[5] | 138 | #endif |
---|
[56] | 139 | |
---|
[5] | 140 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
[2] | 141 | TComPicYuv* getOrgDepthMap() { return m_pcOrgDepthMap; } |
---|
[5] | 142 | #endif |
---|
[56] | 143 | |
---|
[5] | 144 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
[2] | 145 | TComPicYuv* getResidual() { return m_pcResidual; } |
---|
[5] | 146 | #endif |
---|
| 147 | |
---|
[21] | 148 | #if SONY_COLPIC_AVAILABILITY |
---|
| 149 | Void setViewOrderIdx(Int i) { m_iViewOrderIdx = i; } |
---|
| 150 | Int getViewOrderIdx() { return m_iViewOrderIdx; } |
---|
| 151 | #endif |
---|
[2] | 152 | Void setScaleOffset( Int** pS, Int** pO ) { m_aaiCodedScale = pS; m_aaiCodedOffset = pO; } |
---|
| 153 | Int** getCodedScale () { return m_aaiCodedScale; } |
---|
| 154 | Int** getCodedOffset() { return m_aaiCodedOffset; } |
---|
| 155 | |
---|
[56] | 156 | TComPicYuv* getPicYuvPred() { return m_pcPicYuvPred; } |
---|
| 157 | TComPicYuv* getPicYuvResi() { return m_pcPicYuvResi; } |
---|
| 158 | Void setPicYuvPred( TComPicYuv* pcPicYuv ) { m_pcPicYuvPred = pcPicYuv; } |
---|
| 159 | Void setPicYuvResi( TComPicYuv* pcPicYuv ) { m_pcPicYuvResi = pcPicYuv; } |
---|
| 160 | |
---|
[2] | 161 | UInt getNumCUsInFrame() { return m_apcPicSym->getNumberOfCUsInFrame(); } |
---|
| 162 | UInt getNumPartInWidth() { return m_apcPicSym->getNumPartInWidth(); } |
---|
| 163 | UInt getNumPartInHeight() { return m_apcPicSym->getNumPartInHeight(); } |
---|
| 164 | UInt getNumPartInCU() { return m_apcPicSym->getNumPartition(); } |
---|
| 165 | UInt getFrameWidthInCU() { return m_apcPicSym->getFrameWidthInCU(); } |
---|
| 166 | UInt getFrameHeightInCU() { return m_apcPicSym->getFrameHeightInCU(); } |
---|
| 167 | UInt getMinCUWidth() { return m_apcPicSym->getMinCUWidth(); } |
---|
| 168 | UInt getMinCUHeight() { return m_apcPicSym->getMinCUHeight(); } |
---|
[56] | 169 | |
---|
[2] | 170 | UInt getParPelX(UChar uhPartIdx) { return getParPelX(uhPartIdx); } |
---|
| 171 | UInt getParPelY(UChar uhPartIdx) { return getParPelX(uhPartIdx); } |
---|
[56] | 172 | |
---|
[2] | 173 | Int getStride() { return m_apcPicYuv[1]->getStride(); } |
---|
| 174 | Int getCStride() { return m_apcPicYuv[1]->getCStride(); } |
---|
[56] | 175 | |
---|
[2] | 176 | Void setReconMark (Bool b) { m_bReconstructed = b; } |
---|
| 177 | Bool getReconMark () { return m_bReconstructed; } |
---|
[5] | 178 | |
---|
[56] | 179 | Void setUsedForTMVP( Bool b ) { m_usedForTMVP = b; } |
---|
| 180 | Bool getUsedForTMVP() { return m_usedForTMVP; } |
---|
| 181 | |
---|
| 182 | Void setOutputMark (Bool b) { m_bNeededForOutput = b; } |
---|
| 183 | Bool getOutputMark () { return m_bNeededForOutput; } |
---|
| 184 | |
---|
| 185 | Void compressMotion(); |
---|
[2] | 186 | UInt getCurrSliceIdx() { return m_uiCurrSliceIdx; } |
---|
| 187 | Void setCurrSliceIdx(UInt i) { m_uiCurrSliceIdx = i; } |
---|
| 188 | UInt getNumAllocatedSlice() {return m_apcPicSym->getNumAllocatedSlice();} |
---|
| 189 | Void allocateNewSlice() {m_apcPicSym->allocateNewSlice(); } |
---|
| 190 | Void clearSliceBuffer() {m_apcPicSym->clearSliceBuffer(); } |
---|
[56] | 191 | #if HHI_INTERVIEW_SKIP |
---|
| 192 | Void addUsedPelsMapBuffer (); |
---|
| 193 | Void removeUsedPelsMapBuffer (); |
---|
| 194 | #endif |
---|
| 195 | |
---|
| 196 | Void createNonDBFilterInfo (UInt* pSliceStartAddress = NULL, Int numSlices = 1, Int sliceGranularityDepth= 0 |
---|
| 197 | ,Bool bNDBFilterCrossSliceBoundary = true |
---|
| 198 | ,Int numTiles = 1 |
---|
| 199 | ,Bool bNDBFilterCrossTileBoundary = true); |
---|
| 200 | Void createNonDBFilterInfoLCU(Int tileID, Int sliceID, TComDataCU* pcCU, UInt startSU, UInt endSU, Int sliceGranularyDepth, UInt picWidth, UInt picHeight); |
---|
| 201 | Void destroyNonDBFilterInfo(); |
---|
[2] | 202 | |
---|
[5] | 203 | #if DEPTH_MAP_GENERATION |
---|
[21] | 204 | Void addPrdDepthMapBuffer ( UInt uiSubSampExpX, UInt uiSubSampExpY ); |
---|
[5] | 205 | #endif |
---|
| 206 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
[2] | 207 | Void addOrgDepthMapBuffer (); |
---|
[5] | 208 | #endif |
---|
| 209 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
[2] | 210 | Void addResidualBuffer (); |
---|
[5] | 211 | #endif |
---|
| 212 | #if DEPTH_MAP_GENERATION |
---|
[2] | 213 | Void removePrdDepthMapBuffer (); |
---|
[5] | 214 | #endif |
---|
| 215 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
[2] | 216 | Void removeOrgDepthMapBuffer (); |
---|
[5] | 217 | #endif |
---|
| 218 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
[2] | 219 | Void removeResidualBuffer (); |
---|
[5] | 220 | #endif |
---|
[56] | 221 | Bool getValidSlice (Int sliceID) {return m_pbValidSlice[sliceID];} |
---|
| 222 | Int getSliceGranularityForNDBFilter () {return m_sliceGranularityForNDBFilter;} |
---|
| 223 | Bool getIndependentSliceBoundaryForNDBFilter () {return m_bIndependentSliceBoundaryForNDBFilter;} |
---|
| 224 | Bool getIndependentTileBoundaryForNDBFilter () {return m_bIndependentTileBoundaryForNDBFilter; } |
---|
| 225 | TComPicYuv* getYuvPicBufferForIndependentBoundaryProcessing() {return m_pNDBFilterYuvTmp;} |
---|
| 226 | std::vector<TComDataCU*>& getOneSliceCUDataForNDBFilter (Int sliceID) { return m_vSliceCUDataLink[sliceID];} |
---|
[5] | 227 | |
---|
[56] | 228 | /** transfer ownership of seis to this picture */ |
---|
[2] | 229 | void setSEIs(SEImessages* seis) { m_SEIs = seis; } |
---|
| 230 | |
---|
| 231 | /** |
---|
| 232 | * return the current list of SEI messages associated with this picture. |
---|
[56] | 233 | * Pointer is valid until this->destroy() is called */ |
---|
[2] | 234 | SEImessages* getSEIs() { return m_SEIs; } |
---|
| 235 | |
---|
| 236 | /** |
---|
| 237 | * return the current list of SEI messages associated with this picture. |
---|
[56] | 238 | * Pointer is valid until this->destroy() is called */ |
---|
[2] | 239 | const SEImessages* getSEIs() const { return m_SEIs; } |
---|
| 240 | |
---|
| 241 | };// END CLASS DEFINITION TComPic |
---|
| 242 | |
---|
[56] | 243 | //! \} |
---|
[2] | 244 | |
---|
| 245 | #endif // __TCOMPIC__ |
---|