[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 |
---|
[1313] | 4 | * granted under this license. |
---|
[5] | 5 | * |
---|
[1413] | 6 | * Copyright (c) 2010-2017, 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 TComDataCU.h |
---|
| 35 | \brief CU data structure (header) |
---|
| 36 | \todo not all entities are documented |
---|
| 37 | */ |
---|
| 38 | |
---|
[1313] | 39 | #ifndef __TCOMDATACU__ |
---|
| 40 | #define __TCOMDATACU__ |
---|
[2] | 41 | |
---|
[1313] | 42 | #include <algorithm> |
---|
| 43 | #include <vector> |
---|
[2] | 44 | |
---|
| 45 | // Include files |
---|
| 46 | #include "CommonDef.h" |
---|
| 47 | #include "TComMotionInfo.h" |
---|
| 48 | #include "TComSlice.h" |
---|
| 49 | #include "TComRdCost.h" |
---|
| 50 | #include "TComPattern.h" |
---|
[1396] | 51 | #if NH_3D |
---|
| 52 | #include "TComYuv.h" |
---|
| 53 | #endif |
---|
[56] | 54 | |
---|
| 55 | //! \ingroup TLibCommon |
---|
| 56 | //! \{ |
---|
| 57 | |
---|
[1313] | 58 | class TComTU; // forward declaration |
---|
[56] | 59 | |
---|
[1313] | 60 | static const UInt NUM_MOST_PROBABLE_MODES=3; |
---|
| 61 | |
---|
[1413] | 62 | #if NH_3D |
---|
[833] | 63 | typedef struct _DBBPTmpData |
---|
| 64 | { |
---|
| 65 | TComMv acMvd[2][2]; // for two segments and two lists |
---|
| 66 | TComMvField acMvField[2][2]; // for two segments and two lists |
---|
| 67 | Int aiMvpNum[2][2]; // for two segments and two lists |
---|
| 68 | Int aiMvpIdx[2][2]; // for two segments and two lists |
---|
| 69 | UChar auhInterDir[2]; // for two segments |
---|
| 70 | Bool abMergeFlag[2]; // for two segments |
---|
| 71 | UChar auhMergeIndex[2]; // for two segments |
---|
| 72 | PartSize eVirtualPartSize; |
---|
| 73 | UInt uiVirtualPartIndex; |
---|
[1196] | 74 | } DbbpTmpData; |
---|
[833] | 75 | #endif |
---|
[56] | 76 | |
---|
[1313] | 77 | |
---|
[56] | 78 | // ==================================================================================================================== |
---|
[2] | 79 | // Class definition |
---|
| 80 | // ==================================================================================================================== |
---|
| 81 | |
---|
| 82 | /// CU data structure class |
---|
| 83 | class TComDataCU |
---|
| 84 | { |
---|
| 85 | private: |
---|
[1313] | 86 | |
---|
[2] | 87 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 88 | // class pointers |
---|
| 89 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1313] | 90 | |
---|
[2] | 91 | TComPic* m_pcPic; ///< picture class pointer |
---|
| 92 | TComSlice* m_pcSlice; ///< slice header pointer |
---|
[1313] | 93 | |
---|
[2] | 94 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 95 | // CU description |
---|
| 96 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1313] | 97 | |
---|
| 98 | UInt m_ctuRsAddr; ///< CTU (also known as LCU) address in a slice (Raster-scan address, as opposed to tile-scan/encoding order). |
---|
| 99 | UInt m_absZIdxInCtu; ///< absolute address in a CTU. It's Z scan order |
---|
[2] | 100 | UInt m_uiCUPelX; ///< CU position in a pixel (X) |
---|
| 101 | UInt m_uiCUPelY; ///< CU position in a pixel (Y) |
---|
| 102 | UInt m_uiNumPartition; ///< total number of minimum partitions in a CU |
---|
| 103 | UChar* m_puhWidth; ///< array of widths |
---|
| 104 | UChar* m_puhHeight; ///< array of heights |
---|
| 105 | UChar* m_puhDepth; ///< array of depths |
---|
[56] | 106 | Int m_unitSize; ///< size of a "minimum partition" |
---|
[1313] | 107 | |
---|
[2] | 108 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 109 | // CU data |
---|
| 110 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1313] | 111 | |
---|
| 112 | Bool* m_skipFlag; ///< array of skip flags |
---|
[1413] | 113 | #if NH_3D |
---|
[1313] | 114 | Bool* m_bDISFlag; |
---|
| 115 | UChar* m_ucDISType; |
---|
[1039] | 116 | #endif |
---|
[1386] | 117 | SChar* m_pePartSize; ///< array of partition sizes |
---|
| 118 | SChar* m_pePredMode; ///< array of prediction modes |
---|
| 119 | SChar* m_crossComponentPredictionAlpha[MAX_NUM_COMPONENT]; ///< array of cross-component prediction alpha values |
---|
[1313] | 120 | Bool* m_CUTransquantBypass; ///< array of cu_transquant_bypass flags |
---|
[1386] | 121 | SChar* m_phQP; ///< array of QP values |
---|
[1313] | 122 | UChar* m_ChromaQpAdj; ///< array of chroma QP adjustments (indexed). when value = 0, cu_chroma_qp_offset_flag=0; when value>0, indicates cu_chroma_qp_offset_flag=1 and cu_chroma_qp_offset_idx=value-1 |
---|
| 123 | UInt m_codedChromaQpAdj; |
---|
| 124 | UChar* m_puhTrIdx; ///< array of transform indices |
---|
| 125 | UChar* m_puhTransformSkip[MAX_NUM_COMPONENT];///< array of transform skipping flags |
---|
| 126 | UChar* m_puhCbf[MAX_NUM_COMPONENT]; ///< array of coded block flags (CBF) |
---|
| 127 | TComCUMvField m_acCUMvField[NUM_REF_PIC_LIST_01]; ///< array of motion vectors. |
---|
| 128 | TCoeff* m_pcTrCoeff[MAX_NUM_COMPONENT]; ///< array of transform coefficient buffers (0->Y, 1->Cb, 2->Cr) |
---|
[56] | 129 | #if ADAPTIVE_QP_SELECTION |
---|
[1386] | 130 | TCoeff* m_pcArlCoeff[MAX_NUM_COMPONENT]; ///< ARL coefficient buffer (0->Y, 1->Cb, 2->Cr) |
---|
[1313] | 131 | Bool m_ArlCoeffIsAliasedAllocation; ///< ARL coefficient buffer is an alias of the global buffer and must not be free()'d |
---|
[56] | 132 | #endif |
---|
| 133 | |
---|
[1313] | 134 | Pel* m_pcIPCMSample[MAX_NUM_COMPONENT]; ///< PCM sample buffer (0->Y, 1->Cb, 2->Cr) |
---|
| 135 | |
---|
[2] | 136 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 137 | // neighbour access variables |
---|
| 138 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1313] | 139 | |
---|
| 140 | TComDataCU* m_pCtuAboveLeft; ///< pointer of above-left CTU. |
---|
| 141 | TComDataCU* m_pCtuAboveRight; ///< pointer of above-right CTU. |
---|
| 142 | TComDataCU* m_pCtuAbove; ///< pointer of above CTU. |
---|
| 143 | TComDataCU* m_pCtuLeft; ///< pointer of left CTU |
---|
[2] | 144 | TComMvField m_cMvFieldA; ///< motion vector of position A |
---|
| 145 | TComMvField m_cMvFieldB; ///< motion vector of position B |
---|
| 146 | TComMvField m_cMvFieldC; ///< motion vector of position C |
---|
| 147 | TComMv m_cMvPred; ///< motion vector predictor |
---|
[1313] | 148 | |
---|
[2] | 149 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 150 | // coding tool information |
---|
| 151 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1313] | 152 | |
---|
[2] | 153 | Bool* m_pbMergeFlag; ///< array of merge flags |
---|
| 154 | UChar* m_puhMergeIndex; ///< array of merge candidate indices |
---|
[56] | 155 | #if AMP_MRG |
---|
| 156 | Bool m_bIsMergeAMP; |
---|
| 157 | #endif |
---|
[1386] | 158 | UChar* m_puhIntraDir[MAX_NUM_CHANNEL_TYPE]; |
---|
[56] | 159 | UChar* m_puhInterDir; ///< array of inter directions |
---|
[1386] | 160 | SChar* m_apiMVPIdx[NUM_REF_PIC_LIST_01]; ///< array of motion vector predictor candidates |
---|
| 161 | SChar* m_apiMVPNum[NUM_REF_PIC_LIST_01]; ///< array of number of possible motion vectors predictors |
---|
[56] | 162 | Bool* m_pbIPCMFlag; ///< array of intra_pcm flags |
---|
[1413] | 163 | #if MCTS_ENC_CHECK |
---|
| 164 | Bool m_tMctsMvpIsValid; |
---|
| 165 | #endif |
---|
| 166 | #if NH_3D |
---|
[608] | 167 | DisInfo* m_pDvInfo; |
---|
[1386] | 168 | SChar* m_piVSPFlag; ///< array of VSP flags to indicate whehter a block uses VSP or not ///< 0: non-VSP; 1: VSP |
---|
[1196] | 169 | Bool* m_pbSPIVMPFlag; ///< array of sub-PU IVMP flags to indicate whehter a block uses sub-PU IVMP ///< 0: non-SPIVMP; 1: SPIVMP |
---|
[443] | 170 | UChar* m_puhARPW; |
---|
[608] | 171 | Bool* m_pbICFlag; ///< array of IC flags |
---|
[1313] | 172 | Pel* m_dmmDeltaDC[NUM_DMM][2]; |
---|
| 173 | UInt* m_dmm1WedgeTabIdx; |
---|
[608] | 174 | Bool* m_pbSDCFlag; |
---|
| 175 | Pel* m_apSegmentDCOffset[2]; |
---|
[833] | 176 | Bool* m_pbDBBPFlag; ///< array of DBBP flags |
---|
[1196] | 177 | DbbpTmpData m_sDBBPTmpData; |
---|
[1413] | 178 | |
---|
[724] | 179 | Bool m_bAvailableFlagA1; ///< A1 available flag |
---|
| 180 | Bool m_bAvailableFlagB1; ///< B1 available flag |
---|
| 181 | Bool m_bAvailableFlagB0; ///< B0 available flag |
---|
| 182 | Bool m_bAvailableFlagA0; ///< A0 available flag |
---|
| 183 | Bool m_bAvailableFlagB2; ///< B2 available flag |
---|
| 184 | #endif |
---|
[1313] | 185 | |
---|
| 186 | |
---|
[56] | 187 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 188 | // misc. variables |
---|
| 189 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1313] | 190 | |
---|
[56] | 191 | Bool m_bDecSubCu; ///< indicates decoder-mode |
---|
| 192 | Double m_dTotalCost; ///< sum of partition RD costs |
---|
[1313] | 193 | #if NH_3D_VSO |
---|
[189] | 194 | Dist m_uiTotalDistortion; ///< sum of partition distortion |
---|
[608] | 195 | #else |
---|
[1313] | 196 | Distortion m_uiTotalDistortion; ///< sum of partition distortion |
---|
[608] | 197 | #endif |
---|
[56] | 198 | UInt m_uiTotalBits; ///< sum of partition bits |
---|
[1313] | 199 | UInt m_uiTotalBins; ///< sum of partition bins |
---|
[1386] | 200 | SChar m_codedQP; |
---|
[1413] | 201 | #if NH_3D |
---|
[1313] | 202 | DisInfo m_cDefaultDisInfo; ///< Default disparity information for initializing |
---|
| 203 | TComMotionCand m_mergCands[MRG_IVSHIFT+1]; ///< Motion candidates for merge mode |
---|
| 204 | Int m_numSpatialCands; |
---|
[724] | 205 | #endif |
---|
[950] | 206 | |
---|
[1313] | 207 | UChar* m_explicitRdpcmMode[MAX_NUM_COMPONENT]; ///< Stores the explicit RDPCM mode for all TUs belonging to this CU |
---|
| 208 | |
---|
[2] | 209 | protected: |
---|
[1313] | 210 | |
---|
[1386] | 211 | /// adds a single possible motion vector predictor candidate |
---|
| 212 | Bool xAddMVPCandUnscaled ( AMVPInfo &info, const RefPicList eRefPicList, const Int iRefIdx, const UInt uiPartUnitIdx, const MVP_DIR eDir ) const; |
---|
| 213 | Bool xAddMVPCandWithScaling ( AMVPInfo &info, const RefPicList eRefPicList, const Int iRefIdx, const UInt uiPartUnitIdx, const MVP_DIR eDir ) const; |
---|
| 214 | |
---|
[1413] | 215 | #if NH_3D |
---|
[950] | 216 | Bool xAddVspCand( Int mrgCandIdx, DisInfo* pDInfo, Int& iCount); |
---|
| 217 | Bool xAddIvMRGCand( Int mrgCandIdx, Int& iCount, Int* ivCandDir, TComMv* ivCandMv, Int* ivCandRefIdx ); |
---|
[443] | 218 | #endif |
---|
[608] | 219 | |
---|
[1386] | 220 | Void deriveRightBottomIdx ( UInt uiPartIdx, UInt& ruiPartIdxRB ) const; |
---|
| 221 | |
---|
[1413] | 222 | #if NH_3D |
---|
[1386] | 223 | Bool xGetColMVP ( const RefPicList eRefPicList, const Int ctuRsAddr, const Int partUnitIdx, TComMv& rcMv, Int& refIdx, Bool bMRG = true ) const; |
---|
| 224 | #else |
---|
| 225 | Bool xGetColMVP ( const RefPicList eRefPicList, const Int ctuRsAddr, const Int partUnitIdx, TComMv& rcMv, const Int refIdx ) const; |
---|
[296] | 226 | #endif |
---|
[1313] | 227 | |
---|
[2] | 228 | /// compute scaling factor from POC difference |
---|
[1413] | 229 | #if !NH_3D |
---|
[1386] | 230 | static Int xGetDistScaleFactor ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC ); |
---|
[443] | 231 | #endif |
---|
[1386] | 232 | Void xDeriveCenterIdx ( UInt uiPartIdx, UInt& ruiPartIdxCenter ) const; |
---|
[56] | 233 | |
---|
[1413] | 234 | #if NH_3D |
---|
| 235 | Void xSetMvFieldForVSP ( TComDataCU *cu, TComPicYuv *picRefDepth, TComMv *dv, UInt partAddr, Int width, Int height, Int *shiftLUT, RefPicList refPicList, Int refIdx, Bool isDepth, Int &vspSize ); |
---|
[833] | 236 | #endif |
---|
| 237 | |
---|
[2] | 238 | public: |
---|
[1386] | 239 | |
---|
[1413] | 240 | #if NH_3D |
---|
[1386] | 241 | static Int xGetDistScaleFactor ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC ); |
---|
| 242 | #endif |
---|
| 243 | |
---|
[2] | 244 | TComDataCU(); |
---|
| 245 | virtual ~TComDataCU(); |
---|
[1313] | 246 | |
---|
[2] | 247 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 248 | // create / destroy / initialize / copy |
---|
| 249 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1313] | 250 | Void create ( ChromaFormat chromaFormatIDC, UInt uiNumPartition, UInt uiWidth, UInt uiHeight, Bool bDecSubCu, Int unitSize |
---|
[56] | 251 | #if ADAPTIVE_QP_SELECTION |
---|
[1313] | 252 | , TCoeff *pParentARLBuffer = 0 |
---|
| 253 | #endif |
---|
[56] | 254 | ); |
---|
[2] | 255 | Void destroy (); |
---|
[1313] | 256 | |
---|
| 257 | Void initCtu ( TComPic* pcPic, UInt ctuRsAddr ); |
---|
| 258 | Void initEstData ( const UInt uiDepth, const Int qp, const Bool bTransquantBypass ); |
---|
[56] | 259 | Void initSubCU ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, Int qp ); |
---|
| 260 | Void setOutsideCUPart ( UInt uiAbsPartIdx, UInt uiDepth ); |
---|
[1313] | 261 | |
---|
| 262 | Void copySubCU ( TComDataCU* pcCU, UInt uiPartUnitIdx ); |
---|
[1413] | 263 | #if NH_3D |
---|
| 264 | Void copyDVInfoFrom (TComDataCU* pcCU, UInt uiAbsPartIdx); |
---|
| 265 | Void copyInterPredInfoFrom ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList, Bool bNBDV = false ); |
---|
[1386] | 266 | #else |
---|
| 267 | Void copyInterPredInfoFrom ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList ); |
---|
[443] | 268 | #endif |
---|
[608] | 269 | Void copyPartFrom ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth ); |
---|
[1313] | 270 | |
---|
[2] | 271 | Void copyToPic ( UChar uiDepth ); |
---|
[1313] | 272 | |
---|
[2] | 273 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 274 | // member functions for CU description |
---|
| 275 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1313] | 276 | |
---|
| 277 | TComPic* getPic () { return m_pcPic; } |
---|
| 278 | const TComPic* getPic () const { return m_pcPic; } |
---|
| 279 | TComSlice* getSlice () { return m_pcSlice; } |
---|
| 280 | const TComSlice* getSlice () const { return m_pcSlice; } |
---|
| 281 | UInt& getCtuRsAddr () { return m_ctuRsAddr; } |
---|
| 282 | UInt getCtuRsAddr () const { return m_ctuRsAddr; } |
---|
| 283 | UInt getZorderIdxInCtu () const { return m_absZIdxInCtu; } |
---|
| 284 | UInt getCUPelX () const { return m_uiCUPelX; } |
---|
| 285 | UInt getCUPelY () const { return m_uiCUPelY; } |
---|
| 286 | |
---|
[2] | 287 | UChar* getDepth () { return m_puhDepth; } |
---|
[1313] | 288 | UChar getDepth ( UInt uiIdx ) const { return m_puhDepth[uiIdx]; } |
---|
[2] | 289 | Void setDepth ( UInt uiIdx, UChar uh ) { m_puhDepth[uiIdx] = uh; } |
---|
[1313] | 290 | |
---|
[56] | 291 | Void setDepthSubParts ( UInt uiDepth, UInt uiAbsPartIdx ); |
---|
[1413] | 292 | |
---|
| 293 | #if MCTS_ENC_CHECK |
---|
| 294 | Void setTMctsMvpIsValid(Bool b) { m_tMctsMvpIsValid = b; } |
---|
| 295 | Bool getTMctsMvpIsValid() { return m_tMctsMvpIsValid; } |
---|
| 296 | Bool isLastColumnCTUInTile() const; |
---|
[5] | 297 | #endif |
---|
[1313] | 298 | |
---|
[1413] | 299 | #if NH_3D |
---|
| 300 | Void getPosInPic ( UInt uiAbsPartIndex, Int& riPosX, Int& riPosY ) const; |
---|
[1313] | 301 | Void setSlice ( TComSlice* pcSlice) { m_pcSlice = pcSlice; } |
---|
| 302 | Void setPic ( TComDataCU* pcCU ) { m_pcPic = pcCU->getPic(); } |
---|
| 303 | #endif |
---|
[608] | 304 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[2] | 305 | // member functions for CU data |
---|
| 306 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1313] | 307 | |
---|
[1386] | 308 | SChar* getPartitionSize ( ) { return m_pePartSize; } |
---|
| 309 | PartSize getPartitionSize ( UInt uiIdx ) const { return static_cast<PartSize>( m_pePartSize[uiIdx] ); } |
---|
[2] | 310 | Void setPartitionSize ( UInt uiIdx, PartSize uh){ m_pePartSize[uiIdx] = uh; } |
---|
| 311 | Void setPartSizeSubParts ( PartSize eMode, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
[608] | 312 | Void setCUTransquantBypassSubParts( Bool flag, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
[1313] | 313 | |
---|
[1413] | 314 | #if NH_3D |
---|
[833] | 315 | Pel* getVirtualDepthBlock(UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt& uiDepthStride); |
---|
| 316 | #endif |
---|
| 317 | |
---|
[1413] | 318 | Bool* getSkipFlag () { return m_skipFlag; } |
---|
[1386] | 319 | Bool getSkipFlag ( UInt idx ) const { return m_skipFlag[idx]; } |
---|
[1313] | 320 | Void setSkipFlag ( UInt idx, Bool skip) { m_skipFlag[idx] = skip; } |
---|
| 321 | Void setSkipFlagSubParts ( Bool skip, UInt absPartIdx, UInt depth ); |
---|
[1179] | 322 | |
---|
[1413] | 323 | #if NH_3D |
---|
| 324 | Bool* getDISFlag () { return m_bDISFlag; } |
---|
| 325 | Bool getDISFlag ( UInt idx) { return m_bDISFlag[idx]; } |
---|
| 326 | Void setDISFlag ( UInt idx, Bool bDIS) { m_bDISFlag[idx] = bDIS; } |
---|
| 327 | Void setDISFlagSubParts ( Bool bDIS, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
[1313] | 328 | |
---|
[1413] | 329 | UChar* getDISType () { return m_ucDISType; } |
---|
| 330 | UChar getDISType ( UInt idx) { return m_ucDISType[idx]; } |
---|
| 331 | Void getDISType ( UInt idx, UChar ucDISType) { m_ucDISType[idx] = ucDISType; } |
---|
| 332 | Void setDISTypeSubParts ( UChar ucDISType, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
| 333 | |
---|
[1386] | 334 | Bool* getDBBPFlag () const { return m_pbDBBPFlag; } |
---|
| 335 | Bool getDBBPFlag ( UInt uiIdx ) const { return m_pbDBBPFlag[uiIdx]; } |
---|
[833] | 336 | Void setDBBPFlag ( UInt uiIdx, Bool b ) { m_pbDBBPFlag[uiIdx] = b; } |
---|
| 337 | Void setDBBPFlagSubParts ( Bool bDBBPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
[1196] | 338 | DbbpTmpData* getDBBPTmpData () { return &m_sDBBPTmpData; } |
---|
[1413] | 339 | |
---|
| 340 | |
---|
[833] | 341 | #endif |
---|
[1413] | 342 | SChar* getPredictionMode ( ) { return m_pePredMode; } |
---|
| 343 | PredMode getPredictionMode ( UInt uiIdx ) const { return static_cast<PredMode>( m_pePredMode[uiIdx] ); } |
---|
| 344 | Void setPredictionMode ( UInt uiIdx, PredMode uh){ m_pePredMode[uiIdx] = uh; } |
---|
| 345 | Void setPredModeSubParts ( PredMode eMode, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
[1313] | 346 | |
---|
[1413] | 347 | |
---|
[1386] | 348 | SChar* getCrossComponentPredictionAlpha( ComponentID compID ) { return m_crossComponentPredictionAlpha[compID]; } |
---|
| 349 | SChar getCrossComponentPredictionAlpha( UInt uiIdx, ComponentID compID ) { return m_crossComponentPredictionAlpha[compID][uiIdx]; } |
---|
[1313] | 350 | |
---|
| 351 | Bool* getCUTransquantBypass () { return m_CUTransquantBypass; } |
---|
[1386] | 352 | Bool getCUTransquantBypass ( UInt uiIdx ) const { return m_CUTransquantBypass[uiIdx]; } |
---|
[1313] | 353 | |
---|
[2] | 354 | UChar* getWidth () { return m_puhWidth; } |
---|
[1386] | 355 | UChar getWidth ( UInt uiIdx ) const { return m_puhWidth[uiIdx]; } |
---|
[2] | 356 | Void setWidth ( UInt uiIdx, UChar uh ) { m_puhWidth[uiIdx] = uh; } |
---|
[1313] | 357 | |
---|
[2] | 358 | UChar* getHeight () { return m_puhHeight; } |
---|
[1386] | 359 | UChar getHeight ( UInt uiIdx ) const { return m_puhHeight[uiIdx]; } |
---|
[2] | 360 | Void setHeight ( UInt uiIdx, UChar uh ) { m_puhHeight[uiIdx] = uh; } |
---|
[1313] | 361 | |
---|
[2] | 362 | Void setSizeSubParts ( UInt uiWidth, UInt uiHeight, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
[1313] | 363 | |
---|
[1386] | 364 | SChar* getQP ( ) { return m_phQP; } |
---|
| 365 | SChar getQP ( UInt uiIdx ) const { return m_phQP[uiIdx]; } |
---|
| 366 | Void setQP ( UInt uiIdx, SChar value ) { m_phQP[uiIdx] = value; } |
---|
[56] | 367 | Void setQPSubParts ( Int qp, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
[1386] | 368 | Int getLastValidPartIdx ( Int iAbsPartIdx ) const; |
---|
| 369 | SChar getLastCodedQP ( UInt uiAbsPartIdx ) const; |
---|
[1313] | 370 | Void setQPSubCUs ( Int qp, UInt absPartIdx, UInt depth, Bool &foundNonZeroCbf ); |
---|
[1386] | 371 | Void setCodedQP ( SChar qp ) { m_codedQP = qp; } |
---|
| 372 | SChar getCodedQP ( ) const { return m_codedQP; } |
---|
[56] | 373 | |
---|
[1313] | 374 | UChar* getChromaQpAdj () { return m_ChromaQpAdj; } ///< array of chroma QP adjustments (indexed). when value = 0, cu_chroma_qp_offset_flag=0; when value>0, indicates cu_chroma_qp_offset_flag=1 and cu_chroma_qp_offset_idx=value-1 |
---|
| 375 | UChar getChromaQpAdj (Int idx) const { return m_ChromaQpAdj[idx]; } ///< When value = 0, cu_chroma_qp_offset_flag=0; when value>0, indicates cu_chroma_qp_offset_flag=1 and cu_chroma_qp_offset_idx=value-1 |
---|
| 376 | Void setChromaQpAdj (Int idx, UChar val) { m_ChromaQpAdj[idx] = val; } ///< When val = 0, cu_chroma_qp_offset_flag=0; when val>0, indicates cu_chroma_qp_offset_flag=1 and cu_chroma_qp_offset_idx=val-1 |
---|
| 377 | Void setChromaQpAdjSubParts( UChar val, Int absPartIdx, Int depth ); |
---|
[1386] | 378 | Void setCodedChromaQpAdj ( SChar qp ) { m_codedChromaQpAdj = qp; } |
---|
| 379 | SChar getCodedChromaQpAdj ( ) const { return m_codedChromaQpAdj; } |
---|
[1313] | 380 | |
---|
[1386] | 381 | Bool isLosslessCoded ( UInt absPartIdx ) const; |
---|
[1313] | 382 | |
---|
[2] | 383 | UChar* getTransformIdx () { return m_puhTrIdx; } |
---|
[1386] | 384 | UChar getTransformIdx ( UInt uiIdx ) const { return m_puhTrIdx[uiIdx]; } |
---|
[2] | 385 | Void setTrIdxSubParts ( UInt uiTrIdx, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
[608] | 386 | |
---|
[1313] | 387 | UChar* getTransformSkip ( ComponentID compID ) { return m_puhTransformSkip[compID];} |
---|
[1386] | 388 | UChar getTransformSkip ( UInt uiIdx, ComponentID compID ) const { return m_puhTransformSkip[compID][uiIdx]; } |
---|
[1313] | 389 | Void setTransformSkipSubParts ( UInt useTransformSkip, ComponentID compID, UInt uiAbsPartIdx, UInt uiDepth); |
---|
| 390 | Void setTransformSkipSubParts ( const UInt useTransformSkip[MAX_NUM_COMPONENT], UInt uiAbsPartIdx, UInt uiDepth ); |
---|
[608] | 391 | |
---|
[1313] | 392 | UChar* getExplicitRdpcmMode ( ComponentID component ) { return m_explicitRdpcmMode[component]; } |
---|
[1386] | 393 | UChar getExplicitRdpcmMode ( ComponentID component, UInt partIdx ) const { return m_explicitRdpcmMode[component][partIdx]; } |
---|
[1313] | 394 | Void setExplicitRdpcmModePartRange ( UInt rdpcmMode, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes ); |
---|
| 395 | |
---|
[1386] | 396 | Bool isRDPCMEnabled ( UInt uiAbsPartIdx ) const { return getSlice()->getSPS()->getSpsRangeExtension().getRdpcmEnabledFlag(isIntra(uiAbsPartIdx) ? RDPCM_SIGNAL_IMPLICIT : RDPCM_SIGNAL_EXPLICIT); } |
---|
[1313] | 397 | |
---|
[1386] | 398 | Void setCrossComponentPredictionAlphaPartRange ( SChar alphaValue, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes ); |
---|
[1313] | 399 | Void setTransformSkipPartRange ( UInt useTransformSkip, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes ); |
---|
| 400 | |
---|
[1386] | 401 | UInt getQuadtreeTULog2MinSizeInCU ( UInt uiIdx ) const; |
---|
[1313] | 402 | |
---|
[2] | 403 | TComCUMvField* getCUMvField ( RefPicList e ) { return &m_acCUMvField[e]; } |
---|
[1386] | 404 | const TComCUMvField* getCUMvField ( RefPicList e ) const { return &m_acCUMvField[e]; } |
---|
[1313] | 405 | |
---|
| 406 | TCoeff* getCoeff (ComponentID component) { return m_pcTrCoeff[component]; } |
---|
| 407 | |
---|
[56] | 408 | #if ADAPTIVE_QP_SELECTION |
---|
[1313] | 409 | TCoeff* getArlCoeff ( ComponentID component ) { return m_pcArlCoeff[component]; } |
---|
[56] | 410 | #endif |
---|
[1313] | 411 | Pel* getPCMSample ( ComponentID component ) { return m_pcIPCMSample[component]; } |
---|
[56] | 412 | |
---|
[1386] | 413 | UChar getCbf ( UInt uiIdx, ComponentID eType ) const { return m_puhCbf[eType][uiIdx]; } |
---|
[1313] | 414 | UChar* getCbf ( ComponentID eType ) { return m_puhCbf[eType]; } |
---|
[1386] | 415 | UChar getCbf ( UInt uiIdx, ComponentID eType, UInt uiTrDepth ) const { return ( ( getCbf( uiIdx, eType ) >> uiTrDepth ) & 0x1 ); } |
---|
[1313] | 416 | Void setCbf ( UInt uiIdx, ComponentID eType, UChar uh ) { m_puhCbf[eType][uiIdx] = uh; } |
---|
| 417 | Void clearCbf ( UInt uiIdx, ComponentID eType, UInt uiNumParts ); |
---|
[1386] | 418 | UChar getQtRootCbf ( UInt uiIdx ) const; |
---|
[1179] | 419 | |
---|
[1313] | 420 | Void setCbfSubParts ( const UInt uiCbf[MAX_NUM_COMPONENT], UInt uiAbsPartIdx, UInt uiDepth ); |
---|
| 421 | Void setCbfSubParts ( UInt uiCbf, ComponentID compID, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
| 422 | Void setCbfSubParts ( UInt uiCbf, ComponentID compID, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
[1179] | 423 | |
---|
[1313] | 424 | Void setCbfPartRange ( UInt uiCbf, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes ); |
---|
| 425 | Void bitwiseOrCbfPartRange ( UInt uiCbf, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes ); |
---|
| 426 | |
---|
[2] | 427 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 428 | // member functions for coding tool information |
---|
| 429 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1313] | 430 | |
---|
[2] | 431 | Bool* getMergeFlag () { return m_pbMergeFlag; } |
---|
[1386] | 432 | Bool getMergeFlag ( UInt uiIdx ) const { return m_pbMergeFlag[uiIdx]; } |
---|
[2] | 433 | Void setMergeFlag ( UInt uiIdx, Bool b ) { m_pbMergeFlag[uiIdx] = b; } |
---|
| 434 | Void setMergeFlagSubParts ( Bool bMergeFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
| 435 | |
---|
| 436 | UChar* getMergeIndex () { return m_puhMergeIndex; } |
---|
[1386] | 437 | UChar getMergeIndex ( UInt uiIdx ) const { return m_puhMergeIndex[uiIdx]; } |
---|
[2] | 438 | Void setMergeIndex ( UInt uiIdx, UInt uiMergeIndex ) { m_puhMergeIndex[uiIdx] = uiMergeIndex; } |
---|
| 439 | Void setMergeIndexSubParts ( UInt uiMergeIndex, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
[56] | 440 | template <typename T> |
---|
[1313] | 441 | Void setSubPart ( T bParameter, T* pbBaseCtu, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx ); |
---|
[1413] | 442 | #if NH_3D |
---|
[608] | 443 | template<typename T> |
---|
| 444 | Void setSubPartT ( T uiParameter, T* puhBaseLCU, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx ); |
---|
[189] | 445 | #endif |
---|
[1313] | 446 | |
---|
[56] | 447 | #if AMP_MRG |
---|
| 448 | Void setMergeAMP( Bool b ) { m_bIsMergeAMP = b; } |
---|
[1386] | 449 | Bool getMergeAMP ( ) const { return m_bIsMergeAMP; } |
---|
[5] | 450 | #endif |
---|
[2] | 451 | |
---|
[1313] | 452 | UChar* getIntraDir ( const ChannelType channelType ) const { return m_puhIntraDir[channelType]; } |
---|
| 453 | UChar getIntraDir ( const ChannelType channelType, const UInt uiIdx ) const { return m_puhIntraDir[channelType][uiIdx]; } |
---|
| 454 | |
---|
| 455 | Void setIntraDirSubParts ( const ChannelType channelType, |
---|
| 456 | const UInt uiDir, |
---|
| 457 | const UInt uiAbsPartIdx, |
---|
| 458 | const UInt uiDepth ); |
---|
| 459 | |
---|
[2] | 460 | UChar* getInterDir () { return m_puhInterDir; } |
---|
[1386] | 461 | UChar getInterDir ( UInt uiIdx ) const { return m_puhInterDir[uiIdx]; } |
---|
[2] | 462 | Void setInterDir ( UInt uiIdx, UChar uh ) { m_puhInterDir[uiIdx] = uh; } |
---|
| 463 | Void setInterDirSubParts ( UInt uiDir, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
[56] | 464 | Bool* getIPCMFlag () { return m_pbIPCMFlag; } |
---|
[1386] | 465 | Bool getIPCMFlag ( UInt uiIdx ) const { return m_pbIPCMFlag[uiIdx]; } |
---|
[56] | 466 | Void setIPCMFlag (UInt uiIdx, Bool b ) { m_pbIPCMFlag[uiIdx] = b; } |
---|
| 467 | Void setIPCMFlagSubParts (Bool bIpcmFlag, UInt uiAbsPartIdx, UInt uiDepth); |
---|
[1413] | 468 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 469 | // member functions for accessing partition information |
---|
| 470 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 471 | |
---|
| 472 | #if NH_3D_FAST_TEXTURE_ENCODING |
---|
| 473 | Void getIVNStatus ( UInt uiPartIdx, DisInfo* pDInfo, Bool& bIVFMerge, Int& iIVFMaxD); |
---|
| 474 | #endif |
---|
| 475 | |
---|
| 476 | #if NH_3D |
---|
[608] | 477 | Void setDvInfoSubParts ( DisInfo cDvInfo, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
| 478 | Void setDvInfoSubParts ( DisInfo cDvInfo, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth); |
---|
| 479 | DisInfo* getDvInfo () { return m_pDvInfo; } |
---|
| 480 | DisInfo getDvInfo (UInt uiIdx) { return m_pDvInfo[uiIdx]; } |
---|
[1413] | 481 | |
---|
| 482 | Void getDisMvpCandNBDV ( DisInfo* pDInfo, Bool bDepthRefine = false ); |
---|
| 483 | Void getDispforDepth ( UInt uiPartIdx, UInt uiPartAddr, DisInfo* cDisp); |
---|
[1196] | 484 | |
---|
[1413] | 485 | Pel getMcpFromDM ( TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iWidth, Int iHeight, Int* aiShiftLUT ); |
---|
| 486 | Void estimateDVFromDM ( Int refViewIdx, UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred ); |
---|
| 487 | Bool getNeighDepth ( UInt uiPartIdx, UInt uiPartAddr, Pel* pNeighDepth, Int index); |
---|
| 488 | Void getSPPara ( Int iPUWidth , Int iPUHeight, Int& iNumSP, Int& iNumSPInOneLine, Int& iSPWidth, Int& iSPHeight); |
---|
| 489 | Void getSPAbsPartIdx ( UInt uiBaseAbsPartIdx, Int iWidth, Int iHeight, Int iPartIdx, Int iNumPartLine, UInt& ruiPartAddr ); |
---|
| 490 | Void setInterDirSP ( UInt uiDir , UInt uiAbsPartIdx, Int iWidth, Int iHeight ); |
---|
| 491 | Bool getInterViewMergeCands( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* availableMcDc, Bool bIsDepth , TComMvField* pcMFieldSP, UChar* puhInterDirSP, Bool bICFlag ); |
---|
[773] | 492 | |
---|
[1386] | 493 | UChar* getARPW () const { return m_puhARPW; } |
---|
| 494 | UChar getARPW ( UInt uiIdx ) const { return m_puhARPW[uiIdx]; } |
---|
[608] | 495 | Void setARPW ( UInt uiIdx, UChar w ) { m_puhARPW[uiIdx] = w; } |
---|
| 496 | Void setARPWSubParts ( UChar w, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
[1413] | 497 | |
---|
[608] | 498 | Bool* getICFlag () { return m_pbICFlag; } |
---|
| 499 | Bool getICFlag ( UInt uiIdx ) { return m_pbICFlag[uiIdx]; } |
---|
| 500 | Void setICFlag ( UInt uiIdx, Bool uh ) { m_pbICFlag[uiIdx] = uh; } |
---|
| 501 | Void setICFlagSubParts ( Bool bICFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
| 502 | Bool isICFlagRequired ( UInt uiAbsPartIdx ); |
---|
[1313] | 503 | |
---|
[1413] | 504 | Pel* getDmmDeltaDC ( DmmID dmmType, UInt segId ) { return m_dmmDeltaDC[dmmType][segId]; } |
---|
| 505 | Pel getDmmDeltaDC ( DmmID dmmType, UInt segId, UInt uiIdx ) { return m_dmmDeltaDC[dmmType][segId][uiIdx]; } |
---|
| 506 | Void setDmmDeltaDC ( DmmID dmmType, UInt segId, UInt uiIdx, Pel val ) { m_dmmDeltaDC[dmmType][segId][uiIdx] = val; } |
---|
[608] | 507 | |
---|
[1413] | 508 | UInt* getDmm1WedgeTabIdx () { return m_dmm1WedgeTabIdx; } |
---|
| 509 | UInt getDmm1WedgeTabIdx ( UInt uiIdx ) { return m_dmm1WedgeTabIdx[uiIdx]; } |
---|
| 510 | Void setDmm1WedgeTabIdx ( UInt uiIdx, UInt tabIdx ) { m_dmm1WedgeTabIdx[uiIdx] = tabIdx; } |
---|
| 511 | Void setDmm1WedgeTabIdxSubParts ( UInt tabIdx, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
[608] | 512 | |
---|
| 513 | Bool* getSDCFlag () { return m_pbSDCFlag; } |
---|
| 514 | Bool getSDCFlag ( UInt uiIdx ) { return m_pbSDCFlag[uiIdx]; } |
---|
| 515 | Void setSDCFlagSubParts ( Bool bSDCFlag, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
[1413] | 516 | |
---|
[608] | 517 | Bool getSDCAvailable ( UInt uiAbsPartIdx ); |
---|
[1413] | 518 | |
---|
[608] | 519 | Pel* getSDCSegmentDCOffset( UInt uiSeg ) { return m_apSegmentDCOffset[uiSeg]; } |
---|
| 520 | Pel getSDCSegmentDCOffset( UInt uiSeg, UInt uiPartIdx ) { return m_apSegmentDCOffset[uiSeg][uiPartIdx]; } |
---|
| 521 | Void setSDCSegmentDCOffset( Pel pOffset, UInt uiSeg, UInt uiPartIdx) { m_apSegmentDCOffset[uiSeg][uiPartIdx] = pOffset; } |
---|
[1413] | 522 | |
---|
| 523 | Void xDeriveRightBottomNbIdx(Int &uiLCUIdxRBNb, Int &uiPartIdxRBNb ); |
---|
| 524 | Bool xCheckSpatialNBDV (const TComDataCU* pcTmpCU, UInt uiIdx, DisInfo* pNbDvInfo, Bool bSearchForMvpDv, IDVInfo* paMvpDvInfo, UInt uiMvpDvPos , Bool bDepthRefine = false ); |
---|
| 525 | Bool xGetColDisMV ( Int currCandPic, RefPicList eRefPicList, Int refidx, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int & iTargetViewIdx, Int & iStartViewIdx ); |
---|
| 526 | |
---|
| 527 | |
---|
| 528 | Void getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight, UInt uiAbsPartIdx = 0, Bool bLCU = false) const; |
---|
| 529 | #else |
---|
| 530 | Void getPartIndexAndSize ( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight ) const; // This is for use by a leaf/sub CU object only, with no additional AbsPartIdx |
---|
[608] | 531 | #endif |
---|
[1413] | 532 | UChar getNumPartitions ( const UInt uiAbsPartIdx = 0 ) const; |
---|
| 533 | Bool isFirstAbsZorderIdxInDepth ( UInt uiAbsPartIdx, UInt uiDepth ) const; |
---|
[608] | 534 | |
---|
[2] | 535 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 536 | // member functions for motion vector |
---|
| 537 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1313] | 538 | |
---|
[1386] | 539 | static Void getMvField ( const TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList, TComMvField& rcMvField ); |
---|
[1313] | 540 | |
---|
[1386] | 541 | Void fillMvpCand ( const UInt uiPartIdx, const UInt uiPartAddr, const RefPicList eRefPicList, const Int iRefIdx, AMVPInfo* pInfo ) const; |
---|
| 542 | Bool isDiffMER ( Int xN, Int yN, Int xP, Int yP ) const; |
---|
| 543 | Void getPartPosition ( UInt partIdx, Int& xP, Int& yP, Int& nPSW, Int& nPSH ) const; |
---|
[1313] | 544 | |
---|
[1413] | 545 | Void setMVPIdx ( RefPicList eRefPicList, UInt uiIdx, Int iMVPIdx) { m_apiMVPIdx[eRefPicList][uiIdx] = iMVPIdx; } |
---|
[1386] | 546 | Int getMVPIdx ( RefPicList eRefPicList, UInt uiIdx) const { return m_apiMVPIdx[eRefPicList][uiIdx]; } |
---|
| 547 | SChar* getMVPIdx ( RefPicList eRefPicList ) { return m_apiMVPIdx[eRefPicList]; } |
---|
[56] | 548 | |
---|
[1413] | 549 | Void setMVPNum ( RefPicList eRefPicList, UInt uiIdx, Int iMVPNum ) { m_apiMVPNum[eRefPicList][uiIdx] = iMVPNum; } |
---|
[1386] | 550 | Int getMVPNum ( RefPicList eRefPicList, UInt uiIdx ) const { return m_apiMVPNum[eRefPicList][uiIdx]; } |
---|
| 551 | SChar* getMVPNum ( RefPicList eRefPicList ) { return m_apiMVPNum[eRefPicList]; } |
---|
[1313] | 552 | |
---|
[1413] | 553 | Void setMVPIdxSubParts ( Int iMVPIdx, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
| 554 | Void setMVPNumSubParts ( Int iMVPNum, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
[1313] | 555 | |
---|
[1386] | 556 | Void clipMv ( TComMv& rcMv ) const; |
---|
| 557 | |
---|
[1413] | 558 | Void getMvPredLeft ( TComMv& rcMvPred ) const { rcMvPred = m_cMvFieldA.getMv(); } |
---|
| 559 | Void getMvPredAbove ( TComMv& rcMvPred ) const { rcMvPred = m_cMvFieldB.getMv(); } |
---|
| 560 | Void getMvPredAboveRight ( TComMv& rcMvPred ) const { rcMvPred = m_cMvFieldC.getMv(); } |
---|
| 561 | |
---|
[1313] | 562 | #if NH_MV |
---|
[1196] | 563 | Void checkMvVertRest (TComMv& rcMv, RefPicList eRefPicList, int iRefIdx ); |
---|
[1179] | 564 | #endif |
---|
[1413] | 565 | |
---|
| 566 | |
---|
[1313] | 567 | #if NH_3D |
---|
[655] | 568 | Void compressMV ( Int scale ); |
---|
[1321] | 569 | Void printMV ( ); |
---|
[608] | 570 | #else |
---|
[2] | 571 | Void compressMV (); |
---|
[608] | 572 | #endif |
---|
[2] | 573 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 574 | // utility functions for neighbouring information |
---|
| 575 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1313] | 576 | |
---|
| 577 | TComDataCU* getCtuLeft () { return m_pCtuLeft; } |
---|
| 578 | TComDataCU* getCtuAbove () { return m_pCtuAbove; } |
---|
| 579 | TComDataCU* getCtuAboveLeft () { return m_pCtuAboveLeft; } |
---|
| 580 | TComDataCU* getCtuAboveRight () { return m_pCtuAboveRight; } |
---|
| 581 | Bool CUIsFromSameSlice ( const TComDataCU *pCU /* Can be NULL */) const { return ( pCU!=NULL && pCU->getSlice()->getSliceCurStartCtuTsAddr() == getSlice()->getSliceCurStartCtuTsAddr() ); } |
---|
| 582 | Bool CUIsFromSameTile ( const TComDataCU *pCU /* Can be NULL */) const; |
---|
| 583 | Bool CUIsFromSameSliceAndTile ( const TComDataCU *pCU /* Can be NULL */) const; |
---|
| 584 | Bool CUIsFromSameSliceTileAndWavefrontRow( const TComDataCU *pCU /* Can be NULL */) const; |
---|
[1386] | 585 | Bool isLastSubCUOfCtu ( const UInt absPartIdx ) const; |
---|
[56] | 586 | |
---|
| 587 | |
---|
[1386] | 588 | const TComDataCU* getPULeft ( UInt& uiLPartUnitIdx, |
---|
[1313] | 589 | UInt uiCurrPartUnitIdx, |
---|
| 590 | Bool bEnforceSliceRestriction=true, |
---|
[1386] | 591 | Bool bEnforceTileRestriction=true ) const; |
---|
| 592 | |
---|
| 593 | const TComDataCU* getPUAbove ( UInt& uiAPartUnitIdx, |
---|
[1313] | 594 | UInt uiCurrPartUnitIdx, |
---|
| 595 | Bool bEnforceSliceRestriction=true, |
---|
| 596 | Bool planarAtCTUBoundary = false, |
---|
[1386] | 597 | Bool bEnforceTileRestriction=true ) const; |
---|
[56] | 598 | |
---|
[1386] | 599 | const TComDataCU* getPUAboveLeft ( UInt& uiALPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true ) const; |
---|
[56] | 600 | |
---|
[1386] | 601 | const TComDataCU* getQpMinCuLeft ( UInt& uiLPartUnitIdx, UInt uiCurrAbsIdxInCtu ) const; |
---|
| 602 | const TComDataCU* getQpMinCuAbove ( UInt& uiAPartUnitIdx, UInt uiCurrAbsIdxInCtu ) const; |
---|
| 603 | |
---|
[1313] | 604 | /// returns CU and part index of the PU above the top row of the current uiCurrPartUnitIdx of the CU, at a horizontal offset (to the right) of uiPartUnitOffset (in parts) |
---|
[1386] | 605 | const TComDataCU* getPUAboveRight ( UInt& uiARPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true ) const; |
---|
[1313] | 606 | /// returns CU and part index of the PU left of the lefthand column of the current uiCurrPartUnitIdx of the CU, at a vertical offset (below) of uiPartUnitOffset (in parts) |
---|
[1386] | 607 | const TComDataCU* getPUBelowLeft ( UInt& uiBLPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true ) const; |
---|
[1313] | 608 | |
---|
[1386] | 609 | SChar getRefQP ( UInt uiCurrAbsIdxInCtu ) const; |
---|
[1313] | 610 | |
---|
[1386] | 611 | Void deriveLeftRightTopIdx ( UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ) const; |
---|
| 612 | Void deriveLeftBottomIdx ( UInt uiPartIdx, UInt& ruiPartIdxLB ) const; |
---|
| 613 | |
---|
[1413] | 614 | Bool hasEqualMotion ( UInt uiAbsPartIdx, const TComDataCU* pcCandCU, UInt uiCandAbsPartIdx ) const; |
---|
| 615 | |
---|
[1321] | 616 | #if NH_3D |
---|
[1313] | 617 | Bool hasEqualMotion ( Int dirA, const TComMvField* mvFieldA, Int dirB, const TComMvField* mvFieldB ); |
---|
| 618 | Bool getAvailableFlagA1() { return m_bAvailableFlagA1; } |
---|
| 619 | Bool getAvailableFlagB1() { return m_bAvailableFlagB1; } |
---|
| 620 | Bool getAvailableFlagB0() { return m_bAvailableFlagB0; } |
---|
| 621 | Bool getAvailableFlagA0() { return m_bAvailableFlagA0; } |
---|
| 622 | Bool getAvailableFlagB2() { return m_bAvailableFlagB2; } |
---|
[1413] | 623 | |
---|
| 624 | Void initAvailableFlags() { m_bAvailableFlagA1 = m_bAvailableFlagB1 = m_bAvailableFlagB0 = m_bAvailableFlagA0 = m_bAvailableFlagB2 = 0; } |
---|
| 625 | |
---|
| 626 | Void buildMCL(TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int* vspFlag, Bool* pbSPIVMPFlag , Int& numValidMergeCand ); |
---|
| 627 | Void xGetInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, TComMvField* pcMvFieldSP, UChar* puhInterDirSP, Int& numValidMergeCand, Int mrgCandIdx = -1 ); |
---|
[950] | 628 | #endif |
---|
[1413] | 629 | |
---|
| 630 | #if MCTS_ENC_CHECK |
---|
| 631 | Void getInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, UInt& numSpatialMergeCandidates , Int mrgCandIdx = -1) |
---|
| 632 | #else |
---|
| 633 | Void getInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx = -1 ) |
---|
[950] | 634 | #endif |
---|
[1413] | 635 | #if !NH_3D |
---|
| 636 | const |
---|
[724] | 637 | #endif |
---|
[1413] | 638 | ; |
---|
[1386] | 639 | #if NH_3D |
---|
| 640 | Bool* getSPIVMPFlag () const { return m_pbSPIVMPFlag; } |
---|
| 641 | Bool getSPIVMPFlag ( UInt uiIdx ) const { return m_pbSPIVMPFlag[uiIdx]; } |
---|
[724] | 642 | Void setSPIVMPFlag ( UInt uiIdx, Bool n ) { m_pbSPIVMPFlag[uiIdx] = n; } |
---|
| 643 | Void setSPIVMPFlagSubParts( Bool bSPIVMPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
| 644 | |
---|
[1386] | 645 | SChar* getVSPFlag () const { return m_piVSPFlag; } |
---|
| 646 | SChar getVSPFlag ( UInt uiIdx ) const { return m_piVSPFlag[uiIdx]; } |
---|
[608] | 647 | Void setVSPFlag ( UInt uiIdx, Int n ) { m_piVSPFlag[uiIdx] = n; } |
---|
[1386] | 648 | Void setVSPFlagSubParts( SChar iVSPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
[833] | 649 | Void setMvFieldPUForVSP ( TComDataCU* cu, UInt partAddr, Int width, Int height, RefPicList refPicList, Int refIdx, Int &vspSize ); |
---|
[608] | 650 | #endif |
---|
[1386] | 651 | Void deriveLeftRightTopIdxGeneral ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ) const; |
---|
| 652 | Void deriveLeftBottomIdxGeneral ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLB ) const; |
---|
[2] | 653 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 654 | // member functions for modes |
---|
| 655 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1313] | 656 | |
---|
| 657 | Bool isIntra ( UInt uiPartIdx ) const { return m_pePredMode[ uiPartIdx ] == MODE_INTRA; } |
---|
| 658 | Bool isInter ( UInt uiPartIdx ) const { return m_pePredMode[ uiPartIdx ] == MODE_INTER; } |
---|
[1386] | 659 | Bool isSkipped ( UInt uiPartIdx ) const; ///< returns true, if the partiton is skipped |
---|
| 660 | Bool isBipredRestriction ( UInt puIdx ) const; |
---|
[608] | 661 | |
---|
[2] | 662 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 663 | // member functions for symbol prediction (most probable / mode conversion) |
---|
| 664 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1313] | 665 | |
---|
[1386] | 666 | UInt getIntraSizeIdx ( UInt uiAbsPartIdx ) const; |
---|
[1313] | 667 | |
---|
[1386] | 668 | Void getAllowedChromaDir ( UInt uiAbsPartIdx, UInt* uiModeList ) const; |
---|
| 669 | Void getIntraDirPredictor ( UInt uiAbsPartIdx, Int uiIntraDirPred[NUM_MOST_PROBABLE_MODES], const ComponentID compID, Int* piMode = NULL ) const; |
---|
[1313] | 670 | |
---|
[2] | 671 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 672 | // member functions for SBAC context |
---|
| 673 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1313] | 674 | |
---|
[1386] | 675 | UInt getCtxSplitFlag ( UInt uiAbsPartIdx, UInt uiDepth ) const; |
---|
| 676 | UInt getCtxQtCbf ( TComTU &rTu, const ChannelType chType ) const; |
---|
[56] | 677 | |
---|
[1386] | 678 | UInt getCtxSkipFlag ( UInt uiAbsPartIdx ) const; |
---|
| 679 | UInt getCtxInterDir ( UInt uiAbsPartIdx ) const; |
---|
[1413] | 680 | #if NH_3D |
---|
[608] | 681 | UInt getCTXARPWFlag ( UInt uiAbsPartIdx ); |
---|
| 682 | #endif |
---|
[1313] | 683 | |
---|
| 684 | UInt& getTotalBins () { return m_uiTotalBins; } |
---|
[2] | 685 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 686 | // member functions for RD cost storage |
---|
| 687 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1313] | 688 | |
---|
[2] | 689 | Double& getTotalCost() { return m_dTotalCost; } |
---|
[1313] | 690 | #if NH_3D_VSO |
---|
[189] | 691 | Dist& getTotalDistortion() { return m_uiTotalDistortion; } |
---|
[608] | 692 | #else |
---|
[1313] | 693 | Distortion& getTotalDistortion() { return m_uiTotalDistortion; } |
---|
[608] | 694 | #endif |
---|
[2] | 695 | UInt& getTotalBits() { return m_uiTotalBits; } |
---|
| 696 | UInt& getTotalNumPart() { return m_uiNumPartition; } |
---|
| 697 | |
---|
[1313] | 698 | UInt getCoefScanIdx(const UInt uiAbsPartIdx, const UInt uiWidth, const UInt uiHeight, const ComponentID compID) const ; |
---|
[2] | 699 | }; |
---|
| 700 | |
---|
[56] | 701 | namespace RasterAddress |
---|
| 702 | { |
---|
| 703 | /** Check whether 2 addresses point to the same column |
---|
| 704 | * \param addrA First address in raster scan order |
---|
| 705 | * \param addrB Second address in raters scan order |
---|
| 706 | * \param numUnitsPerRow Number of units in a row |
---|
| 707 | * \return Result of test |
---|
| 708 | */ |
---|
| 709 | static inline Bool isEqualCol( Int addrA, Int addrB, Int numUnitsPerRow ) |
---|
| 710 | { |
---|
| 711 | // addrA % numUnitsPerRow == addrB % numUnitsPerRow |
---|
| 712 | return (( addrA ^ addrB ) & ( numUnitsPerRow - 1 ) ) == 0; |
---|
| 713 | } |
---|
[1313] | 714 | |
---|
[56] | 715 | /** Check whether 2 addresses point to the same row |
---|
| 716 | * \param addrA First address in raster scan order |
---|
| 717 | * \param addrB Second address in raters scan order |
---|
| 718 | * \param numUnitsPerRow Number of units in a row |
---|
| 719 | * \return Result of test |
---|
| 720 | */ |
---|
| 721 | static inline Bool isEqualRow( Int addrA, Int addrB, Int numUnitsPerRow ) |
---|
| 722 | { |
---|
| 723 | // addrA / numUnitsPerRow == addrB / numUnitsPerRow |
---|
| 724 | return (( addrA ^ addrB ) &~ ( numUnitsPerRow - 1 ) ) == 0; |
---|
| 725 | } |
---|
[1313] | 726 | |
---|
[56] | 727 | /** Check whether 2 addresses point to the same row or column |
---|
| 728 | * \param addrA First address in raster scan order |
---|
| 729 | * \param addrB Second address in raters scan order |
---|
| 730 | * \param numUnitsPerRow Number of units in a row |
---|
| 731 | * \return Result of test |
---|
| 732 | */ |
---|
| 733 | static inline Bool isEqualRowOrCol( Int addrA, Int addrB, Int numUnitsPerRow ) |
---|
| 734 | { |
---|
| 735 | return isEqualCol( addrA, addrB, numUnitsPerRow ) | isEqualRow( addrA, addrB, numUnitsPerRow ); |
---|
| 736 | } |
---|
[1313] | 737 | |
---|
[56] | 738 | /** Check whether one address points to the first column |
---|
| 739 | * \param addr Address in raster scan order |
---|
| 740 | * \param numUnitsPerRow Number of units in a row |
---|
| 741 | * \return Result of test |
---|
| 742 | */ |
---|
| 743 | static inline Bool isZeroCol( Int addr, Int numUnitsPerRow ) |
---|
| 744 | { |
---|
| 745 | // addr % numUnitsPerRow == 0 |
---|
| 746 | return ( addr & ( numUnitsPerRow - 1 ) ) == 0; |
---|
| 747 | } |
---|
[1313] | 748 | |
---|
[56] | 749 | /** Check whether one address points to the first row |
---|
| 750 | * \param addr Address in raster scan order |
---|
| 751 | * \param numUnitsPerRow Number of units in a row |
---|
| 752 | * \return Result of test |
---|
| 753 | */ |
---|
| 754 | static inline Bool isZeroRow( Int addr, Int numUnitsPerRow ) |
---|
| 755 | { |
---|
| 756 | // addr / numUnitsPerRow == 0 |
---|
| 757 | return ( addr &~ ( numUnitsPerRow - 1 ) ) == 0; |
---|
| 758 | } |
---|
[1313] | 759 | |
---|
[56] | 760 | /** Check whether one address points to a column whose index is smaller than a given value |
---|
| 761 | * \param addr Address in raster scan order |
---|
| 762 | * \param val Given column index value |
---|
| 763 | * \param numUnitsPerRow Number of units in a row |
---|
| 764 | * \return Result of test |
---|
| 765 | */ |
---|
| 766 | static inline Bool lessThanCol( Int addr, Int val, Int numUnitsPerRow ) |
---|
| 767 | { |
---|
| 768 | // addr % numUnitsPerRow < val |
---|
| 769 | return ( addr & ( numUnitsPerRow - 1 ) ) < val; |
---|
| 770 | } |
---|
[1313] | 771 | |
---|
[56] | 772 | /** Check whether one address points to a row whose index is smaller than a given value |
---|
| 773 | * \param addr Address in raster scan order |
---|
| 774 | * \param val Given row index value |
---|
| 775 | * \param numUnitsPerRow Number of units in a row |
---|
| 776 | * \return Result of test |
---|
| 777 | */ |
---|
| 778 | static inline Bool lessThanRow( Int addr, Int val, Int numUnitsPerRow ) |
---|
| 779 | { |
---|
| 780 | // addr / numUnitsPerRow < val |
---|
| 781 | return addr < val * numUnitsPerRow; |
---|
| 782 | } |
---|
[1313] | 783 | } |
---|
[56] | 784 | |
---|
| 785 | //! \} |
---|
| 786 | |
---|
[2] | 787 | #endif |
---|