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