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