[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 | * |
---|
[1259] | 6 | * Copyright (c) 2010-2015, 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 | |
---|
[313] | 72 | TComPic* m_pcPic; ///< picture class pointer |
---|
| 73 | TComSlice* m_pcSlice; ///< slice header pointer |
---|
[1029] | 74 | |
---|
[313] | 75 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 76 | // CU description |
---|
| 77 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1029] | 78 | |
---|
| 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 |
---|
[313] | 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" |
---|
| 88 | |
---|
| 89 | #if SVC_EXTENSION |
---|
| 90 | UInt m_layerId; ///< layer id |
---|
[1418] | 91 | #if FAST_INTRA_SHVC |
---|
| 92 | UChar m_reducedSetIntraModes[NUM_INTRA_MODE-1]; |
---|
[313] | 93 | #endif |
---|
[1418] | 94 | #endif |
---|
[313] | 95 | |
---|
| 96 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 97 | // CU data |
---|
| 98 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1029] | 99 | |
---|
| 100 | Bool* m_skipFlag; ///< array of skip flags |
---|
| 101 | Char* m_pePartSize; ///< array of partition sizes |
---|
| 102 | Char* m_pePredMode; ///< array of prediction modes |
---|
| 103 | Char* m_crossComponentPredictionAlpha[MAX_NUM_COMPONENT]; ///< array of cross-component prediction alpha values |
---|
| 104 | Bool* m_CUTransquantBypass; ///< array of cu_transquant_bypass flags |
---|
| 105 | Char* m_phQP; ///< array of QP values |
---|
[1265] | 106 | 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 |
---|
[1029] | 107 | UInt m_codedChromaQpAdj; |
---|
| 108 | UChar* m_puhTrIdx; ///< array of transform indices |
---|
| 109 | UChar* m_puhTransformSkip[MAX_NUM_COMPONENT];///< array of transform skipping flags |
---|
| 110 | UChar* m_puhCbf[MAX_NUM_COMPONENT]; ///< array of coded block flags (CBF) |
---|
| 111 | TComCUMvField m_acCUMvField[NUM_REF_PIC_LIST_01]; ///< array of motion vectors. |
---|
| 112 | TCoeff* m_pcTrCoeff[MAX_NUM_COMPONENT]; ///< array of transform coefficient buffers (0->Y, 1->Cb, 2->Cr) |
---|
[313] | 113 | #if ADAPTIVE_QP_SELECTION |
---|
[1029] | 114 | TCoeff* m_pcArlCoeff[MAX_NUM_COMPONENT]; // ARL coefficient buffer (0->Y, 1->Cb, 2->Cr) |
---|
| 115 | Bool m_ArlCoeffIsAliasedAllocation; ///< ARL coefficient buffer is an alias of the global buffer and must not be free()'d |
---|
[313] | 116 | #endif |
---|
| 117 | |
---|
[1029] | 118 | Pel* m_pcIPCMSample[MAX_NUM_COMPONENT]; ///< PCM sample buffer (0->Y, 1->Cb, 2->Cr) |
---|
| 119 | |
---|
[313] | 120 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 121 | // neighbour access variables |
---|
| 122 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1029] | 123 | |
---|
| 124 | TComDataCU* m_pCtuAboveLeft; ///< pointer of above-left CTU. |
---|
| 125 | TComDataCU* m_pCtuAboveRight; ///< pointer of above-right CTU. |
---|
| 126 | TComDataCU* m_pCtuAbove; ///< pointer of above CTU. |
---|
| 127 | TComDataCU* m_pCtuLeft; ///< pointer of left CTU |
---|
| 128 | TComDataCU* m_apcCUColocated[NUM_REF_PIC_LIST_01]; ///< pointer of temporally colocated CU's for both directions |
---|
[313] | 129 | TComMvField m_cMvFieldA; ///< motion vector of position A |
---|
| 130 | TComMvField m_cMvFieldB; ///< motion vector of position B |
---|
| 131 | TComMvField m_cMvFieldC; ///< motion vector of position C |
---|
| 132 | TComMv m_cMvPred; ///< motion vector predictor |
---|
[1029] | 133 | |
---|
[313] | 134 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 135 | // coding tool information |
---|
| 136 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1029] | 137 | |
---|
[313] | 138 | Bool* m_pbMergeFlag; ///< array of merge flags |
---|
| 139 | UChar* m_puhMergeIndex; ///< array of merge candidate indices |
---|
| 140 | #if AMP_MRG |
---|
| 141 | Bool m_bIsMergeAMP; |
---|
| 142 | #endif |
---|
[1029] | 143 | UChar* m_puhIntraDir[MAX_NUM_CHANNEL_TYPE]; // 0-> Luma, 1-> Chroma |
---|
[313] | 144 | UChar* m_puhInterDir; ///< array of inter directions |
---|
[1029] | 145 | Char* m_apiMVPIdx[NUM_REF_PIC_LIST_01]; ///< array of motion vector predictor candidates |
---|
| 146 | Char* m_apiMVPNum[NUM_REF_PIC_LIST_01]; ///< array of number of possible motion vectors predictors |
---|
[313] | 147 | Bool* m_pbIPCMFlag; ///< array of intra_pcm flags |
---|
| 148 | |
---|
| 149 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 150 | // misc. variables |
---|
| 151 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1029] | 152 | |
---|
[313] | 153 | Bool m_bDecSubCu; ///< indicates decoder-mode |
---|
| 154 | Double m_dTotalCost; ///< sum of partition RD costs |
---|
[1029] | 155 | Distortion m_uiTotalDistortion; ///< sum of partition distortion |
---|
[313] | 156 | UInt m_uiTotalBits; ///< sum of partition bits |
---|
[1029] | 157 | UInt m_uiTotalBins; ///< sum of partition bins |
---|
[313] | 158 | Char m_codedQP; |
---|
[1029] | 159 | UChar* m_explicitRdpcmMode[MAX_NUM_COMPONENT]; ///< Stores the explicit RDPCM mode for all TUs belonging to this CU |
---|
| 160 | |
---|
[313] | 161 | protected: |
---|
[1029] | 162 | |
---|
[313] | 163 | /// add possible motion vector predictor candidates |
---|
| 164 | Bool xAddMVPCand ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir ); |
---|
| 165 | Bool xAddMVPCandOrder ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir ); |
---|
| 166 | |
---|
| 167 | Void deriveRightBottomIdx ( UInt uiPartIdx, UInt& ruiPartIdxRB ); |
---|
[1029] | 168 | Bool xGetColMVP( RefPicList eRefPicList, Int ctuRsAddr, Int uiPartUnitIdx, TComMv& rcMv, Int& riRefIdx ); |
---|
| 169 | |
---|
[313] | 170 | /// compute scaling factor from POC difference |
---|
| 171 | Int xGetDistScaleFactor ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC ); |
---|
[1029] | 172 | |
---|
[313] | 173 | Void xDeriveCenterIdx( UInt uiPartIdx, UInt& ruiPartIdxCenter ); |
---|
| 174 | |
---|
| 175 | public: |
---|
| 176 | TComDataCU(); |
---|
| 177 | virtual ~TComDataCU(); |
---|
[1029] | 178 | |
---|
[313] | 179 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 180 | // create / destroy / initialize / copy |
---|
| 181 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1029] | 182 | |
---|
| 183 | Void create ( ChromaFormat chromaFormatIDC, UInt uiNumPartition, UInt uiWidth, UInt uiHeight, Bool bDecSubCu, Int unitSize |
---|
[313] | 184 | #if ADAPTIVE_QP_SELECTION |
---|
[1296] | 185 | , TCoeff *pParentARLBuffer = 0 |
---|
[1029] | 186 | #endif |
---|
[313] | 187 | ); |
---|
| 188 | Void destroy (); |
---|
[1029] | 189 | |
---|
| 190 | Void initCtu ( TComPic* pcPic, UInt ctuRsAddr ); |
---|
| 191 | Void initEstData ( const UInt uiDepth, const Int qp, const Bool bTransquantBypass ); |
---|
[313] | 192 | Void initSubCU ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, Int qp ); |
---|
| 193 | Void setOutsideCUPart ( UInt uiAbsPartIdx, UInt uiDepth ); |
---|
| 194 | |
---|
[1307] | 195 | Void copySubCU ( TComDataCU* pcCU, UInt uiPartUnitIdx ); |
---|
[313] | 196 | Void copyInterPredInfoFrom ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList ); |
---|
| 197 | Void copyPartFrom ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth ); |
---|
[1029] | 198 | |
---|
[313] | 199 | Void copyToPic ( UChar uiDepth ); |
---|
[1246] | 200 | |
---|
[313] | 201 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 202 | // member functions for CU description |
---|
| 203 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1029] | 204 | |
---|
| 205 | TComPic* getPic () { return m_pcPic; } |
---|
| 206 | const TComPic* getPic () const { return m_pcPic; } |
---|
| 207 | TComSlice* getSlice () { return m_pcSlice; } |
---|
| 208 | const TComSlice* getSlice () const { return m_pcSlice; } |
---|
| 209 | UInt& getCtuRsAddr () { return m_ctuRsAddr; } |
---|
| 210 | UInt getCtuRsAddr () const { return m_ctuRsAddr; } |
---|
| 211 | UInt getZorderIdxInCtu () const { return m_absZIdxInCtu; } |
---|
| 212 | UInt getCUPelX () const { return m_uiCUPelX; } |
---|
| 213 | UInt getCUPelY () const { return m_uiCUPelY; } |
---|
| 214 | |
---|
[313] | 215 | UChar* getDepth () { return m_puhDepth; } |
---|
[1029] | 216 | UChar getDepth ( UInt uiIdx ) const { return m_puhDepth[uiIdx]; } |
---|
[313] | 217 | Void setDepth ( UInt uiIdx, UChar uh ) { m_puhDepth[uiIdx] = uh; } |
---|
[1029] | 218 | |
---|
[313] | 219 | Void setDepthSubParts ( UInt uiDepth, UInt uiAbsPartIdx ); |
---|
[1029] | 220 | |
---|
[313] | 221 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 222 | // member functions for CU data |
---|
| 223 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1029] | 224 | |
---|
[313] | 225 | Char* getPartitionSize () { return m_pePartSize; } |
---|
| 226 | PartSize getPartitionSize ( UInt uiIdx ) { return static_cast<PartSize>( m_pePartSize[uiIdx] ); } |
---|
| 227 | Void setPartitionSize ( UInt uiIdx, PartSize uh){ m_pePartSize[uiIdx] = uh; } |
---|
| 228 | Void setPartSizeSubParts ( PartSize eMode, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
| 229 | Void setCUTransquantBypassSubParts( Bool flag, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
| 230 | |
---|
[1029] | 231 | Bool* getSkipFlag () { return m_skipFlag; } |
---|
| 232 | Bool getSkipFlag (UInt idx) { return m_skipFlag[idx]; } |
---|
| 233 | Void setSkipFlag ( UInt idx, Bool skip) { m_skipFlag[idx] = skip; } |
---|
| 234 | Void setSkipFlagSubParts ( Bool skip, UInt absPartIdx, UInt depth ); |
---|
| 235 | |
---|
[313] | 236 | Char* getPredictionMode () { return m_pePredMode; } |
---|
| 237 | PredMode getPredictionMode ( UInt uiIdx ) { return static_cast<PredMode>( m_pePredMode[uiIdx] ); } |
---|
[1029] | 238 | Void setPredictionMode ( UInt uiIdx, PredMode uh){ m_pePredMode[uiIdx] = uh; } |
---|
| 239 | Void setPredModeSubParts ( PredMode eMode, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
| 240 | |
---|
| 241 | Char* getCrossComponentPredictionAlpha( ComponentID compID ) { return m_crossComponentPredictionAlpha[compID]; } |
---|
| 242 | Char getCrossComponentPredictionAlpha( UInt uiIdx, ComponentID compID ) { return m_crossComponentPredictionAlpha[compID][uiIdx]; } |
---|
| 243 | |
---|
[313] | 244 | Bool* getCUTransquantBypass () { return m_CUTransquantBypass; } |
---|
| 245 | Bool getCUTransquantBypass( UInt uiIdx ) { return m_CUTransquantBypass[uiIdx]; } |
---|
[1029] | 246 | |
---|
[313] | 247 | UChar* getWidth () { return m_puhWidth; } |
---|
| 248 | UChar getWidth ( UInt uiIdx ) { return m_puhWidth[uiIdx]; } |
---|
| 249 | Void setWidth ( UInt uiIdx, UChar uh ) { m_puhWidth[uiIdx] = uh; } |
---|
[1029] | 250 | |
---|
[313] | 251 | UChar* getHeight () { return m_puhHeight; } |
---|
| 252 | UChar getHeight ( UInt uiIdx ) { return m_puhHeight[uiIdx]; } |
---|
| 253 | Void setHeight ( UInt uiIdx, UChar uh ) { m_puhHeight[uiIdx] = uh; } |
---|
[1029] | 254 | |
---|
[313] | 255 | Void setSizeSubParts ( UInt uiWidth, UInt uiHeight, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
[1029] | 256 | |
---|
[313] | 257 | Char* getQP () { return m_phQP; } |
---|
[1029] | 258 | Char getQP ( UInt uiIdx ) const { return m_phQP[uiIdx]; } |
---|
[313] | 259 | Void setQP ( UInt uiIdx, Char value ){ m_phQP[uiIdx] = value; } |
---|
| 260 | Void setQPSubParts ( Int qp, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
| 261 | Int getLastValidPartIdx ( Int iAbsPartIdx ); |
---|
| 262 | Char getLastCodedQP ( UInt uiAbsPartIdx ); |
---|
[1029] | 263 | Void setQPSubCUs ( Int qp, UInt absPartIdx, UInt depth, Bool &foundNonZeroCbf ); |
---|
[313] | 264 | Void setCodedQP ( Char qp ) { m_codedQP = qp; } |
---|
| 265 | Char getCodedQP () { return m_codedQP; } |
---|
| 266 | |
---|
[1265] | 267 | 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 |
---|
| 268 | 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 |
---|
| 269 | 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 |
---|
[1029] | 270 | Void setChromaQpAdjSubParts( UChar val, Int absPartIdx, Int depth ); |
---|
| 271 | Void setCodedChromaQpAdj ( Char qp ) { m_codedChromaQpAdj = qp; } |
---|
| 272 | Char getCodedChromaQpAdj () { return m_codedChromaQpAdj; } |
---|
| 273 | |
---|
| 274 | Bool isLosslessCoded ( UInt absPartIdx ); |
---|
| 275 | |
---|
[313] | 276 | UChar* getTransformIdx () { return m_puhTrIdx; } |
---|
| 277 | UChar getTransformIdx ( UInt uiIdx ) { return m_puhTrIdx[uiIdx]; } |
---|
| 278 | Void setTrIdxSubParts ( UInt uiTrIdx, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
| 279 | |
---|
[1029] | 280 | UChar* getTransformSkip ( ComponentID compID ) { return m_puhTransformSkip[compID];} |
---|
| 281 | UChar getTransformSkip ( UInt uiIdx, ComponentID compID) { return m_puhTransformSkip[compID][uiIdx];} |
---|
| 282 | Void setTransformSkipSubParts ( UInt useTransformSkip, ComponentID compID, UInt uiAbsPartIdx, UInt uiDepth); |
---|
| 283 | Void setTransformSkipSubParts ( const UInt useTransformSkip[MAX_NUM_COMPONENT], UInt uiAbsPartIdx, UInt uiDepth ); |
---|
[313] | 284 | |
---|
[1029] | 285 | UChar* getExplicitRdpcmMode ( ComponentID component ) { return m_explicitRdpcmMode[component]; } |
---|
| 286 | UChar getExplicitRdpcmMode ( ComponentID component, UInt partIdx ) {return m_explicitRdpcmMode[component][partIdx]; } |
---|
| 287 | Void setExplicitRdpcmModePartRange ( UInt rdpcmMode, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes ); |
---|
| 288 | |
---|
[1316] | 289 | Bool isRDPCMEnabled ( UInt uiAbsPartIdx ) { return getSlice()->getSPS()->getSpsRangeExtension().getRdpcmEnabledFlag(isIntra(uiAbsPartIdx) ? RDPCM_SIGNAL_IMPLICIT : RDPCM_SIGNAL_EXPLICIT); } |
---|
[1029] | 290 | |
---|
| 291 | Void setCrossComponentPredictionAlphaPartRange ( Char alphaValue, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes ); |
---|
| 292 | Void setTransformSkipPartRange ( UInt useTransformSkip, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes ); |
---|
| 293 | |
---|
| 294 | UInt getQuadtreeTULog2MinSizeInCU( UInt uiIdx ); |
---|
| 295 | |
---|
[313] | 296 | TComCUMvField* getCUMvField ( RefPicList e ) { return &m_acCUMvField[e]; } |
---|
[1029] | 297 | |
---|
| 298 | TCoeff* getCoeff (ComponentID component) { return m_pcTrCoeff[component]; } |
---|
| 299 | |
---|
[313] | 300 | #if ADAPTIVE_QP_SELECTION |
---|
[1029] | 301 | TCoeff* getArlCoeff ( ComponentID component ) { return m_pcArlCoeff[component]; } |
---|
[313] | 302 | #endif |
---|
[1029] | 303 | Pel* getPCMSample ( ComponentID component ) { return m_pcIPCMSample[component]; } |
---|
[313] | 304 | |
---|
[1029] | 305 | UChar getCbf ( UInt uiIdx, ComponentID eType ) { return m_puhCbf[eType][uiIdx]; } |
---|
| 306 | UChar* getCbf ( ComponentID eType ) { return m_puhCbf[eType]; } |
---|
| 307 | UChar getCbf ( UInt uiIdx, ComponentID eType, UInt uiTrDepth ) { return ( ( getCbf( uiIdx, eType ) >> uiTrDepth ) & 0x1 ); } |
---|
| 308 | Void setCbf ( UInt uiIdx, ComponentID eType, UChar uh ) { m_puhCbf[eType][uiIdx] = uh; } |
---|
| 309 | Void clearCbf ( UInt uiIdx, ComponentID eType, UInt uiNumParts ); |
---|
| 310 | UChar getQtRootCbf ( UInt uiIdx ); |
---|
| 311 | |
---|
| 312 | Void setCbfSubParts ( const UInt uiCbf[MAX_NUM_COMPONENT], UInt uiAbsPartIdx, UInt uiDepth ); |
---|
| 313 | Void setCbfSubParts ( UInt uiCbf, ComponentID compID, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
| 314 | Void setCbfSubParts ( UInt uiCbf, ComponentID compID, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
| 315 | |
---|
| 316 | Void setCbfPartRange ( UInt uiCbf, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes ); |
---|
| 317 | Void bitwiseOrCbfPartRange ( UInt uiCbf, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes ); |
---|
| 318 | |
---|
[313] | 319 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 320 | // member functions for coding tool information |
---|
| 321 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1029] | 322 | |
---|
[313] | 323 | Bool* getMergeFlag () { return m_pbMergeFlag; } |
---|
| 324 | Bool getMergeFlag ( UInt uiIdx ) { return m_pbMergeFlag[uiIdx]; } |
---|
| 325 | Void setMergeFlag ( UInt uiIdx, Bool b ) { m_pbMergeFlag[uiIdx] = b; } |
---|
| 326 | Void setMergeFlagSubParts ( Bool bMergeFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
| 327 | |
---|
| 328 | UChar* getMergeIndex () { return m_puhMergeIndex; } |
---|
| 329 | UChar getMergeIndex ( UInt uiIdx ) { return m_puhMergeIndex[uiIdx]; } |
---|
| 330 | Void setMergeIndex ( UInt uiIdx, UInt uiMergeIndex ) { m_puhMergeIndex[uiIdx] = uiMergeIndex; } |
---|
| 331 | Void setMergeIndexSubParts ( UInt uiMergeIndex, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
| 332 | template <typename T> |
---|
[1029] | 333 | Void setSubPart ( T bParameter, T* pbBaseCtu, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx ); |
---|
[313] | 334 | |
---|
| 335 | #if AMP_MRG |
---|
| 336 | Void setMergeAMP( Bool b ) { m_bIsMergeAMP = b; } |
---|
| 337 | Bool getMergeAMP( ) { return m_bIsMergeAMP; } |
---|
| 338 | #endif |
---|
| 339 | |
---|
[1029] | 340 | UChar* getIntraDir ( const ChannelType channelType ) const { return m_puhIntraDir[channelType]; } |
---|
| 341 | UChar getIntraDir ( const ChannelType channelType, const UInt uiIdx ) const { return m_puhIntraDir[channelType][uiIdx]; } |
---|
| 342 | |
---|
| 343 | Void setIntraDirSubParts ( const ChannelType channelType, |
---|
| 344 | const UInt uiDir, |
---|
| 345 | const UInt uiAbsPartIdx, |
---|
| 346 | const UInt uiDepth ); |
---|
| 347 | |
---|
[313] | 348 | UChar* getInterDir () { return m_puhInterDir; } |
---|
| 349 | UChar getInterDir ( UInt uiIdx ) { return m_puhInterDir[uiIdx]; } |
---|
| 350 | Void setInterDir ( UInt uiIdx, UChar uh ) { m_puhInterDir[uiIdx] = uh; } |
---|
| 351 | Void setInterDirSubParts ( UInt uiDir, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
| 352 | Bool* getIPCMFlag () { return m_pbIPCMFlag; } |
---|
| 353 | Bool getIPCMFlag (UInt uiIdx ) { return m_pbIPCMFlag[uiIdx]; } |
---|
| 354 | Void setIPCMFlag (UInt uiIdx, Bool b ) { m_pbIPCMFlag[uiIdx] = b; } |
---|
| 355 | Void setIPCMFlagSubParts (Bool bIpcmFlag, UInt uiAbsPartIdx, UInt uiDepth); |
---|
| 356 | |
---|
| 357 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 358 | // member functions for accessing partition information |
---|
| 359 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1029] | 360 | |
---|
[1236] | 361 | Void getPartIndexAndSize ( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight ); // This is for use by a leaf/sub CU object only, with no additional AbsPartIdx |
---|
[1029] | 362 | UChar getNumPartitions ( const UInt uiAbsPartIdx = 0 ); |
---|
[313] | 363 | Bool isFirstAbsZorderIdxInDepth (UInt uiAbsPartIdx, UInt uiDepth); |
---|
[1029] | 364 | |
---|
[313] | 365 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 366 | // member functions for motion vector |
---|
| 367 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1029] | 368 | |
---|
[313] | 369 | Void getMvField ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList, TComMvField& rcMvField ); |
---|
[1029] | 370 | |
---|
[313] | 371 | Void fillMvpCand ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo ); |
---|
| 372 | Bool isDiffMER ( Int xN, Int yN, Int xP, Int yP); |
---|
| 373 | Void getPartPosition ( UInt partIdx, Int& xP, Int& yP, Int& nPSW, Int& nPSH); |
---|
[1029] | 374 | |
---|
[313] | 375 | Void setMVPIdx ( RefPicList eRefPicList, UInt uiIdx, Int iMVPIdx) { m_apiMVPIdx[eRefPicList][uiIdx] = iMVPIdx; } |
---|
| 376 | Int getMVPIdx ( RefPicList eRefPicList, UInt uiIdx) { return m_apiMVPIdx[eRefPicList][uiIdx]; } |
---|
| 377 | Char* getMVPIdx ( RefPicList eRefPicList ) { return m_apiMVPIdx[eRefPicList]; } |
---|
| 378 | |
---|
| 379 | Void setMVPNum ( RefPicList eRefPicList, UInt uiIdx, Int iMVPNum ) { m_apiMVPNum[eRefPicList][uiIdx] = iMVPNum; } |
---|
| 380 | Int getMVPNum ( RefPicList eRefPicList, UInt uiIdx ) { return m_apiMVPNum[eRefPicList][uiIdx]; } |
---|
| 381 | Char* getMVPNum ( RefPicList eRefPicList ) { return m_apiMVPNum[eRefPicList]; } |
---|
[1029] | 382 | |
---|
[313] | 383 | Void setMVPIdxSubParts ( Int iMVPIdx, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
| 384 | Void setMVPNumSubParts ( Int iMVPNum, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
[1029] | 385 | |
---|
[1395] | 386 | Void clipMv ( TComMv& rcMv ) const; |
---|
| 387 | Void getMvPredLeft ( TComMv& rcMvPred ) const { rcMvPred = m_cMvFieldA.getMv(); } |
---|
| 388 | Void getMvPredAbove ( TComMv& rcMvPred ) const { rcMvPred = m_cMvFieldB.getMv(); } |
---|
| 389 | Void getMvPredAboveRight ( TComMv& rcMvPred ) const { rcMvPred = m_cMvFieldC.getMv(); } |
---|
[1029] | 390 | |
---|
[313] | 391 | Void compressMV (); |
---|
[1029] | 392 | |
---|
[313] | 393 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 394 | // utility functions for neighbouring information |
---|
| 395 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1029] | 396 | |
---|
| 397 | TComDataCU* getCtuLeft () { return m_pCtuLeft; } |
---|
| 398 | TComDataCU* getCtuAbove () { return m_pCtuAbove; } |
---|
| 399 | TComDataCU* getCtuAboveLeft () { return m_pCtuAboveLeft; } |
---|
| 400 | TComDataCU* getCtuAboveRight () { return m_pCtuAboveRight; } |
---|
[313] | 401 | TComDataCU* getCUColocated ( RefPicList eRefPicList ) { return m_apcCUColocated[eRefPicList]; } |
---|
[1029] | 402 | Bool CUIsFromSameSlice ( const TComDataCU *pCU /* Can be NULL */) const { return ( pCU!=NULL && pCU->getSlice()->getSliceCurStartCtuTsAddr() == getSlice()->getSliceCurStartCtuTsAddr() ); } |
---|
| 403 | Bool CUIsFromSameTile ( const TComDataCU *pCU /* Can be NULL */) const; |
---|
| 404 | Bool CUIsFromSameSliceAndTile ( const TComDataCU *pCU /* Can be NULL */) const; |
---|
| 405 | Bool CUIsFromSameSliceTileAndWavefrontRow( const TComDataCU *pCU /* Can be NULL */) const; |
---|
| 406 | Bool isLastSubCUOfCtu(const UInt absPartIdx); |
---|
[313] | 407 | |
---|
| 408 | |
---|
[1029] | 409 | TComDataCU* getPULeft ( UInt& uiLPartUnitIdx, |
---|
| 410 | UInt uiCurrPartUnitIdx, |
---|
| 411 | Bool bEnforceSliceRestriction=true, |
---|
[313] | 412 | Bool bEnforceTileRestriction=true ); |
---|
| 413 | TComDataCU* getPUAbove ( UInt& uiAPartUnitIdx, |
---|
[1029] | 414 | UInt uiCurrPartUnitIdx, |
---|
| 415 | Bool bEnforceSliceRestriction=true, |
---|
| 416 | Bool planarAtCTUBoundary = false, |
---|
[313] | 417 | Bool bEnforceTileRestriction=true ); |
---|
| 418 | TComDataCU* getPUAboveLeft ( UInt& uiALPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true ); |
---|
| 419 | |
---|
[1029] | 420 | TComDataCU* getQpMinCuLeft ( UInt& uiLPartUnitIdx , UInt uiCurrAbsIdxInCtu ); |
---|
| 421 | TComDataCU* getQpMinCuAbove ( UInt& uiAPartUnitIdx , UInt uiCurrAbsIdxInCtu ); |
---|
| 422 | Char getRefQP ( UInt uiCurrAbsIdxInCtu ); |
---|
[313] | 423 | |
---|
[1315] | 424 | /// 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) |
---|
| 425 | TComDataCU* getPUAboveRight ( UInt& uiARPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true ); |
---|
| 426 | /// 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) |
---|
| 427 | TComDataCU* getPUBelowLeft ( UInt& uiBLPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true ); |
---|
[1029] | 428 | |
---|
[313] | 429 | Void deriveLeftRightTopIdx ( UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ); |
---|
| 430 | Void deriveLeftBottomIdx ( UInt uiPartIdx, UInt& ruiPartIdxLB ); |
---|
[1029] | 431 | |
---|
[313] | 432 | Bool hasEqualMotion ( UInt uiAbsPartIdx, TComDataCU* pcCandCU, UInt uiCandAbsPartIdx ); |
---|
| 433 | Void getInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx = -1 ); |
---|
[1029] | 434 | |
---|
[313] | 435 | Void deriveLeftRightTopIdxGeneral ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ); |
---|
| 436 | Void deriveLeftBottomIdxGeneral ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLB ); |
---|
[1029] | 437 | |
---|
[313] | 438 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 439 | // member functions for modes |
---|
| 440 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1029] | 441 | |
---|
| 442 | Bool isIntra ( UInt uiPartIdx ) const { return m_pePredMode[ uiPartIdx ] == MODE_INTRA; } |
---|
| 443 | Bool isInter ( UInt uiPartIdx ) const { return m_pePredMode[ uiPartIdx ] == MODE_INTER; } |
---|
[1258] | 444 | Bool isSkipped ( UInt uiPartIdx ); ///< returns true, if the partiton is skipped |
---|
[313] | 445 | Bool isBipredRestriction( UInt puIdx ); |
---|
| 446 | |
---|
| 447 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 448 | // member functions for symbol prediction (most probable / mode conversion) |
---|
| 449 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1029] | 450 | |
---|
[313] | 451 | UInt getIntraSizeIdx ( UInt uiAbsPartIdx ); |
---|
[1029] | 452 | |
---|
[313] | 453 | Void getAllowedChromaDir ( UInt uiAbsPartIdx, UInt* uiModeList ); |
---|
[1244] | 454 | Void getIntraDirPredictor ( UInt uiAbsPartIdx, Int uiIntraDirPred[NUM_MOST_PROBABLE_MODES], const ComponentID compID, Int* piMode = NULL ); |
---|
[1029] | 455 | |
---|
[313] | 456 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 457 | // member functions for SBAC context |
---|
| 458 | // ------------------------------------------------------------------------------------------------------------------- |
---|
[1029] | 459 | |
---|
[313] | 460 | UInt getCtxSplitFlag ( UInt uiAbsPartIdx, UInt uiDepth ); |
---|
[1029] | 461 | UInt getCtxQtCbf ( TComTU &rTu, const ChannelType chType ); |
---|
[313] | 462 | |
---|
| 463 | UInt getCtxSkipFlag ( UInt uiAbsPartIdx ); |
---|
| 464 | UInt getCtxInterDir ( UInt uiAbsPartIdx ); |
---|
| 465 | |
---|
[1029] | 466 | UInt& getTotalBins () { return m_uiTotalBins; } |
---|
| 467 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 468 | // member functions for RD cost storage |
---|
| 469 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 470 | |
---|
| 471 | Double& getTotalCost() { return m_dTotalCost; } |
---|
| 472 | Distortion& getTotalDistortion() { return m_uiTotalDistortion; } |
---|
| 473 | UInt& getTotalBits() { return m_uiTotalBits; } |
---|
| 474 | UInt& getTotalNumPart() { return m_uiNumPartition; } |
---|
| 475 | |
---|
| 476 | UInt getCoefScanIdx(const UInt uiAbsPartIdx, const UInt uiWidth, const UInt uiHeight, const ComponentID compID) const ; |
---|
| 477 | |
---|
[442] | 478 | #if SVC_EXTENSION |
---|
[1418] | 479 | Void setLayerId (UInt layerId) { m_layerId = layerId; } |
---|
| 480 | UInt getLayerId () { return m_layerId; } |
---|
| 481 | UInt getLayerIdx () { return m_pcSlice->getVPS()->getLayerIdxInVps(m_layerId); } |
---|
[595] | 482 | #if N0383_IL_CONSTRAINED_TILE_SETS_SEI |
---|
| 483 | Bool isInterLayerReference(UChar uhInterDir, TComMvField& cMvFieldL0, TComMvField& cMvFieldL1); |
---|
| 484 | #endif |
---|
[313] | 485 | #if FAST_INTRA_SHVC |
---|
[1421] | 486 | Int reduceSetOfIntraModes( UInt uiAbsPartIdx, Int* uiIntraDirPred, Int** posScalingFactor, Int &fullSetOfModes ); |
---|
[313] | 487 | #endif |
---|
| 488 | #if REF_IDX_ME_ZEROMV |
---|
[1029] | 489 | Bool xCheckZeroMVILRMerge(UChar uhInterDir, TComMvField& cMvFieldL0, TComMvField& cMvFieldL1); |
---|
| 490 | Bool xCheckZeroMVILRMvdL1Zero(Int iRefList, Int iRefIdx, Int MvpIdx); |
---|
[313] | 491 | #endif |
---|
[1419] | 492 | TComDataCU* getBaseColCU( UInt refLayerIdc, UInt uiCuAbsPartIdx, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase, Int** posScalingFactor, Bool motionMapping = false ); |
---|
| 493 | TComDataCU* getBaseColCU( UInt refLayerIdc, UInt pelX, UInt pelY, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase, Int** posScalingFactor, Bool motionMapping = false ); |
---|
| 494 | Void scaleBaseMV( UInt refLayerIdc, TComMvField& rcMvFieldEnhance, TComMvField& rcMvFieldBase, Int** mvScalingFactor ); |
---|
[1418] | 495 | #if FAST_INTRA_SHVC |
---|
| 496 | UChar getReducedSetIntraModes(UChar idx) { assert( idx < NUM_INTRA_MODE-1 ); return m_reducedSetIntraModes[idx]; } |
---|
[345] | 497 | #endif |
---|
[1418] | 498 | #endif |
---|
[313] | 499 | }; |
---|
| 500 | |
---|
| 501 | namespace RasterAddress |
---|
| 502 | { |
---|
| 503 | /** Check whether 2 addresses point to the same column |
---|
| 504 | * \param addrA First address in raster scan order |
---|
| 505 | * \param addrB Second address in raters scan order |
---|
| 506 | * \param numUnitsPerRow Number of units in a row |
---|
| 507 | * \return Result of test |
---|
| 508 | */ |
---|
| 509 | static inline Bool isEqualCol( Int addrA, Int addrB, Int numUnitsPerRow ) |
---|
| 510 | { |
---|
| 511 | // addrA % numUnitsPerRow == addrB % numUnitsPerRow |
---|
| 512 | return (( addrA ^ addrB ) & ( numUnitsPerRow - 1 ) ) == 0; |
---|
| 513 | } |
---|
[1029] | 514 | |
---|
[313] | 515 | /** Check whether 2 addresses point to the same row |
---|
| 516 | * \param addrA First address in raster scan order |
---|
| 517 | * \param addrB Second address in raters scan order |
---|
| 518 | * \param numUnitsPerRow Number of units in a row |
---|
| 519 | * \return Result of test |
---|
| 520 | */ |
---|
| 521 | static inline Bool isEqualRow( Int addrA, Int addrB, Int numUnitsPerRow ) |
---|
| 522 | { |
---|
| 523 | // addrA / numUnitsPerRow == addrB / numUnitsPerRow |
---|
| 524 | return (( addrA ^ addrB ) &~ ( numUnitsPerRow - 1 ) ) == 0; |
---|
| 525 | } |
---|
[1029] | 526 | |
---|
[313] | 527 | /** Check whether 2 addresses point to the same row or column |
---|
| 528 | * \param addrA First address in raster scan order |
---|
| 529 | * \param addrB Second address in raters scan order |
---|
| 530 | * \param numUnitsPerRow Number of units in a row |
---|
| 531 | * \return Result of test |
---|
| 532 | */ |
---|
| 533 | static inline Bool isEqualRowOrCol( Int addrA, Int addrB, Int numUnitsPerRow ) |
---|
| 534 | { |
---|
| 535 | return isEqualCol( addrA, addrB, numUnitsPerRow ) | isEqualRow( addrA, addrB, numUnitsPerRow ); |
---|
| 536 | } |
---|
[1029] | 537 | |
---|
[313] | 538 | /** Check whether one address points to the first column |
---|
| 539 | * \param addr Address in raster scan order |
---|
| 540 | * \param numUnitsPerRow Number of units in a row |
---|
| 541 | * \return Result of test |
---|
| 542 | */ |
---|
| 543 | static inline Bool isZeroCol( Int addr, Int numUnitsPerRow ) |
---|
| 544 | { |
---|
| 545 | // addr % numUnitsPerRow == 0 |
---|
| 546 | return ( addr & ( numUnitsPerRow - 1 ) ) == 0; |
---|
| 547 | } |
---|
[1029] | 548 | |
---|
[313] | 549 | /** Check whether one address points to the first row |
---|
| 550 | * \param addr Address in raster scan order |
---|
| 551 | * \param numUnitsPerRow Number of units in a row |
---|
| 552 | * \return Result of test |
---|
| 553 | */ |
---|
| 554 | static inline Bool isZeroRow( Int addr, Int numUnitsPerRow ) |
---|
| 555 | { |
---|
| 556 | // addr / numUnitsPerRow == 0 |
---|
| 557 | return ( addr &~ ( numUnitsPerRow - 1 ) ) == 0; |
---|
| 558 | } |
---|
[1029] | 559 | |
---|
[313] | 560 | /** Check whether one address points to a column whose index is smaller than a given value |
---|
| 561 | * \param addr Address in raster scan order |
---|
| 562 | * \param val Given column index value |
---|
| 563 | * \param numUnitsPerRow Number of units in a row |
---|
| 564 | * \return Result of test |
---|
| 565 | */ |
---|
| 566 | static inline Bool lessThanCol( Int addr, Int val, Int numUnitsPerRow ) |
---|
| 567 | { |
---|
| 568 | // addr % numUnitsPerRow < val |
---|
| 569 | return ( addr & ( numUnitsPerRow - 1 ) ) < val; |
---|
| 570 | } |
---|
[1029] | 571 | |
---|
[313] | 572 | /** Check whether one address points to a row whose index is smaller than a given value |
---|
| 573 | * \param addr Address in raster scan order |
---|
| 574 | * \param val Given row index value |
---|
| 575 | * \param numUnitsPerRow Number of units in a row |
---|
| 576 | * \return Result of test |
---|
| 577 | */ |
---|
| 578 | static inline Bool lessThanRow( Int addr, Int val, Int numUnitsPerRow ) |
---|
| 579 | { |
---|
| 580 | // addr / numUnitsPerRow < val |
---|
| 581 | return addr < val * numUnitsPerRow; |
---|
| 582 | } |
---|
[1029] | 583 | } |
---|
[313] | 584 | |
---|
| 585 | //! \} |
---|
| 586 | |
---|
| 587 | #endif |
---|