[313] | 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 |
---|
[1029] | 4 | * granted under this license. |
---|
[313] | 5 | * |
---|
[1550] | 6 | * Copyright (c) 2010-2016, ITU/ISO/IEC |
---|
[313] | 7 | * All rights reserved. |
---|
| 8 | * |
---|
| 9 | * Redistribution and use in source and binary forms, with or without |
---|
| 10 | * modification, are permitted provided that the following conditions are met: |
---|
| 11 | * |
---|
| 12 | * * Redistributions of source code must retain the above copyright notice, |
---|
| 13 | * this list of conditions and the following disclaimer. |
---|
| 14 | * * Redistributions in binary form must reproduce the above copyright notice, |
---|
| 15 | * this list of conditions and the following disclaimer in the documentation |
---|
| 16 | * and/or other materials provided with the distribution. |
---|
| 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may |
---|
| 18 | * be used to endorse or promote products derived from this software without |
---|
| 19 | * specific prior written permission. |
---|
| 20 | * |
---|
| 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
| 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
| 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
| 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS |
---|
| 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
| 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
| 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
| 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
| 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
| 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
---|
| 31 | * THE POSSIBILITY OF SUCH DAMAGE. |
---|
| 32 | */ |
---|
| 33 | |
---|
| 34 | /** \file TComDataCU.h |
---|
| 35 | \brief CU data structure (header) |
---|
| 36 | \todo not all entities are documented |
---|
| 37 | */ |
---|
| 38 | |
---|
[1029] | 39 | #ifndef __TCOMDATACU__ |
---|
| 40 | #define __TCOMDATACU__ |
---|
[313] | 41 | |
---|
[1262] | 42 | #include <algorithm> |
---|
| 43 | #include <vector> |
---|
[313] | 44 | |
---|
| 45 | // Include files |
---|
| 46 | #include "CommonDef.h" |
---|
| 47 | #include "TComMotionInfo.h" |
---|
| 48 | #include "TComSlice.h" |
---|
| 49 | #include "TComRdCost.h" |
---|
| 50 | #include "TComPattern.h" |
---|
| 51 | |
---|
| 52 | //! \ingroup TLibCommon |
---|
| 53 | //! \{ |
---|
| 54 | |
---|
[1029] | 55 | class TComTU; // forward declaration |
---|
| 56 | |
---|
| 57 | static const UInt NUM_MOST_PROBABLE_MODES=3; |
---|
| 58 | |
---|
[313] | 59 | // ==================================================================================================================== |
---|
| 60 | // Class definition |
---|
| 61 | // ==================================================================================================================== |
---|
| 62 | |
---|
| 63 | /// CU data structure class |
---|
| 64 | class TComDataCU |
---|
| 65 | { |
---|
| 66 | private: |
---|
[1029] | 67 | |
---|
[313] | 68 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 69 | // class pointers |
---|
| 70 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1029] | 71 | |
---|
[1465] | 72 | TComPic* m_pcPic; ///< picture class pointer |
---|
| 73 | TComSlice* m_pcSlice; ///< slice header pointer |
---|
[1029] | 74 | |
---|
[313] | 75 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 76 | // CU description |
---|
| 77 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1029] | 78 | |
---|
[1465] | 79 | UInt m_ctuRsAddr; ///< CTU (also known as LCU) address in a slice (Raster-scan address, as opposed to tile-scan/encoding order). |
---|
| 80 | UInt m_absZIdxInCtu; ///< absolute address in a CTU. It's Z scan order |
---|
| 81 | UInt m_uiCUPelX; ///< CU position in a pixel (X) |
---|
| 82 | UInt m_uiCUPelY; ///< CU position in a pixel (Y) |
---|
| 83 | UInt m_uiNumPartition; ///< total number of minimum partitions in a CU |
---|
| 84 | UChar* m_puhWidth; ///< array of widths |
---|
| 85 | UChar* m_puhHeight; ///< array of heights |
---|
| 86 | UChar* m_puhDepth; ///< array of depths |
---|
| 87 | Int m_unitSize; ///< size of a "minimum partition" |
---|
[1442] | 88 | |
---|
[313] | 89 | #if SVC_EXTENSION |
---|
[1418] | 90 | #if FAST_INTRA_SHVC |
---|
| 91 | UChar m_reducedSetIntraModes[NUM_INTRA_MODE-1]; |
---|
[313] | 92 | #endif |
---|
[1418] | 93 | #endif |
---|
[313] | 94 | |
---|
| 95 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 96 | // CU data |
---|
| 97 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1029] | 98 | |
---|
[1465] | 99 | Bool* m_skipFlag; ///< array of skip flags |
---|
| 100 | SChar* m_pePartSize; ///< array of partition sizes |
---|
| 101 | SChar* m_pePredMode; ///< array of prediction modes |
---|
| 102 | SChar* m_crossComponentPredictionAlpha[MAX_NUM_COMPONENT]; ///< array of cross-component prediction alpha values |
---|
| 103 | Bool* m_CUTransquantBypass; ///< array of cu_transquant_bypass flags |
---|
| 104 | SChar* m_phQP; ///< array of QP values |
---|
| 105 | 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 |
---|
| 106 | UInt m_codedChromaQpAdj; |
---|
| 107 | UChar* m_puhTrIdx; ///< array of transform indices |
---|
| 108 | UChar* m_puhTransformSkip[MAX_NUM_COMPONENT]; ///< array of transform skipping flags |
---|
| 109 | UChar* m_puhCbf[MAX_NUM_COMPONENT]; ///< array of coded block flags (CBF) |
---|
| 110 | TComCUMvField m_acCUMvField[NUM_REF_PIC_LIST_01]; ///< array of motion vectors. |
---|
| 111 | TCoeff* m_pcTrCoeff[MAX_NUM_COMPONENT]; ///< array of transform coefficient buffers (0->Y, 1->Cb, 2->Cr) |
---|
[313] | 112 | #if ADAPTIVE_QP_SELECTION |
---|
[1465] | 113 | TCoeff* m_pcArlCoeff[MAX_NUM_COMPONENT]; ///< ARL coefficient buffer (0->Y, 1->Cb, 2->Cr) |
---|
| 114 | Bool m_ArlCoeffIsAliasedAllocation; ///< ARL coefficient buffer is an alias of the global buffer and must not be free()'d |
---|
[313] | 115 | #endif |
---|
| 116 | |
---|
[1465] | 117 | Pel* m_pcIPCMSample[MAX_NUM_COMPONENT]; ///< PCM sample buffer (0->Y, 1->Cb, 2->Cr) |
---|
[1029] | 118 | |
---|
[313] | 119 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 120 | // neighbour access variables |
---|
| 121 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1029] | 122 | |
---|
[1465] | 123 | TComDataCU* m_pCtuAboveLeft; ///< pointer of above-left CTU. |
---|
| 124 | TComDataCU* m_pCtuAboveRight; ///< pointer of above-right CTU. |
---|
| 125 | TComDataCU* m_pCtuAbove; ///< pointer of above CTU. |
---|
| 126 | TComDataCU* m_pCtuLeft; ///< pointer of left CTU |
---|
| 127 | TComMvField m_cMvFieldA; ///< motion vector of position A |
---|
| 128 | TComMvField m_cMvFieldB; ///< motion vector of position B |
---|
| 129 | TComMvField m_cMvFieldC; ///< motion vector of position C |
---|
| 130 | TComMv m_cMvPred; ///< motion vector predictor |
---|
[1029] | 131 | |
---|
[313] | 132 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 133 | // coding tool information |
---|
| 134 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1029] | 135 | |
---|
[1465] | 136 | Bool* m_pbMergeFlag; ///< array of merge flags |
---|
| 137 | UChar* m_puhMergeIndex; ///< array of merge candidate indices |
---|
[313] | 138 | #if AMP_MRG |
---|
| 139 | Bool m_bIsMergeAMP; |
---|
| 140 | #endif |
---|
[1465] | 141 | UChar* m_puhIntraDir[MAX_NUM_CHANNEL_TYPE]; |
---|
| 142 | UChar* m_puhInterDir; ///< array of inter directions |
---|
[1442] | 143 | SChar* m_apiMVPIdx[NUM_REF_PIC_LIST_01]; ///< array of motion vector predictor candidates |
---|
| 144 | SChar* m_apiMVPNum[NUM_REF_PIC_LIST_01]; ///< array of number of possible motion vectors predictors |
---|
[1465] | 145 | Bool* m_pbIPCMFlag; ///< array of intra_pcm flags |
---|
[313] | 146 | |
---|
| 147 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 148 | // misc. variables |
---|
| 149 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1029] | 150 | |
---|
[1465] | 151 | Bool m_bDecSubCu; ///< indicates decoder-mode |
---|
| 152 | Double m_dTotalCost; ///< sum of partition RD costs |
---|
| 153 | Distortion m_uiTotalDistortion; ///< sum of partition distortion |
---|
| 154 | UInt m_uiTotalBits; ///< sum of partition bits |
---|
| 155 | UInt m_uiTotalBins; ///< sum of partition bins |
---|
[1442] | 156 | SChar m_codedQP; |
---|
[1029] | 157 | UChar* m_explicitRdpcmMode[MAX_NUM_COMPONENT]; ///< Stores the explicit RDPCM mode for all TUs belonging to this CU |
---|
| 158 | |
---|
[313] | 159 | protected: |
---|
[1029] | 160 | |
---|
[1465] | 161 | /// adds a single possible motion vector predictor candidate |
---|
| 162 | Bool xAddMVPCandUnscaled ( AMVPInfo &info, const RefPicList eRefPicList, const Int iRefIdx, const UInt uiPartUnitIdx, const MVP_DIR eDir ) const; |
---|
| 163 | Bool xAddMVPCandWithScaling ( AMVPInfo &info, const RefPicList eRefPicList, const Int iRefIdx, const UInt uiPartUnitIdx, const MVP_DIR eDir ) const; |
---|
[313] | 164 | |
---|
[1465] | 165 | Void deriveRightBottomIdx ( UInt uiPartIdx, UInt& ruiPartIdxRB ) const; |
---|
| 166 | Bool xGetColMVP ( const RefPicList eRefPicList, const Int ctuRsAddr, const Int partUnitIdx, TComMv& rcMv, const Int refIdx ) const; |
---|
[1029] | 167 | |
---|
[313] | 168 | /// compute scaling factor from POC difference |
---|
[1465] | 169 | static Int xGetDistScaleFactor ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC ); |
---|
[1029] | 170 | |
---|
[1465] | 171 | Void xDeriveCenterIdx ( UInt uiPartIdx, UInt& ruiPartIdxCenter ) const; |
---|
[313] | 172 | |
---|
[1600] | 173 | #if SVC_EXTENSION |
---|
| 174 | UInt xDeriveRightBottomIdxForILRP ( UInt partIdx, TComPic* refILP ) const; |
---|
| 175 | UInt xDeriveCenterIdxForILRP ( UInt partIdx, TComPic* refILP ) const; |
---|
| 176 | #endif |
---|
| 177 | |
---|
[313] | 178 | public: |
---|
[1465] | 179 | TComDataCU(); |
---|
| 180 | virtual ~TComDataCU(); |
---|
[1029] | 181 | |
---|
[313] | 182 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 183 | // create / destroy / initialize / copy |
---|
| 184 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1029] | 185 | |
---|
[1465] | 186 | Void create ( ChromaFormat chromaFormatIDC, UInt uiNumPartition, UInt uiWidth, UInt uiHeight, Bool bDecSubCu, Int unitSize |
---|
[313] | 187 | #if ADAPTIVE_QP_SELECTION |
---|
[1465] | 188 | , TCoeff *pParentARLBuffer = 0 |
---|
[1029] | 189 | #endif |
---|
[1465] | 190 | ); |
---|
| 191 | Void destroy ( ); |
---|
[1029] | 192 | |
---|
[1465] | 193 | Void initCtu ( TComPic* pcPic, UInt ctuRsAddr ); |
---|
| 194 | Void initEstData ( const UInt uiDepth, const Int qp, const Bool bTransquantBypass ); |
---|
| 195 | Void initSubCU ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, Int qp ); |
---|
| 196 | Void setOutsideCUPart ( UInt uiAbsPartIdx, UInt uiDepth ); |
---|
[313] | 197 | |
---|
[1465] | 198 | Void copySubCU ( TComDataCU* pcCU, UInt uiPartUnitIdx ); |
---|
| 199 | Void copyInterPredInfoFrom ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList ); |
---|
| 200 | Void copyPartFrom ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth ); |
---|
[1029] | 201 | |
---|
[1465] | 202 | Void copyToPic ( UChar uiDepth ); |
---|
[1246] | 203 | |
---|
[313] | 204 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 205 | // member functions for CU description |
---|
| 206 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1029] | 207 | |
---|
[1465] | 208 | TComPic* getPic ( ) { return m_pcPic; } |
---|
| 209 | const TComPic* getPic ( ) const { return m_pcPic; } |
---|
| 210 | TComSlice* getSlice ( ) { return m_pcSlice; } |
---|
| 211 | const TComSlice* getSlice ( ) const { return m_pcSlice; } |
---|
| 212 | UInt& getCtuRsAddr ( ) { return m_ctuRsAddr; } |
---|
| 213 | UInt getCtuRsAddr ( ) const { return m_ctuRsAddr; } |
---|
| 214 | UInt getZorderIdxInCtu ( ) const { return m_absZIdxInCtu; } |
---|
| 215 | UInt getCUPelX ( ) const { return m_uiCUPelX; } |
---|
| 216 | UInt getCUPelY ( ) const { return m_uiCUPelY; } |
---|
[1029] | 217 | |
---|
[1465] | 218 | UChar* getDepth ( ) { return m_puhDepth; } |
---|
| 219 | UChar getDepth ( UInt uiIdx ) const { return m_puhDepth[uiIdx]; } |
---|
| 220 | Void setDepth ( UInt uiIdx, UChar uh ) { m_puhDepth[uiIdx] = uh; } |
---|
[1029] | 221 | |
---|
[1465] | 222 | Void setDepthSubParts ( UInt uiDepth, UInt uiAbsPartIdx ); |
---|
[1029] | 223 | |
---|
[313] | 224 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 225 | // member functions for CU data |
---|
| 226 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1029] | 227 | |
---|
[1465] | 228 | SChar* getPartitionSize ( ) { return m_pePartSize; } |
---|
| 229 | PartSize getPartitionSize ( UInt uiIdx ) const { return static_cast<PartSize>( m_pePartSize[uiIdx] ); } |
---|
| 230 | Void setPartitionSize ( UInt uiIdx, PartSize uh ) { m_pePartSize[uiIdx] = uh; } |
---|
| 231 | Void setPartSizeSubParts ( PartSize eMode, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
| 232 | Void setCUTransquantBypassSubParts ( Bool flag, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
[313] | 233 | |
---|
[1465] | 234 | Bool* getSkipFlag ( ) { return m_skipFlag; } |
---|
| 235 | Bool getSkipFlag ( UInt idx ) const { return m_skipFlag[idx]; } |
---|
| 236 | Void setSkipFlag ( UInt idx, Bool skip ) { m_skipFlag[idx] = skip; } |
---|
| 237 | Void setSkipFlagSubParts ( Bool skip, UInt absPartIdx, UInt depth ); |
---|
[1029] | 238 | |
---|
[1465] | 239 | SChar* getPredictionMode ( ) { return m_pePredMode; } |
---|
| 240 | PredMode getPredictionMode ( UInt uiIdx ) const { return static_cast<PredMode>( m_pePredMode[uiIdx] ); } |
---|
| 241 | Void setPredictionMode ( UInt uiIdx, PredMode uh ) { m_pePredMode[uiIdx] = uh; } |
---|
| 242 | Void setPredModeSubParts ( PredMode eMode, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
[1029] | 243 | |
---|
[1465] | 244 | SChar* getCrossComponentPredictionAlpha( ComponentID compID ) { return m_crossComponentPredictionAlpha[compID]; } |
---|
| 245 | SChar getCrossComponentPredictionAlpha( UInt uiIdx, ComponentID compID ) { return m_crossComponentPredictionAlpha[compID][uiIdx]; } |
---|
[1029] | 246 | |
---|
[1465] | 247 | Bool* getCUTransquantBypass ( ) { return m_CUTransquantBypass; } |
---|
| 248 | Bool getCUTransquantBypass ( UInt uiIdx ) const { return m_CUTransquantBypass[uiIdx]; } |
---|
[1029] | 249 | |
---|
[1465] | 250 | UChar* getWidth ( ) { return m_puhWidth; } |
---|
| 251 | UChar getWidth ( UInt uiIdx ) const { return m_puhWidth[uiIdx]; } |
---|
| 252 | Void setWidth ( UInt uiIdx, UChar uh ) { m_puhWidth[uiIdx] = uh; } |
---|
[1029] | 253 | |
---|
[1465] | 254 | UChar* getHeight ( ) { return m_puhHeight; } |
---|
| 255 | UChar getHeight ( UInt uiIdx ) const { return m_puhHeight[uiIdx]; } |
---|
| 256 | Void setHeight ( UInt uiIdx, UChar uh ) { m_puhHeight[uiIdx] = uh; } |
---|
[1029] | 257 | |
---|
[1465] | 258 | Void setSizeSubParts ( UInt uiWidth, UInt uiHeight, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
[1029] | 259 | |
---|
[1465] | 260 | SChar* getQP ( ) { return m_phQP; } |
---|
| 261 | SChar getQP ( UInt uiIdx ) const { return m_phQP[uiIdx]; } |
---|
| 262 | Void setQP ( UInt uiIdx, SChar value ) { m_phQP[uiIdx] = value; } |
---|
| 263 | Void setQPSubParts ( Int qp, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
| 264 | Int getLastValidPartIdx ( Int iAbsPartIdx ) const; |
---|
| 265 | SChar getLastCodedQP ( UInt uiAbsPartIdx ) const; |
---|
| 266 | Void setQPSubCUs ( Int qp, UInt absPartIdx, UInt depth, Bool &foundNonZeroCbf ); |
---|
| 267 | Void setCodedQP ( SChar qp ) { m_codedQP = qp; } |
---|
| 268 | SChar getCodedQP ( ) const { return m_codedQP; } |
---|
[313] | 269 | |
---|
[1465] | 270 | 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 |
---|
| 271 | 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 |
---|
| 272 | 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 |
---|
| 273 | Void setChromaQpAdjSubParts ( UChar val, Int absPartIdx, Int depth ); |
---|
| 274 | Void setCodedChromaQpAdj ( SChar qp ) { m_codedChromaQpAdj = qp; } |
---|
| 275 | SChar getCodedChromaQpAdj ( ) const { return m_codedChromaQpAdj; } |
---|
[1029] | 276 | |
---|
[1465] | 277 | Bool isLosslessCoded ( UInt absPartIdx ) const; |
---|
[1029] | 278 | |
---|
[1465] | 279 | UChar* getTransformIdx ( ) { return m_puhTrIdx; } |
---|
| 280 | UChar getTransformIdx ( UInt uiIdx ) const { return m_puhTrIdx[uiIdx]; } |
---|
| 281 | Void setTrIdxSubParts ( UInt uiTrIdx, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
[313] | 282 | |
---|
[1465] | 283 | UChar* getTransformSkip ( ComponentID compID ) { return m_puhTransformSkip[compID]; } |
---|
| 284 | UChar getTransformSkip ( UInt uiIdx, ComponentID compID ) const { return m_puhTransformSkip[compID][uiIdx]; } |
---|
| 285 | Void setTransformSkipSubParts ( UInt useTransformSkip, ComponentID compID, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
| 286 | Void setTransformSkipSubParts ( const UInt useTransformSkip[MAX_NUM_COMPONENT], UInt uiAbsPartIdx, UInt uiDepth ); |
---|
[313] | 287 | |
---|
[1465] | 288 | UChar* getExplicitRdpcmMode ( ComponentID component ) { return m_explicitRdpcmMode[component]; } |
---|
| 289 | UChar getExplicitRdpcmMode ( ComponentID component, UInt partIdx ) const { return m_explicitRdpcmMode[component][partIdx]; } |
---|
[1029] | 290 | Void setExplicitRdpcmModePartRange ( UInt rdpcmMode, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes ); |
---|
| 291 | |
---|
[1465] | 292 | Bool isRDPCMEnabled ( UInt uiAbsPartIdx ) const { return getSlice()->getSPS()->getSpsRangeExtension().getRdpcmEnabledFlag(isIntra(uiAbsPartIdx) ? RDPCM_SIGNAL_IMPLICIT : RDPCM_SIGNAL_EXPLICIT); } |
---|
[1029] | 293 | |
---|
[1465] | 294 | Void setCrossComponentPredictionAlphaPartRange ( SChar alphaValue, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes ); |
---|
| 295 | Void setTransformSkipPartRange ( UInt useTransformSkip, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes ); |
---|
[1029] | 296 | |
---|
[1465] | 297 | UInt getQuadtreeTULog2MinSizeInCU ( UInt uiIdx ) const; |
---|
[1029] | 298 | |
---|
[1465] | 299 | TComCUMvField* getCUMvField ( RefPicList e ) { return &m_acCUMvField[e]; } |
---|
| 300 | const TComCUMvField* getCUMvField ( RefPicList e ) const { return &m_acCUMvField[e]; } |
---|
[1029] | 301 | |
---|
[1465] | 302 | TCoeff* getCoeff ( ComponentID component ) { return m_pcTrCoeff[component]; } |
---|
[1029] | 303 | |
---|
[313] | 304 | #if ADAPTIVE_QP_SELECTION |
---|
[1465] | 305 | TCoeff* getArlCoeff ( ComponentID component ) { return m_pcArlCoeff[component]; } |
---|
[313] | 306 | #endif |
---|
[1465] | 307 | Pel* getPCMSample ( ComponentID component ) { return m_pcIPCMSample[component]; } |
---|
[313] | 308 | |
---|
[1465] | 309 | UChar getCbf ( UInt uiIdx, ComponentID eType ) const { return m_puhCbf[eType][uiIdx]; } |
---|
| 310 | UChar* getCbf ( ComponentID eType ) { return m_puhCbf[eType]; } |
---|
| 311 | UChar getCbf ( UInt uiIdx, ComponentID eType, UInt uiTrDepth ) const { return ( ( getCbf( uiIdx, eType ) >> uiTrDepth ) & 0x1 ); } |
---|
| 312 | Void setCbf ( UInt uiIdx, ComponentID eType, UChar uh ) { m_puhCbf[eType][uiIdx] = uh; } |
---|
| 313 | Void clearCbf ( UInt uiIdx, ComponentID eType, UInt uiNumParts ); |
---|
| 314 | UChar getQtRootCbf ( UInt uiIdx ) const; |
---|
[1029] | 315 | |
---|
[1465] | 316 | Void setCbfSubParts ( const UInt uiCbf[MAX_NUM_COMPONENT], UInt uiAbsPartIdx, UInt uiDepth ); |
---|
| 317 | Void setCbfSubParts ( UInt uiCbf, ComponentID compID, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
| 318 | Void setCbfSubParts ( UInt uiCbf, ComponentID compID, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
[1029] | 319 | |
---|
[1465] | 320 | Void setCbfPartRange ( UInt uiCbf, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes ); |
---|
| 321 | Void bitwiseOrCbfPartRange ( UInt uiCbf, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes ); |
---|
[1029] | 322 | |
---|
[313] | 323 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 324 | // member functions for coding tool information |
---|
| 325 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1029] | 326 | |
---|
[1465] | 327 | Bool* getMergeFlag ( ) { return m_pbMergeFlag; } |
---|
| 328 | Bool getMergeFlag ( UInt uiIdx ) const { return m_pbMergeFlag[uiIdx]; } |
---|
| 329 | Void setMergeFlag ( UInt uiIdx, Bool b ) { m_pbMergeFlag[uiIdx] = b; } |
---|
| 330 | Void setMergeFlagSubParts ( Bool bMergeFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
[313] | 331 | |
---|
[1465] | 332 | UChar* getMergeIndex ( ) { return m_puhMergeIndex; } |
---|
| 333 | UChar getMergeIndex ( UInt uiIdx ) const { return m_puhMergeIndex[uiIdx]; } |
---|
| 334 | Void setMergeIndex ( UInt uiIdx, UInt uiMergeIndex ) { m_puhMergeIndex[uiIdx] = uiMergeIndex; } |
---|
| 335 | Void setMergeIndexSubParts ( UInt uiMergeIndex, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
[313] | 336 | template <typename T> |
---|
[1465] | 337 | Void setSubPart ( T bParameter, T* pbBaseCtu, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx ); |
---|
[313] | 338 | |
---|
| 339 | #if AMP_MRG |
---|
[1465] | 340 | Void setMergeAMP ( Bool b ) { m_bIsMergeAMP = b; } |
---|
| 341 | Bool getMergeAMP ( ) const { return m_bIsMergeAMP; } |
---|
[313] | 342 | #endif |
---|
| 343 | |
---|
[1465] | 344 | UChar* getIntraDir ( const ChannelType channelType ) const { return m_puhIntraDir[channelType]; } |
---|
| 345 | UChar getIntraDir ( const ChannelType channelType, const UInt uiIdx ) const { return m_puhIntraDir[channelType][uiIdx]; } |
---|
[1029] | 346 | |
---|
[1465] | 347 | Void setIntraDirSubParts ( const ChannelType channelType, |
---|
| 348 | const UInt uiDir, |
---|
| 349 | const UInt uiAbsPartIdx, |
---|
| 350 | const UInt uiDepth ); |
---|
[1029] | 351 | |
---|
[1465] | 352 | UChar* getInterDir ( ) { return m_puhInterDir; } |
---|
| 353 | UChar getInterDir ( UInt uiIdx ) const { return m_puhInterDir[uiIdx]; } |
---|
| 354 | Void setInterDir ( UInt uiIdx, UChar uh ) { m_puhInterDir[uiIdx] = uh; } |
---|
| 355 | Void setInterDirSubParts ( UInt uiDir, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
| 356 | Bool* getIPCMFlag ( ) { return m_pbIPCMFlag; } |
---|
| 357 | Bool getIPCMFlag ( UInt uiIdx ) const { return m_pbIPCMFlag[uiIdx]; } |
---|
| 358 | Void setIPCMFlag ( UInt uiIdx, Bool b ) { m_pbIPCMFlag[uiIdx] = b; } |
---|
| 359 | Void setIPCMFlagSubParts ( Bool bIpcmFlag, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
[313] | 360 | |
---|
| 361 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 362 | // member functions for accessing partition information |
---|
| 363 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1029] | 364 | |
---|
[1465] | 365 | 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 |
---|
| 366 | UChar getNumPartitions ( const UInt uiAbsPartIdx = 0 ) const; |
---|
| 367 | Bool isFirstAbsZorderIdxInDepth ( UInt uiAbsPartIdx, UInt uiDepth ) const; |
---|
[1029] | 368 | |
---|
[313] | 369 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 370 | // member functions for motion vector |
---|
| 371 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1029] | 372 | |
---|
[1465] | 373 | static Void getMvField ( const TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList, TComMvField& rcMvField ); |
---|
[1029] | 374 | |
---|
[1465] | 375 | Void fillMvpCand ( const UInt uiPartIdx, const UInt uiPartAddr, const RefPicList eRefPicList, const Int iRefIdx, AMVPInfo* pInfo ) const; |
---|
| 376 | Bool isDiffMER ( Int xN, Int yN, Int xP, Int yP ) const; |
---|
| 377 | Void getPartPosition ( UInt partIdx, Int& xP, Int& yP, Int& nPSW, Int& nPSH ) const; |
---|
[1029] | 378 | |
---|
[1465] | 379 | Void setMVPIdx ( RefPicList eRefPicList, UInt uiIdx, Int iMVPIdx) { m_apiMVPIdx[eRefPicList][uiIdx] = iMVPIdx; } |
---|
| 380 | Int getMVPIdx ( RefPicList eRefPicList, UInt uiIdx) const { return m_apiMVPIdx[eRefPicList][uiIdx]; } |
---|
| 381 | SChar* getMVPIdx ( RefPicList eRefPicList ) { return m_apiMVPIdx[eRefPicList]; } |
---|
[313] | 382 | |
---|
[1465] | 383 | Void setMVPNum ( RefPicList eRefPicList, UInt uiIdx, Int iMVPNum ) { m_apiMVPNum[eRefPicList][uiIdx] = iMVPNum; } |
---|
| 384 | Int getMVPNum ( RefPicList eRefPicList, UInt uiIdx ) const { return m_apiMVPNum[eRefPicList][uiIdx]; } |
---|
| 385 | SChar* getMVPNum ( RefPicList eRefPicList ) { return m_apiMVPNum[eRefPicList]; } |
---|
[1029] | 386 | |
---|
[1465] | 387 | Void setMVPIdxSubParts ( Int iMVPIdx, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
| 388 | Void setMVPNumSubParts ( Int iMVPNum, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
[1029] | 389 | |
---|
[1465] | 390 | Void clipMv ( TComMv& rcMv ) const; |
---|
| 391 | Void getMvPredLeft ( TComMv& rcMvPred ) const { rcMvPred = m_cMvFieldA.getMv(); } |
---|
| 392 | Void getMvPredAbove ( TComMv& rcMvPred ) const { rcMvPred = m_cMvFieldB.getMv(); } |
---|
| 393 | Void getMvPredAboveRight ( TComMv& rcMvPred ) const { rcMvPred = m_cMvFieldC.getMv(); } |
---|
[1029] | 394 | |
---|
[1465] | 395 | Void compressMV (); |
---|
[1029] | 396 | |
---|
[313] | 397 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 398 | // utility functions for neighbouring information |
---|
| 399 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1029] | 400 | |
---|
[1465] | 401 | TComDataCU* getCtuLeft ( ) { return m_pCtuLeft; } |
---|
| 402 | TComDataCU* getCtuAbove ( ) { return m_pCtuAbove; } |
---|
| 403 | TComDataCU* getCtuAboveLeft ( ) { return m_pCtuAboveLeft; } |
---|
| 404 | TComDataCU* getCtuAboveRight ( ) { return m_pCtuAboveRight; } |
---|
| 405 | Bool CUIsFromSameSlice ( const TComDataCU *pCU /* Can be NULL */ ) const { return ( pCU!=NULL && pCU->getSlice()->getSliceCurStartCtuTsAddr() == getSlice()->getSliceCurStartCtuTsAddr() ); } |
---|
| 406 | Bool CUIsFromSameTile ( const TComDataCU *pCU /* Can be NULL */ ) const; |
---|
| 407 | Bool CUIsFromSameSliceAndTile ( const TComDataCU *pCU /* Can be NULL */ ) const; |
---|
| 408 | Bool CUIsFromSameSliceTileAndWavefrontRow( const TComDataCU *pCU /* Can be NULL */ ) const; |
---|
| 409 | Bool isLastSubCUOfCtu ( const UInt absPartIdx ) const; |
---|
[313] | 410 | |
---|
| 411 | |
---|
[1465] | 412 | const TComDataCU* getPULeft ( UInt& uiLPartUnitIdx, |
---|
| 413 | UInt uiCurrPartUnitIdx, |
---|
| 414 | Bool bEnforceSliceRestriction=true, |
---|
| 415 | Bool bEnforceTileRestriction=true ) const; |
---|
[313] | 416 | |
---|
[1465] | 417 | const TComDataCU* getPUAbove ( UInt& uiAPartUnitIdx, |
---|
| 418 | UInt uiCurrPartUnitIdx, |
---|
| 419 | Bool bEnforceSliceRestriction=true, |
---|
| 420 | Bool planarAtCTUBoundary = false, |
---|
| 421 | Bool bEnforceTileRestriction=true ) const; |
---|
[313] | 422 | |
---|
[1465] | 423 | const TComDataCU* getPUAboveLeft ( UInt& uiALPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true ) const; |
---|
| 424 | |
---|
| 425 | const TComDataCU* getQpMinCuLeft ( UInt& uiLPartUnitIdx, UInt uiCurrAbsIdxInCtu ) const; |
---|
| 426 | const TComDataCU* getQpMinCuAbove ( UInt& uiAPartUnitIdx, UInt uiCurrAbsIdxInCtu ) const; |
---|
| 427 | |
---|
[1315] | 428 | /// 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) |
---|
[1465] | 429 | const TComDataCU* getPUAboveRight ( UInt& uiARPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true ) const; |
---|
[1315] | 430 | /// 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) |
---|
[1465] | 431 | const TComDataCU* getPUBelowLeft ( UInt& uiBLPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true ) const; |
---|
[1029] | 432 | |
---|
[1465] | 433 | SChar getRefQP ( UInt uiCurrAbsIdxInCtu ) const; |
---|
[1029] | 434 | |
---|
[1465] | 435 | Void deriveLeftRightTopIdx ( UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ) const; |
---|
| 436 | Void deriveLeftBottomIdx ( UInt uiPartIdx, UInt& ruiPartIdxLB ) const; |
---|
[1029] | 437 | |
---|
[1465] | 438 | Bool hasEqualMotion ( UInt uiAbsPartIdx, const TComDataCU* pcCandCU, UInt uiCandAbsPartIdx ) const; |
---|
| 439 | Void getInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx = -1 ) const; |
---|
[1029] | 440 | |
---|
[1465] | 441 | Void deriveLeftRightTopIdxGeneral ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ) const; |
---|
| 442 | Void deriveLeftBottomIdxGeneral ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLB ) const; |
---|
| 443 | |
---|
[313] | 444 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 445 | // member functions for modes |
---|
| 446 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1029] | 447 | |
---|
[1465] | 448 | Bool isIntra ( UInt uiPartIdx ) const { return m_pePredMode[ uiPartIdx ] == MODE_INTRA; } |
---|
| 449 | Bool isInter ( UInt uiPartIdx ) const { return m_pePredMode[ uiPartIdx ] == MODE_INTER; } |
---|
| 450 | Bool isSkipped ( UInt uiPartIdx ) const; ///< returns true, if the partiton is skipped |
---|
| 451 | Bool isBipredRestriction ( UInt puIdx ) const; |
---|
[313] | 452 | |
---|
| 453 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 454 | // member functions for symbol prediction (most probable / mode conversion) |
---|
| 455 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1029] | 456 | |
---|
[1465] | 457 | UInt getIntraSizeIdx ( UInt uiAbsPartIdx ) const; |
---|
[1029] | 458 | |
---|
[1465] | 459 | Void getAllowedChromaDir ( UInt uiAbsPartIdx, UInt* uiModeList ) const; |
---|
| 460 | Void getIntraDirPredictor ( UInt uiAbsPartIdx, Int uiIntraDirPred[NUM_MOST_PROBABLE_MODES], const ComponentID compID, Int* piMode = NULL ) const; |
---|
[1029] | 461 | |
---|
[313] | 462 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 463 | // member functions for SBAC context |
---|
| 464 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1029] | 465 | |
---|
[1465] | 466 | UInt getCtxSplitFlag ( UInt uiAbsPartIdx, UInt uiDepth ) const; |
---|
| 467 | UInt getCtxQtCbf ( TComTU &rTu, const ChannelType chType ) const; |
---|
[313] | 468 | |
---|
[1465] | 469 | UInt getCtxSkipFlag ( UInt uiAbsPartIdx ) const; |
---|
| 470 | UInt getCtxInterDir ( UInt uiAbsPartIdx ) const; |
---|
[313] | 471 | |
---|
[1465] | 472 | UInt& getTotalBins ( ) { return m_uiTotalBins; } |
---|
[1029] | 473 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 474 | // member functions for RD cost storage |
---|
| 475 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 476 | |
---|
[1465] | 477 | Double& getTotalCost ( ) { return m_dTotalCost; } |
---|
| 478 | Distortion& getTotalDistortion ( ) { return m_uiTotalDistortion; } |
---|
| 479 | UInt& getTotalBits ( ) { return m_uiTotalBits; } |
---|
| 480 | UInt& getTotalNumPart ( ) { return m_uiNumPartition; } |
---|
[1029] | 481 | |
---|
[1465] | 482 | UInt getCoefScanIdx ( const UInt uiAbsPartIdx, const UInt uiWidth, const UInt uiHeight, const ComponentID compID ) const ; |
---|
[1442] | 483 | |
---|
[442] | 484 | #if SVC_EXTENSION |
---|
[595] | 485 | #if N0383_IL_CONSTRAINED_TILE_SETS_SEI |
---|
[1465] | 486 | Bool isInterLayerReference ( UChar uhInterDir, TComMvField& cMvFieldL0, TComMvField& cMvFieldL1 ) const; |
---|
[595] | 487 | #endif |
---|
[313] | 488 | #if FAST_INTRA_SHVC |
---|
[1465] | 489 | Int reduceSetOfIntraModes ( UInt uiAbsPartIdx, Int* uiIntraDirPred, Int** posScalingFactor, Int &fullSetOfModes ); |
---|
[313] | 490 | #endif |
---|
| 491 | #if REF_IDX_ME_ZEROMV |
---|
[1534] | 492 | Bool checkZeroMVILRMerge ( UChar uhInterDir, TComMvField& cMvFieldL0, TComMvField& cMvFieldL1); |
---|
| 493 | Bool checkZeroMVILRMvdL1Zero ( Int iRefList, Int iRefIdx, Int MvpIdx); |
---|
[313] | 494 | #endif |
---|
[1465] | 495 | TComDataCU* getBaseColCU ( UInt refLayerIdc, UInt uiCuAbsPartIdx, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase, Int** posScalingFactor, Bool motionMapping = false ); |
---|
| 496 | TComDataCU* getBaseColCU ( UInt refLayerIdc, UInt pelX, UInt pelY, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase, Int** posScalingFactor, Bool motionMapping = false ); |
---|
| 497 | Void scaleBaseMV ( UInt refLayerIdc, TComMvField& rcMvFieldEnhance, TComMvField& rcMvFieldBase, Int** mvScalingFactor ); |
---|
[1418] | 498 | #if FAST_INTRA_SHVC |
---|
[1465] | 499 | UChar getReducedSetIntraModes ( UChar idx ) const { assert( idx < NUM_INTRA_MODE-1 ); return m_reducedSetIntraModes[idx]; } |
---|
[345] | 500 | #endif |
---|
[1418] | 501 | #endif |
---|
[313] | 502 | }; |
---|
| 503 | |
---|
| 504 | namespace RasterAddress |
---|
| 505 | { |
---|
| 506 | /** Check whether 2 addresses point to the same column |
---|
| 507 | * \param addrA First address in raster scan order |
---|
| 508 | * \param addrB Second address in raters scan order |
---|
| 509 | * \param numUnitsPerRow Number of units in a row |
---|
| 510 | * \return Result of test |
---|
| 511 | */ |
---|
| 512 | static inline Bool isEqualCol( Int addrA, Int addrB, Int numUnitsPerRow ) |
---|
| 513 | { |
---|
| 514 | // addrA % numUnitsPerRow == addrB % numUnitsPerRow |
---|
| 515 | return (( addrA ^ addrB ) & ( numUnitsPerRow - 1 ) ) == 0; |
---|
| 516 | } |
---|
[1029] | 517 | |
---|
[313] | 518 | /** Check whether 2 addresses point to the same row |
---|
| 519 | * \param addrA First address in raster scan order |
---|
| 520 | * \param addrB Second address in raters scan order |
---|
| 521 | * \param numUnitsPerRow Number of units in a row |
---|
| 522 | * \return Result of test |
---|
| 523 | */ |
---|
| 524 | static inline Bool isEqualRow( Int addrA, Int addrB, Int numUnitsPerRow ) |
---|
| 525 | { |
---|
| 526 | // addrA / numUnitsPerRow == addrB / numUnitsPerRow |
---|
| 527 | return (( addrA ^ addrB ) &~ ( numUnitsPerRow - 1 ) ) == 0; |
---|
| 528 | } |
---|
[1029] | 529 | |
---|
[313] | 530 | /** Check whether 2 addresses point to the same row or column |
---|
| 531 | * \param addrA First address in raster scan order |
---|
| 532 | * \param addrB Second address in raters scan order |
---|
| 533 | * \param numUnitsPerRow Number of units in a row |
---|
| 534 | * \return Result of test |
---|
| 535 | */ |
---|
| 536 | static inline Bool isEqualRowOrCol( Int addrA, Int addrB, Int numUnitsPerRow ) |
---|
| 537 | { |
---|
| 538 | return isEqualCol( addrA, addrB, numUnitsPerRow ) | isEqualRow( addrA, addrB, numUnitsPerRow ); |
---|
| 539 | } |
---|
[1029] | 540 | |
---|
[313] | 541 | /** Check whether one address points to the first column |
---|
| 542 | * \param addr Address in raster scan order |
---|
| 543 | * \param numUnitsPerRow Number of units in a row |
---|
| 544 | * \return Result of test |
---|
| 545 | */ |
---|
| 546 | static inline Bool isZeroCol( Int addr, Int numUnitsPerRow ) |
---|
| 547 | { |
---|
| 548 | // addr % numUnitsPerRow == 0 |
---|
| 549 | return ( addr & ( numUnitsPerRow - 1 ) ) == 0; |
---|
| 550 | } |
---|
[1029] | 551 | |
---|
[313] | 552 | /** Check whether one address points to the first row |
---|
| 553 | * \param addr Address in raster scan order |
---|
| 554 | * \param numUnitsPerRow Number of units in a row |
---|
| 555 | * \return Result of test |
---|
| 556 | */ |
---|
| 557 | static inline Bool isZeroRow( Int addr, Int numUnitsPerRow ) |
---|
| 558 | { |
---|
| 559 | // addr / numUnitsPerRow == 0 |
---|
| 560 | return ( addr &~ ( numUnitsPerRow - 1 ) ) == 0; |
---|
| 561 | } |
---|
[1029] | 562 | |
---|
[313] | 563 | /** Check whether one address points to a column whose index is smaller than a given value |
---|
| 564 | * \param addr Address in raster scan order |
---|
| 565 | * \param val Given column index value |
---|
| 566 | * \param numUnitsPerRow Number of units in a row |
---|
| 567 | * \return Result of test |
---|
| 568 | */ |
---|
| 569 | static inline Bool lessThanCol( Int addr, Int val, Int numUnitsPerRow ) |
---|
| 570 | { |
---|
| 571 | // addr % numUnitsPerRow < val |
---|
| 572 | return ( addr & ( numUnitsPerRow - 1 ) ) < val; |
---|
| 573 | } |
---|
[1029] | 574 | |
---|
[313] | 575 | /** Check whether one address points to a row whose index is smaller than a given value |
---|
| 576 | * \param addr Address in raster scan order |
---|
| 577 | * \param val Given row index value |
---|
| 578 | * \param numUnitsPerRow Number of units in a row |
---|
| 579 | * \return Result of test |
---|
| 580 | */ |
---|
| 581 | static inline Bool lessThanRow( Int addr, Int val, Int numUnitsPerRow ) |
---|
| 582 | { |
---|
| 583 | // addr / numUnitsPerRow < val |
---|
| 584 | return addr < val * numUnitsPerRow; |
---|
| 585 | } |
---|
[1029] | 586 | } |
---|
[313] | 587 | |
---|
| 588 | //! \} |
---|
| 589 | |
---|
| 590 | #endif |
---|