[5] | 1 | /* The copyright in this software is being made available under the BSD |
---|
| 2 | * License, included below. This software may be subject to other third party |
---|
| 3 | * and contributor rights, including patent rights, and no such rights are |
---|
[56] | 4 | * granted under this license. |
---|
[5] | 5 | * |
---|
[56] | 6 | * Copyright (c) 2010-2012, 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.cpp |
---|
| 35 | \brief CU data structure |
---|
| 36 | \todo not all entities are documented |
---|
| 37 | */ |
---|
| 38 | |
---|
| 39 | #include "TComDataCU.h" |
---|
| 40 | #include "TComPic.h" |
---|
| 41 | #include "TComDepthMapGenerator.h" |
---|
| 42 | #include "TComResidualGenerator.h" |
---|
| 43 | |
---|
[56] | 44 | //! \ingroup TLibCommon |
---|
| 45 | //! \{ |
---|
| 46 | |
---|
| 47 | #if ADAPTIVE_QP_SELECTION |
---|
| 48 | Int * TComDataCU::m_pcGlbArlCoeffY = NULL; |
---|
| 49 | Int * TComDataCU::m_pcGlbArlCoeffCb = NULL; |
---|
| 50 | Int * TComDataCU::m_pcGlbArlCoeffCr = NULL; |
---|
| 51 | #endif |
---|
| 52 | |
---|
[2] | 53 | // ==================================================================================================================== |
---|
| 54 | // Constructor / destructor / create / destroy |
---|
| 55 | // ==================================================================================================================== |
---|
| 56 | |
---|
| 57 | TComDataCU::TComDataCU() |
---|
| 58 | { |
---|
| 59 | m_pcPic = NULL; |
---|
| 60 | m_pcSlice = NULL; |
---|
| 61 | m_puhDepth = NULL; |
---|
[5] | 62 | #if HHI_MPI |
---|
[2] | 63 | m_piTextureModeDepth = NULL; |
---|
[5] | 64 | #endif |
---|
[2] | 65 | |
---|
| 66 | m_pePartSize = NULL; |
---|
[56] | 67 | #if HHI_INTERVIEW_SKIP |
---|
| 68 | m_pbRenderable = NULL; |
---|
| 69 | #endif |
---|
[2] | 70 | m_pePredMode = NULL; |
---|
| 71 | m_puiAlfCtrlFlag = NULL; |
---|
| 72 | m_puiTmpAlfCtrlFlag = NULL; |
---|
| 73 | m_puhWidth = NULL; |
---|
| 74 | m_puhHeight = NULL; |
---|
| 75 | m_phQP = NULL; |
---|
| 76 | m_pbMergeFlag = NULL; |
---|
| 77 | m_puhMergeIndex = NULL; |
---|
| 78 | m_puhLumaIntraDir = NULL; |
---|
| 79 | m_puhChromaIntraDir = NULL; |
---|
| 80 | m_puhInterDir = NULL; |
---|
| 81 | m_puhTrIdx = NULL; |
---|
[56] | 82 | #if NSQT_MOD2 |
---|
| 83 | m_nsqtPartIdx = NULL; |
---|
| 84 | #endif |
---|
[2] | 85 | m_puhCbf[0] = NULL; |
---|
| 86 | m_puhCbf[1] = NULL; |
---|
| 87 | m_puhCbf[2] = NULL; |
---|
| 88 | m_pcTrCoeffY = NULL; |
---|
| 89 | m_pcTrCoeffCb = NULL; |
---|
| 90 | m_pcTrCoeffCr = NULL; |
---|
[56] | 91 | #if ADAPTIVE_QP_SELECTION |
---|
| 92 | m_pcArlCoeffY = NULL; |
---|
| 93 | m_pcArlCoeffCb = NULL; |
---|
| 94 | m_pcArlCoeffCr = NULL; |
---|
| 95 | #endif |
---|
[2] | 96 | |
---|
[56] | 97 | m_pbIPCMFlag = NULL; |
---|
| 98 | m_pcIPCMSampleY = NULL; |
---|
| 99 | m_pcIPCMSampleCb = NULL; |
---|
| 100 | m_pcIPCMSampleCr = NULL; |
---|
| 101 | |
---|
[2] | 102 | m_pcPattern = NULL; |
---|
| 103 | |
---|
| 104 | m_pcCUAboveLeft = NULL; |
---|
| 105 | m_pcCUAboveRight = NULL; |
---|
| 106 | m_pcCUAbove = NULL; |
---|
| 107 | m_pcCULeft = NULL; |
---|
| 108 | |
---|
| 109 | m_apcCUColocated[0] = NULL; |
---|
| 110 | m_apcCUColocated[1] = NULL; |
---|
| 111 | |
---|
| 112 | m_apiMVPIdx[0] = NULL; |
---|
| 113 | m_apiMVPIdx[1] = NULL; |
---|
| 114 | m_apiMVPNum[0] = NULL; |
---|
| 115 | m_apiMVPNum[1] = NULL; |
---|
| 116 | |
---|
| 117 | m_bDecSubCu = false; |
---|
| 118 | m_uiSliceStartCU = 0; |
---|
| 119 | m_uiEntropySliceStartCU = 0; |
---|
| 120 | |
---|
[5] | 121 | #if HHI_DMM_WEDGE_INTRA |
---|
[56] | 122 | m_puiWedgeFullTabIdx = NULL; |
---|
| 123 | m_piWedgeFullDeltaDC1 = NULL; |
---|
| 124 | m_piWedgeFullDeltaDC2 = NULL; |
---|
[2] | 125 | |
---|
| 126 | m_puiWedgePredDirTabIdx = NULL; |
---|
| 127 | m_piWedgePredDirDeltaDC1 = NULL; |
---|
| 128 | m_piWedgePredDirDeltaDC2 = NULL; |
---|
| 129 | m_piWedgePredDirDeltaEnd = NULL; |
---|
[5] | 130 | #endif |
---|
| 131 | #if HHI_DMM_PRED_TEX |
---|
[56] | 132 | m_puiWedgePredTexTabIdx = NULL; |
---|
| 133 | m_piWedgePredTexDeltaDC1 = NULL; |
---|
| 134 | m_piWedgePredTexDeltaDC2 = NULL; |
---|
[2] | 135 | |
---|
[56] | 136 | m_piContourPredTexDeltaDC1 = NULL; |
---|
| 137 | m_piContourPredTexDeltaDC2 = NULL; |
---|
[2] | 138 | #endif |
---|
[56] | 139 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
| 140 | m_pbResPredAvailable = NULL; |
---|
| 141 | m_pbResPredFlag = NULL; |
---|
| 142 | #endif |
---|
[2] | 143 | } |
---|
| 144 | |
---|
| 145 | TComDataCU::~TComDataCU() |
---|
| 146 | { |
---|
| 147 | } |
---|
| 148 | |
---|
[56] | 149 | Void TComDataCU::create(UInt uiNumPartition, UInt uiWidth, UInt uiHeight, Bool bDecSubCu, Int unitSize |
---|
| 150 | #if ADAPTIVE_QP_SELECTION |
---|
| 151 | , Bool bGlobalRMARLBuffer |
---|
| 152 | #endif |
---|
| 153 | ) |
---|
[2] | 154 | { |
---|
| 155 | m_bDecSubCu = bDecSubCu; |
---|
| 156 | |
---|
| 157 | m_pcPic = NULL; |
---|
| 158 | m_pcSlice = NULL; |
---|
| 159 | m_uiNumPartition = uiNumPartition; |
---|
[56] | 160 | m_unitSize = unitSize; |
---|
[2] | 161 | |
---|
| 162 | if ( !bDecSubCu ) |
---|
| 163 | { |
---|
[56] | 164 | #if H0736_AVC_STYLE_QP_RANGE |
---|
| 165 | m_phQP = (Char* )xMalloc(Char, uiNumPartition); |
---|
| 166 | #else |
---|
[2] | 167 | m_phQP = (UChar* )xMalloc(UChar, uiNumPartition); |
---|
[56] | 168 | #endif |
---|
[2] | 169 | m_puhDepth = (UChar* )xMalloc(UChar, uiNumPartition); |
---|
[5] | 170 | #if HHI_MPI |
---|
[2] | 171 | m_piTextureModeDepth = (Int* )xMalloc(Int, uiNumPartition); |
---|
[5] | 172 | #endif |
---|
[2] | 173 | m_puhWidth = (UChar* )xMalloc(UChar, uiNumPartition); |
---|
| 174 | m_puhHeight = (UChar* )xMalloc(UChar, uiNumPartition); |
---|
[56] | 175 | m_pePartSize = new Char[ uiNumPartition ]; |
---|
| 176 | #if HHI_INTERVIEW_SKIP |
---|
| 177 | m_pbRenderable = (Bool* )xMalloc(Bool, uiNumPartition); |
---|
| 178 | #endif |
---|
| 179 | memset( m_pePartSize, SIZE_NONE,uiNumPartition * sizeof( *m_pePartSize ) ); |
---|
| 180 | m_pePredMode = new Char[ uiNumPartition ]; |
---|
[2] | 181 | |
---|
[56] | 182 | m_puiAlfCtrlFlag = new Bool[ uiNumPartition ]; |
---|
[2] | 183 | |
---|
| 184 | m_pbMergeFlag = (Bool* )xMalloc(Bool, uiNumPartition); |
---|
| 185 | m_puhMergeIndex = (UChar* )xMalloc(UChar, uiNumPartition); |
---|
[5] | 186 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
[2] | 187 | m_pbResPredAvailable = (Bool* )xMalloc(Bool, uiNumPartition); |
---|
| 188 | m_pbResPredFlag = (Bool* )xMalloc(Bool, uiNumPartition); |
---|
[5] | 189 | #endif |
---|
[2] | 190 | m_puhLumaIntraDir = (UChar* )xMalloc(UChar, uiNumPartition); |
---|
| 191 | m_puhChromaIntraDir = (UChar* )xMalloc(UChar, uiNumPartition); |
---|
| 192 | m_puhInterDir = (UChar* )xMalloc(UChar, uiNumPartition); |
---|
| 193 | |
---|
| 194 | m_puhTrIdx = (UChar* )xMalloc(UChar, uiNumPartition); |
---|
[56] | 195 | m_nsqtPartIdx = (UChar* )xMalloc(UChar, uiNumPartition); |
---|
[2] | 196 | |
---|
| 197 | m_puhCbf[0] = (UChar* )xMalloc(UChar, uiNumPartition); |
---|
| 198 | m_puhCbf[1] = (UChar* )xMalloc(UChar, uiNumPartition); |
---|
| 199 | m_puhCbf[2] = (UChar* )xMalloc(UChar, uiNumPartition); |
---|
| 200 | |
---|
[56] | 201 | m_apiMVPIdx[0] = new Char[ uiNumPartition ]; |
---|
| 202 | m_apiMVPIdx[1] = new Char[ uiNumPartition ]; |
---|
| 203 | m_apiMVPNum[0] = new Char[ uiNumPartition ]; |
---|
| 204 | m_apiMVPNum[1] = new Char[ uiNumPartition ]; |
---|
| 205 | memset( m_apiMVPIdx[0], -1,uiNumPartition * sizeof( Char ) ); |
---|
| 206 | memset( m_apiMVPIdx[1], -1,uiNumPartition * sizeof( Char ) ); |
---|
[2] | 207 | |
---|
| 208 | m_pcTrCoeffY = (TCoeff*)xMalloc(TCoeff, uiWidth*uiHeight); |
---|
| 209 | m_pcTrCoeffCb = (TCoeff*)xMalloc(TCoeff, uiWidth*uiHeight/4); |
---|
| 210 | m_pcTrCoeffCr = (TCoeff*)xMalloc(TCoeff, uiWidth*uiHeight/4); |
---|
[56] | 211 | memset( m_pcTrCoeffY, 0,uiWidth*uiHeight * sizeof( TCoeff ) ); |
---|
| 212 | memset( m_pcTrCoeffCb, 0,uiWidth*uiHeight/4 * sizeof( TCoeff ) ); |
---|
| 213 | memset( m_pcTrCoeffCr, 0,uiWidth*uiHeight/4 * sizeof( TCoeff ) ); |
---|
| 214 | #if ADAPTIVE_QP_SELECTION |
---|
| 215 | if( bGlobalRMARLBuffer ) |
---|
| 216 | { |
---|
| 217 | if( m_pcGlbArlCoeffY == NULL ) |
---|
| 218 | { |
---|
| 219 | m_pcGlbArlCoeffY = (Int*)xMalloc(Int, uiWidth*uiHeight); |
---|
| 220 | m_pcGlbArlCoeffCb = (Int*)xMalloc(Int, uiWidth*uiHeight/4); |
---|
| 221 | m_pcGlbArlCoeffCr = (Int*)xMalloc(Int, uiWidth*uiHeight/4); |
---|
| 222 | } |
---|
| 223 | m_pcArlCoeffY = m_pcGlbArlCoeffY; |
---|
| 224 | m_pcArlCoeffCb = m_pcGlbArlCoeffCb; |
---|
| 225 | m_pcArlCoeffCr = m_pcGlbArlCoeffCr; |
---|
| 226 | } |
---|
| 227 | else |
---|
| 228 | { |
---|
| 229 | m_pcArlCoeffY = (Int*)xMalloc(Int, uiWidth*uiHeight); |
---|
| 230 | m_pcArlCoeffCb = (Int*)xMalloc(Int, uiWidth*uiHeight/4); |
---|
| 231 | m_pcArlCoeffCr = (Int*)xMalloc(Int, uiWidth*uiHeight/4); |
---|
| 232 | } |
---|
| 233 | #endif |
---|
[2] | 234 | |
---|
[56] | 235 | m_pbIPCMFlag = (Bool* )xMalloc(Bool, uiNumPartition); |
---|
| 236 | m_pcIPCMSampleY = (Pel* )xMalloc(Pel , uiWidth*uiHeight); |
---|
| 237 | m_pcIPCMSampleCb = (Pel* )xMalloc(Pel , uiWidth*uiHeight/4); |
---|
| 238 | m_pcIPCMSampleCr = (Pel* )xMalloc(Pel , uiWidth*uiHeight/4); |
---|
| 239 | |
---|
[2] | 240 | m_acCUMvField[0].create( uiNumPartition ); |
---|
| 241 | m_acCUMvField[1].create( uiNumPartition ); |
---|
| 242 | |
---|
[5] | 243 | #if HHI_DMM_WEDGE_INTRA |
---|
| 244 | m_puiWedgeFullTabIdx = (UInt*)xMalloc(UInt, uiNumPartition); |
---|
[56] | 245 | m_piWedgeFullDeltaDC1 = (Int* )xMalloc(Int, uiNumPartition); |
---|
| 246 | m_piWedgeFullDeltaDC2 = (Int* )xMalloc(Int, uiNumPartition); |
---|
[2] | 247 | |
---|
| 248 | m_puiWedgePredDirTabIdx = (UInt*)xMalloc(UInt, uiNumPartition); |
---|
| 249 | m_piWedgePredDirDeltaDC1 = (Int* )xMalloc(Int, uiNumPartition); |
---|
| 250 | m_piWedgePredDirDeltaDC2 = (Int* )xMalloc(Int, uiNumPartition); |
---|
| 251 | m_piWedgePredDirDeltaEnd = (Int* )xMalloc(Int, uiNumPartition); |
---|
[5] | 252 | #endif |
---|
| 253 | #if HHI_DMM_PRED_TEX |
---|
[56] | 254 | m_puiWedgePredTexTabIdx = (UInt*)xMalloc(UInt, uiNumPartition); |
---|
| 255 | m_piWedgePredTexDeltaDC1 = (Int* )xMalloc(Int, uiNumPartition); |
---|
| 256 | m_piWedgePredTexDeltaDC2 = (Int* )xMalloc(Int, uiNumPartition); |
---|
[2] | 257 | |
---|
[56] | 258 | m_piContourPredTexDeltaDC1 = (Int* )xMalloc(Int, uiNumPartition); |
---|
| 259 | m_piContourPredTexDeltaDC2 = (Int* )xMalloc(Int, uiNumPartition); |
---|
[2] | 260 | #endif |
---|
| 261 | } |
---|
| 262 | else |
---|
| 263 | { |
---|
| 264 | m_acCUMvField[0].setNumPartition(uiNumPartition ); |
---|
| 265 | m_acCUMvField[1].setNumPartition(uiNumPartition ); |
---|
| 266 | } |
---|
| 267 | |
---|
[56] | 268 | m_uiSliceStartCU = (UInt* )xMalloc(UInt, uiNumPartition); |
---|
| 269 | m_uiEntropySliceStartCU = (UInt* )xMalloc(UInt, uiNumPartition); |
---|
| 270 | |
---|
[2] | 271 | // create pattern memory |
---|
| 272 | m_pcPattern = (TComPattern*)xMalloc(TComPattern, 1); |
---|
| 273 | |
---|
| 274 | // create motion vector fields |
---|
| 275 | |
---|
| 276 | m_pcCUAboveLeft = NULL; |
---|
| 277 | m_pcCUAboveRight = NULL; |
---|
| 278 | m_pcCUAbove = NULL; |
---|
| 279 | m_pcCULeft = NULL; |
---|
| 280 | |
---|
| 281 | m_apcCUColocated[0] = NULL; |
---|
| 282 | m_apcCUColocated[1] = NULL; |
---|
| 283 | } |
---|
| 284 | |
---|
| 285 | Void TComDataCU::destroy() |
---|
| 286 | { |
---|
| 287 | m_pcPic = NULL; |
---|
| 288 | m_pcSlice = NULL; |
---|
| 289 | |
---|
| 290 | if ( m_pcPattern ) |
---|
| 291 | { |
---|
| 292 | xFree(m_pcPattern); |
---|
| 293 | m_pcPattern = NULL; |
---|
| 294 | } |
---|
| 295 | |
---|
| 296 | // encoder-side buffer free |
---|
| 297 | if ( !m_bDecSubCu ) |
---|
| 298 | { |
---|
| 299 | if ( m_phQP ) { xFree(m_phQP); m_phQP = NULL; } |
---|
| 300 | if ( m_puhDepth ) { xFree(m_puhDepth); m_puhDepth = NULL; } |
---|
[5] | 301 | #if HHI_MPI |
---|
[2] | 302 | if ( m_piTextureModeDepth ) { xFree(m_piTextureModeDepth); m_piTextureModeDepth= NULL; } |
---|
[5] | 303 | #endif |
---|
[2] | 304 | if ( m_puhWidth ) { xFree(m_puhWidth); m_puhWidth = NULL; } |
---|
| 305 | if ( m_puhHeight ) { xFree(m_puhHeight); m_puhHeight = NULL; } |
---|
[56] | 306 | if ( m_pePartSize ) { delete[] m_pePartSize; m_pePartSize = NULL; } |
---|
| 307 | #if HHI_INTERVIEW_SKIP |
---|
| 308 | if ( m_pbRenderable ) { xFree(m_pbRenderable); m_pbRenderable = NULL; } |
---|
| 309 | #endif |
---|
| 310 | if ( m_pePredMode ) { delete[] m_pePredMode; m_pePredMode = NULL; } |
---|
[2] | 311 | if ( m_puhCbf[0] ) { xFree(m_puhCbf[0]); m_puhCbf[0] = NULL; } |
---|
| 312 | if ( m_puhCbf[1] ) { xFree(m_puhCbf[1]); m_puhCbf[1] = NULL; } |
---|
| 313 | if ( m_puhCbf[2] ) { xFree(m_puhCbf[2]); m_puhCbf[2] = NULL; } |
---|
[56] | 314 | if ( m_puiAlfCtrlFlag ) { delete[] m_puiAlfCtrlFlag; m_puiAlfCtrlFlag = NULL; } |
---|
[2] | 315 | if ( m_puhInterDir ) { xFree(m_puhInterDir); m_puhInterDir = NULL; } |
---|
| 316 | if ( m_pbMergeFlag ) { xFree(m_pbMergeFlag); m_pbMergeFlag = NULL; } |
---|
| 317 | if ( m_puhMergeIndex ) { xFree(m_puhMergeIndex); m_puhMergeIndex = NULL; } |
---|
[5] | 318 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
[2] | 319 | if ( m_pbResPredAvailable ) { xFree(m_pbResPredAvailable); m_pbResPredAvailable= NULL; } |
---|
| 320 | if ( m_pbResPredFlag ) { xFree(m_pbResPredFlag); m_pbResPredFlag = NULL; } |
---|
[5] | 321 | #endif |
---|
[2] | 322 | if ( m_puhLumaIntraDir ) { xFree(m_puhLumaIntraDir); m_puhLumaIntraDir = NULL; } |
---|
| 323 | if ( m_puhChromaIntraDir ) { xFree(m_puhChromaIntraDir); m_puhChromaIntraDir = NULL; } |
---|
| 324 | if ( m_puhTrIdx ) { xFree(m_puhTrIdx); m_puhTrIdx = NULL; } |
---|
[56] | 325 | if ( m_nsqtPartIdx ) { xFree(m_nsqtPartIdx); m_nsqtPartIdx = NULL; } |
---|
[2] | 326 | if ( m_pcTrCoeffY ) { xFree(m_pcTrCoeffY); m_pcTrCoeffY = NULL; } |
---|
| 327 | if ( m_pcTrCoeffCb ) { xFree(m_pcTrCoeffCb); m_pcTrCoeffCb = NULL; } |
---|
| 328 | if ( m_pcTrCoeffCr ) { xFree(m_pcTrCoeffCr); m_pcTrCoeffCr = NULL; } |
---|
[56] | 329 | #if ADAPTIVE_QP_SELECTION |
---|
| 330 | if ( m_pcGlbArlCoeffY ) { xFree(m_pcGlbArlCoeffY); m_pcGlbArlCoeffY = NULL; } |
---|
| 331 | if ( m_pcGlbArlCoeffCb ) { xFree(m_pcGlbArlCoeffCb); m_pcGlbArlCoeffCb = NULL; } |
---|
| 332 | if ( m_pcGlbArlCoeffCr ) { xFree(m_pcGlbArlCoeffCr); m_pcGlbArlCoeffCr = NULL; } |
---|
| 333 | #endif |
---|
| 334 | if ( m_pbIPCMFlag ) { xFree(m_pbIPCMFlag ); m_pbIPCMFlag = NULL; } |
---|
| 335 | if ( m_pcIPCMSampleY ) { xFree(m_pcIPCMSampleY); m_pcIPCMSampleY = NULL; } |
---|
| 336 | if ( m_pcIPCMSampleCb ) { xFree(m_pcIPCMSampleCb); m_pcIPCMSampleCb = NULL; } |
---|
| 337 | if ( m_pcIPCMSampleCr ) { xFree(m_pcIPCMSampleCr); m_pcIPCMSampleCr = NULL; } |
---|
| 338 | if ( m_apiMVPIdx[0] ) { delete[] m_apiMVPIdx[0]; m_apiMVPIdx[0] = NULL; } |
---|
| 339 | if ( m_apiMVPIdx[1] ) { delete[] m_apiMVPIdx[1]; m_apiMVPIdx[1] = NULL; } |
---|
| 340 | if ( m_apiMVPNum[0] ) { delete[] m_apiMVPNum[0]; m_apiMVPNum[0] = NULL; } |
---|
| 341 | if ( m_apiMVPNum[1] ) { delete[] m_apiMVPNum[1]; m_apiMVPNum[1] = NULL; } |
---|
[2] | 342 | |
---|
[5] | 343 | #if HHI_DMM_WEDGE_INTRA |
---|
[56] | 344 | if ( m_puiWedgeFullTabIdx ) { xFree(m_puiWedgeFullTabIdx ); m_puiWedgeFullTabIdx = NULL; } |
---|
| 345 | if ( m_piWedgeFullDeltaDC1 ) { xFree(m_piWedgeFullDeltaDC1 ); m_piWedgeFullDeltaDC1 = NULL; } |
---|
| 346 | if ( m_piWedgeFullDeltaDC2 ) { xFree(m_piWedgeFullDeltaDC2 ); m_piWedgeFullDeltaDC2 = NULL; } |
---|
[2] | 347 | |
---|
[56] | 348 | if ( m_puiWedgePredDirTabIdx ) { xFree(m_puiWedgePredDirTabIdx ); m_puiWedgePredDirTabIdx = NULL; } |
---|
| 349 | if ( m_piWedgePredDirDeltaEnd ) { xFree(m_piWedgePredDirDeltaEnd ); m_piWedgePredDirDeltaEnd = NULL; } |
---|
| 350 | if ( m_piWedgePredDirDeltaDC1 ) { xFree(m_piWedgePredDirDeltaDC1 ); m_piWedgePredDirDeltaDC1 = NULL; } |
---|
| 351 | if ( m_piWedgePredDirDeltaDC2 ) { xFree(m_piWedgePredDirDeltaDC2 ); m_piWedgePredDirDeltaDC2 = NULL; } |
---|
[5] | 352 | #endif |
---|
| 353 | #if HHI_DMM_PRED_TEX |
---|
[56] | 354 | if ( m_puiWedgePredTexTabIdx ) { xFree(m_puiWedgePredTexTabIdx ); m_puiWedgePredTexTabIdx = NULL; } |
---|
| 355 | if ( m_piWedgePredTexDeltaDC1 ) { xFree(m_piWedgePredTexDeltaDC1 ); m_piWedgePredTexDeltaDC1 = NULL; } |
---|
| 356 | if ( m_piWedgePredTexDeltaDC2 ) { xFree(m_piWedgePredTexDeltaDC2 ); m_piWedgePredTexDeltaDC2 = NULL; } |
---|
[2] | 357 | |
---|
[56] | 358 | if ( m_piContourPredTexDeltaDC1 ) { xFree(m_piContourPredTexDeltaDC1); m_piContourPredTexDeltaDC1 = NULL; } |
---|
| 359 | if ( m_piContourPredTexDeltaDC2 ) { xFree(m_piContourPredTexDeltaDC2); m_piContourPredTexDeltaDC2 = NULL; } |
---|
[2] | 360 | #endif |
---|
[56] | 361 | m_acCUMvField[0].destroy(); |
---|
| 362 | m_acCUMvField[1].destroy(); |
---|
| 363 | |
---|
[2] | 364 | } |
---|
| 365 | |
---|
| 366 | m_pcCUAboveLeft = NULL; |
---|
| 367 | m_pcCUAboveRight = NULL; |
---|
| 368 | m_pcCUAbove = NULL; |
---|
| 369 | m_pcCULeft = NULL; |
---|
| 370 | |
---|
| 371 | m_apcCUColocated[0] = NULL; |
---|
| 372 | m_apcCUColocated[1] = NULL; |
---|
[56] | 373 | |
---|
| 374 | if( m_uiSliceStartCU ) |
---|
| 375 | { |
---|
| 376 | xFree(m_uiSliceStartCU); |
---|
| 377 | m_uiSliceStartCU=NULL; |
---|
| 378 | } |
---|
| 379 | if(m_uiEntropySliceStartCU ) |
---|
| 380 | { |
---|
| 381 | xFree(m_uiEntropySliceStartCU); |
---|
| 382 | m_uiEntropySliceStartCU=NULL; |
---|
| 383 | } |
---|
[2] | 384 | } |
---|
| 385 | |
---|
[56] | 386 | const NDBFBlockInfo& NDBFBlockInfo::operator= (const NDBFBlockInfo& src) |
---|
| 387 | { |
---|
| 388 | this->tileID = src.tileID; |
---|
| 389 | this->sliceID= src.sliceID; |
---|
| 390 | this->startSU= src.startSU; |
---|
| 391 | this->endSU = src.endSU; |
---|
| 392 | this->widthSU= src.widthSU; |
---|
| 393 | this->heightSU=src.heightSU; |
---|
| 394 | this->posX = src.posX; |
---|
| 395 | this->posY = src.posY; |
---|
| 396 | this->width = src.width; |
---|
| 397 | this->height = src.height; |
---|
| 398 | ::memcpy(this->isBorderAvailable, src.isBorderAvailable, sizeof(Bool)*((Int)NUM_SGU_BORDER)); |
---|
| 399 | #if LCU_SYNTAX_ALF |
---|
| 400 | this->allBordersAvailable = src.allBordersAvailable; |
---|
| 401 | #endif |
---|
| 402 | |
---|
| 403 | return *this; |
---|
| 404 | } |
---|
| 405 | |
---|
| 406 | |
---|
[2] | 407 | // ==================================================================================================================== |
---|
| 408 | // Public member functions |
---|
| 409 | // ==================================================================================================================== |
---|
| 410 | |
---|
| 411 | // -------------------------------------------------------------------------------------------------------------------- |
---|
| 412 | // Initialization |
---|
| 413 | // -------------------------------------------------------------------------------------------------------------------- |
---|
| 414 | |
---|
| 415 | /** |
---|
| 416 | - initialize top-level CU |
---|
| 417 | - internal buffers are already created |
---|
| 418 | - set values before encoding a CU |
---|
| 419 | . |
---|
| 420 | \param pcPic picture (TComPic) class pointer |
---|
| 421 | \param iCUAddr CU address |
---|
| 422 | */ |
---|
| 423 | Void TComDataCU::initCU( TComPic* pcPic, UInt iCUAddr ) |
---|
| 424 | { |
---|
[56] | 425 | |
---|
[2] | 426 | m_pcPic = pcPic; |
---|
[56] | 427 | m_pcSlice = pcPic->getSlice(pcPic->getCurrSliceIdx()); |
---|
[2] | 428 | m_uiCUAddr = iCUAddr; |
---|
| 429 | m_uiCUPelX = ( iCUAddr % pcPic->getFrameWidthInCU() ) * g_uiMaxCUWidth; |
---|
| 430 | m_uiCUPelY = ( iCUAddr / pcPic->getFrameWidthInCU() ) * g_uiMaxCUHeight; |
---|
| 431 | m_uiAbsIdxInLCU = 0; |
---|
| 432 | m_dTotalCost = MAX_DOUBLE; |
---|
| 433 | m_uiTotalDistortion = 0; |
---|
| 434 | m_uiTotalBits = 0; |
---|
[56] | 435 | m_uiTotalBins = 0; |
---|
[2] | 436 | m_uiNumPartition = pcPic->getNumPartInCU(); |
---|
[56] | 437 | #if BURST_IPCM |
---|
| 438 | m_numSucIPCM = 0; |
---|
| 439 | m_lastCUSucIPCMFlag = false; |
---|
| 440 | #endif |
---|
[2] | 441 | |
---|
[56] | 442 | for(int i=0; i<pcPic->getNumPartInCU(); i++) |
---|
[2] | 443 | { |
---|
[56] | 444 | if(pcPic->getPicSym()->getInverseCUOrderMap(iCUAddr)*pcPic->getNumPartInCU()+i>=getSlice()->getSliceCurStartCUAddr()) |
---|
| 445 | { |
---|
| 446 | m_uiSliceStartCU[i]=getSlice()->getSliceCurStartCUAddr(); |
---|
| 447 | } |
---|
| 448 | else |
---|
| 449 | { |
---|
| 450 | m_uiSliceStartCU[i]=pcPic->getCU(getAddr())->m_uiSliceStartCU[i]; |
---|
| 451 | } |
---|
[2] | 452 | } |
---|
[56] | 453 | for(int i=0; i<pcPic->getNumPartInCU(); i++) |
---|
| 454 | { |
---|
| 455 | if(pcPic->getPicSym()->getInverseCUOrderMap(iCUAddr)*pcPic->getNumPartInCU()+i>=getSlice()->getEntropySliceCurStartCUAddr()) |
---|
| 456 | { |
---|
| 457 | m_uiEntropySliceStartCU[i]=getSlice()->getEntropySliceCurStartCUAddr(); |
---|
| 458 | } |
---|
| 459 | else |
---|
| 460 | { |
---|
| 461 | m_uiEntropySliceStartCU[i]=pcPic->getCU(getAddr())->m_uiEntropySliceStartCU[i]; |
---|
| 462 | } |
---|
| 463 | } |
---|
| 464 | |
---|
| 465 | Int partStartIdx = getSlice()->getEntropySliceCurStartCUAddr() - pcPic->getPicSym()->getInverseCUOrderMap(iCUAddr) * pcPic->getNumPartInCU(); |
---|
| 466 | |
---|
| 467 | Int numElements = min<Int>( partStartIdx, m_uiNumPartition ); |
---|
| 468 | for ( Int ui = 0; ui < numElements; ui++ ) |
---|
| 469 | { |
---|
| 470 | TComDataCU * pcFrom = pcPic->getCU(getAddr()); |
---|
| 471 | m_pePartSize[ui] = pcFrom->getPartitionSize(ui); |
---|
| 472 | m_pePredMode[ui] = pcFrom->getPredictionMode(ui); |
---|
| 473 | m_puhDepth[ui] = pcFrom->getDepth(ui); |
---|
[5] | 474 | #if HHI_MPI |
---|
[56] | 475 | m_piTextureModeDepth[ui] = pcFrom->getTextureModeDepth(ui); |
---|
[5] | 476 | #endif |
---|
[56] | 477 | m_puhWidth [ui] = pcFrom->getWidth(ui); |
---|
| 478 | m_puhHeight [ui] = pcFrom->getHeight(ui); |
---|
| 479 | m_puhTrIdx [ui] = pcFrom->getTransformIdx(ui); |
---|
| 480 | m_nsqtPartIdx[ui] = pcFrom->getNSQTPartIdx(ui); |
---|
| 481 | m_apiMVPIdx[0][ui] = pcFrom->m_apiMVPIdx[0][ui];; |
---|
| 482 | m_apiMVPIdx[1][ui] = pcFrom->m_apiMVPIdx[1][ui]; |
---|
| 483 | m_apiMVPNum[0][ui] = pcFrom->m_apiMVPNum[0][ui]; |
---|
| 484 | m_apiMVPNum[1][ui] = pcFrom->m_apiMVPNum[1][ui]; |
---|
| 485 | m_phQP[ui]=pcFrom->m_phQP[ui]; |
---|
| 486 | m_puiAlfCtrlFlag[ui]=pcFrom->m_puiAlfCtrlFlag[ui]; |
---|
| 487 | m_pbMergeFlag[ui]=pcFrom->m_pbMergeFlag[ui]; |
---|
| 488 | m_puhMergeIndex[ui]=pcFrom->m_puhMergeIndex[ui]; |
---|
| 489 | m_puhLumaIntraDir[ui]=pcFrom->m_puhLumaIntraDir[ui]; |
---|
| 490 | m_puhChromaIntraDir[ui]=pcFrom->m_puhChromaIntraDir[ui]; |
---|
| 491 | m_puhInterDir[ui]=pcFrom->m_puhInterDir[ui]; |
---|
| 492 | m_puhCbf[0][ui]=pcFrom->m_puhCbf[0][ui]; |
---|
| 493 | m_puhCbf[1][ui]=pcFrom->m_puhCbf[1][ui]; |
---|
| 494 | m_puhCbf[2][ui]=pcFrom->m_puhCbf[2][ui]; |
---|
| 495 | m_pbIPCMFlag[ui] = pcFrom->m_pbIPCMFlag[ui]; |
---|
| 496 | } |
---|
[2] | 497 | |
---|
[56] | 498 | Int firstElement = max<Int>( partStartIdx, 0 ); |
---|
| 499 | numElements = m_uiNumPartition - firstElement; |
---|
[2] | 500 | |
---|
[56] | 501 | if ( numElements > 0 ) |
---|
[2] | 502 | { |
---|
[56] | 503 | memset( m_pePartSize + firstElement, SIZE_NONE, numElements * sizeof( *m_pePartSize ) ); |
---|
| 504 | memset( m_pePredMode + firstElement, MODE_NONE, numElements * sizeof( *m_pePredMode ) ); |
---|
| 505 | memset( m_puhDepth + firstElement, 0, numElements * sizeof( *m_puhDepth ) ); |
---|
| 506 | #if HHI_MPI |
---|
| 507 | memset( m_piTextureModeDepth+ firstElement,-1, numElements * sizeof( *m_piTextureModeDepth ) ); |
---|
| 508 | #endif |
---|
| 509 | memset( m_puhTrIdx + firstElement, 0, numElements * sizeof( *m_puhTrIdx ) ); |
---|
| 510 | memset( m_nsqtPartIdx + firstElement, 0, numElements * sizeof( *m_nsqtPartIdx) ); |
---|
| 511 | memset( m_puhWidth + firstElement, g_uiMaxCUWidth, numElements * sizeof( *m_puhWidth ) ); |
---|
| 512 | memset( m_puhHeight + firstElement, g_uiMaxCUHeight, numElements * sizeof( *m_puhHeight ) ); |
---|
| 513 | memset( m_apiMVPIdx[0] + firstElement, -1, numElements * sizeof( *m_apiMVPIdx[0] ) ); |
---|
| 514 | memset( m_apiMVPIdx[1] + firstElement, -1, numElements * sizeof( *m_apiMVPIdx[1] ) ); |
---|
| 515 | memset( m_apiMVPNum[0] + firstElement, -1, numElements * sizeof( *m_apiMVPNum[0] ) ); |
---|
| 516 | memset( m_apiMVPNum[1] + firstElement, -1, numElements * sizeof( *m_apiMVPNum[1] ) ); |
---|
| 517 | memset( m_phQP + firstElement, getSlice()->getSliceQp(), numElements * sizeof( *m_phQP ) ); |
---|
| 518 | memset( m_puiAlfCtrlFlag + firstElement, false, numElements * sizeof( *m_puiAlfCtrlFlag ) ); |
---|
| 519 | memset( m_pbMergeFlag + firstElement, false, numElements * sizeof( *m_pbMergeFlag ) ); |
---|
| 520 | memset( m_puhMergeIndex + firstElement, 0, numElements * sizeof( *m_puhMergeIndex ) ); |
---|
| 521 | memset( m_puhLumaIntraDir + firstElement, 2, numElements * sizeof( *m_puhLumaIntraDir ) ); |
---|
| 522 | memset( m_puhChromaIntraDir + firstElement, 0, numElements * sizeof( *m_puhChromaIntraDir ) ); |
---|
| 523 | memset( m_puhInterDir + firstElement, 0, numElements * sizeof( *m_puhInterDir ) ); |
---|
| 524 | memset( m_puhCbf[0] + firstElement, 0, numElements * sizeof( *m_puhCbf[0] ) ); |
---|
| 525 | memset( m_puhCbf[1] + firstElement, 0, numElements * sizeof( *m_puhCbf[1] ) ); |
---|
| 526 | memset( m_puhCbf[2] + firstElement, 0, numElements * sizeof( *m_puhCbf[2] ) ); |
---|
| 527 | memset( m_pbIPCMFlag + firstElement, false, numElements * sizeof( *m_pbIPCMFlag ) ); |
---|
| 528 | |
---|
| 529 | #if HHI_DMM_WEDGE_INTRA |
---|
| 530 | memset( m_puiWedgeFullTabIdx + firstElement, 0, sizeof( UInt ) * numElements ); |
---|
| 531 | memset( m_piWedgeFullDeltaDC1 + firstElement, 0, sizeof( Int ) * numElements ); |
---|
| 532 | memset( m_piWedgeFullDeltaDC2 + firstElement, 0, sizeof( Int ) * numElements ); |
---|
| 533 | |
---|
| 534 | memset( m_puiWedgePredDirTabIdx + firstElement, 0, sizeof( UInt ) * numElements ); |
---|
| 535 | memset( m_piWedgePredDirDeltaDC1 + firstElement, 0, sizeof( Int ) * numElements ); |
---|
| 536 | memset( m_piWedgePredDirDeltaDC2 + firstElement, 0, sizeof( Int ) * numElements ); |
---|
| 537 | memset( m_piWedgePredDirDeltaEnd + firstElement, 0, sizeof( Int ) * numElements ); |
---|
| 538 | #endif |
---|
| 539 | #if HHI_DMM_PRED_TEX |
---|
| 540 | memset( m_puiWedgePredTexTabIdx + firstElement, 0, sizeof( UInt ) * numElements ); |
---|
| 541 | memset( m_piWedgePredTexDeltaDC1 + firstElement, 0, sizeof( Int ) * numElements ); |
---|
| 542 | memset( m_piWedgePredTexDeltaDC2 + firstElement, 0, sizeof( Int ) * numElements ); |
---|
| 543 | |
---|
| 544 | memset( m_piContourPredTexDeltaDC1 + firstElement, 0, sizeof( Int ) * numElements ); |
---|
| 545 | memset( m_piContourPredTexDeltaDC2 + firstElement, 0, sizeof( Int ) * numElements ); |
---|
| 546 | #endif |
---|
| 547 | #if HHI_INTERVIEW_SKIP |
---|
| 548 | memset (m_pbRenderable + firstElement, false, sizeof( Bool ) * numElements) ; |
---|
| 549 | #endif |
---|
| 550 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
| 551 | memset( m_pbResPredAvailable + firstElement, 0 , sizeof( Bool ) * numElements ); |
---|
| 552 | memset( m_pbResPredFlag + firstElement, 0 , sizeof( Bool ) * numElements ); |
---|
| 553 | #endif |
---|
[2] | 554 | } |
---|
| 555 | |
---|
[56] | 556 | UInt uiTmp = g_uiMaxCUWidth*g_uiMaxCUHeight; |
---|
| 557 | if ( 0 >= partStartIdx ) |
---|
| 558 | { |
---|
| 559 | m_acCUMvField[0].clearMvField(); |
---|
| 560 | m_acCUMvField[1].clearMvField(); |
---|
| 561 | memset( m_pcTrCoeffY , 0, sizeof( TCoeff ) * uiTmp ); |
---|
| 562 | #if ADAPTIVE_QP_SELECTION |
---|
| 563 | memset( m_pcArlCoeffY , 0, sizeof( Int ) * uiTmp ); |
---|
| 564 | #endif |
---|
| 565 | memset( m_pcIPCMSampleY , 0, sizeof( Pel ) * uiTmp ); |
---|
| 566 | uiTmp >>= 2; |
---|
| 567 | memset( m_pcTrCoeffCb, 0, sizeof( TCoeff ) * uiTmp ); |
---|
| 568 | memset( m_pcTrCoeffCr, 0, sizeof( TCoeff ) * uiTmp ); |
---|
| 569 | #if ADAPTIVE_QP_SELECTION |
---|
| 570 | memset( m_pcArlCoeffCb, 0, sizeof( Int ) * uiTmp ); |
---|
| 571 | memset( m_pcArlCoeffCr, 0, sizeof( Int ) * uiTmp ); |
---|
| 572 | #endif |
---|
| 573 | memset( m_pcIPCMSampleCb , 0, sizeof( Pel ) * uiTmp ); |
---|
| 574 | memset( m_pcIPCMSampleCr , 0, sizeof( Pel ) * uiTmp ); |
---|
| 575 | } |
---|
| 576 | else |
---|
| 577 | { |
---|
| 578 | TComDataCU * pcFrom = pcPic->getCU(getAddr()); |
---|
| 579 | m_acCUMvField[0].copyFrom(&pcFrom->m_acCUMvField[0],m_uiNumPartition,0); |
---|
| 580 | m_acCUMvField[1].copyFrom(&pcFrom->m_acCUMvField[1],m_uiNumPartition,0); |
---|
| 581 | for(int i=0; i<uiTmp; i++) |
---|
| 582 | { |
---|
| 583 | m_pcTrCoeffY[i]=pcFrom->m_pcTrCoeffY[i]; |
---|
| 584 | #if ADAPTIVE_QP_SELECTION |
---|
| 585 | m_pcArlCoeffY[i]=pcFrom->m_pcArlCoeffY[i]; |
---|
| 586 | #endif |
---|
| 587 | m_pcIPCMSampleY[i]=pcFrom->m_pcIPCMSampleY[i]; |
---|
| 588 | } |
---|
| 589 | for(int i=0; i<(uiTmp>>2); i++) |
---|
| 590 | { |
---|
| 591 | m_pcTrCoeffCb[i]=pcFrom->m_pcTrCoeffCb[i]; |
---|
| 592 | m_pcTrCoeffCr[i]=pcFrom->m_pcTrCoeffCr[i]; |
---|
| 593 | #if ADAPTIVE_QP_SELECTION |
---|
| 594 | m_pcArlCoeffCb[i]=pcFrom->m_pcArlCoeffCb[i]; |
---|
| 595 | m_pcArlCoeffCr[i]=pcFrom->m_pcArlCoeffCr[i]; |
---|
| 596 | #endif |
---|
| 597 | m_pcIPCMSampleCb[i]=pcFrom->m_pcIPCMSampleCb[i]; |
---|
| 598 | m_pcIPCMSampleCr[i]=pcFrom->m_pcIPCMSampleCr[i]; |
---|
| 599 | } |
---|
| 600 | } |
---|
| 601 | |
---|
| 602 | // Setting neighbor CU |
---|
[2] | 603 | m_pcCULeft = NULL; |
---|
| 604 | m_pcCUAbove = NULL; |
---|
| 605 | m_pcCUAboveLeft = NULL; |
---|
| 606 | m_pcCUAboveRight = NULL; |
---|
[56] | 607 | |
---|
[2] | 608 | m_apcCUColocated[0] = NULL; |
---|
| 609 | m_apcCUColocated[1] = NULL; |
---|
[56] | 610 | |
---|
[2] | 611 | UInt uiWidthInCU = pcPic->getFrameWidthInCU(); |
---|
| 612 | if ( m_uiCUAddr % uiWidthInCU ) |
---|
| 613 | { |
---|
| 614 | m_pcCULeft = pcPic->getCU( m_uiCUAddr - 1 ); |
---|
| 615 | } |
---|
[56] | 616 | |
---|
[2] | 617 | if ( m_uiCUAddr / uiWidthInCU ) |
---|
| 618 | { |
---|
| 619 | m_pcCUAbove = pcPic->getCU( m_uiCUAddr - uiWidthInCU ); |
---|
| 620 | } |
---|
[56] | 621 | |
---|
[2] | 622 | if ( m_pcCULeft && m_pcCUAbove ) |
---|
| 623 | { |
---|
| 624 | m_pcCUAboveLeft = pcPic->getCU( m_uiCUAddr - uiWidthInCU - 1 ); |
---|
| 625 | } |
---|
[56] | 626 | |
---|
[2] | 627 | if ( m_pcCUAbove && ( (m_uiCUAddr%uiWidthInCU) < (uiWidthInCU-1) ) ) |
---|
| 628 | { |
---|
| 629 | m_pcCUAboveRight = pcPic->getCU( m_uiCUAddr - uiWidthInCU + 1 ); |
---|
| 630 | } |
---|
[56] | 631 | |
---|
| 632 | if ( getSlice()->getNumRefIdx( REF_PIC_LIST_0 ) > 0 ) |
---|
[2] | 633 | { |
---|
[56] | 634 | m_apcCUColocated[0] = getSlice()->getRefPic( REF_PIC_LIST_0, 0)->getCU( m_uiCUAddr ); |
---|
[2] | 635 | } |
---|
| 636 | |
---|
[56] | 637 | if ( getSlice()->getNumRefIdx( REF_PIC_LIST_1 ) > 0 ) |
---|
[2] | 638 | { |
---|
[56] | 639 | m_apcCUColocated[1] = getSlice()->getRefPic( REF_PIC_LIST_1, 0)->getCU( m_uiCUAddr ); |
---|
[2] | 640 | } |
---|
[56] | 641 | } |
---|
[2] | 642 | |
---|
[56] | 643 | #if H0736_AVC_STYLE_QP_RANGE |
---|
| 644 | /** initialize prediction data with enabling sub-LCU-level delta QP |
---|
| 645 | *\param uiDepth depth of the current CU |
---|
| 646 | *\param qp qp for the current CU |
---|
| 647 | *- set CU width and CU height according to depth |
---|
| 648 | *- set qp value according to input qp |
---|
| 649 | *- set last-coded qp value according to input last-coded qp |
---|
| 650 | */ |
---|
| 651 | Void TComDataCU::initEstData( UInt uiDepth, Int qp ) |
---|
| 652 | #else |
---|
| 653 | /** initialize prediction data with enabling sub-LCU-level delta QP |
---|
| 654 | *\param uiDepth depth of the current CU |
---|
| 655 | *\param uiQP QP for the current CU |
---|
| 656 | *- set CU width and CU height according to depth |
---|
| 657 | *- set QP value according to input QP |
---|
| 658 | *- set last-coded QP value according to input last-coded QP |
---|
| 659 | */ |
---|
| 660 | Void TComDataCU::initEstData( UInt uiDepth, UInt uiQP ) |
---|
[5] | 661 | #endif |
---|
[2] | 662 | { |
---|
| 663 | m_dTotalCost = MAX_DOUBLE; |
---|
| 664 | m_uiTotalDistortion = 0; |
---|
| 665 | m_uiTotalBits = 0; |
---|
[56] | 666 | m_uiTotalBins = 0; |
---|
| 667 | |
---|
| 668 | UChar uhWidth = g_uiMaxCUWidth >> uiDepth; |
---|
| 669 | UChar uhHeight = g_uiMaxCUHeight >> uiDepth; |
---|
| 670 | |
---|
| 671 | for (UInt ui = 0; ui < m_uiNumPartition; ui++) |
---|
| 672 | { |
---|
| 673 | if(getPic()->getPicSym()->getInverseCUOrderMap(getAddr())*m_pcPic->getNumPartInCU()+m_uiAbsIdxInLCU+ui >= getSlice()->getEntropySliceCurStartCUAddr()) |
---|
| 674 | { |
---|
| 675 | #if HHI_INTERVIEW_SKIP |
---|
| 676 | m_pbRenderable[ui]= 0 ; |
---|
| 677 | #endif |
---|
| 678 | m_apiMVPIdx[0][ui] = -1; |
---|
| 679 | m_apiMVPIdx[1][ui] = -1; |
---|
| 680 | m_apiMVPNum[0][ui] = -1; |
---|
| 681 | m_apiMVPNum[1][ui] = -1; |
---|
| 682 | m_puhDepth [ui] = uiDepth; |
---|
| 683 | m_puhWidth [ui] = uhWidth; |
---|
| 684 | m_puhHeight [ui] = uhHeight; |
---|
| 685 | m_puhTrIdx [ui] = 0; |
---|
| 686 | #if HHI_MPI |
---|
| 687 | m_piTextureModeDepth[ui] = -1; |
---|
| 688 | #endif |
---|
| 689 | m_nsqtPartIdx[ui] = 0; |
---|
| 690 | m_pePartSize[ui] = SIZE_NONE; |
---|
| 691 | m_pePredMode[ui] = MODE_NONE; |
---|
| 692 | m_pbIPCMFlag[ui] = 0; |
---|
| 693 | #if H0736_AVC_STYLE_QP_RANGE |
---|
| 694 | m_phQP[ui] = qp; |
---|
| 695 | #else |
---|
| 696 | m_phQP[ui] = uiQP; |
---|
| 697 | #endif |
---|
| 698 | m_puiAlfCtrlFlag[ui]= false; |
---|
| 699 | m_pbMergeFlag[ui] = 0; |
---|
| 700 | m_puhMergeIndex[ui] = 0; |
---|
[5] | 701 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
[56] | 702 | m_pbResPredAvailable[ui] = 0; |
---|
| 703 | m_pbResPredFlag[ui] = 0; |
---|
[5] | 704 | #endif |
---|
[56] | 705 | m_puhLumaIntraDir[ui] = 2; |
---|
| 706 | m_puhChromaIntraDir[ui] = 0; |
---|
| 707 | m_puhInterDir[ui] = 0; |
---|
| 708 | m_puhCbf[0][ui] = 0; |
---|
| 709 | m_puhCbf[1][ui] = 0; |
---|
| 710 | m_puhCbf[2][ui] = 0; |
---|
[5] | 711 | #if HHI_DMM_WEDGE_INTRA |
---|
[56] | 712 | m_puiWedgeFullTabIdx [ui] = 0; |
---|
| 713 | m_piWedgeFullDeltaDC1 [ui] = 0; |
---|
| 714 | m_piWedgeFullDeltaDC2 [ui] = 0; |
---|
[2] | 715 | |
---|
[56] | 716 | m_puiWedgePredDirTabIdx [ui] = 0; |
---|
| 717 | m_piWedgePredDirDeltaDC1 [ui] = 0; |
---|
| 718 | m_piWedgePredDirDeltaDC2 [ui] = 0; |
---|
| 719 | m_piWedgePredDirDeltaEnd [ui] = 0; |
---|
[5] | 720 | #endif |
---|
| 721 | #if HHI_DMM_PRED_TEX |
---|
[56] | 722 | m_puiWedgePredTexTabIdx [ui] = 0; |
---|
| 723 | m_piWedgePredTexDeltaDC1 [ui] = 0; |
---|
| 724 | m_piWedgePredTexDeltaDC2 [ui] = 0; |
---|
[2] | 725 | |
---|
[56] | 726 | m_piContourPredTexDeltaDC1[ui] = 0; |
---|
| 727 | m_piContourPredTexDeltaDC2[ui] = 0; |
---|
| 728 | #endif |
---|
| 729 | } |
---|
| 730 | } |
---|
[2] | 731 | |
---|
[56] | 732 | UInt uiTmp = uhWidth*uhHeight; |
---|
| 733 | |
---|
| 734 | if(getPic()->getPicSym()->getInverseCUOrderMap(getAddr())*m_pcPic->getNumPartInCU()+m_uiAbsIdxInLCU >= getSlice()->getEntropySliceCurStartCUAddr()) |
---|
| 735 | { |
---|
| 736 | m_acCUMvField[0].clearMvField(); |
---|
| 737 | m_acCUMvField[1].clearMvField(); |
---|
| 738 | uiTmp = uhWidth*uhHeight; |
---|
| 739 | |
---|
| 740 | memset( m_pcTrCoeffY, 0, uiTmp * sizeof( *m_pcTrCoeffY ) ); |
---|
| 741 | #if ADAPTIVE_QP_SELECTION |
---|
| 742 | memset( m_pcArlCoeffY , 0, uiTmp * sizeof( *m_pcArlCoeffY ) ); |
---|
[5] | 743 | #endif |
---|
[56] | 744 | memset( m_pcIPCMSampleY, 0, uiTmp * sizeof( *m_pcIPCMSampleY ) ); |
---|
| 745 | |
---|
| 746 | uiTmp>>=2; |
---|
| 747 | memset( m_pcTrCoeffCb, 0, uiTmp * sizeof( *m_pcTrCoeffCb ) ); |
---|
| 748 | memset( m_pcTrCoeffCr, 0, uiTmp * sizeof( *m_pcTrCoeffCr ) ); |
---|
| 749 | #if ADAPTIVE_QP_SELECTION |
---|
| 750 | memset( m_pcArlCoeffCb, 0, uiTmp * sizeof( *m_pcArlCoeffCb ) ); |
---|
| 751 | memset( m_pcArlCoeffCr, 0, uiTmp * sizeof( *m_pcArlCoeffCr ) ); |
---|
| 752 | #endif |
---|
| 753 | memset( m_pcIPCMSampleCb, 0, uiTmp * sizeof( *m_pcIPCMSampleCb ) ); |
---|
| 754 | memset( m_pcIPCMSampleCr, 0, uiTmp * sizeof( *m_pcIPCMSampleCr ) ); |
---|
| 755 | } |
---|
[2] | 756 | } |
---|
| 757 | |
---|
[56] | 758 | |
---|
[2] | 759 | // initialize Sub partition |
---|
[56] | 760 | #if H0736_AVC_STYLE_QP_RANGE |
---|
| 761 | Void TComDataCU::initSubCU( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, Int qp ) |
---|
| 762 | #else |
---|
| 763 | Void TComDataCU::initSubCU( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, UInt uiQP ) |
---|
| 764 | #endif |
---|
[2] | 765 | { |
---|
| 766 | assert( uiPartUnitIdx<4 ); |
---|
[56] | 767 | |
---|
[2] | 768 | UInt uiPartOffset = ( pcCU->getTotalNumPart()>>2 )*uiPartUnitIdx; |
---|
[56] | 769 | |
---|
[2] | 770 | m_pcPic = pcCU->getPic(); |
---|
[56] | 771 | m_pcSlice = m_pcPic->getSlice(m_pcPic->getCurrSliceIdx()); |
---|
[2] | 772 | m_uiCUAddr = pcCU->getAddr(); |
---|
| 773 | m_uiAbsIdxInLCU = pcCU->getZorderIdxInCU() + uiPartOffset; |
---|
[56] | 774 | |
---|
| 775 | m_uiCUPelX = pcCU->getCUPelX() + ( g_uiMaxCUWidth>>uiDepth )*( uiPartUnitIdx & 1 ); |
---|
| 776 | m_uiCUPelY = pcCU->getCUPelY() + ( g_uiMaxCUHeight>>uiDepth )*( uiPartUnitIdx >> 1 ); |
---|
| 777 | |
---|
[2] | 778 | m_dTotalCost = MAX_DOUBLE; |
---|
| 779 | m_uiTotalDistortion = 0; |
---|
| 780 | m_uiTotalBits = 0; |
---|
[56] | 781 | m_uiTotalBins = 0; |
---|
[2] | 782 | m_uiNumPartition = pcCU->getTotalNumPart() >> 2; |
---|
[56] | 783 | |
---|
| 784 | #if BURST_IPCM |
---|
| 785 | m_numSucIPCM = 0; |
---|
| 786 | m_lastCUSucIPCMFlag = false; |
---|
| 787 | #endif |
---|
| 788 | |
---|
[2] | 789 | Int iSizeInUchar = sizeof( UChar ) * m_uiNumPartition; |
---|
| 790 | Int iSizeInBool = sizeof( Bool ) * m_uiNumPartition; |
---|
[56] | 791 | |
---|
| 792 | #if H0736_AVC_STYLE_QP_RANGE |
---|
| 793 | Int sizeInChar = sizeof( Char ) * m_uiNumPartition; |
---|
| 794 | memset( m_phQP, qp, sizeInChar ); |
---|
| 795 | #else |
---|
| 796 | memset( m_phQP, uiQP, iSizeInUchar ); |
---|
| 797 | #endif |
---|
| 798 | |
---|
| 799 | memset( m_puiAlfCtrlFlag, 0, iSizeInBool ); |
---|
[2] | 800 | memset( m_pbMergeFlag, 0, iSizeInBool ); |
---|
[56] | 801 | #if HHI_INTERVIEW_SKIP |
---|
| 802 | memset( m_pbRenderable, 0, iSizeInBool ); |
---|
| 803 | #endif |
---|
[2] | 804 | memset( m_puhMergeIndex, 0, iSizeInUchar ); |
---|
[5] | 805 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
[2] | 806 | memset( m_pbResPredAvailable, 0, iSizeInBool ); |
---|
| 807 | memset( m_pbResPredFlag, 0, iSizeInBool ); |
---|
[5] | 808 | #endif |
---|
[2] | 809 | memset( m_puhLumaIntraDir, 2, iSizeInUchar ); |
---|
| 810 | memset( m_puhChromaIntraDir, 0, iSizeInUchar ); |
---|
| 811 | memset( m_puhInterDir, 0, iSizeInUchar ); |
---|
| 812 | memset( m_puhTrIdx, 0, iSizeInUchar ); |
---|
| 813 | memset( m_puhCbf[0], 0, iSizeInUchar ); |
---|
| 814 | memset( m_puhCbf[1], 0, iSizeInUchar ); |
---|
| 815 | memset( m_puhCbf[2], 0, iSizeInUchar ); |
---|
| 816 | memset( m_puhDepth, uiDepth, iSizeInUchar ); |
---|
[5] | 817 | #if HHI_MPI |
---|
[56] | 818 | memset( m_piTextureModeDepth, -1, sizeof( Int ) * m_uiNumPartition ); |
---|
[5] | 819 | #endif |
---|
[56] | 820 | |
---|
| 821 | #if HHI_DMM_WEDGE_INTRA |
---|
| 822 | memset( m_puiWedgeFullTabIdx, 0, sizeof( UInt ) * m_uiNumPartition ); |
---|
| 823 | memset( m_piWedgeFullDeltaDC1, 0, sizeof( Int ) * m_uiNumPartition ); |
---|
| 824 | memset( m_piWedgeFullDeltaDC2, 0, sizeof( Int ) * m_uiNumPartition ); |
---|
| 825 | |
---|
| 826 | memset( m_puiWedgePredDirTabIdx, 0, sizeof( UInt ) * m_uiNumPartition ); |
---|
| 827 | memset( m_piWedgePredDirDeltaDC1, 0, sizeof( Int ) * m_uiNumPartition ); |
---|
| 828 | memset( m_piWedgePredDirDeltaDC2, 0, sizeof( Int ) * m_uiNumPartition ); |
---|
| 829 | memset( m_piWedgePredDirDeltaEnd, 0, sizeof( Int ) * m_uiNumPartition ); |
---|
| 830 | #endif |
---|
| 831 | #if HHI_DMM_PRED_TEX |
---|
| 832 | memset( m_puiWedgePredTexTabIdx, 0, sizeof( UInt ) * m_uiNumPartition ); |
---|
| 833 | memset( m_piWedgePredTexDeltaDC1, 0, sizeof( Int ) * m_uiNumPartition ); |
---|
| 834 | memset( m_piWedgePredTexDeltaDC2, 0, sizeof( Int ) * m_uiNumPartition ); |
---|
| 835 | |
---|
| 836 | memset( m_piContourPredTexDeltaDC1, 0, sizeof( Int ) * m_uiNumPartition ); |
---|
| 837 | memset( m_piContourPredTexDeltaDC2, 0, sizeof( Int ) * m_uiNumPartition ); |
---|
| 838 | #endif |
---|
| 839 | |
---|
[2] | 840 | UChar uhWidth = g_uiMaxCUWidth >> uiDepth; |
---|
| 841 | UChar uhHeight = g_uiMaxCUHeight >> uiDepth; |
---|
| 842 | memset( m_puhWidth, uhWidth, iSizeInUchar ); |
---|
| 843 | memset( m_puhHeight, uhHeight, iSizeInUchar ); |
---|
[56] | 844 | memset( m_pbIPCMFlag, 0, iSizeInBool ); |
---|
[2] | 845 | for (UInt ui = 0; ui < m_uiNumPartition; ui++) |
---|
| 846 | { |
---|
| 847 | m_pePartSize[ui] = SIZE_NONE; |
---|
| 848 | m_pePredMode[ui] = MODE_NONE; |
---|
[56] | 849 | #if HHI_INTERVIEW_SKIP |
---|
| 850 | m_pbRenderable[ui]= 0 ; |
---|
| 851 | #endif |
---|
[2] | 852 | m_apiMVPIdx[0][ui] = -1; |
---|
| 853 | m_apiMVPIdx[1][ui] = -1; |
---|
| 854 | m_apiMVPNum[0][ui] = -1; |
---|
| 855 | m_apiMVPNum[1][ui] = -1; |
---|
[56] | 856 | if(m_pcPic->getPicSym()->getInverseCUOrderMap(getAddr())*m_pcPic->getNumPartInCU()+m_uiAbsIdxInLCU+ui<getSlice()->getEntropySliceCurStartCUAddr()) |
---|
| 857 | { |
---|
| 858 | m_apiMVPIdx[0][ui] = pcCU->m_apiMVPIdx[0][uiPartOffset+ui]; |
---|
| 859 | m_apiMVPIdx[1][ui] = pcCU->m_apiMVPIdx[1][uiPartOffset+ui];; |
---|
| 860 | m_apiMVPNum[0][ui] = pcCU->m_apiMVPNum[0][uiPartOffset+ui];; |
---|
| 861 | m_apiMVPNum[1][ui] = pcCU->m_apiMVPNum[1][uiPartOffset+ui];; |
---|
| 862 | m_puhDepth [ui] = pcCU->getDepth(uiPartOffset+ui); |
---|
| 863 | #if HHI_MPI |
---|
| 864 | m_piTextureModeDepth[ui] = pcCU->getTextureModeDepth(uiPartOffset+ui); |
---|
| 865 | #endif |
---|
| 866 | m_puhWidth [ui] = pcCU->getWidth(uiPartOffset+ui); |
---|
| 867 | m_puhHeight [ui] = pcCU->getHeight(uiPartOffset+ui); |
---|
| 868 | m_puhTrIdx [ui] = pcCU->getTransformIdx(uiPartOffset+ui); |
---|
| 869 | m_nsqtPartIdx[ui] = pcCU->getNSQTPartIdx(uiPartOffset+ui); |
---|
| 870 | m_pePartSize[ui] = pcCU->getPartitionSize(uiPartOffset+ui); |
---|
| 871 | m_pePredMode[ui] = pcCU->getPredictionMode(uiPartOffset+ui); |
---|
| 872 | m_pbIPCMFlag[ui]=pcCU->m_pbIPCMFlag[uiPartOffset+ui]; |
---|
| 873 | m_phQP[ui] = pcCU->m_phQP[uiPartOffset+ui]; |
---|
| 874 | m_puiAlfCtrlFlag[ui]=pcCU->m_puiAlfCtrlFlag[uiPartOffset+ui]; |
---|
| 875 | m_pbMergeFlag[ui]=pcCU->m_pbMergeFlag[uiPartOffset+ui]; |
---|
| 876 | m_puhMergeIndex[ui]=pcCU->m_puhMergeIndex[uiPartOffset+ui]; |
---|
| 877 | m_puhLumaIntraDir[ui]=pcCU->m_puhLumaIntraDir[uiPartOffset+ui]; |
---|
| 878 | m_puhChromaIntraDir[ui]=pcCU->m_puhChromaIntraDir[uiPartOffset+ui]; |
---|
| 879 | m_puhInterDir[ui]=pcCU->m_puhInterDir[uiPartOffset+ui]; |
---|
| 880 | m_puhCbf[0][ui]=pcCU->m_puhCbf[0][uiPartOffset+ui]; |
---|
| 881 | m_puhCbf[1][ui]=pcCU->m_puhCbf[1][uiPartOffset+ui]; |
---|
| 882 | m_puhCbf[2][ui]=pcCU->m_puhCbf[2][uiPartOffset+ui]; |
---|
| 883 | |
---|
| 884 | #if HHI_DMM_WEDGE_INTRA |
---|
| 885 | m_puiWedgeFullTabIdx [ui]=pcCU->getWedgeFullTabIdx (uiPartOffset+ui); |
---|
| 886 | m_piWedgeFullDeltaDC1 [ui]=pcCU->getWedgeFullDeltaDC1 (uiPartOffset+ui); |
---|
| 887 | m_piWedgeFullDeltaDC2 [ui]=pcCU->getWedgeFullDeltaDC2 (uiPartOffset+ui); |
---|
| 888 | |
---|
| 889 | m_puiWedgePredDirTabIdx [ui]=pcCU->getWedgePredDirTabIdx (uiPartOffset+ui); |
---|
| 890 | m_piWedgePredDirDeltaDC1 [ui]=pcCU->getWedgePredDirDeltaDC1 (uiPartOffset+ui); |
---|
| 891 | m_piWedgePredDirDeltaDC2 [ui]=pcCU->getWedgePredDirDeltaDC2 (uiPartOffset+ui); |
---|
| 892 | m_piWedgePredDirDeltaEnd [ui]=pcCU->getWedgePredDirDeltaEnd (uiPartOffset+ui); |
---|
| 893 | #endif |
---|
| 894 | #if HHI_DMM_PRED_TEX |
---|
| 895 | m_puiWedgePredTexTabIdx [ui]=pcCU->getWedgePredTexTabIdx (uiPartOffset+ui); |
---|
| 896 | m_piWedgePredTexDeltaDC1 [ui]=pcCU->getWedgePredTexDeltaDC1 (uiPartOffset+ui); |
---|
| 897 | m_piWedgePredTexDeltaDC2 [ui]=pcCU->getWedgePredTexDeltaDC2 (uiPartOffset+ui); |
---|
| 898 | |
---|
| 899 | m_piContourPredTexDeltaDC1[ui]=pcCU->getContourPredTexDeltaDC1(uiPartOffset+ui); |
---|
| 900 | m_piContourPredTexDeltaDC2[ui]=pcCU->getContourPredTexDeltaDC2(uiPartOffset+ui); |
---|
| 901 | #endif |
---|
| 902 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
| 903 | m_pbResPredAvailable[ui] = pcCU->m_pbResPredAvailable[ uiPartOffset + ui ]; |
---|
| 904 | m_pbResPredFlag [ui] = pcCU->m_pbResPredFlag [ uiPartOffset + ui ]; |
---|
| 905 | #endif |
---|
| 906 | } |
---|
[2] | 907 | } |
---|
[56] | 908 | UInt uiTmp = uhWidth*uhHeight; |
---|
[2] | 909 | memset( m_pcTrCoeffY , 0, sizeof(TCoeff)*uiTmp ); |
---|
[56] | 910 | #if ADAPTIVE_QP_SELECTION |
---|
| 911 | memset( m_pcArlCoeffY , 0, sizeof(Int)*uiTmp ); |
---|
| 912 | #endif |
---|
| 913 | memset( m_pcIPCMSampleY , 0, sizeof( Pel ) * uiTmp ); |
---|
[2] | 914 | uiTmp >>= 2; |
---|
| 915 | memset( m_pcTrCoeffCb, 0, sizeof(TCoeff)*uiTmp ); |
---|
| 916 | memset( m_pcTrCoeffCr, 0, sizeof(TCoeff)*uiTmp ); |
---|
[56] | 917 | #if ADAPTIVE_QP_SELECTION |
---|
| 918 | memset( m_pcArlCoeffCb, 0, sizeof(Int)*uiTmp ); |
---|
| 919 | memset( m_pcArlCoeffCr, 0, sizeof(Int)*uiTmp ); |
---|
| 920 | #endif |
---|
| 921 | memset( m_pcIPCMSampleCb , 0, sizeof( Pel ) * uiTmp ); |
---|
| 922 | memset( m_pcIPCMSampleCr , 0, sizeof( Pel ) * uiTmp ); |
---|
| 923 | m_acCUMvField[0].clearMvField(); |
---|
| 924 | m_acCUMvField[1].clearMvField(); |
---|
| 925 | |
---|
| 926 | if(m_pcPic->getPicSym()->getInverseCUOrderMap(getAddr())*m_pcPic->getNumPartInCU()+m_uiAbsIdxInLCU<getSlice()->getEntropySliceCurStartCUAddr()) |
---|
| 927 | { |
---|
| 928 | // Part of this CU contains data from an older slice. Now copy in that data. |
---|
| 929 | UInt uiMaxCuWidth=pcCU->getSlice()->getSPS()->getMaxCUWidth(); |
---|
| 930 | UInt uiMaxCuHeight=pcCU->getSlice()->getSPS()->getMaxCUHeight(); |
---|
| 931 | TComDataCU * bigCU = getPic()->getCU(getAddr()); |
---|
| 932 | Int minui = uiPartOffset; |
---|
| 933 | minui = -minui; |
---|
| 934 | pcCU->m_acCUMvField[0].copyTo(&m_acCUMvField[0],minui,uiPartOffset,m_uiNumPartition); |
---|
| 935 | pcCU->m_acCUMvField[1].copyTo(&m_acCUMvField[1],minui,uiPartOffset,m_uiNumPartition); |
---|
| 936 | UInt uiCoffOffset = uiMaxCuWidth*uiMaxCuHeight*m_uiAbsIdxInLCU/pcCU->getPic()->getNumPartInCU(); |
---|
| 937 | uiTmp = uhWidth*uhHeight; |
---|
| 938 | for(int i=0; i<uiTmp; i++) |
---|
| 939 | { |
---|
| 940 | m_pcTrCoeffY[i]=bigCU->m_pcTrCoeffY[uiCoffOffset+i]; |
---|
| 941 | #if ADAPTIVE_QP_SELECTION |
---|
| 942 | m_pcArlCoeffY[i]=bigCU->m_pcArlCoeffY[uiCoffOffset+i]; |
---|
| 943 | #endif |
---|
| 944 | m_pcIPCMSampleY[i]=bigCU->m_pcIPCMSampleY[uiCoffOffset+i]; |
---|
| 945 | } |
---|
| 946 | uiTmp>>=2; |
---|
| 947 | uiCoffOffset>>=2; |
---|
| 948 | for(int i=0; i<uiTmp; i++) |
---|
| 949 | { |
---|
| 950 | m_pcTrCoeffCr[i]=bigCU->m_pcTrCoeffCr[uiCoffOffset+i]; |
---|
| 951 | m_pcTrCoeffCb[i]=bigCU->m_pcTrCoeffCb[uiCoffOffset+i]; |
---|
| 952 | #if ADAPTIVE_QP_SELECTION |
---|
| 953 | m_pcArlCoeffCr[i]=bigCU->m_pcArlCoeffCr[uiCoffOffset+i]; |
---|
| 954 | m_pcArlCoeffCb[i]=bigCU->m_pcArlCoeffCb[uiCoffOffset+i]; |
---|
| 955 | #endif |
---|
| 956 | m_pcIPCMSampleCb[i]=bigCU->m_pcIPCMSampleCb[uiCoffOffset+i]; |
---|
| 957 | m_pcIPCMSampleCr[i]=bigCU->m_pcIPCMSampleCr[uiCoffOffset+i]; |
---|
| 958 | } |
---|
| 959 | } |
---|
| 960 | |
---|
[2] | 961 | m_pcCULeft = pcCU->getCULeft(); |
---|
| 962 | m_pcCUAbove = pcCU->getCUAbove(); |
---|
| 963 | m_pcCUAboveLeft = pcCU->getCUAboveLeft(); |
---|
| 964 | m_pcCUAboveRight = pcCU->getCUAboveRight(); |
---|
[56] | 965 | |
---|
[2] | 966 | m_apcCUColocated[0] = pcCU->getCUColocated(REF_PIC_LIST_0); |
---|
| 967 | m_apcCUColocated[1] = pcCU->getCUColocated(REF_PIC_LIST_1); |
---|
[56] | 968 | memcpy(m_uiSliceStartCU,pcCU->m_uiSliceStartCU+uiPartOffset,sizeof(UInt)*m_uiNumPartition); |
---|
| 969 | memcpy(m_uiEntropySliceStartCU,pcCU->m_uiEntropySliceStartCU+uiPartOffset,sizeof(UInt)*m_uiNumPartition); |
---|
| 970 | } |
---|
[2] | 971 | |
---|
[56] | 972 | Void TComDataCU::setOutsideCUPart( UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 973 | { |
---|
| 974 | UInt uiNumPartition = m_uiNumPartition >> (uiDepth << 1); |
---|
| 975 | UInt uiSizeInUchar = sizeof( UChar ) * uiNumPartition; |
---|
[2] | 976 | |
---|
[56] | 977 | UChar uhWidth = g_uiMaxCUWidth >> uiDepth; |
---|
| 978 | UChar uhHeight = g_uiMaxCUHeight >> uiDepth; |
---|
| 979 | memset( m_puhDepth + uiAbsPartIdx, uiDepth, uiSizeInUchar ); |
---|
| 980 | memset( m_puhWidth + uiAbsPartIdx, uhWidth, uiSizeInUchar ); |
---|
| 981 | memset( m_puhHeight + uiAbsPartIdx, uhHeight, uiSizeInUchar ); |
---|
[2] | 982 | } |
---|
| 983 | |
---|
| 984 | // -------------------------------------------------------------------------------------------------------------------- |
---|
| 985 | // Copy |
---|
| 986 | // -------------------------------------------------------------------------------------------------------------------- |
---|
| 987 | |
---|
| 988 | Void TComDataCU::copySubCU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 989 | { |
---|
| 990 | UInt uiPart = uiAbsPartIdx; |
---|
| 991 | |
---|
| 992 | m_pcPic = pcCU->getPic(); |
---|
| 993 | m_pcSlice = pcCU->getSlice(); |
---|
| 994 | m_uiCUAddr = pcCU->getAddr(); |
---|
| 995 | m_uiAbsIdxInLCU = uiAbsPartIdx; |
---|
| 996 | |
---|
| 997 | m_uiCUPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ]; |
---|
| 998 | m_uiCUPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ]; |
---|
| 999 | |
---|
| 1000 | UInt uiWidth = g_uiMaxCUWidth >> uiDepth; |
---|
| 1001 | UInt uiHeight = g_uiMaxCUHeight >> uiDepth; |
---|
| 1002 | |
---|
| 1003 | m_phQP=pcCU->getQP() + uiPart; |
---|
[56] | 1004 | m_pePartSize = pcCU->getPartitionSize() + uiPart; |
---|
| 1005 | #if HHI_INTERVIEW_SKIP |
---|
| 1006 | m_pbRenderable = pcCU->getRenderable() + uiPart; |
---|
| 1007 | |
---|
| 1008 | #endif |
---|
[2] | 1009 | m_pePredMode=pcCU->getPredictionMode() + uiPart; |
---|
| 1010 | |
---|
| 1011 | m_pbMergeFlag = pcCU->getMergeFlag() + uiPart; |
---|
| 1012 | m_puhMergeIndex = pcCU->getMergeIndex() + uiPart; |
---|
[5] | 1013 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
[2] | 1014 | m_pbResPredAvailable = pcCU->getResPredAvail() + uiPart; |
---|
| 1015 | m_pbResPredFlag = pcCU->getResPredFlag () + uiPart; |
---|
[5] | 1016 | #endif |
---|
[2] | 1017 | m_puhLumaIntraDir = pcCU->getLumaIntraDir() + uiPart; |
---|
| 1018 | m_puhChromaIntraDir = pcCU->getChromaIntraDir() + uiPart; |
---|
| 1019 | m_puhInterDir = pcCU->getInterDir() + uiPart; |
---|
| 1020 | m_puhTrIdx = pcCU->getTransformIdx() + uiPart; |
---|
[56] | 1021 | m_nsqtPartIdx = pcCU->getNSQTPartIdx() + uiPart; |
---|
[2] | 1022 | |
---|
| 1023 | m_puhCbf[0]= pcCU->getCbf(TEXT_LUMA) + uiPart; |
---|
| 1024 | m_puhCbf[1]= pcCU->getCbf(TEXT_CHROMA_U) + uiPart; |
---|
| 1025 | m_puhCbf[2]= pcCU->getCbf(TEXT_CHROMA_V) + uiPart; |
---|
| 1026 | |
---|
| 1027 | m_puhDepth=pcCU->getDepth() + uiPart; |
---|
| 1028 | m_puhWidth=pcCU->getWidth() + uiPart; |
---|
| 1029 | m_puhHeight=pcCU->getHeight() + uiPart; |
---|
[5] | 1030 | #if HHI_MPI |
---|
[2] | 1031 | m_piTextureModeDepth=pcCU->getTextureModeDepth()+ uiPart; |
---|
[5] | 1032 | #endif |
---|
[2] | 1033 | |
---|
| 1034 | m_apiMVPIdx[0]=pcCU->getMVPIdx(REF_PIC_LIST_0) + uiPart; |
---|
| 1035 | m_apiMVPIdx[1]=pcCU->getMVPIdx(REF_PIC_LIST_1) + uiPart; |
---|
| 1036 | m_apiMVPNum[0]=pcCU->getMVPNum(REF_PIC_LIST_0) + uiPart; |
---|
| 1037 | m_apiMVPNum[1]=pcCU->getMVPNum(REF_PIC_LIST_1) + uiPart; |
---|
| 1038 | |
---|
[56] | 1039 | m_pbIPCMFlag = pcCU->getIPCMFlag() + uiPart; |
---|
| 1040 | |
---|
[2] | 1041 | m_pcCUAboveLeft = pcCU->getCUAboveLeft(); |
---|
| 1042 | m_pcCUAboveRight = pcCU->getCUAboveRight(); |
---|
| 1043 | m_pcCUAbove = pcCU->getCUAbove(); |
---|
| 1044 | m_pcCULeft = pcCU->getCULeft(); |
---|
| 1045 | |
---|
| 1046 | m_apcCUColocated[0] = pcCU->getCUColocated(REF_PIC_LIST_0); |
---|
| 1047 | m_apcCUColocated[1] = pcCU->getCUColocated(REF_PIC_LIST_1); |
---|
| 1048 | |
---|
| 1049 | UInt uiTmp = uiWidth*uiHeight; |
---|
| 1050 | UInt uiMaxCuWidth=pcCU->getSlice()->getSPS()->getMaxCUWidth(); |
---|
| 1051 | UInt uiMaxCuHeight=pcCU->getSlice()->getSPS()->getMaxCUHeight(); |
---|
| 1052 | |
---|
| 1053 | UInt uiCoffOffset = uiMaxCuWidth*uiMaxCuHeight*uiAbsPartIdx/pcCU->getPic()->getNumPartInCU(); |
---|
| 1054 | |
---|
[56] | 1055 | m_pcTrCoeffY = pcCU->getCoeffY() + uiCoffOffset; |
---|
| 1056 | #if ADAPTIVE_QP_SELECTION |
---|
| 1057 | m_pcArlCoeffY= pcCU->getArlCoeffY() + uiCoffOffset; |
---|
| 1058 | #endif |
---|
| 1059 | m_pcIPCMSampleY = pcCU->getPCMSampleY() + uiCoffOffset; |
---|
| 1060 | |
---|
[2] | 1061 | uiTmp >>= 2; |
---|
| 1062 | uiCoffOffset >>=2; |
---|
| 1063 | m_pcTrCoeffCb=pcCU->getCoeffCb() + uiCoffOffset; |
---|
| 1064 | m_pcTrCoeffCr=pcCU->getCoeffCr() + uiCoffOffset; |
---|
[56] | 1065 | #if ADAPTIVE_QP_SELECTION |
---|
| 1066 | m_pcArlCoeffCb=pcCU->getArlCoeffCb() + uiCoffOffset; |
---|
| 1067 | m_pcArlCoeffCr=pcCU->getArlCoeffCr() + uiCoffOffset; |
---|
| 1068 | #endif |
---|
| 1069 | m_pcIPCMSampleCb = pcCU->getPCMSampleCb() + uiCoffOffset; |
---|
| 1070 | m_pcIPCMSampleCr = pcCU->getPCMSampleCr() + uiCoffOffset; |
---|
[2] | 1071 | |
---|
[56] | 1072 | m_acCUMvField[0].linkToWithOffset( pcCU->getCUMvField(REF_PIC_LIST_0), uiPart ); |
---|
| 1073 | m_acCUMvField[1].linkToWithOffset( pcCU->getCUMvField(REF_PIC_LIST_1), uiPart ); |
---|
| 1074 | memcpy(m_uiSliceStartCU,pcCU->m_uiSliceStartCU+uiPart,sizeof(UInt)*m_uiNumPartition); |
---|
| 1075 | memcpy(m_uiEntropySliceStartCU,pcCU->m_uiEntropySliceStartCU+uiPart,sizeof(UInt)*m_uiNumPartition); |
---|
| 1076 | |
---|
[5] | 1077 | #if HHI_DMM_WEDGE_INTRA |
---|
[56] | 1078 | m_puiWedgeFullTabIdx = pcCU->getWedgeFullTabIdx() + uiPart; |
---|
| 1079 | m_piWedgeFullDeltaDC1 = pcCU->getWedgeFullDeltaDC1() + uiPart; |
---|
| 1080 | m_piWedgeFullDeltaDC2 = pcCU->getWedgeFullDeltaDC2() + uiPart; |
---|
[2] | 1081 | |
---|
| 1082 | m_puiWedgePredDirTabIdx = pcCU->getWedgePredDirTabIdx() + uiPart; |
---|
| 1083 | m_piWedgePredDirDeltaDC1 = pcCU->getWedgePredDirDeltaDC1() + uiPart; |
---|
| 1084 | m_piWedgePredDirDeltaDC2 = pcCU->getWedgePredDirDeltaDC2() + uiPart; |
---|
| 1085 | m_piWedgePredDirDeltaEnd = pcCU->getWedgePredDirDeltaEnd() + uiPart; |
---|
[5] | 1086 | #endif |
---|
| 1087 | #if HHI_DMM_PRED_TEX |
---|
[56] | 1088 | m_puiWedgePredTexTabIdx = pcCU->getWedgePredTexTabIdx() + uiPart; |
---|
| 1089 | m_piWedgePredTexDeltaDC1 = pcCU->getWedgePredTexDeltaDC1() + uiPart; |
---|
| 1090 | m_piWedgePredTexDeltaDC2 = pcCU->getWedgePredTexDeltaDC2() + uiPart; |
---|
[2] | 1091 | |
---|
[56] | 1092 | m_piContourPredTexDeltaDC1 = pcCU->getContourPredTexDeltaDC1() + uiPart; |
---|
| 1093 | m_piContourPredTexDeltaDC2 = pcCU->getContourPredTexDeltaDC2() + uiPart; |
---|
[2] | 1094 | #endif |
---|
| 1095 | } |
---|
| 1096 | |
---|
| 1097 | // Copy inter prediction info from the biggest CU |
---|
| 1098 | Void TComDataCU::copyInterPredInfoFrom ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList ) |
---|
| 1099 | { |
---|
| 1100 | m_pcPic = pcCU->getPic(); |
---|
| 1101 | m_pcSlice = pcCU->getSlice(); |
---|
| 1102 | m_uiCUAddr = pcCU->getAddr(); |
---|
| 1103 | m_uiAbsIdxInLCU = uiAbsPartIdx; |
---|
| 1104 | |
---|
| 1105 | Int iRastPartIdx = g_auiZscanToRaster[uiAbsPartIdx]; |
---|
| 1106 | m_uiCUPelX = pcCU->getCUPelX() + m_pcPic->getMinCUWidth ()*( iRastPartIdx % m_pcPic->getNumPartInWidth() ); |
---|
| 1107 | m_uiCUPelY = pcCU->getCUPelY() + m_pcPic->getMinCUHeight()*( iRastPartIdx / m_pcPic->getNumPartInWidth() ); |
---|
| 1108 | |
---|
| 1109 | m_pcCUAboveLeft = pcCU->getCUAboveLeft(); |
---|
| 1110 | m_pcCUAboveRight = pcCU->getCUAboveRight(); |
---|
| 1111 | m_pcCUAbove = pcCU->getCUAbove(); |
---|
| 1112 | m_pcCULeft = pcCU->getCULeft(); |
---|
| 1113 | |
---|
| 1114 | m_apcCUColocated[0] = pcCU->getCUColocated(REF_PIC_LIST_0); |
---|
| 1115 | m_apcCUColocated[1] = pcCU->getCUColocated(REF_PIC_LIST_1); |
---|
| 1116 | |
---|
| 1117 | m_pePartSize = pcCU->getPartitionSize () + uiAbsPartIdx; |
---|
[56] | 1118 | #if HHI_INTERVIEW_SKIP |
---|
| 1119 | m_pbRenderable = pcCU->getRenderable() + uiAbsPartIdx; |
---|
| 1120 | |
---|
| 1121 | #endif |
---|
[2] | 1122 | m_pePredMode = pcCU->getPredictionMode() + uiAbsPartIdx; |
---|
| 1123 | m_puhInterDir = pcCU->getInterDir () + uiAbsPartIdx; |
---|
| 1124 | |
---|
| 1125 | m_puhDepth = pcCU->getDepth () + uiAbsPartIdx; |
---|
| 1126 | m_puhWidth = pcCU->getWidth () + uiAbsPartIdx; |
---|
| 1127 | m_puhHeight = pcCU->getHeight() + uiAbsPartIdx; |
---|
| 1128 | |
---|
| 1129 | m_pbMergeFlag = pcCU->getMergeFlag() + uiAbsPartIdx; |
---|
| 1130 | m_puhMergeIndex = pcCU->getMergeIndex() + uiAbsPartIdx; |
---|
[5] | 1131 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
[2] | 1132 | m_pbResPredAvailable = pcCU->getResPredAvail() + uiAbsPartIdx; |
---|
| 1133 | m_pbResPredFlag = pcCU->getResPredFlag () + uiAbsPartIdx; |
---|
[5] | 1134 | #endif |
---|
[2] | 1135 | m_apiMVPIdx[eRefPicList] = pcCU->getMVPIdx(eRefPicList) + uiAbsPartIdx; |
---|
| 1136 | m_apiMVPNum[eRefPicList] = pcCU->getMVPNum(eRefPicList) + uiAbsPartIdx; |
---|
| 1137 | |
---|
[56] | 1138 | m_acCUMvField[ eRefPicList ].linkToWithOffset( pcCU->getCUMvField(eRefPicList), uiAbsPartIdx ); |
---|
[5] | 1139 | #if HHI_MPI |
---|
[2] | 1140 | m_piTextureModeDepth = pcCU->getTextureModeDepth() + uiAbsPartIdx; |
---|
[5] | 1141 | #endif |
---|
[2] | 1142 | |
---|
[56] | 1143 | memcpy(m_uiSliceStartCU,pcCU->m_uiSliceStartCU+uiAbsPartIdx,sizeof(UInt)*m_uiNumPartition); |
---|
| 1144 | memcpy(m_uiEntropySliceStartCU,pcCU->m_uiEntropySliceStartCU+uiAbsPartIdx,sizeof(UInt)*m_uiNumPartition); |
---|
[2] | 1145 | } |
---|
| 1146 | |
---|
| 1147 | // Copy small CU to bigger CU. |
---|
| 1148 | // One of quarter parts overwritten by predicted sub part. |
---|
| 1149 | Void TComDataCU::copyPartFrom( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth ) |
---|
| 1150 | { |
---|
| 1151 | assert( uiPartUnitIdx<4 ); |
---|
| 1152 | |
---|
| 1153 | m_dTotalCost += pcCU->getTotalCost(); |
---|
| 1154 | m_uiTotalDistortion += pcCU->getTotalDistortion(); |
---|
| 1155 | m_uiTotalBits += pcCU->getTotalBits(); |
---|
| 1156 | |
---|
| 1157 | UInt uiOffset = pcCU->getTotalNumPart()*uiPartUnitIdx; |
---|
| 1158 | |
---|
| 1159 | UInt uiNumPartition = pcCU->getTotalNumPart(); |
---|
| 1160 | Int iSizeInUchar = sizeof( UChar ) * uiNumPartition; |
---|
| 1161 | Int iSizeInBool = sizeof( Bool ) * uiNumPartition; |
---|
| 1162 | |
---|
[56] | 1163 | #if H0736_AVC_STYLE_QP_RANGE |
---|
| 1164 | Int sizeInChar = sizeof( Char ) * uiNumPartition; |
---|
| 1165 | memcpy( m_phQP + uiOffset, pcCU->getQP(), sizeInChar ); |
---|
| 1166 | #else |
---|
[2] | 1167 | memcpy( m_phQP + uiOffset, pcCU->getQP(), iSizeInUchar ); |
---|
[56] | 1168 | #endif |
---|
| 1169 | memcpy( m_pePartSize + uiOffset, pcCU->getPartitionSize(), sizeof( *m_pePartSize ) * uiNumPartition ); |
---|
| 1170 | memcpy( m_pePredMode + uiOffset, pcCU->getPredictionMode(), sizeof( *m_pePredMode ) * uiNumPartition ); |
---|
| 1171 | #if HHI_INTERVIEW_SKIP |
---|
| 1172 | memcpy( m_pbRenderable + uiOffset, pcCU->getRenderable(), iSizeInBool ); |
---|
| 1173 | #endif |
---|
| 1174 | memcpy( m_puiAlfCtrlFlag + uiOffset, pcCU->getAlfCtrlFlag(), iSizeInBool ); |
---|
[2] | 1175 | memcpy( m_pbMergeFlag + uiOffset, pcCU->getMergeFlag(), iSizeInBool ); |
---|
| 1176 | memcpy( m_puhMergeIndex + uiOffset, pcCU->getMergeIndex(), iSizeInUchar ); |
---|
[5] | 1177 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
[2] | 1178 | memcpy( m_pbResPredAvailable + uiOffset, pcCU->getResPredAvail(), iSizeInBool ); |
---|
| 1179 | memcpy( m_pbResPredFlag + uiOffset, pcCU->getResPredFlag(), iSizeInBool ); |
---|
[5] | 1180 | #endif |
---|
[2] | 1181 | memcpy( m_puhLumaIntraDir + uiOffset, pcCU->getLumaIntraDir(), iSizeInUchar ); |
---|
| 1182 | memcpy( m_puhChromaIntraDir + uiOffset, pcCU->getChromaIntraDir(), iSizeInUchar ); |
---|
| 1183 | memcpy( m_puhInterDir + uiOffset, pcCU->getInterDir(), iSizeInUchar ); |
---|
| 1184 | memcpy( m_puhTrIdx + uiOffset, pcCU->getTransformIdx(), iSizeInUchar ); |
---|
[56] | 1185 | memcpy( m_nsqtPartIdx + uiOffset, pcCU->getNSQTPartIdx(), iSizeInUchar ); |
---|
[2] | 1186 | |
---|
| 1187 | memcpy( m_puhCbf[0] + uiOffset, pcCU->getCbf(TEXT_LUMA) , iSizeInUchar ); |
---|
| 1188 | memcpy( m_puhCbf[1] + uiOffset, pcCU->getCbf(TEXT_CHROMA_U), iSizeInUchar ); |
---|
| 1189 | memcpy( m_puhCbf[2] + uiOffset, pcCU->getCbf(TEXT_CHROMA_V), iSizeInUchar ); |
---|
| 1190 | |
---|
| 1191 | memcpy( m_puhDepth + uiOffset, pcCU->getDepth(), iSizeInUchar ); |
---|
| 1192 | memcpy( m_puhWidth + uiOffset, pcCU->getWidth(), iSizeInUchar ); |
---|
| 1193 | memcpy( m_puhHeight + uiOffset, pcCU->getHeight(), iSizeInUchar ); |
---|
| 1194 | |
---|
[56] | 1195 | memcpy( m_apiMVPIdx[0] + uiOffset, pcCU->getMVPIdx(REF_PIC_LIST_0), iSizeInUchar ); |
---|
| 1196 | memcpy( m_apiMVPIdx[1] + uiOffset, pcCU->getMVPIdx(REF_PIC_LIST_1), iSizeInUchar ); |
---|
| 1197 | memcpy( m_apiMVPNum[0] + uiOffset, pcCU->getMVPNum(REF_PIC_LIST_0), iSizeInUchar ); |
---|
| 1198 | memcpy( m_apiMVPNum[1] + uiOffset, pcCU->getMVPNum(REF_PIC_LIST_1), iSizeInUchar ); |
---|
[2] | 1199 | |
---|
[56] | 1200 | memcpy( m_pbIPCMFlag + uiOffset, pcCU->getIPCMFlag(), iSizeInBool ); |
---|
| 1201 | |
---|
[2] | 1202 | m_pcCUAboveLeft = pcCU->getCUAboveLeft(); |
---|
| 1203 | m_pcCUAboveRight = pcCU->getCUAboveRight(); |
---|
| 1204 | m_pcCUAbove = pcCU->getCUAbove(); |
---|
| 1205 | m_pcCULeft = pcCU->getCULeft(); |
---|
| 1206 | |
---|
| 1207 | m_apcCUColocated[0] = pcCU->getCUColocated(REF_PIC_LIST_0); |
---|
| 1208 | m_apcCUColocated[1] = pcCU->getCUColocated(REF_PIC_LIST_1); |
---|
| 1209 | |
---|
| 1210 | m_acCUMvField[0].copyFrom( pcCU->getCUMvField( REF_PIC_LIST_0 ), pcCU->getTotalNumPart(), uiOffset ); |
---|
| 1211 | m_acCUMvField[1].copyFrom( pcCU->getCUMvField( REF_PIC_LIST_1 ), pcCU->getTotalNumPart(), uiOffset ); |
---|
| 1212 | |
---|
| 1213 | UInt uiTmp = g_uiMaxCUWidth*g_uiMaxCUHeight >> (uiDepth<<1); |
---|
| 1214 | UInt uiTmp2 = uiPartUnitIdx*uiTmp; |
---|
| 1215 | memcpy( m_pcTrCoeffY + uiTmp2, pcCU->getCoeffY(), sizeof(TCoeff)*uiTmp ); |
---|
[56] | 1216 | #if ADAPTIVE_QP_SELECTION |
---|
| 1217 | memcpy( m_pcArlCoeffY + uiTmp2, pcCU->getArlCoeffY(), sizeof(Int)*uiTmp ); |
---|
| 1218 | #endif |
---|
| 1219 | memcpy( m_pcIPCMSampleY + uiTmp2 , pcCU->getPCMSampleY(), sizeof(Pel) * uiTmp ); |
---|
| 1220 | |
---|
[2] | 1221 | uiTmp >>= 2; uiTmp2>>= 2; |
---|
| 1222 | memcpy( m_pcTrCoeffCb + uiTmp2, pcCU->getCoeffCb(), sizeof(TCoeff)*uiTmp ); |
---|
| 1223 | memcpy( m_pcTrCoeffCr + uiTmp2, pcCU->getCoeffCr(), sizeof(TCoeff)*uiTmp ); |
---|
[56] | 1224 | #if ADAPTIVE_QP_SELECTION |
---|
| 1225 | memcpy( m_pcArlCoeffCb + uiTmp2, pcCU->getArlCoeffCb(), sizeof(Int)*uiTmp ); |
---|
| 1226 | memcpy( m_pcArlCoeffCr + uiTmp2, pcCU->getArlCoeffCr(), sizeof(Int)*uiTmp ); |
---|
| 1227 | #endif |
---|
| 1228 | memcpy( m_pcIPCMSampleCb + uiTmp2 , pcCU->getPCMSampleCb(), sizeof(Pel) * uiTmp ); |
---|
| 1229 | memcpy( m_pcIPCMSampleCr + uiTmp2 , pcCU->getPCMSampleCr(), sizeof(Pel) * uiTmp ); |
---|
| 1230 | m_uiTotalBins += pcCU->getTotalBins(); |
---|
| 1231 | memcpy( m_uiSliceStartCU + uiOffset, pcCU->m_uiSliceStartCU, sizeof( UInt ) * uiNumPartition ); |
---|
| 1232 | memcpy( m_uiEntropySliceStartCU + uiOffset, pcCU->m_uiEntropySliceStartCU, sizeof( UInt ) * uiNumPartition ); |
---|
[2] | 1233 | |
---|
[5] | 1234 | #if HHI_DMM_WEDGE_INTRA |
---|
[56] | 1235 | memcpy( m_puiWedgeFullTabIdx + uiOffset, pcCU->getWedgeFullTabIdx(), sizeof( UInt ) * uiNumPartition ); |
---|
| 1236 | memcpy( m_piWedgeFullDeltaDC1 + uiOffset, pcCU->getWedgeFullDeltaDC1(), sizeof( Int ) * uiNumPartition ); |
---|
| 1237 | memcpy( m_piWedgeFullDeltaDC2 + uiOffset, pcCU->getWedgeFullDeltaDC2(), sizeof( Int ) * uiNumPartition ); |
---|
[2] | 1238 | |
---|
[56] | 1239 | memcpy( m_puiWedgePredDirTabIdx + uiOffset, pcCU->getWedgePredDirTabIdx(), sizeof( UInt ) * uiNumPartition ); |
---|
| 1240 | memcpy( m_piWedgePredDirDeltaDC1 + uiOffset, pcCU->getWedgePredDirDeltaDC1(), sizeof( Int ) * uiNumPartition ); |
---|
| 1241 | memcpy( m_piWedgePredDirDeltaDC2 + uiOffset, pcCU->getWedgePredDirDeltaDC2(), sizeof( Int ) * uiNumPartition ); |
---|
| 1242 | memcpy( m_piWedgePredDirDeltaEnd + uiOffset, pcCU->getWedgePredDirDeltaEnd(), sizeof( Int ) * uiNumPartition ); |
---|
[5] | 1243 | #endif |
---|
| 1244 | #if HHI_DMM_PRED_TEX |
---|
[56] | 1245 | memcpy( m_puiWedgePredTexTabIdx + uiOffset, pcCU->getWedgePredTexTabIdx(), sizeof( UInt ) * uiNumPartition ); |
---|
| 1246 | memcpy( m_piWedgePredTexDeltaDC1 + uiOffset, pcCU->getWedgePredTexDeltaDC1(), sizeof( Int ) * uiNumPartition ); |
---|
| 1247 | memcpy( m_piWedgePredTexDeltaDC2 + uiOffset, pcCU->getWedgePredTexDeltaDC2(), sizeof( Int ) * uiNumPartition ); |
---|
[2] | 1248 | |
---|
[56] | 1249 | memcpy( m_piContourPredTexDeltaDC1 + uiOffset, pcCU->getContourPredTexDeltaDC1(), sizeof( Int ) * uiNumPartition ); |
---|
| 1250 | memcpy( m_piContourPredTexDeltaDC2 + uiOffset, pcCU->getContourPredTexDeltaDC2(), sizeof( Int ) * uiNumPartition ); |
---|
[2] | 1251 | #endif |
---|
[5] | 1252 | #if HHI_MPI |
---|
[56] | 1253 | memcpy( m_piTextureModeDepth + uiOffset, pcCU->getTextureModeDepth(), sizeof( Int ) * uiNumPartition ); |
---|
[5] | 1254 | #endif |
---|
[2] | 1255 | } |
---|
| 1256 | |
---|
| 1257 | // Copy current predicted part to a CU in picture. |
---|
| 1258 | // It is used to predict for next part |
---|
| 1259 | Void TComDataCU::copyToPic( UChar uhDepth ) |
---|
| 1260 | { |
---|
| 1261 | TComDataCU*& rpcCU = m_pcPic->getCU( m_uiCUAddr ); |
---|
| 1262 | |
---|
| 1263 | rpcCU->getTotalCost() = m_dTotalCost; |
---|
| 1264 | rpcCU->getTotalDistortion() = m_uiTotalDistortion; |
---|
| 1265 | rpcCU->getTotalBits() = m_uiTotalBits; |
---|
| 1266 | |
---|
| 1267 | Int iSizeInUchar = sizeof( UChar ) * m_uiNumPartition; |
---|
| 1268 | Int iSizeInBool = sizeof( Bool ) * m_uiNumPartition; |
---|
| 1269 | |
---|
[56] | 1270 | #if H0736_AVC_STYLE_QP_RANGE |
---|
| 1271 | Int sizeInChar = sizeof( Char ) * m_uiNumPartition; |
---|
| 1272 | memcpy( rpcCU->getQP() + m_uiAbsIdxInLCU, m_phQP, sizeInChar ); |
---|
| 1273 | #else |
---|
[2] | 1274 | memcpy( rpcCU->getQP() + m_uiAbsIdxInLCU, m_phQP, iSizeInUchar ); |
---|
[56] | 1275 | #endif |
---|
| 1276 | |
---|
| 1277 | memcpy( rpcCU->getPartitionSize() + m_uiAbsIdxInLCU, m_pePartSize, sizeof( *m_pePartSize ) * m_uiNumPartition ); |
---|
| 1278 | #if HHI_INTERVIEW_SKIP |
---|
| 1279 | memcpy( rpcCU->getRenderable() + m_uiAbsIdxInLCU, m_pbRenderable, iSizeInBool ); |
---|
| 1280 | #endif |
---|
| 1281 | memcpy( rpcCU->getPredictionMode() + m_uiAbsIdxInLCU, m_pePredMode, sizeof( *m_pePredMode ) * m_uiNumPartition ); |
---|
[2] | 1282 | |
---|
[56] | 1283 | memcpy( rpcCU->getAlfCtrlFlag() + m_uiAbsIdxInLCU, m_puiAlfCtrlFlag, iSizeInBool ); |
---|
[2] | 1284 | |
---|
| 1285 | memcpy( rpcCU->getMergeFlag() + m_uiAbsIdxInLCU, m_pbMergeFlag, iSizeInBool ); |
---|
| 1286 | memcpy( rpcCU->getMergeIndex() + m_uiAbsIdxInLCU, m_puhMergeIndex, iSizeInUchar ); |
---|
[5] | 1287 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
[2] | 1288 | memcpy( rpcCU->getResPredAvail() + m_uiAbsIdxInLCU, m_pbResPredAvailable, iSizeInBool ); |
---|
| 1289 | memcpy( rpcCU->getResPredFlag() + m_uiAbsIdxInLCU, m_pbResPredFlag, iSizeInBool ); |
---|
[5] | 1290 | #endif |
---|
[2] | 1291 | memcpy( rpcCU->getLumaIntraDir() + m_uiAbsIdxInLCU, m_puhLumaIntraDir, iSizeInUchar ); |
---|
| 1292 | memcpy( rpcCU->getChromaIntraDir() + m_uiAbsIdxInLCU, m_puhChromaIntraDir, iSizeInUchar ); |
---|
| 1293 | memcpy( rpcCU->getInterDir() + m_uiAbsIdxInLCU, m_puhInterDir, iSizeInUchar ); |
---|
| 1294 | memcpy( rpcCU->getTransformIdx() + m_uiAbsIdxInLCU, m_puhTrIdx, iSizeInUchar ); |
---|
[56] | 1295 | memcpy( rpcCU->getNSQTPartIdx() + m_uiAbsIdxInLCU, m_nsqtPartIdx, iSizeInUchar ); |
---|
[2] | 1296 | |
---|
| 1297 | memcpy( rpcCU->getCbf(TEXT_LUMA) + m_uiAbsIdxInLCU, m_puhCbf[0], iSizeInUchar ); |
---|
| 1298 | memcpy( rpcCU->getCbf(TEXT_CHROMA_U) + m_uiAbsIdxInLCU, m_puhCbf[1], iSizeInUchar ); |
---|
| 1299 | memcpy( rpcCU->getCbf(TEXT_CHROMA_V) + m_uiAbsIdxInLCU, m_puhCbf[2], iSizeInUchar ); |
---|
| 1300 | |
---|
| 1301 | memcpy( rpcCU->getDepth() + m_uiAbsIdxInLCU, m_puhDepth, iSizeInUchar ); |
---|
| 1302 | memcpy( rpcCU->getWidth() + m_uiAbsIdxInLCU, m_puhWidth, iSizeInUchar ); |
---|
| 1303 | memcpy( rpcCU->getHeight() + m_uiAbsIdxInLCU, m_puhHeight, iSizeInUchar ); |
---|
| 1304 | |
---|
[56] | 1305 | memcpy( rpcCU->getMVPIdx(REF_PIC_LIST_0) + m_uiAbsIdxInLCU, m_apiMVPIdx[0], iSizeInUchar ); |
---|
| 1306 | memcpy( rpcCU->getMVPIdx(REF_PIC_LIST_1) + m_uiAbsIdxInLCU, m_apiMVPIdx[1], iSizeInUchar ); |
---|
| 1307 | memcpy( rpcCU->getMVPNum(REF_PIC_LIST_0) + m_uiAbsIdxInLCU, m_apiMVPNum[0], iSizeInUchar ); |
---|
| 1308 | memcpy( rpcCU->getMVPNum(REF_PIC_LIST_1) + m_uiAbsIdxInLCU, m_apiMVPNum[1], iSizeInUchar ); |
---|
[2] | 1309 | |
---|
| 1310 | m_acCUMvField[0].copyTo( rpcCU->getCUMvField( REF_PIC_LIST_0 ), m_uiAbsIdxInLCU ); |
---|
| 1311 | m_acCUMvField[1].copyTo( rpcCU->getCUMvField( REF_PIC_LIST_1 ), m_uiAbsIdxInLCU ); |
---|
| 1312 | |
---|
[56] | 1313 | memcpy( rpcCU->getIPCMFlag() + m_uiAbsIdxInLCU, m_pbIPCMFlag, iSizeInBool ); |
---|
| 1314 | |
---|
[2] | 1315 | UInt uiTmp = (g_uiMaxCUWidth*g_uiMaxCUHeight)>>(uhDepth<<1); |
---|
| 1316 | UInt uiTmp2 = m_uiAbsIdxInLCU*m_pcPic->getMinCUWidth()*m_pcPic->getMinCUHeight(); |
---|
| 1317 | memcpy( rpcCU->getCoeffY() + uiTmp2, m_pcTrCoeffY, sizeof(TCoeff)*uiTmp ); |
---|
[56] | 1318 | #if ADAPTIVE_QP_SELECTION |
---|
| 1319 | memcpy( rpcCU->getArlCoeffY() + uiTmp2, m_pcArlCoeffY, sizeof(Int)*uiTmp ); |
---|
| 1320 | #endif |
---|
| 1321 | memcpy( rpcCU->getPCMSampleY() + uiTmp2 , m_pcIPCMSampleY, sizeof(Pel)*uiTmp ); |
---|
| 1322 | |
---|
[2] | 1323 | uiTmp >>= 2; uiTmp2 >>= 2; |
---|
| 1324 | memcpy( rpcCU->getCoeffCb() + uiTmp2, m_pcTrCoeffCb, sizeof(TCoeff)*uiTmp ); |
---|
| 1325 | memcpy( rpcCU->getCoeffCr() + uiTmp2, m_pcTrCoeffCr, sizeof(TCoeff)*uiTmp ); |
---|
[56] | 1326 | #if ADAPTIVE_QP_SELECTION |
---|
| 1327 | memcpy( rpcCU->getArlCoeffCb() + uiTmp2, m_pcArlCoeffCb, sizeof(Int)*uiTmp ); |
---|
| 1328 | memcpy( rpcCU->getArlCoeffCr() + uiTmp2, m_pcArlCoeffCr, sizeof(Int)*uiTmp ); |
---|
| 1329 | #endif |
---|
| 1330 | memcpy( rpcCU->getPCMSampleCb() + uiTmp2 , m_pcIPCMSampleCb, sizeof( Pel ) * uiTmp ); |
---|
| 1331 | memcpy( rpcCU->getPCMSampleCr() + uiTmp2 , m_pcIPCMSampleCr, sizeof( Pel ) * uiTmp ); |
---|
| 1332 | rpcCU->getTotalBins() = m_uiTotalBins; |
---|
| 1333 | memcpy( rpcCU->m_uiSliceStartCU + m_uiAbsIdxInLCU, m_uiSliceStartCU, sizeof( UInt ) * m_uiNumPartition ); |
---|
| 1334 | memcpy( rpcCU->m_uiEntropySliceStartCU + m_uiAbsIdxInLCU, m_uiEntropySliceStartCU, sizeof( UInt ) * m_uiNumPartition ); |
---|
[2] | 1335 | |
---|
[5] | 1336 | #if HHI_DMM_WEDGE_INTRA |
---|
[56] | 1337 | memcpy( rpcCU->getWedgeFullTabIdx() + m_uiAbsIdxInLCU, m_puiWedgeFullTabIdx, sizeof( UInt ) * m_uiNumPartition ); |
---|
| 1338 | memcpy( rpcCU->getWedgeFullDeltaDC1() + m_uiAbsIdxInLCU, m_piWedgeFullDeltaDC1, sizeof( Int ) * m_uiNumPartition ); |
---|
| 1339 | memcpy( rpcCU->getWedgeFullDeltaDC2() + m_uiAbsIdxInLCU, m_piWedgeFullDeltaDC2, sizeof( Int ) * m_uiNumPartition ); |
---|
[2] | 1340 | |
---|
[56] | 1341 | memcpy( rpcCU->getWedgePredDirTabIdx() + m_uiAbsIdxInLCU, m_puiWedgePredDirTabIdx, sizeof( UInt ) * m_uiNumPartition ); |
---|
| 1342 | memcpy( rpcCU->getWedgePredDirDeltaDC1() + m_uiAbsIdxInLCU, m_piWedgePredDirDeltaDC1, sizeof( Int ) * m_uiNumPartition ); |
---|
| 1343 | memcpy( rpcCU->getWedgePredDirDeltaDC2() + m_uiAbsIdxInLCU, m_piWedgePredDirDeltaDC2, sizeof( Int ) * m_uiNumPartition ); |
---|
| 1344 | memcpy( rpcCU->getWedgePredDirDeltaEnd() + m_uiAbsIdxInLCU, m_piWedgePredDirDeltaEnd, sizeof( Int ) * m_uiNumPartition ); |
---|
[5] | 1345 | #endif |
---|
| 1346 | #if HHI_DMM_PRED_TEX |
---|
[56] | 1347 | memcpy( rpcCU->getWedgePredTexTabIdx() + m_uiAbsIdxInLCU, m_puiWedgePredTexTabIdx, sizeof( UInt ) * m_uiNumPartition ); |
---|
| 1348 | memcpy( rpcCU->getWedgePredTexDeltaDC1() + m_uiAbsIdxInLCU, m_piWedgePredTexDeltaDC1, sizeof( Int ) * m_uiNumPartition ); |
---|
| 1349 | memcpy( rpcCU->getWedgePredTexDeltaDC2() + m_uiAbsIdxInLCU, m_piWedgePredTexDeltaDC2, sizeof( Int ) * m_uiNumPartition ); |
---|
[2] | 1350 | |
---|
[56] | 1351 | memcpy( rpcCU->getContourPredTexDeltaDC1() + m_uiAbsIdxInLCU, m_piContourPredTexDeltaDC1, sizeof( Int ) * m_uiNumPartition ); |
---|
| 1352 | memcpy( rpcCU->getContourPredTexDeltaDC2() + m_uiAbsIdxInLCU, m_piContourPredTexDeltaDC2, sizeof( Int ) * m_uiNumPartition ); |
---|
[2] | 1353 | #endif |
---|
[5] | 1354 | #if HHI_MPI |
---|
[56] | 1355 | memcpy( rpcCU->getTextureModeDepth() + m_uiAbsIdxInLCU, m_piTextureModeDepth, sizeof( Int ) * m_uiNumPartition ); |
---|
[5] | 1356 | #endif |
---|
[2] | 1357 | } |
---|
| 1358 | |
---|
| 1359 | Void TComDataCU::copyToPic( UChar uhDepth, UInt uiPartIdx, UInt uiPartDepth ) |
---|
| 1360 | { |
---|
| 1361 | TComDataCU*& rpcCU = m_pcPic->getCU( m_uiCUAddr ); |
---|
| 1362 | UInt uiQNumPart = m_uiNumPartition>>(uiPartDepth<<1); |
---|
| 1363 | |
---|
| 1364 | UInt uiPartStart = uiPartIdx*uiQNumPart; |
---|
| 1365 | UInt uiPartOffset = m_uiAbsIdxInLCU + uiPartStart; |
---|
| 1366 | |
---|
| 1367 | rpcCU->getTotalCost() = m_dTotalCost; |
---|
| 1368 | rpcCU->getTotalDistortion() = m_uiTotalDistortion; |
---|
| 1369 | rpcCU->getTotalBits() = m_uiTotalBits; |
---|
| 1370 | |
---|
| 1371 | Int iSizeInUchar = sizeof( UChar ) * uiQNumPart; |
---|
| 1372 | Int iSizeInBool = sizeof( Bool ) * uiQNumPart; |
---|
| 1373 | |
---|
[56] | 1374 | #if H0736_AVC_STYLE_QP_RANGE |
---|
| 1375 | Int sizeInChar = sizeof( Char ) * uiQNumPart; |
---|
| 1376 | memcpy( rpcCU->getQP() + uiPartOffset, m_phQP, sizeInChar ); |
---|
| 1377 | #else |
---|
[2] | 1378 | memcpy( rpcCU->getQP() + uiPartOffset, m_phQP, iSizeInUchar ); |
---|
[56] | 1379 | #endif |
---|
| 1380 | memcpy( rpcCU->getPartitionSize() + uiPartOffset, m_pePartSize, sizeof( *m_pePartSize ) * uiQNumPart ); |
---|
| 1381 | #if HHI_INTERVIEW_SKIP |
---|
| 1382 | memcpy( rpcCU->getRenderable() + uiPartOffset, m_pbRenderable, iSizeInBool ); |
---|
| 1383 | #endif |
---|
| 1384 | memcpy( rpcCU->getPredictionMode() + uiPartOffset, m_pePredMode, sizeof( *m_pePredMode ) * uiQNumPart ); |
---|
[2] | 1385 | |
---|
[56] | 1386 | memcpy( rpcCU->getAlfCtrlFlag() + uiPartOffset, m_puiAlfCtrlFlag, iSizeInBool ); |
---|
[2] | 1387 | memcpy( rpcCU->getMergeFlag() + uiPartOffset, m_pbMergeFlag, iSizeInBool ); |
---|
| 1388 | memcpy( rpcCU->getMergeIndex() + uiPartOffset, m_puhMergeIndex, iSizeInUchar ); |
---|
[5] | 1389 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
[2] | 1390 | memcpy( rpcCU->getResPredAvail() + uiPartOffset, m_pbResPredAvailable, iSizeInBool ); |
---|
| 1391 | memcpy( rpcCU->getResPredFlag() + uiPartOffset, m_pbResPredFlag, iSizeInBool ); |
---|
[5] | 1392 | #endif |
---|
[2] | 1393 | memcpy( rpcCU->getLumaIntraDir() + uiPartOffset, m_puhLumaIntraDir, iSizeInUchar ); |
---|
| 1394 | memcpy( rpcCU->getChromaIntraDir() + uiPartOffset, m_puhChromaIntraDir, iSizeInUchar ); |
---|
| 1395 | memcpy( rpcCU->getInterDir() + uiPartOffset, m_puhInterDir, iSizeInUchar ); |
---|
| 1396 | memcpy( rpcCU->getTransformIdx() + uiPartOffset, m_puhTrIdx, iSizeInUchar ); |
---|
[56] | 1397 | memcpy( rpcCU->getNSQTPartIdx() + uiPartOffset, m_nsqtPartIdx, iSizeInUchar ); |
---|
[2] | 1398 | |
---|
| 1399 | memcpy( rpcCU->getCbf(TEXT_LUMA) + uiPartOffset, m_puhCbf[0], iSizeInUchar ); |
---|
| 1400 | memcpy( rpcCU->getCbf(TEXT_CHROMA_U) + uiPartOffset, m_puhCbf[1], iSizeInUchar ); |
---|
| 1401 | memcpy( rpcCU->getCbf(TEXT_CHROMA_V) + uiPartOffset, m_puhCbf[2], iSizeInUchar ); |
---|
| 1402 | |
---|
| 1403 | memcpy( rpcCU->getDepth() + uiPartOffset, m_puhDepth, iSizeInUchar ); |
---|
| 1404 | memcpy( rpcCU->getWidth() + uiPartOffset, m_puhWidth, iSizeInUchar ); |
---|
| 1405 | memcpy( rpcCU->getHeight() + uiPartOffset, m_puhHeight, iSizeInUchar ); |
---|
| 1406 | |
---|
[56] | 1407 | memcpy( rpcCU->getMVPIdx(REF_PIC_LIST_0) + uiPartOffset, m_apiMVPIdx[0], iSizeInUchar ); |
---|
| 1408 | memcpy( rpcCU->getMVPIdx(REF_PIC_LIST_1) + uiPartOffset, m_apiMVPIdx[1], iSizeInUchar ); |
---|
| 1409 | memcpy( rpcCU->getMVPNum(REF_PIC_LIST_0) + uiPartOffset, m_apiMVPNum[0], iSizeInUchar ); |
---|
| 1410 | memcpy( rpcCU->getMVPNum(REF_PIC_LIST_1) + uiPartOffset, m_apiMVPNum[1], iSizeInUchar ); |
---|
[2] | 1411 | m_acCUMvField[0].copyTo( rpcCU->getCUMvField( REF_PIC_LIST_0 ), m_uiAbsIdxInLCU, uiPartStart, uiQNumPart ); |
---|
| 1412 | m_acCUMvField[1].copyTo( rpcCU->getCUMvField( REF_PIC_LIST_1 ), m_uiAbsIdxInLCU, uiPartStart, uiQNumPart ); |
---|
| 1413 | |
---|
[56] | 1414 | memcpy( rpcCU->getIPCMFlag() + uiPartOffset, m_pbIPCMFlag, iSizeInBool ); |
---|
| 1415 | |
---|
[2] | 1416 | UInt uiTmp = (g_uiMaxCUWidth*g_uiMaxCUHeight)>>((uhDepth+uiPartDepth)<<1); |
---|
| 1417 | UInt uiTmp2 = uiPartOffset*m_pcPic->getMinCUWidth()*m_pcPic->getMinCUHeight(); |
---|
| 1418 | memcpy( rpcCU->getCoeffY() + uiTmp2, m_pcTrCoeffY, sizeof(TCoeff)*uiTmp ); |
---|
[56] | 1419 | #if ADAPTIVE_QP_SELECTION |
---|
| 1420 | memcpy( rpcCU->getArlCoeffY() + uiTmp2, m_pcArlCoeffY, sizeof(Int)*uiTmp ); |
---|
| 1421 | #endif |
---|
| 1422 | |
---|
| 1423 | memcpy( rpcCU->getPCMSampleY() + uiTmp2 , m_pcIPCMSampleY, sizeof( Pel ) * uiTmp ); |
---|
| 1424 | |
---|
[2] | 1425 | uiTmp >>= 2; uiTmp2 >>= 2; |
---|
| 1426 | memcpy( rpcCU->getCoeffCb() + uiTmp2, m_pcTrCoeffCb, sizeof(TCoeff)*uiTmp ); |
---|
| 1427 | memcpy( rpcCU->getCoeffCr() + uiTmp2, m_pcTrCoeffCr, sizeof(TCoeff)*uiTmp ); |
---|
[56] | 1428 | #if ADAPTIVE_QP_SELECTION |
---|
| 1429 | memcpy( rpcCU->getArlCoeffCb() + uiTmp2, m_pcArlCoeffCb, sizeof(Int)*uiTmp ); |
---|
| 1430 | memcpy( rpcCU->getArlCoeffCr() + uiTmp2, m_pcArlCoeffCr, sizeof(Int)*uiTmp ); |
---|
| 1431 | #endif |
---|
[2] | 1432 | |
---|
[56] | 1433 | memcpy( rpcCU->getPCMSampleCb() + uiTmp2 , m_pcIPCMSampleCb, sizeof( Pel ) * uiTmp ); |
---|
| 1434 | memcpy( rpcCU->getPCMSampleCr() + uiTmp2 , m_pcIPCMSampleCr, sizeof( Pel ) * uiTmp ); |
---|
| 1435 | rpcCU->getTotalBins() = m_uiTotalBins; |
---|
| 1436 | memcpy( rpcCU->m_uiSliceStartCU + uiPartOffset, m_uiSliceStartCU, sizeof( UInt ) * uiQNumPart ); |
---|
| 1437 | memcpy( rpcCU->m_uiEntropySliceStartCU + uiPartOffset, m_uiEntropySliceStartCU, sizeof( UInt ) * uiQNumPart ); |
---|
| 1438 | |
---|
[5] | 1439 | #if HHI_DMM_WEDGE_INTRA |
---|
[56] | 1440 | memcpy( rpcCU->getWedgeFullTabIdx() + uiPartOffset, m_puiWedgeFullTabIdx, sizeof( UInt ) * uiQNumPart ); |
---|
| 1441 | memcpy( rpcCU->getWedgeFullDeltaDC1() + uiPartOffset, m_piWedgeFullDeltaDC1, sizeof( Int ) * uiQNumPart ); |
---|
| 1442 | memcpy( rpcCU->getWedgeFullDeltaDC2() + uiPartOffset, m_piWedgeFullDeltaDC2, sizeof( Int ) * uiQNumPart ); |
---|
[2] | 1443 | |
---|
[56] | 1444 | memcpy( rpcCU->getWedgePredDirTabIdx() + uiPartOffset, m_puiWedgePredDirTabIdx, sizeof( UInt ) * uiQNumPart ); |
---|
| 1445 | memcpy( rpcCU->getWedgePredDirDeltaDC1() + uiPartOffset, m_piWedgePredDirDeltaDC1, sizeof( Int ) * uiQNumPart ); |
---|
| 1446 | memcpy( rpcCU->getWedgePredDirDeltaDC2() + uiPartOffset, m_piWedgePredDirDeltaDC2, sizeof( Int ) * uiQNumPart ); |
---|
| 1447 | memcpy( rpcCU->getWedgePredDirDeltaEnd() + uiPartOffset, m_piWedgePredDirDeltaEnd, sizeof( Int ) * uiQNumPart ); |
---|
[5] | 1448 | #endif |
---|
| 1449 | #if HHI_DMM_PRED_TEX |
---|
[56] | 1450 | memcpy( rpcCU->getWedgePredTexTabIdx() + uiPartOffset, m_puiWedgePredTexTabIdx, sizeof( UInt ) * uiQNumPart ); |
---|
| 1451 | memcpy( rpcCU->getWedgePredTexDeltaDC1() + uiPartOffset, m_piWedgePredTexDeltaDC1, sizeof( Int ) * uiQNumPart ); |
---|
| 1452 | memcpy( rpcCU->getWedgePredTexDeltaDC2() + uiPartOffset, m_piWedgePredTexDeltaDC2, sizeof( Int ) * uiQNumPart ); |
---|
[2] | 1453 | |
---|
[56] | 1454 | memcpy( rpcCU->getContourPredTexDeltaDC1() + uiPartOffset, m_piContourPredTexDeltaDC1, sizeof( Int ) * uiQNumPart ); |
---|
| 1455 | memcpy( rpcCU->getContourPredTexDeltaDC2() + uiPartOffset, m_piContourPredTexDeltaDC2, sizeof( Int ) * uiQNumPart ); |
---|
[2] | 1456 | #endif |
---|
[5] | 1457 | #if HHI_MPI |
---|
[56] | 1458 | memcpy( rpcCU->getTextureModeDepth() + uiPartOffset, m_piTextureModeDepth, sizeof( Int ) * uiQNumPart ); |
---|
[5] | 1459 | #endif |
---|
[2] | 1460 | } |
---|
| 1461 | |
---|
| 1462 | // -------------------------------------------------------------------------------------------------------------------- |
---|
| 1463 | // Other public functions |
---|
| 1464 | // -------------------------------------------------------------------------------------------------------------------- |
---|
| 1465 | |
---|
[56] | 1466 | TComDataCU* TComDataCU::getPULeft( UInt& uiLPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction, Bool bEnforceEntropySliceRestriction |
---|
| 1467 | , Bool bEnforceTileRestriction |
---|
| 1468 | ) |
---|
[2] | 1469 | { |
---|
| 1470 | UInt uiAbsPartIdx = g_auiZscanToRaster[uiCurrPartUnitIdx]; |
---|
| 1471 | UInt uiAbsZorderCUIdx = g_auiZscanToRaster[m_uiAbsIdxInLCU]; |
---|
| 1472 | UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth(); |
---|
| 1473 | |
---|
[56] | 1474 | if ( !RasterAddress::isZeroCol( uiAbsPartIdx, uiNumPartInCUWidth ) ) |
---|
[2] | 1475 | { |
---|
| 1476 | uiLPartUnitIdx = g_auiRasterToZscan[ uiAbsPartIdx - 1 ]; |
---|
[56] | 1477 | if ( RasterAddress::isEqualCol( uiAbsPartIdx, uiAbsZorderCUIdx, uiNumPartInCUWidth ) ) |
---|
[2] | 1478 | { |
---|
[56] | 1479 | TComDataCU* pcTempReconCU = m_pcPic->getCU( getAddr() ); |
---|
| 1480 | if ((bEnforceSliceRestriction && (pcTempReconCU==NULL || pcTempReconCU->getSlice() == NULL || pcTempReconCU->getSCUAddr()+uiLPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU (uiCurrPartUnitIdx))) |
---|
| 1481 | ||(bEnforceEntropySliceRestriction && (pcTempReconCU==NULL || pcTempReconCU->getSlice() == NULL || pcTempReconCU->getSCUAddr()+uiLPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)))) |
---|
| 1482 | { |
---|
| 1483 | return NULL; |
---|
| 1484 | } |
---|
[2] | 1485 | return m_pcPic->getCU( getAddr() ); |
---|
| 1486 | } |
---|
| 1487 | else |
---|
| 1488 | { |
---|
| 1489 | uiLPartUnitIdx -= m_uiAbsIdxInLCU; |
---|
[56] | 1490 | if ((bEnforceSliceRestriction && (this->getSCUAddr()+uiLPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU (uiCurrPartUnitIdx) || m_pcSlice==NULL)) |
---|
| 1491 | ||(bEnforceEntropySliceRestriction && (this->getSCUAddr()+uiLPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx) || m_pcSlice==NULL))) |
---|
| 1492 | { |
---|
| 1493 | return NULL; |
---|
| 1494 | } |
---|
[2] | 1495 | return this; |
---|
| 1496 | } |
---|
| 1497 | } |
---|
| 1498 | |
---|
| 1499 | uiLPartUnitIdx = g_auiRasterToZscan[ uiAbsPartIdx + uiNumPartInCUWidth - 1 ]; |
---|
[56] | 1500 | |
---|
| 1501 | |
---|
| 1502 | if ( (bEnforceSliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || m_pcCULeft->getSCUAddr()+uiLPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx))) |
---|
| 1503 | || |
---|
| 1504 | (bEnforceEntropySliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || m_pcCULeft->getSCUAddr()+uiLPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx))) |
---|
| 1505 | || |
---|
| 1506 | #if !REMOVE_TILE_DEPENDENCE |
---|
| 1507 | (bEnforceTileRestriction && ( m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) ) ) |
---|
| 1508 | #else |
---|
| 1509 | (bEnforceTileRestriction && ( m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) ) ) |
---|
| 1510 | #endif |
---|
| 1511 | ) |
---|
[2] | 1512 | { |
---|
| 1513 | return NULL; |
---|
| 1514 | } |
---|
| 1515 | return m_pcCULeft; |
---|
| 1516 | } |
---|
| 1517 | |
---|
[56] | 1518 | |
---|
| 1519 | TComDataCU* TComDataCU::getPUAbove( UInt& uiAPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction, Bool bEnforceEntropySliceRestriction, Bool MotionDataCompresssion |
---|
| 1520 | , Bool planarAtLCUBoundary |
---|
| 1521 | , Bool bEnforceTileRestriction |
---|
| 1522 | ) |
---|
[2] | 1523 | { |
---|
| 1524 | UInt uiAbsPartIdx = g_auiZscanToRaster[uiCurrPartUnitIdx]; |
---|
| 1525 | UInt uiAbsZorderCUIdx = g_auiZscanToRaster[m_uiAbsIdxInLCU]; |
---|
| 1526 | UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth(); |
---|
| 1527 | |
---|
[56] | 1528 | if ( !RasterAddress::isZeroRow( uiAbsPartIdx, uiNumPartInCUWidth ) ) |
---|
[2] | 1529 | { |
---|
| 1530 | uiAPartUnitIdx = g_auiRasterToZscan[ uiAbsPartIdx - uiNumPartInCUWidth ]; |
---|
[56] | 1531 | if ( RasterAddress::isEqualRow( uiAbsPartIdx, uiAbsZorderCUIdx, uiNumPartInCUWidth ) ) |
---|
[2] | 1532 | { |
---|
[56] | 1533 | TComDataCU* pcTempReconCU = m_pcPic->getCU( getAddr() ); |
---|
| 1534 | if ((bEnforceSliceRestriction && (pcTempReconCU==NULL || pcTempReconCU->getSlice() == NULL || pcTempReconCU->getSCUAddr()+uiAPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU (uiCurrPartUnitIdx))) |
---|
| 1535 | ||(bEnforceEntropySliceRestriction && (pcTempReconCU==NULL || pcTempReconCU->getSlice() == NULL || pcTempReconCU->getSCUAddr()+uiAPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)))) |
---|
| 1536 | { |
---|
| 1537 | return NULL; |
---|
| 1538 | } |
---|
[2] | 1539 | return m_pcPic->getCU( getAddr() ); |
---|
| 1540 | } |
---|
| 1541 | else |
---|
| 1542 | { |
---|
| 1543 | uiAPartUnitIdx -= m_uiAbsIdxInLCU; |
---|
[56] | 1544 | if ((bEnforceSliceRestriction && (this->getSCUAddr()+uiAPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU (uiCurrPartUnitIdx) || m_pcSlice==NULL)) |
---|
| 1545 | ||(bEnforceEntropySliceRestriction && (this->getSCUAddr()+uiAPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx) || m_pcSlice==NULL))) |
---|
| 1546 | { |
---|
| 1547 | return NULL; |
---|
| 1548 | } |
---|
[2] | 1549 | return this; |
---|
| 1550 | } |
---|
| 1551 | } |
---|
[56] | 1552 | |
---|
| 1553 | if(planarAtLCUBoundary) |
---|
| 1554 | { |
---|
| 1555 | return NULL; |
---|
| 1556 | } |
---|
[2] | 1557 | |
---|
| 1558 | uiAPartUnitIdx = g_auiRasterToZscan[ uiAbsPartIdx + m_pcPic->getNumPartInCU() - uiNumPartInCUWidth ]; |
---|
[56] | 1559 | if(MotionDataCompresssion) |
---|
[2] | 1560 | { |
---|
[56] | 1561 | uiAPartUnitIdx = g_motionRefer[uiAPartUnitIdx]; |
---|
| 1562 | } |
---|
| 1563 | |
---|
| 1564 | if ( (bEnforceSliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || m_pcCUAbove->getSCUAddr()+uiAPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx))) |
---|
| 1565 | || |
---|
| 1566 | (bEnforceEntropySliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || m_pcCUAbove->getSCUAddr()+uiAPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx))) |
---|
| 1567 | || |
---|
| 1568 | #if !REMOVE_TILE_DEPENDENCE |
---|
| 1569 | (bEnforceTileRestriction &&(m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())))) |
---|
| 1570 | #else |
---|
| 1571 | (bEnforceTileRestriction &&(m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())))) |
---|
| 1572 | #endif |
---|
| 1573 | ) |
---|
| 1574 | { |
---|
[2] | 1575 | return NULL; |
---|
| 1576 | } |
---|
| 1577 | return m_pcCUAbove; |
---|
| 1578 | } |
---|
| 1579 | |
---|
[56] | 1580 | TComDataCU* TComDataCU::getPUAboveLeft( UInt& uiALPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction, Bool bEnforceEntropySliceRestriction, Bool MotionDataCompresssion ) |
---|
[2] | 1581 | { |
---|
| 1582 | UInt uiAbsPartIdx = g_auiZscanToRaster[uiCurrPartUnitIdx]; |
---|
| 1583 | UInt uiAbsZorderCUIdx = g_auiZscanToRaster[m_uiAbsIdxInLCU]; |
---|
| 1584 | UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth(); |
---|
| 1585 | |
---|
[56] | 1586 | if ( !RasterAddress::isZeroCol( uiAbsPartIdx, uiNumPartInCUWidth ) ) |
---|
[2] | 1587 | { |
---|
[56] | 1588 | if ( !RasterAddress::isZeroRow( uiAbsPartIdx, uiNumPartInCUWidth ) ) |
---|
[2] | 1589 | { |
---|
| 1590 | uiALPartUnitIdx = g_auiRasterToZscan[ uiAbsPartIdx - uiNumPartInCUWidth - 1 ]; |
---|
[56] | 1591 | if ( RasterAddress::isEqualRowOrCol( uiAbsPartIdx, uiAbsZorderCUIdx, uiNumPartInCUWidth ) ) |
---|
[2] | 1592 | { |
---|
[56] | 1593 | TComDataCU* pcTempReconCU = m_pcPic->getCU( getAddr() ); |
---|
| 1594 | if ((bEnforceSliceRestriction && (pcTempReconCU==NULL || pcTempReconCU->getSlice() == NULL || pcTempReconCU->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU (uiCurrPartUnitIdx))) |
---|
| 1595 | ||(bEnforceEntropySliceRestriction && (pcTempReconCU==NULL || pcTempReconCU->getSlice() == NULL || pcTempReconCU->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)))) |
---|
| 1596 | { |
---|
| 1597 | return NULL; |
---|
| 1598 | } |
---|
[2] | 1599 | return m_pcPic->getCU( getAddr() ); |
---|
| 1600 | } |
---|
| 1601 | else |
---|
| 1602 | { |
---|
| 1603 | uiALPartUnitIdx -= m_uiAbsIdxInLCU; |
---|
[56] | 1604 | if ((bEnforceSliceRestriction && (this->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU (uiCurrPartUnitIdx) || m_pcSlice==NULL)) |
---|
| 1605 | ||(bEnforceEntropySliceRestriction && (this->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx) || m_pcSlice==NULL))) |
---|
| 1606 | { |
---|
| 1607 | return NULL; |
---|
| 1608 | } |
---|
[2] | 1609 | return this; |
---|
| 1610 | } |
---|
| 1611 | } |
---|
| 1612 | uiALPartUnitIdx = g_auiRasterToZscan[ uiAbsPartIdx + getPic()->getNumPartInCU() - uiNumPartInCUWidth - 1 ]; |
---|
[56] | 1613 | if(MotionDataCompresssion) |
---|
[2] | 1614 | { |
---|
[56] | 1615 | uiALPartUnitIdx = g_motionRefer[uiALPartUnitIdx]; |
---|
| 1616 | } |
---|
| 1617 | if ( (bEnforceSliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || |
---|
| 1618 | m_pcCUAbove->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)|| |
---|
| 1619 | #if !REMOVE_TILE_DEPENDENCE |
---|
| 1620 | (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
| 1621 | #else |
---|
| 1622 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
| 1623 | #endif |
---|
| 1624 | ))|| |
---|
| 1625 | (bEnforceEntropySliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || |
---|
| 1626 | m_pcCUAbove->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)|| |
---|
| 1627 | #if !REMOVE_TILE_DEPENDENCE |
---|
| 1628 | (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
| 1629 | #else |
---|
| 1630 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
| 1631 | #endif |
---|
| 1632 | )) |
---|
| 1633 | ) |
---|
| 1634 | { |
---|
[2] | 1635 | return NULL; |
---|
| 1636 | } |
---|
| 1637 | return m_pcCUAbove; |
---|
| 1638 | } |
---|
| 1639 | |
---|
[56] | 1640 | if ( !RasterAddress::isZeroRow( uiAbsPartIdx, uiNumPartInCUWidth ) ) |
---|
[2] | 1641 | { |
---|
| 1642 | uiALPartUnitIdx = g_auiRasterToZscan[ uiAbsPartIdx - 1 ]; |
---|
[56] | 1643 | if ( (bEnforceSliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || |
---|
| 1644 | m_pcCULeft->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)|| |
---|
| 1645 | #if !REMOVE_TILE_DEPENDENCE |
---|
| 1646 | (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
| 1647 | #else |
---|
| 1648 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
| 1649 | #endif |
---|
| 1650 | ))|| |
---|
| 1651 | (bEnforceEntropySliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || |
---|
| 1652 | m_pcCULeft->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)|| |
---|
| 1653 | #if !REMOVE_TILE_DEPENDENCE |
---|
| 1654 | (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
| 1655 | #else |
---|
| 1656 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
| 1657 | #endif |
---|
| 1658 | )) |
---|
| 1659 | ) |
---|
[2] | 1660 | { |
---|
| 1661 | return NULL; |
---|
| 1662 | } |
---|
| 1663 | return m_pcCULeft; |
---|
| 1664 | } |
---|
| 1665 | |
---|
| 1666 | uiALPartUnitIdx = g_auiRasterToZscan[ m_pcPic->getNumPartInCU() - 1 ]; |
---|
[56] | 1667 | if(MotionDataCompresssion) |
---|
[2] | 1668 | { |
---|
[56] | 1669 | uiALPartUnitIdx = g_motionRefer[uiALPartUnitIdx]; |
---|
| 1670 | } |
---|
| 1671 | if ( (bEnforceSliceRestriction && (m_pcCUAboveLeft==NULL || m_pcCUAboveLeft->getSlice()==NULL || |
---|
| 1672 | m_pcCUAboveLeft->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)|| |
---|
| 1673 | #if !REMOVE_TILE_DEPENDENCE |
---|
| 1674 | (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveLeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
| 1675 | #else |
---|
| 1676 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveLeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
| 1677 | #endif |
---|
| 1678 | ))|| |
---|
| 1679 | (bEnforceEntropySliceRestriction && (m_pcCUAboveLeft==NULL || m_pcCUAboveLeft->getSlice()==NULL || |
---|
| 1680 | m_pcCUAboveLeft->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)|| |
---|
| 1681 | #if !REMOVE_TILE_DEPENDENCE |
---|
| 1682 | (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveLeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
| 1683 | #else |
---|
| 1684 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveLeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
| 1685 | #endif |
---|
| 1686 | )) |
---|
| 1687 | ) |
---|
| 1688 | { |
---|
[2] | 1689 | return NULL; |
---|
| 1690 | } |
---|
| 1691 | return m_pcCUAboveLeft; |
---|
| 1692 | } |
---|
| 1693 | |
---|
[56] | 1694 | TComDataCU* TComDataCU::getPUAboveRight( UInt& uiARPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction, Bool bEnforceEntropySliceRestriction, Bool MotionDataCompresssion ) |
---|
[2] | 1695 | { |
---|
| 1696 | UInt uiAbsPartIdxRT = g_auiZscanToRaster[uiCurrPartUnitIdx]; |
---|
| 1697 | UInt uiAbsZorderCUIdx = g_auiZscanToRaster[ m_uiAbsIdxInLCU ] + m_puhWidth[0] / m_pcPic->getMinCUWidth() - 1; |
---|
| 1698 | UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth(); |
---|
| 1699 | |
---|
[56] | 1700 | if( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxRT] + m_pcPic->getMinCUWidth() ) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples() ) |
---|
[2] | 1701 | { |
---|
| 1702 | uiARPartUnitIdx = MAX_UINT; |
---|
| 1703 | return NULL; |
---|
| 1704 | } |
---|
| 1705 | |
---|
[56] | 1706 | if ( RasterAddress::lessThanCol( uiAbsPartIdxRT, uiNumPartInCUWidth - 1, uiNumPartInCUWidth ) ) |
---|
[2] | 1707 | { |
---|
[56] | 1708 | if ( !RasterAddress::isZeroRow( uiAbsPartIdxRT, uiNumPartInCUWidth ) ) |
---|
[2] | 1709 | { |
---|
| 1710 | if ( uiCurrPartUnitIdx > g_auiRasterToZscan[ uiAbsPartIdxRT - uiNumPartInCUWidth + 1 ] ) |
---|
| 1711 | { |
---|
| 1712 | uiARPartUnitIdx = g_auiRasterToZscan[ uiAbsPartIdxRT - uiNumPartInCUWidth + 1 ]; |
---|
[56] | 1713 | if ( RasterAddress::isEqualRowOrCol( uiAbsPartIdxRT, uiAbsZorderCUIdx, uiNumPartInCUWidth ) ) |
---|
[2] | 1714 | { |
---|
[56] | 1715 | TComDataCU* pcTempReconCU = m_pcPic->getCU( getAddr() ); |
---|
| 1716 | if ((bEnforceSliceRestriction && (pcTempReconCU==NULL || pcTempReconCU->getSlice() == NULL || pcTempReconCU->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU (uiCurrPartUnitIdx))) |
---|
| 1717 | ||(bEnforceEntropySliceRestriction && (pcTempReconCU==NULL || pcTempReconCU->getSlice() == NULL || pcTempReconCU->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)))) |
---|
| 1718 | { |
---|
| 1719 | return NULL; |
---|
| 1720 | } |
---|
[2] | 1721 | return m_pcPic->getCU( getAddr() ); |
---|
| 1722 | } |
---|
| 1723 | else |
---|
| 1724 | { |
---|
| 1725 | uiARPartUnitIdx -= m_uiAbsIdxInLCU; |
---|
[56] | 1726 | if ((bEnforceSliceRestriction && (this->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU (uiCurrPartUnitIdx) || m_pcSlice==NULL)) |
---|
| 1727 | ||(bEnforceEntropySliceRestriction && (this->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx) || m_pcSlice==NULL))) |
---|
| 1728 | { |
---|
| 1729 | return NULL; |
---|
| 1730 | } |
---|
[2] | 1731 | return this; |
---|
| 1732 | } |
---|
| 1733 | } |
---|
| 1734 | uiARPartUnitIdx = MAX_UINT; |
---|
| 1735 | return NULL; |
---|
| 1736 | } |
---|
| 1737 | uiARPartUnitIdx = g_auiRasterToZscan[ uiAbsPartIdxRT + m_pcPic->getNumPartInCU() - uiNumPartInCUWidth + 1 ]; |
---|
[56] | 1738 | if(MotionDataCompresssion) |
---|
[2] | 1739 | { |
---|
[56] | 1740 | uiARPartUnitIdx = g_motionRefer[uiARPartUnitIdx]; |
---|
| 1741 | } |
---|
| 1742 | |
---|
| 1743 | if ( (bEnforceSliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || |
---|
| 1744 | m_pcCUAbove->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)|| |
---|
| 1745 | #if !REMOVE_TILE_DEPENDENCE |
---|
| 1746 | (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
| 1747 | #else |
---|
| 1748 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
| 1749 | #endif |
---|
| 1750 | ))|| |
---|
| 1751 | (bEnforceEntropySliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || |
---|
| 1752 | m_pcCUAbove->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)|| |
---|
| 1753 | #if !REMOVE_TILE_DEPENDENCE |
---|
| 1754 | (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
| 1755 | #else |
---|
| 1756 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
| 1757 | #endif |
---|
| 1758 | )) |
---|
| 1759 | ) |
---|
| 1760 | { |
---|
[2] | 1761 | return NULL; |
---|
| 1762 | } |
---|
| 1763 | return m_pcCUAbove; |
---|
| 1764 | } |
---|
| 1765 | |
---|
[56] | 1766 | if ( !RasterAddress::isZeroRow( uiAbsPartIdxRT, uiNumPartInCUWidth ) ) |
---|
[2] | 1767 | { |
---|
| 1768 | uiARPartUnitIdx = MAX_UINT; |
---|
| 1769 | return NULL; |
---|
| 1770 | } |
---|
| 1771 | |
---|
| 1772 | uiARPartUnitIdx = g_auiRasterToZscan[ m_pcPic->getNumPartInCU() - uiNumPartInCUWidth ]; |
---|
[56] | 1773 | if(MotionDataCompresssion) |
---|
[2] | 1774 | { |
---|
[56] | 1775 | uiARPartUnitIdx = g_motionRefer[uiARPartUnitIdx]; |
---|
| 1776 | } |
---|
| 1777 | if ( (bEnforceSliceRestriction && (m_pcCUAboveRight==NULL || m_pcCUAboveRight->getSlice()==NULL || |
---|
| 1778 | m_pcPic->getPicSym()->getInverseCUOrderMap( m_pcCUAboveRight->getAddr()) > m_pcPic->getPicSym()->getInverseCUOrderMap( getAddr()) || |
---|
| 1779 | m_pcCUAboveRight->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)|| |
---|
| 1780 | #if !REMOVE_TILE_DEPENDENCE |
---|
| 1781 | (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
| 1782 | #else |
---|
| 1783 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
| 1784 | #endif |
---|
| 1785 | ))|| |
---|
| 1786 | (bEnforceEntropySliceRestriction && (m_pcCUAboveRight==NULL || m_pcCUAboveRight->getSlice()==NULL || |
---|
| 1787 | m_pcPic->getPicSym()->getInverseCUOrderMap( m_pcCUAboveRight->getAddr()) > m_pcPic->getPicSym()->getInverseCUOrderMap( getAddr()) || |
---|
| 1788 | m_pcCUAboveRight->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)|| |
---|
| 1789 | #if !REMOVE_TILE_DEPENDENCE |
---|
| 1790 | (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
| 1791 | #else |
---|
| 1792 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
| 1793 | #endif |
---|
| 1794 | )) |
---|
| 1795 | ) |
---|
| 1796 | { |
---|
[2] | 1797 | return NULL; |
---|
| 1798 | } |
---|
| 1799 | return m_pcCUAboveRight; |
---|
| 1800 | } |
---|
| 1801 | |
---|
| 1802 | TComDataCU* TComDataCU::getPUBelowLeft( UInt& uiBLPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction, Bool bEnforceEntropySliceRestriction ) |
---|
| 1803 | { |
---|
| 1804 | UInt uiAbsPartIdxLB = g_auiZscanToRaster[uiCurrPartUnitIdx]; |
---|
| 1805 | UInt uiAbsZorderCUIdxLB = g_auiZscanToRaster[ m_uiAbsIdxInLCU ] + (m_puhHeight[0] / m_pcPic->getMinCUHeight() - 1)*m_pcPic->getNumPartInWidth(); |
---|
| 1806 | UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth(); |
---|
| 1807 | |
---|
[56] | 1808 | if( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxLB] + m_pcPic->getMinCUHeight() ) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples() ) |
---|
[2] | 1809 | { |
---|
| 1810 | uiBLPartUnitIdx = MAX_UINT; |
---|
| 1811 | return NULL; |
---|
| 1812 | } |
---|
| 1813 | |
---|
[56] | 1814 | if ( RasterAddress::lessThanRow( uiAbsPartIdxLB, m_pcPic->getNumPartInHeight() - 1, uiNumPartInCUWidth ) ) |
---|
[2] | 1815 | { |
---|
[56] | 1816 | if ( !RasterAddress::isZeroCol( uiAbsPartIdxLB, uiNumPartInCUWidth ) ) |
---|
[2] | 1817 | { |
---|
| 1818 | if ( uiCurrPartUnitIdx > g_auiRasterToZscan[ uiAbsPartIdxLB + uiNumPartInCUWidth - 1 ] ) |
---|
| 1819 | { |
---|
| 1820 | uiBLPartUnitIdx = g_auiRasterToZscan[ uiAbsPartIdxLB + uiNumPartInCUWidth - 1 ]; |
---|
[56] | 1821 | if ( RasterAddress::isEqualRowOrCol( uiAbsPartIdxLB, uiAbsZorderCUIdxLB, uiNumPartInCUWidth ) ) |
---|
[2] | 1822 | { |
---|
[56] | 1823 | TComDataCU* pcTempReconCU = m_pcPic->getCU( getAddr() ); |
---|
| 1824 | if ((bEnforceSliceRestriction && (pcTempReconCU==NULL || pcTempReconCU->getSlice() == NULL || pcTempReconCU->getSCUAddr()+uiBLPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU (uiCurrPartUnitIdx))) |
---|
| 1825 | ||(bEnforceEntropySliceRestriction && (pcTempReconCU==NULL || pcTempReconCU->getSlice() == NULL || pcTempReconCU->getSCUAddr()+uiBLPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)))) |
---|
| 1826 | { |
---|
| 1827 | return NULL; |
---|
| 1828 | } |
---|
[2] | 1829 | return m_pcPic->getCU( getAddr() ); |
---|
| 1830 | } |
---|
| 1831 | else |
---|
| 1832 | { |
---|
| 1833 | uiBLPartUnitIdx -= m_uiAbsIdxInLCU; |
---|
[56] | 1834 | if ((bEnforceSliceRestriction && (this->getSCUAddr()+uiBLPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU (uiCurrPartUnitIdx) || m_pcSlice==NULL)) |
---|
| 1835 | ||(bEnforceEntropySliceRestriction && (this->getSCUAddr()+uiBLPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx) || m_pcSlice==NULL))) |
---|
| 1836 | { |
---|
| 1837 | return NULL; |
---|
| 1838 | } |
---|
[2] | 1839 | return this; |
---|
| 1840 | } |
---|
| 1841 | } |
---|
| 1842 | uiBLPartUnitIdx = MAX_UINT; |
---|
| 1843 | return NULL; |
---|
| 1844 | } |
---|
| 1845 | uiBLPartUnitIdx = g_auiRasterToZscan[ uiAbsPartIdxLB + uiNumPartInCUWidth*2 - 1 ]; |
---|
[56] | 1846 | if ( (bEnforceSliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || |
---|
| 1847 | m_pcCULeft->getSCUAddr()+uiBLPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)|| |
---|
| 1848 | #if !REMOVE_TILE_DEPENDENCE |
---|
| 1849 | (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
| 1850 | #else |
---|
| 1851 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
| 1852 | #endif |
---|
| 1853 | ))|| |
---|
| 1854 | (bEnforceEntropySliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || |
---|
| 1855 | m_pcCULeft->getSCUAddr()+uiBLPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)|| |
---|
| 1856 | #if !REMOVE_TILE_DEPENDENCE |
---|
| 1857 | (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
| 1858 | #else |
---|
| 1859 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
| 1860 | #endif |
---|
| 1861 | )) |
---|
| 1862 | ) |
---|
[2] | 1863 | { |
---|
| 1864 | return NULL; |
---|
| 1865 | } |
---|
| 1866 | return m_pcCULeft; |
---|
| 1867 | } |
---|
| 1868 | |
---|
| 1869 | uiBLPartUnitIdx = MAX_UINT; |
---|
| 1870 | return NULL; |
---|
| 1871 | } |
---|
| 1872 | |
---|
| 1873 | TComDataCU* TComDataCU::getPUBelowLeftAdi(UInt& uiBLPartUnitIdx, UInt uiPuHeight, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset, Bool bEnforceSliceRestriction, Bool bEnforceEntropySliceRestriction ) |
---|
| 1874 | { |
---|
| 1875 | UInt uiAbsPartIdxLB = g_auiZscanToRaster[uiCurrPartUnitIdx]; |
---|
| 1876 | UInt uiAbsZorderCUIdxLB = g_auiZscanToRaster[ m_uiAbsIdxInLCU ] + ((m_puhHeight[0] / m_pcPic->getMinCUHeight()) - 1)*m_pcPic->getNumPartInWidth(); |
---|
| 1877 | UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth(); |
---|
| 1878 | |
---|
[56] | 1879 | if( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxLB] + (m_pcPic->getPicSym()->getMinCUHeight() * uiPartUnitOffset)) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples()) |
---|
[2] | 1880 | { |
---|
| 1881 | uiBLPartUnitIdx = MAX_UINT; |
---|
| 1882 | return NULL; |
---|
| 1883 | } |
---|
| 1884 | |
---|
[56] | 1885 | if ( RasterAddress::lessThanRow( uiAbsPartIdxLB, m_pcPic->getNumPartInHeight() - uiPartUnitOffset, uiNumPartInCUWidth ) ) |
---|
[2] | 1886 | { |
---|
[56] | 1887 | if ( !RasterAddress::isZeroCol( uiAbsPartIdxLB, uiNumPartInCUWidth ) ) |
---|
[2] | 1888 | { |
---|
| 1889 | if ( uiCurrPartUnitIdx > g_auiRasterToZscan[ uiAbsPartIdxLB + uiPartUnitOffset * uiNumPartInCUWidth - 1 ] ) |
---|
| 1890 | { |
---|
| 1891 | uiBLPartUnitIdx = g_auiRasterToZscan[ uiAbsPartIdxLB + uiPartUnitOffset * uiNumPartInCUWidth - 1 ]; |
---|
[56] | 1892 | if ( RasterAddress::isEqualRowOrCol( uiAbsPartIdxLB, uiAbsZorderCUIdxLB, uiNumPartInCUWidth ) ) |
---|
[2] | 1893 | { |
---|
[56] | 1894 | TComDataCU* pcTempReconCU = m_pcPic->getCU( getAddr() ); |
---|
| 1895 | if ((bEnforceSliceRestriction && (pcTempReconCU==NULL || pcTempReconCU->getSlice() == NULL || pcTempReconCU->getSCUAddr()+uiBLPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU (uiCurrPartUnitIdx))) |
---|
| 1896 | ||(bEnforceEntropySliceRestriction && (pcTempReconCU==NULL || pcTempReconCU->getSlice() == NULL || pcTempReconCU->getSCUAddr()+uiBLPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)))) |
---|
| 1897 | { |
---|
| 1898 | return NULL; |
---|
| 1899 | } |
---|
[2] | 1900 | return m_pcPic->getCU( getAddr() ); |
---|
| 1901 | } |
---|
| 1902 | else |
---|
| 1903 | { |
---|
| 1904 | uiBLPartUnitIdx -= m_uiAbsIdxInLCU; |
---|
[56] | 1905 | if ((bEnforceSliceRestriction && (this->getSCUAddr()+uiBLPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU (uiCurrPartUnitIdx) || m_pcSlice==NULL)) |
---|
| 1906 | ||(bEnforceEntropySliceRestriction && (this->getSCUAddr()+uiBLPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx) || m_pcSlice==NULL))) |
---|
| 1907 | { |
---|
| 1908 | return NULL; |
---|
| 1909 | } |
---|
[2] | 1910 | return this; |
---|
| 1911 | } |
---|
| 1912 | } |
---|
| 1913 | uiBLPartUnitIdx = MAX_UINT; |
---|
| 1914 | return NULL; |
---|
| 1915 | } |
---|
| 1916 | uiBLPartUnitIdx = g_auiRasterToZscan[ uiAbsPartIdxLB + (1+uiPartUnitOffset) * uiNumPartInCUWidth - 1 ]; |
---|
[56] | 1917 | if ( (bEnforceSliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || |
---|
| 1918 | m_pcCULeft->getSCUAddr()+uiBLPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)|| |
---|
| 1919 | #if !REMOVE_TILE_DEPENDENCE |
---|
| 1920 | (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
[2] | 1921 | #else |
---|
[56] | 1922 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
[2] | 1923 | #endif |
---|
[56] | 1924 | ))|| |
---|
| 1925 | (bEnforceEntropySliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || |
---|
| 1926 | m_pcCULeft->getSCUAddr()+uiBLPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)|| |
---|
| 1927 | #if !REMOVE_TILE_DEPENDENCE |
---|
| 1928 | (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
| 1929 | #else |
---|
| 1930 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
| 1931 | #endif |
---|
| 1932 | )) |
---|
| 1933 | ) |
---|
[2] | 1934 | { |
---|
| 1935 | return NULL; |
---|
| 1936 | } |
---|
| 1937 | return m_pcCULeft; |
---|
| 1938 | } |
---|
| 1939 | |
---|
| 1940 | uiBLPartUnitIdx = MAX_UINT; |
---|
| 1941 | return NULL; |
---|
| 1942 | } |
---|
| 1943 | |
---|
| 1944 | TComDataCU* TComDataCU::getPUAboveRightAdi(UInt& uiARPartUnitIdx, UInt uiPuWidth, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset, Bool bEnforceSliceRestriction, Bool bEnforceEntropySliceRestriction ) |
---|
| 1945 | { |
---|
| 1946 | UInt uiAbsPartIdxRT = g_auiZscanToRaster[uiCurrPartUnitIdx]; |
---|
| 1947 | UInt uiAbsZorderCUIdx = g_auiZscanToRaster[ m_uiAbsIdxInLCU ] + (m_puhWidth[0] / m_pcPic->getMinCUWidth()) - 1; |
---|
| 1948 | UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth(); |
---|
| 1949 | |
---|
[56] | 1950 | if( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxRT] + (m_pcPic->getPicSym()->getMinCUHeight() * uiPartUnitOffset)) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples() ) |
---|
[2] | 1951 | { |
---|
| 1952 | uiARPartUnitIdx = MAX_UINT; |
---|
| 1953 | return NULL; |
---|
| 1954 | } |
---|
| 1955 | |
---|
[56] | 1956 | if ( RasterAddress::lessThanCol( uiAbsPartIdxRT, uiNumPartInCUWidth - uiPartUnitOffset, uiNumPartInCUWidth ) ) |
---|
[2] | 1957 | { |
---|
[56] | 1958 | if ( !RasterAddress::isZeroRow( uiAbsPartIdxRT, uiNumPartInCUWidth ) ) |
---|
[2] | 1959 | { |
---|
| 1960 | if ( uiCurrPartUnitIdx > g_auiRasterToZscan[ uiAbsPartIdxRT - uiNumPartInCUWidth + uiPartUnitOffset ] ) |
---|
| 1961 | { |
---|
| 1962 | uiARPartUnitIdx = g_auiRasterToZscan[ uiAbsPartIdxRT - uiNumPartInCUWidth + uiPartUnitOffset ]; |
---|
[56] | 1963 | if ( RasterAddress::isEqualRowOrCol( uiAbsPartIdxRT, uiAbsZorderCUIdx, uiNumPartInCUWidth ) ) |
---|
[2] | 1964 | { |
---|
[56] | 1965 | TComDataCU* pcTempReconCU = m_pcPic->getCU( getAddr() ); |
---|
| 1966 | if ((bEnforceSliceRestriction && (pcTempReconCU==NULL || pcTempReconCU->getSlice() == NULL || pcTempReconCU->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx))) |
---|
| 1967 | ||( bEnforceEntropySliceRestriction && (pcTempReconCU==NULL || pcTempReconCU->getSlice() == NULL || pcTempReconCU->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)))) |
---|
| 1968 | |
---|
| 1969 | { |
---|
| 1970 | return NULL; |
---|
| 1971 | } |
---|
[2] | 1972 | return m_pcPic->getCU( getAddr() ); |
---|
| 1973 | } |
---|
| 1974 | else |
---|
| 1975 | { |
---|
| 1976 | uiARPartUnitIdx -= m_uiAbsIdxInLCU; |
---|
[56] | 1977 | if ((bEnforceSliceRestriction && (this->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx) || m_pcSlice==NULL)) |
---|
| 1978 | ||(bEnforceEntropySliceRestriction && (this->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx) || m_pcSlice==NULL))) |
---|
| 1979 | { |
---|
| 1980 | return NULL; |
---|
| 1981 | } |
---|
[2] | 1982 | return this; |
---|
| 1983 | } |
---|
| 1984 | } |
---|
| 1985 | uiARPartUnitIdx = MAX_UINT; |
---|
| 1986 | return NULL; |
---|
| 1987 | } |
---|
| 1988 | uiARPartUnitIdx = g_auiRasterToZscan[ uiAbsPartIdxRT + m_pcPic->getNumPartInCU() - uiNumPartInCUWidth + uiPartUnitOffset ]; |
---|
[56] | 1989 | if ( (bEnforceSliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || |
---|
| 1990 | m_pcCUAbove->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)|| |
---|
| 1991 | #if !REMOVE_TILE_DEPENDENCE |
---|
| 1992 | (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
[2] | 1993 | #else |
---|
[56] | 1994 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
[2] | 1995 | #endif |
---|
[56] | 1996 | ))|| |
---|
| 1997 | (bEnforceEntropySliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || |
---|
| 1998 | m_pcCUAbove->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)|| |
---|
| 1999 | #if !REMOVE_TILE_DEPENDENCE |
---|
| 2000 | (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
| 2001 | #else |
---|
| 2002 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
| 2003 | #endif |
---|
| 2004 | )) |
---|
| 2005 | ) |
---|
[2] | 2006 | { |
---|
| 2007 | return NULL; |
---|
| 2008 | } |
---|
| 2009 | return m_pcCUAbove; |
---|
| 2010 | } |
---|
| 2011 | |
---|
[56] | 2012 | if ( !RasterAddress::isZeroRow( uiAbsPartIdxRT, uiNumPartInCUWidth ) ) |
---|
[2] | 2013 | { |
---|
| 2014 | uiARPartUnitIdx = MAX_UINT; |
---|
| 2015 | return NULL; |
---|
| 2016 | } |
---|
| 2017 | |
---|
| 2018 | uiARPartUnitIdx = g_auiRasterToZscan[ m_pcPic->getNumPartInCU() - uiNumPartInCUWidth + uiPartUnitOffset-1 ]; |
---|
[56] | 2019 | if ( (bEnforceSliceRestriction && (m_pcCUAboveRight==NULL || m_pcCUAboveRight->getSlice()==NULL || |
---|
| 2020 | m_pcPic->getPicSym()->getInverseCUOrderMap( m_pcCUAboveRight->getAddr()) > m_pcPic->getPicSym()->getInverseCUOrderMap( getAddr()) || |
---|
| 2021 | m_pcCUAboveRight->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)|| |
---|
| 2022 | #if !REMOVE_TILE_DEPENDENCE |
---|
| 2023 | (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
[2] | 2024 | #else |
---|
[56] | 2025 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
[2] | 2026 | #endif |
---|
[56] | 2027 | ))|| |
---|
| 2028 | (bEnforceEntropySliceRestriction && (m_pcCUAboveRight==NULL || m_pcCUAboveRight->getSlice()==NULL || |
---|
| 2029 | m_pcPic->getPicSym()->getInverseCUOrderMap( m_pcCUAboveRight->getAddr()) > m_pcPic->getPicSym()->getInverseCUOrderMap( getAddr()) || |
---|
| 2030 | m_pcCUAboveRight->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)|| |
---|
| 2031 | #if !REMOVE_TILE_DEPENDENCE |
---|
| 2032 | (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
| 2033 | #else |
---|
| 2034 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
| 2035 | #endif |
---|
| 2036 | )) |
---|
| 2037 | ) |
---|
[2] | 2038 | { |
---|
| 2039 | return NULL; |
---|
| 2040 | } |
---|
| 2041 | return m_pcCUAboveRight; |
---|
| 2042 | } |
---|
| 2043 | |
---|
[56] | 2044 | /** Get left QpMinCu |
---|
| 2045 | *\param uiLPartUnitIdx |
---|
| 2046 | *\param uiCurrAbsIdxInLCU |
---|
| 2047 | *\param bEnforceSliceRestriction |
---|
| 2048 | *\param bEnforceEntropySliceRestriction |
---|
| 2049 | *\returns TComDataCU* point of TComDataCU of left QpMinCu |
---|
| 2050 | */ |
---|
| 2051 | TComDataCU* TComDataCU::getQpMinCuLeft( UInt& uiLPartUnitIdx, UInt uiCurrAbsIdxInLCU, Bool bEnforceSliceRestriction, Bool bEnforceEntropySliceRestriction) |
---|
[2] | 2052 | { |
---|
[56] | 2053 | UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth(); |
---|
[2] | 2054 | |
---|
[56] | 2055 | UInt uiAbsRorderQpMinCUIdx = g_auiZscanToRaster[(uiCurrAbsIdxInLCU>>(8-(getSlice()->getPPS()->getMaxCuDQPDepth()<<1)))<<(8-(getSlice()->getPPS()->getMaxCuDQPDepth()<<1))]; |
---|
| 2056 | UInt uiNumPartInQpMinCUWidth = getSlice()->getPPS()->getMinCuDQPSize()>>2; |
---|
| 2057 | |
---|
| 2058 | UInt uiAbsZorderQpMinCUIdx = (uiCurrAbsIdxInLCU>>(8-(getSlice()->getPPS()->getMaxCuDQPDepth()<<1)))<<(8-(getSlice()->getPPS()->getMaxCuDQPDepth()<<1)); |
---|
| 2059 | if( (uiCurrAbsIdxInLCU != uiAbsZorderQpMinCUIdx) && |
---|
| 2060 | ((bEnforceSliceRestriction && (m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrAbsIdxInLCU) != m_pcPic->getCU( getAddr() )->getSliceStartCU (uiAbsZorderQpMinCUIdx))) || |
---|
| 2061 | (bEnforceEntropySliceRestriction &&(m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrAbsIdxInLCU) != m_pcPic->getCU( getAddr() )->getEntropySliceStartCU (uiAbsZorderQpMinCUIdx)) )) ) |
---|
[2] | 2062 | { |
---|
[56] | 2063 | return NULL; |
---|
[2] | 2064 | } |
---|
| 2065 | |
---|
[56] | 2066 | if ( !RasterAddress::isZeroCol( uiAbsRorderQpMinCUIdx, uiNumPartInCUWidth ) ) |
---|
[2] | 2067 | { |
---|
[56] | 2068 | uiLPartUnitIdx = g_auiRasterToZscan[ uiAbsRorderQpMinCUIdx - uiNumPartInQpMinCUWidth ]; |
---|
| 2069 | TComDataCU* pcTempReconCU = m_pcPic->getCU( getAddr() ); |
---|
| 2070 | if ((bEnforceSliceRestriction && (pcTempReconCU==NULL || pcTempReconCU->getSlice() == NULL || pcTempReconCU->getSCUAddr()+uiLPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU (uiAbsZorderQpMinCUIdx))) |
---|
| 2071 | ||(bEnforceEntropySliceRestriction && (pcTempReconCU==NULL || pcTempReconCU->getSlice() == NULL || pcTempReconCU->getSCUAddr()+uiLPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiAbsZorderQpMinCUIdx)))) |
---|
| 2072 | { |
---|
| 2073 | return NULL; |
---|
| 2074 | } |
---|
| 2075 | return m_pcPic->getCU( getAddr() ); |
---|
[2] | 2076 | } |
---|
| 2077 | |
---|
[56] | 2078 | uiLPartUnitIdx = g_auiRasterToZscan[ uiAbsRorderQpMinCUIdx + uiNumPartInCUWidth - uiNumPartInQpMinCUWidth ]; |
---|
[2] | 2079 | |
---|
[56] | 2080 | if ( (bEnforceSliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || |
---|
| 2081 | m_pcCULeft->getSCUAddr()+uiLPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiAbsZorderQpMinCUIdx)|| |
---|
| 2082 | #if !REMOVE_TILE_DEPENDENCE |
---|
| 2083 | (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
| 2084 | #else |
---|
| 2085 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
| 2086 | #endif |
---|
| 2087 | ))|| |
---|
| 2088 | (bEnforceEntropySliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || |
---|
| 2089 | m_pcCULeft->getSCUAddr()+uiLPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiAbsZorderQpMinCUIdx)|| |
---|
| 2090 | #if !REMOVE_TILE_DEPENDENCE |
---|
| 2091 | (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
| 2092 | #else |
---|
| 2093 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
| 2094 | #endif |
---|
| 2095 | )) |
---|
| 2096 | ) |
---|
[2] | 2097 | { |
---|
[56] | 2098 | return NULL; |
---|
[2] | 2099 | } |
---|
| 2100 | |
---|
[56] | 2101 | #if H0204_QP_PREDICTION |
---|
| 2102 | if ( m_pcCULeft && m_pcCULeft->getAddr() != getAddr() ) |
---|
[2] | 2103 | { |
---|
[56] | 2104 | return NULL; |
---|
[2] | 2105 | } |
---|
[56] | 2106 | #endif |
---|
| 2107 | |
---|
| 2108 | return m_pcCULeft; |
---|
[2] | 2109 | } |
---|
| 2110 | |
---|
[56] | 2111 | #if H0204_QP_PREDICTION |
---|
| 2112 | /** Get Above QpMinCu |
---|
| 2113 | *\param aPartUnitIdx |
---|
| 2114 | *\param currAbsIdxInLCU |
---|
| 2115 | *\param enforceSliceRestriction |
---|
| 2116 | *\param enforceEntropySliceRestriction |
---|
| 2117 | *\returns TComDataCU* point of TComDataCU of above QpMinCu |
---|
| 2118 | */ |
---|
| 2119 | TComDataCU* TComDataCU::getQpMinCuAbove( UInt& aPartUnitIdx, UInt currAbsIdxInLCU, Bool enforceSliceRestriction, Bool enforceEntropySliceRestriction ) |
---|
[2] | 2120 | { |
---|
[56] | 2121 | UInt numPartInCUWidth = m_pcPic->getNumPartInWidth(); |
---|
[2] | 2122 | |
---|
[56] | 2123 | UInt absRorderQpMinCUIdx = g_auiZscanToRaster[(currAbsIdxInLCU>>(8-(getSlice()->getPPS()->getMaxCuDQPDepth()<<1)))<<(8-(getSlice()->getPPS()->getMaxCuDQPDepth()<<1))]; |
---|
| 2124 | |
---|
| 2125 | UInt absZorderQpMinCUIdx = (currAbsIdxInLCU>>(8-(getSlice()->getPPS()->getMaxCuDQPDepth()<<1)))<<(8-(getSlice()->getPPS()->getMaxCuDQPDepth()<<1)); |
---|
| 2126 | if( (currAbsIdxInLCU != absZorderQpMinCUIdx) && |
---|
| 2127 | ((enforceSliceRestriction && (m_pcPic->getCU( getAddr() )->getSliceStartCU(currAbsIdxInLCU) != m_pcPic->getCU( getAddr() )->getSliceStartCU (absZorderQpMinCUIdx))) |
---|
| 2128 | ||(enforceEntropySliceRestriction && (m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(currAbsIdxInLCU) != m_pcPic->getCU( getAddr() )->getEntropySliceStartCU (absZorderQpMinCUIdx)) )) ) |
---|
[2] | 2129 | { |
---|
[56] | 2130 | return NULL; |
---|
[2] | 2131 | } |
---|
| 2132 | |
---|
[56] | 2133 | if ( !RasterAddress::isZeroRow( absRorderQpMinCUIdx, numPartInCUWidth ) ) |
---|
[2] | 2134 | { |
---|
[56] | 2135 | aPartUnitIdx = g_auiRasterToZscan[ absRorderQpMinCUIdx - numPartInCUWidth ]; |
---|
| 2136 | TComDataCU* pcTempReconCU = m_pcPic->getCU( getAddr() ); |
---|
| 2137 | if ((enforceSliceRestriction && (pcTempReconCU==NULL || pcTempReconCU->getSlice() == NULL || pcTempReconCU->getSCUAddr()+aPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU (absZorderQpMinCUIdx))) |
---|
| 2138 | ||(enforceEntropySliceRestriction && (pcTempReconCU==NULL || pcTempReconCU->getSlice() == NULL || pcTempReconCU->getSCUAddr()+aPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(absZorderQpMinCUIdx)))) |
---|
| 2139 | { |
---|
| 2140 | return NULL; |
---|
| 2141 | } |
---|
| 2142 | return m_pcPic->getCU( getAddr() ); |
---|
[2] | 2143 | } |
---|
[56] | 2144 | |
---|
| 2145 | aPartUnitIdx = g_auiRasterToZscan[ absRorderQpMinCUIdx + m_pcPic->getNumPartInCU() - numPartInCUWidth ]; |
---|
[2] | 2146 | |
---|
[56] | 2147 | if ( (enforceSliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || |
---|
| 2148 | m_pcCUAbove->getSCUAddr()+aPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(absZorderQpMinCUIdx)|| |
---|
| 2149 | #if !REMOVE_TILE_DEPENDENCE |
---|
| 2150 | (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
| 2151 | #else |
---|
| 2152 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
| 2153 | #endif |
---|
| 2154 | ))|| |
---|
| 2155 | (enforceEntropySliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || |
---|
| 2156 | m_pcCUAbove->getSCUAddr()+aPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(absZorderQpMinCUIdx)|| |
---|
| 2157 | #if !REMOVE_TILE_DEPENDENCE |
---|
| 2158 | (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
| 2159 | #else |
---|
| 2160 | (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) |
---|
| 2161 | #endif |
---|
| 2162 | )) |
---|
| 2163 | ) |
---|
[2] | 2164 | { |
---|
[56] | 2165 | return NULL; |
---|
[2] | 2166 | } |
---|
| 2167 | |
---|
[56] | 2168 | if ( m_pcCUAbove && m_pcCUAbove->getAddr() != getAddr() ) |
---|
[2] | 2169 | { |
---|
[56] | 2170 | return NULL; |
---|
[2] | 2171 | } |
---|
[56] | 2172 | |
---|
| 2173 | return m_pcCUAbove; |
---|
[2] | 2174 | } |
---|
[56] | 2175 | #endif |
---|
[2] | 2176 | |
---|
[56] | 2177 | #if H0736_AVC_STYLE_QP_RANGE |
---|
| 2178 | /** Get reference QP from left QpMinCu or latest coded QP |
---|
| 2179 | *\param uiCurrAbsIdxInLCU |
---|
| 2180 | *\returns Char reference QP value |
---|
| 2181 | */ |
---|
| 2182 | Char TComDataCU::getRefQP( UInt uiCurrAbsIdxInLCU ) |
---|
| 2183 | #else |
---|
| 2184 | /** Get reference QP from left QpMinCu or latest coded QP |
---|
| 2185 | *\param uiCurrAbsIdxInLCU |
---|
| 2186 | *\returns UChar reference QP value |
---|
| 2187 | */ |
---|
| 2188 | UChar TComDataCU::getRefQP( UInt uiCurrAbsIdxInLCU ) |
---|
| 2189 | #endif |
---|
[2] | 2190 | { |
---|
[56] | 2191 | #if H0204_QP_PREDICTION |
---|
| 2192 | UInt lPartIdx, aPartIdx; |
---|
| 2193 | TComDataCU* cULeft = getQpMinCuLeft ( lPartIdx, m_uiAbsIdxInLCU + uiCurrAbsIdxInLCU ); |
---|
| 2194 | TComDataCU* cUAbove = getQpMinCuAbove( aPartIdx, m_uiAbsIdxInLCU + uiCurrAbsIdxInLCU ); |
---|
| 2195 | return (((cULeft? cULeft->getQP( lPartIdx ): getLastCodedQP( uiCurrAbsIdxInLCU )) + (cUAbove? cUAbove->getQP( aPartIdx ): getLastCodedQP( uiCurrAbsIdxInLCU )) + 1) >> 1); |
---|
| 2196 | #else |
---|
| 2197 | // Left CU |
---|
| 2198 | TComDataCU* pcCULeft; |
---|
| 2199 | UInt uiLPartIdx; |
---|
| 2200 | pcCULeft = getQpMinCuLeft( uiLPartIdx, m_uiAbsIdxInLCU + uiCurrAbsIdxInLCU ); |
---|
| 2201 | if ( pcCULeft ) |
---|
[2] | 2202 | { |
---|
[56] | 2203 | return pcCULeft->getQP(uiLPartIdx); |
---|
[2] | 2204 | } |
---|
[56] | 2205 | // Last QP |
---|
| 2206 | return getLastCodedQP( uiCurrAbsIdxInLCU ); |
---|
| 2207 | #endif |
---|
[2] | 2208 | } |
---|
| 2209 | |
---|
[56] | 2210 | Int TComDataCU::getLastValidPartIdx( Int iAbsPartIdx ) |
---|
[2] | 2211 | { |
---|
[56] | 2212 | Int iLastValidPartIdx = iAbsPartIdx-1; |
---|
| 2213 | while ( iLastValidPartIdx >= 0 |
---|
| 2214 | && getPredictionMode( iLastValidPartIdx ) == MODE_NONE ) |
---|
[2] | 2215 | { |
---|
[56] | 2216 | UInt uiDepth = getDepth( iLastValidPartIdx ); |
---|
| 2217 | iLastValidPartIdx -= m_uiNumPartition>>(uiDepth<<1); |
---|
[2] | 2218 | } |
---|
[56] | 2219 | return iLastValidPartIdx; |
---|
[2] | 2220 | } |
---|
| 2221 | |
---|
[56] | 2222 | #if H0736_AVC_STYLE_QP_RANGE |
---|
| 2223 | Char TComDataCU::getLastCodedQP( UInt uiAbsPartIdx ) |
---|
| 2224 | #else |
---|
| 2225 | UChar TComDataCU::getLastCodedQP( UInt uiAbsPartIdx ) |
---|
| 2226 | #endif |
---|
[2] | 2227 | { |
---|
[56] | 2228 | UInt uiQUPartIdxMask = ~((1<<(8-(getSlice()->getPPS()->getMaxCuDQPDepth()<<1)))-1); |
---|
| 2229 | Int iLastValidPartIdx = getLastValidPartIdx( uiAbsPartIdx&uiQUPartIdxMask ); |
---|
| 2230 | if ( uiAbsPartIdx < m_uiNumPartition |
---|
| 2231 | && (getSCUAddr()+iLastValidPartIdx < getSliceStartCU(m_uiAbsIdxInLCU+uiAbsPartIdx) || getSCUAddr()+iLastValidPartIdx < getEntropySliceStartCU(m_uiAbsIdxInLCU+uiAbsPartIdx) )) |
---|
[2] | 2232 | { |
---|
[56] | 2233 | return getSlice()->getSliceQp(); |
---|
[2] | 2234 | } |
---|
[56] | 2235 | else |
---|
| 2236 | if ( iLastValidPartIdx >= 0 ) |
---|
[2] | 2237 | { |
---|
[56] | 2238 | return getQP( iLastValidPartIdx ); |
---|
[2] | 2239 | } |
---|
[56] | 2240 | else |
---|
| 2241 | { |
---|
| 2242 | if ( getZorderIdxInCU() > 0 ) |
---|
| 2243 | { |
---|
| 2244 | return getPic()->getCU( getAddr() )->getLastCodedQP( getZorderIdxInCU() ); |
---|
| 2245 | } |
---|
| 2246 | else if ( getAddr() > 0 ) |
---|
| 2247 | { |
---|
| 2248 | return getPic()->getCU( getAddr()-1 )->getLastCodedQP( getPic()->getNumPartInCU() ); |
---|
| 2249 | } |
---|
| 2250 | else |
---|
| 2251 | { |
---|
| 2252 | return getSlice()->getSliceQp(); |
---|
| 2253 | } |
---|
| 2254 | } |
---|
[2] | 2255 | } |
---|
[56] | 2256 | #if LOSSLESS_CODING |
---|
| 2257 | /** Check whether the CU is coded in lossless coding mode |
---|
| 2258 | * \param uiAbsPartIdx |
---|
| 2259 | * \returns true if the CU is coded in lossless coding mode; false if otherwise |
---|
| 2260 | */ |
---|
| 2261 | Bool TComDataCU::isLosslessCoded(UInt absPartIdx) |
---|
[2] | 2262 | { |
---|
[56] | 2263 | #if H0736_AVC_STYLE_QP_RANGE |
---|
| 2264 | return ( getSlice()->getSPS()->getUseLossless() && ((getQP(absPartIdx) + getSlice()->getSPS()->getQpBDOffsetY()) == 0) ); |
---|
| 2265 | #else |
---|
| 2266 | return ( getSlice()->getSPS()->getUseLossless() && (getQP(absPartPIdx) == 0) ); |
---|
[5] | 2267 | #endif |
---|
[2] | 2268 | } |
---|
[5] | 2269 | #endif |
---|
[2] | 2270 | |
---|
[56] | 2271 | /** Get allowed chroma intra modes |
---|
| 2272 | *\param uiAbsPartIdx |
---|
| 2273 | *\param uiModeList pointer to chroma intra modes array |
---|
| 2274 | *\returns |
---|
| 2275 | *- fill uiModeList with chroma intra modes |
---|
| 2276 | */ |
---|
| 2277 | Void TComDataCU::getAllowedChromaDir( UInt uiAbsPartIdx, UInt* uiModeList ) |
---|
[2] | 2278 | { |
---|
[56] | 2279 | uiModeList[0] = PLANAR_IDX; |
---|
| 2280 | #if LOGI_INTRA_NAME_3MPM |
---|
| 2281 | uiModeList[1] = VER_IDX; |
---|
| 2282 | uiModeList[2] = HOR_IDX; |
---|
| 2283 | #else |
---|
| 2284 | uiModeList[1] = 1; |
---|
| 2285 | uiModeList[2] = 2; |
---|
[2] | 2286 | #endif |
---|
[56] | 2287 | uiModeList[3] = DC_IDX; |
---|
| 2288 | uiModeList[4] = LM_CHROMA_IDX; |
---|
| 2289 | uiModeList[5] = DM_CHROMA_IDX; |
---|
[2] | 2290 | |
---|
[56] | 2291 | UInt uiLumaMode = getLumaIntraDir( uiAbsPartIdx ); |
---|
[5] | 2292 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
[56] | 2293 | mapDMMtoIntraMode( uiLumaMode ); |
---|
[2] | 2294 | #endif |
---|
| 2295 | |
---|
[56] | 2296 | for( Int i = 0; i < NUM_CHROMA_MODE - 2; i++ ) |
---|
| 2297 | { |
---|
| 2298 | if( uiLumaMode == uiModeList[i] ) |
---|
| 2299 | { |
---|
| 2300 | #if LOGI_INTRA_NAME_3MPM |
---|
| 2301 | uiModeList[i] = 34; // VER+8 mode |
---|
| 2302 | #else |
---|
| 2303 | uiModeList[i] = 7; // VER+8 mode |
---|
[2] | 2304 | #endif |
---|
[56] | 2305 | break; |
---|
| 2306 | } |
---|
[2] | 2307 | } |
---|
| 2308 | } |
---|
| 2309 | |
---|
[56] | 2310 | /** Get most probable intra modes |
---|
| 2311 | *\param uiAbsPartIdx |
---|
| 2312 | *\param uiIntraDirPred pointer to the array for MPM storage |
---|
| 2313 | *\param piMode it is set with MPM mode in case both MPM are equal. It is used to restrict RD search at encode side. |
---|
| 2314 | *\returns Number of MPM |
---|
| 2315 | */ |
---|
| 2316 | Int TComDataCU::getIntraDirLumaPredictor( UInt uiAbsPartIdx, Int* uiIntraDirPred, Int* piMode ) |
---|
[2] | 2317 | { |
---|
| 2318 | TComDataCU* pcTempCU; |
---|
| 2319 | UInt uiTempPartIdx; |
---|
[56] | 2320 | Int iLeftIntraDir, iAboveIntraDir; |
---|
| 2321 | Int uiPredNum = 0; |
---|
[2] | 2322 | |
---|
| 2323 | // Get intra direction of left PU |
---|
| 2324 | pcTempCU = getPULeft( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx ); |
---|
[56] | 2325 | |
---|
| 2326 | #if DEFAULT_DC |
---|
| 2327 | iLeftIntraDir = pcTempCU ? ( pcTempCU->isIntra( uiTempPartIdx ) ? pcTempCU->getLumaIntraDir( uiTempPartIdx ) : DC_IDX ) : DC_IDX; |
---|
[2] | 2328 | #else |
---|
[56] | 2329 | iLeftIntraDir = pcTempCU ? ( pcTempCU->isIntra( uiTempPartIdx ) ? pcTempCU->getLumaIntraDir( uiTempPartIdx ) : PLANAR_IDX ) : PLANAR_IDX; |
---|
[2] | 2330 | #endif |
---|
[56] | 2331 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
| 2332 | mapDMMtoIntraMode( iLeftIntraDir ); |
---|
| 2333 | #endif |
---|
[2] | 2334 | |
---|
| 2335 | // Get intra direction of above PU |
---|
[56] | 2336 | pcTempCU = getPUAbove( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx, true, true, false, true ); |
---|
| 2337 | |
---|
| 2338 | #if DEFAULT_DC |
---|
| 2339 | iAboveIntraDir = pcTempCU ? ( pcTempCU->isIntra( uiTempPartIdx ) ? pcTempCU->getLumaIntraDir( uiTempPartIdx ) : DC_IDX ) : DC_IDX; |
---|
[2] | 2340 | #else |
---|
[56] | 2341 | iAboveIntraDir = pcTempCU ? ( pcTempCU->isIntra( uiTempPartIdx ) ? pcTempCU->getLumaIntraDir( uiTempPartIdx ) : PLANAR_IDX ) : PLANAR_IDX; |
---|
[2] | 2342 | #endif |
---|
[56] | 2343 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
| 2344 | mapDMMtoIntraMode( iAboveIntraDir ); |
---|
| 2345 | #endif |
---|
[2] | 2346 | |
---|
[56] | 2347 | #if LOGI_INTRA_NAME_3MPM |
---|
| 2348 | uiPredNum = 3; |
---|
| 2349 | if(iLeftIntraDir == iAboveIntraDir) |
---|
[2] | 2350 | { |
---|
[56] | 2351 | if( piMode ) |
---|
| 2352 | { |
---|
| 2353 | *piMode = 1; |
---|
| 2354 | } |
---|
| 2355 | |
---|
| 2356 | if (iLeftIntraDir > 1) // angular modes |
---|
| 2357 | { |
---|
| 2358 | uiIntraDirPred[0] = iLeftIntraDir; |
---|
| 2359 | uiIntraDirPred[1] = ((iLeftIntraDir + 29) % 32) + 2; |
---|
| 2360 | uiIntraDirPred[2] = ((iLeftIntraDir - 1 ) % 32) + 2; |
---|
| 2361 | } |
---|
| 2362 | else //non-angular |
---|
| 2363 | { |
---|
| 2364 | uiIntraDirPred[0] = PLANAR_IDX; |
---|
| 2365 | uiIntraDirPred[1] = DC_IDX; |
---|
| 2366 | uiIntraDirPred[2] = VER_IDX; |
---|
| 2367 | } |
---|
[2] | 2368 | } |
---|
| 2369 | else |
---|
| 2370 | { |
---|
[56] | 2371 | if( piMode ) |
---|
| 2372 | { |
---|
| 2373 | *piMode = 2; |
---|
| 2374 | } |
---|
| 2375 | uiIntraDirPred[0] = iLeftIntraDir; |
---|
| 2376 | uiIntraDirPred[1] = iAboveIntraDir; |
---|
| 2377 | |
---|
| 2378 | if (iLeftIntraDir && iAboveIntraDir ) //both modes are non-planar |
---|
| 2379 | { |
---|
| 2380 | uiIntraDirPred[2] = PLANAR_IDX; |
---|
| 2381 | } |
---|
| 2382 | else |
---|
| 2383 | { |
---|
| 2384 | uiIntraDirPred[2] = (iLeftIntraDir+iAboveIntraDir)<2? VER_IDX : DC_IDX; |
---|
| 2385 | } |
---|
[2] | 2386 | } |
---|
[56] | 2387 | #else |
---|
| 2388 | Int iIdx = getIntraSizeIdx(uiAbsPartIdx); |
---|
[2] | 2389 | |
---|
[56] | 2390 | |
---|
| 2391 | if ( iLeftIntraDir >= g_aucIntraModeNumAng[iIdx] ) |
---|
[2] | 2392 | { |
---|
[56] | 2393 | iLeftIntraDir = PLANAR_IDX; |
---|
[2] | 2394 | } |
---|
| 2395 | |
---|
[56] | 2396 | |
---|
| 2397 | if ( iAboveIntraDir >= g_aucIntraModeNumAng[iIdx] ) |
---|
[2] | 2398 | { |
---|
[56] | 2399 | iAboveIntraDir = PLANAR_IDX; |
---|
[2] | 2400 | } |
---|
| 2401 | |
---|
[56] | 2402 | if(iLeftIntraDir == iAboveIntraDir) |
---|
[2] | 2403 | { |
---|
[56] | 2404 | uiPredNum = 2; |
---|
[2] | 2405 | |
---|
[56] | 2406 | if( piMode ) |
---|
[2] | 2407 | { |
---|
[56] | 2408 | *piMode = iLeftIntraDir; |
---|
[2] | 2409 | } |
---|
| 2410 | |
---|
[56] | 2411 | iAboveIntraDir = iLeftIntraDir == PLANAR_IDX ? DC_IDX : PLANAR_IDX; // DC or Planar |
---|
| 2412 | |
---|
| 2413 | assert( iLeftIntraDir != iAboveIntraDir ); |
---|
| 2414 | |
---|
| 2415 | uiIntraDirPred[0] = min(iLeftIntraDir, iAboveIntraDir); |
---|
| 2416 | uiIntraDirPred[1] = max(iLeftIntraDir, iAboveIntraDir); |
---|
[2] | 2417 | } |
---|
[56] | 2418 | else |
---|
| 2419 | { |
---|
| 2420 | uiPredNum = 2; |
---|
| 2421 | uiIntraDirPred[0] = min(iLeftIntraDir, iAboveIntraDir); |
---|
| 2422 | uiIntraDirPred[1] = max(iLeftIntraDir, iAboveIntraDir); |
---|
| 2423 | } |
---|
| 2424 | #endif |
---|
| 2425 | |
---|
| 2426 | return uiPredNum; |
---|
[2] | 2427 | } |
---|
| 2428 | |
---|
[56] | 2429 | UInt TComDataCU::getCtxSplitFlag( UInt uiAbsPartIdx, UInt uiDepth ) |
---|
[2] | 2430 | { |
---|
| 2431 | TComDataCU* pcTempCU; |
---|
| 2432 | UInt uiTempPartIdx; |
---|
[56] | 2433 | UInt uiCtx; |
---|
| 2434 | // Get left split flag |
---|
[2] | 2435 | pcTempCU = getPULeft( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx ); |
---|
[56] | 2436 | uiCtx = ( pcTempCU ) ? ( ( pcTempCU->getDepth( uiTempPartIdx ) > uiDepth ) ? 1 : 0 ) : 0; |
---|
[2] | 2437 | |
---|
[56] | 2438 | // Get above split flag |
---|
[2] | 2439 | pcTempCU = getPUAbove( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx ); |
---|
[56] | 2440 | uiCtx += ( pcTempCU ) ? ( ( pcTempCU->getDepth( uiTempPartIdx ) > uiDepth ) ? 1 : 0 ) : 0; |
---|
[2] | 2441 | |
---|
| 2442 | return uiCtx; |
---|
| 2443 | } |
---|
| 2444 | |
---|
[56] | 2445 | UInt TComDataCU::getCtxQtCbf( UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth ) |
---|
[2] | 2446 | { |
---|
[56] | 2447 | if( eType ) |
---|
[2] | 2448 | { |
---|
[56] | 2449 | return uiTrDepth; |
---|
[2] | 2450 | } |
---|
| 2451 | else |
---|
| 2452 | { |
---|
[56] | 2453 | const UInt uiDepth = getDepth( uiAbsPartIdx ); |
---|
| 2454 | const UInt uiLog2TrafoSize = g_aucConvertToBit[ getSlice()->getSPS()->getMaxCUWidth() ] + 2 - uiDepth - uiTrDepth; |
---|
| 2455 | const UInt uiCtx = uiTrDepth == 0 || uiLog2TrafoSize == getSlice()->getSPS()->getQuadtreeTULog2MaxSize() ? 1 : 0; |
---|
| 2456 | return uiCtx; |
---|
[2] | 2457 | } |
---|
| 2458 | } |
---|
| 2459 | |
---|
[56] | 2460 | UInt TComDataCU::getQuadtreeTULog2MinSizeInCU( UInt absPartIdx ) |
---|
[2] | 2461 | { |
---|
[56] | 2462 | UInt log2CbSize = g_aucConvertToBit[getWidth( absPartIdx )] + 2; |
---|
| 2463 | PartSize partSize = getPartitionSize( absPartIdx ); |
---|
| 2464 | UInt quadtreeTUMaxDepth = getPredictionMode( absPartIdx ) == MODE_INTRA ? m_pcSlice->getSPS()->getQuadtreeTUMaxDepthIntra() : m_pcSlice->getSPS()->getQuadtreeTUMaxDepthInter(); |
---|
| 2465 | Int intraSplitFlag = ( getPredictionMode( absPartIdx ) == MODE_INTRA && partSize == SIZE_NxN ) ? 1 : 0; |
---|
| 2466 | #if G519_TU_AMP_NSQT_HARMONIZATION |
---|
| 2467 | Int interSplitFlag = ((quadtreeTUMaxDepth == 1) && (getPredictionMode( absPartIdx ) == MODE_INTER) && (partSize != SIZE_2Nx2N) ); |
---|
| 2468 | #else |
---|
| 2469 | Int interSplitFlag = ((quadtreeTUMaxDepth == 1) && (getPredictionMode( absPartIdx ) == MODE_INTER) && (partSize == SIZE_Nx2N || partSize == SIZE_2NxN) ); |
---|
[2] | 2470 | #endif |
---|
| 2471 | |
---|
[56] | 2472 | UInt log2MinTUSizeInCU = 0; |
---|
| 2473 | if (log2CbSize < (m_pcSlice->getSPS()->getQuadtreeTULog2MinSize() + quadtreeTUMaxDepth - 1 + interSplitFlag + intraSplitFlag) ) |
---|
[2] | 2474 | { |
---|
[56] | 2475 | // when fully making use of signaled TUMaxDepth + inter/intraSplitFlag, resulting luma TB size is < QuadtreeTULog2MinSize |
---|
| 2476 | log2MinTUSizeInCU = m_pcSlice->getSPS()->getQuadtreeTULog2MinSize(); |
---|
[2] | 2477 | } |
---|
[56] | 2478 | else |
---|
[2] | 2479 | { |
---|
[56] | 2480 | // when fully making use of signaled TUMaxDepth + inter/intraSplitFlag, resulting luma TB size is still >= QuadtreeTULog2MinSize |
---|
| 2481 | log2MinTUSizeInCU = log2CbSize - ( quadtreeTUMaxDepth - 1 + interSplitFlag + intraSplitFlag); // stop when trafoDepth == hierarchy_depth = splitFlag |
---|
| 2482 | if ( log2MinTUSizeInCU > m_pcSlice->getSPS()->getQuadtreeTULog2MaxSize()) |
---|
| 2483 | { |
---|
| 2484 | // when fully making use of signaled TUMaxDepth + inter/intraSplitFlag, resulting luma TB size is still > QuadtreeTULog2MaxSize |
---|
| 2485 | log2MinTUSizeInCU = m_pcSlice->getSPS()->getQuadtreeTULog2MaxSize(); |
---|
| 2486 | } |
---|
[2] | 2487 | } |
---|
[56] | 2488 | return log2MinTUSizeInCU; |
---|
[2] | 2489 | } |
---|
| 2490 | |
---|
[56] | 2491 | |
---|
| 2492 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
| 2493 | UInt |
---|
| 2494 | TComDataCU::getCtxResPredFlag( UInt uiAbsPartIdx ) |
---|
[2] | 2495 | { |
---|
[56] | 2496 | #if 1 // simple context |
---|
| 2497 | UInt uiCtx = 0; |
---|
| 2498 | #else |
---|
[2] | 2499 | TComDataCU* pcTempCU; |
---|
| 2500 | UInt uiTempPartIdx; |
---|
| 2501 | UInt uiCtx = 0; |
---|
| 2502 | |
---|
| 2503 | // Get BCBP of left PU |
---|
| 2504 | pcTempCU = getPULeft( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx ); |
---|
[56] | 2505 | uiCtx = ( pcTempCU ) ? pcTempCU->getResPredFlag( uiTempPartIdx ) : 0; |
---|
[2] | 2506 | |
---|
| 2507 | // Get BCBP of above PU |
---|
| 2508 | pcTempCU = getPUAbove( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx ); |
---|
[56] | 2509 | uiCtx += ( pcTempCU ) ? pcTempCU->getResPredFlag( uiTempPartIdx ) : 0; |
---|
| 2510 | #endif |
---|
[2] | 2511 | return uiCtx; |
---|
| 2512 | } |
---|
[56] | 2513 | #endif |
---|
[2] | 2514 | |
---|
[56] | 2515 | |
---|
[2] | 2516 | UInt TComDataCU::getCtxSkipFlag( UInt uiAbsPartIdx ) |
---|
| 2517 | { |
---|
| 2518 | TComDataCU* pcTempCU; |
---|
| 2519 | UInt uiTempPartIdx; |
---|
| 2520 | UInt uiCtx = 0; |
---|
| 2521 | |
---|
| 2522 | // Get BCBP of left PU |
---|
| 2523 | pcTempCU = getPULeft( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx ); |
---|
| 2524 | uiCtx = ( pcTempCU ) ? pcTempCU->isSkipped( uiTempPartIdx ) : 0; |
---|
| 2525 | |
---|
| 2526 | // Get BCBP of above PU |
---|
| 2527 | pcTempCU = getPUAbove( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx ); |
---|
| 2528 | uiCtx += ( pcTempCU ) ? pcTempCU->isSkipped( uiTempPartIdx ) : 0; |
---|
| 2529 | |
---|
| 2530 | return uiCtx; |
---|
| 2531 | } |
---|
| 2532 | |
---|
| 2533 | UInt TComDataCU::getCtxInterDir( UInt uiAbsPartIdx ) |
---|
| 2534 | { |
---|
[56] | 2535 | return getDepth( uiAbsPartIdx ); |
---|
[2] | 2536 | } |
---|
| 2537 | |
---|
| 2538 | Void TComDataCU::setCbfSubParts( UInt uiCbfY, UInt uiCbfU, UInt uiCbfV, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 2539 | { |
---|
| 2540 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
| 2541 | memset( m_puhCbf[0] + uiAbsPartIdx, uiCbfY, sizeof( UChar ) * uiCurrPartNumb ); |
---|
| 2542 | memset( m_puhCbf[1] + uiAbsPartIdx, uiCbfU, sizeof( UChar ) * uiCurrPartNumb ); |
---|
| 2543 | memset( m_puhCbf[2] + uiAbsPartIdx, uiCbfV, sizeof( UChar ) * uiCurrPartNumb ); |
---|
| 2544 | } |
---|
| 2545 | |
---|
| 2546 | Void TComDataCU::setCbfSubParts( UInt uiCbf, TextType eTType, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 2547 | { |
---|
| 2548 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
| 2549 | memset( m_puhCbf[g_aucConvertTxtTypeToIdx[eTType]] + uiAbsPartIdx, uiCbf, sizeof( UChar ) * uiCurrPartNumb ); |
---|
| 2550 | } |
---|
| 2551 | |
---|
| 2552 | /** Sets a coded block flag for all sub-partitions of a partition |
---|
| 2553 | * \param uiCbf The value of the coded block flag to be set |
---|
| 2554 | * \param eTType |
---|
| 2555 | * \param uiAbsPartIdx |
---|
| 2556 | * \param uiPartIdx |
---|
| 2557 | * \param uiDepth |
---|
| 2558 | * \returns Void |
---|
| 2559 | */ |
---|
| 2560 | Void TComDataCU::setCbfSubParts ( UInt uiCbf, TextType eTType, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) |
---|
| 2561 | { |
---|
[56] | 2562 | setSubPart<UChar>( uiCbf, m_puhCbf[g_aucConvertTxtTypeToIdx[eTType]], uiAbsPartIdx, uiDepth, uiPartIdx ); |
---|
[2] | 2563 | } |
---|
| 2564 | |
---|
| 2565 | Void TComDataCU::setDepthSubParts( UInt uiDepth, UInt uiAbsPartIdx ) |
---|
| 2566 | { |
---|
| 2567 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
| 2568 | memset( m_puhDepth + uiAbsPartIdx, uiDepth, sizeof(UChar)*uiCurrPartNumb ); |
---|
| 2569 | } |
---|
| 2570 | |
---|
| 2571 | Bool TComDataCU::isFirstAbsZorderIdxInDepth (UInt uiAbsPartIdx, UInt uiDepth) |
---|
| 2572 | { |
---|
| 2573 | UInt uiPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
| 2574 | return (((m_uiAbsIdxInLCU + uiAbsPartIdx)% uiPartNumb) == 0); |
---|
| 2575 | } |
---|
| 2576 | |
---|
[56] | 2577 | Void TComDataCU::setAlfCtrlFlagSubParts( Bool uiFlag, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
[2] | 2578 | { |
---|
[56] | 2579 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> ( 2 * uiDepth ); |
---|
| 2580 | memset( m_puiAlfCtrlFlag + uiAbsPartIdx, uiFlag, sizeof( *m_puiAlfCtrlFlag ) * uiCurrPartNumb ); |
---|
[2] | 2581 | } |
---|
| 2582 | |
---|
| 2583 | Void TComDataCU::createTmpAlfCtrlFlag() |
---|
| 2584 | { |
---|
[56] | 2585 | m_puiTmpAlfCtrlFlag = new Bool[ m_uiNumPartition ]; |
---|
[2] | 2586 | } |
---|
| 2587 | |
---|
| 2588 | Void TComDataCU::destroyTmpAlfCtrlFlag() |
---|
| 2589 | { |
---|
| 2590 | if(m_puiTmpAlfCtrlFlag) |
---|
| 2591 | { |
---|
[56] | 2592 | delete[] m_puiTmpAlfCtrlFlag; |
---|
| 2593 | m_puiTmpAlfCtrlFlag = NULL; |
---|
[2] | 2594 | } |
---|
| 2595 | } |
---|
| 2596 | |
---|
| 2597 | Void TComDataCU::copyAlfCtrlFlagToTmp() |
---|
| 2598 | { |
---|
[56] | 2599 | memcpy( m_puiTmpAlfCtrlFlag, m_puiAlfCtrlFlag, sizeof( *m_puiAlfCtrlFlag )*m_uiNumPartition ); |
---|
[2] | 2600 | } |
---|
| 2601 | |
---|
| 2602 | Void TComDataCU::copyAlfCtrlFlagFromTmp() |
---|
| 2603 | { |
---|
[56] | 2604 | memcpy( m_puiAlfCtrlFlag, m_puiTmpAlfCtrlFlag, sizeof( *m_puiAlfCtrlFlag )*m_uiNumPartition ); |
---|
[2] | 2605 | } |
---|
| 2606 | |
---|
| 2607 | Void TComDataCU::setPartSizeSubParts( PartSize eMode, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 2608 | { |
---|
[56] | 2609 | assert( sizeof( *m_pePartSize) == 1 ); |
---|
| 2610 | memset( m_pePartSize + uiAbsPartIdx, eMode, m_pcPic->getNumPartInCU() >> ( 2 * uiDepth ) ); |
---|
| 2611 | } |
---|
| 2612 | #if HHI_INTERVIEW_SKIP |
---|
| 2613 | Void TComDataCU::setRenderableSubParts ( Bool bRenderable, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 2614 | { |
---|
[2] | 2615 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
[56] | 2616 | |
---|
[2] | 2617 | for (UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
| 2618 | { |
---|
[56] | 2619 | m_pbRenderable[uiAbsPartIdx + ui] = bRenderable; |
---|
[2] | 2620 | } |
---|
| 2621 | } |
---|
[56] | 2622 | #endif |
---|
[2] | 2623 | |
---|
| 2624 | Void TComDataCU::setPredModeSubParts( PredMode eMode, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 2625 | { |
---|
[56] | 2626 | assert( sizeof( *m_pePartSize) == 1 ); |
---|
| 2627 | memset( m_pePredMode + uiAbsPartIdx, eMode, m_pcPic->getNumPartInCU() >> ( 2 * uiDepth ) ); |
---|
[2] | 2628 | } |
---|
| 2629 | |
---|
[56] | 2630 | #if H0736_AVC_STYLE_QP_RANGE |
---|
| 2631 | Void TComDataCU::setQPSubParts( Int qp, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 2632 | #else |
---|
[2] | 2633 | Void TComDataCU::setQPSubParts( UInt uiQP, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
[56] | 2634 | #endif |
---|
[2] | 2635 | { |
---|
| 2636 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
[56] | 2637 | TComSlice * pcSlice = getPic()->getSlice(getPic()->getCurrSliceIdx()); |
---|
| 2638 | |
---|
| 2639 | for(UInt uiSCUIdx = uiAbsPartIdx; uiSCUIdx < uiAbsPartIdx+uiCurrPartNumb; uiSCUIdx++) |
---|
| 2640 | { |
---|
| 2641 | if( m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiSCUIdx+getZorderIdxInCU()) == pcSlice->getEntropySliceCurStartCUAddr() ) |
---|
| 2642 | { |
---|
| 2643 | #if H0736_AVC_STYLE_QP_RANGE |
---|
| 2644 | m_phQP[uiSCUIdx] = qp; |
---|
| 2645 | #else |
---|
| 2646 | m_phQP[uiSCUIdx] = uiQP; |
---|
| 2647 | #endif |
---|
| 2648 | } |
---|
| 2649 | } |
---|
[2] | 2650 | } |
---|
| 2651 | |
---|
| 2652 | Void TComDataCU::setLumaIntraDirSubParts( UInt uiDir, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 2653 | { |
---|
| 2654 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
| 2655 | |
---|
| 2656 | memset( m_puhLumaIntraDir + uiAbsPartIdx, uiDir, sizeof(UChar)*uiCurrPartNumb ); |
---|
| 2657 | } |
---|
| 2658 | |
---|
[56] | 2659 | template<typename T> |
---|
| 2660 | Void TComDataCU::setSubPart( T uiParameter, T* puhBaseLCU, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx ) |
---|
[2] | 2661 | { |
---|
[56] | 2662 | assert( sizeof(T) == 1 ); // Using memset() works only for types of size 1 |
---|
| 2663 | |
---|
| 2664 | UInt uiCurrPartNumQ = (m_pcPic->getNumPartInCU() >> (2 * uiCUDepth)) >> 2; |
---|
[2] | 2665 | switch ( m_pePartSize[ uiCUAddr ] ) |
---|
| 2666 | { |
---|
[56] | 2667 | case SIZE_2Nx2N: |
---|
| 2668 | memset( puhBaseLCU + uiCUAddr, uiParameter, 4 * uiCurrPartNumQ ); |
---|
| 2669 | break; |
---|
| 2670 | case SIZE_2NxN: |
---|
| 2671 | memset( puhBaseLCU + uiCUAddr, uiParameter, 2 * uiCurrPartNumQ ); |
---|
| 2672 | break; |
---|
| 2673 | case SIZE_Nx2N: |
---|
| 2674 | memset( puhBaseLCU + uiCUAddr, uiParameter, uiCurrPartNumQ ); |
---|
| 2675 | memset( puhBaseLCU + uiCUAddr + 2 * uiCurrPartNumQ, uiParameter, uiCurrPartNumQ ); |
---|
| 2676 | break; |
---|
| 2677 | case SIZE_NxN: |
---|
| 2678 | memset( puhBaseLCU + uiCUAddr, uiParameter, uiCurrPartNumQ ); |
---|
| 2679 | break; |
---|
| 2680 | case SIZE_2NxnU: |
---|
| 2681 | if ( uiPUIdx == 0 ) |
---|
| 2682 | { |
---|
| 2683 | memset( puhBaseLCU + uiCUAddr, uiParameter, (uiCurrPartNumQ >> 1) ); |
---|
| 2684 | memset( puhBaseLCU + uiCUAddr + uiCurrPartNumQ, uiParameter, (uiCurrPartNumQ >> 1) ); |
---|
| 2685 | } |
---|
| 2686 | else if ( uiPUIdx == 1 ) |
---|
| 2687 | { |
---|
| 2688 | memset( puhBaseLCU + uiCUAddr, uiParameter, (uiCurrPartNumQ >> 1) ); |
---|
| 2689 | memset( puhBaseLCU + uiCUAddr + uiCurrPartNumQ, uiParameter, ((uiCurrPartNumQ >> 1) + (uiCurrPartNumQ << 1)) ); |
---|
| 2690 | } |
---|
| 2691 | else |
---|
| 2692 | { |
---|
| 2693 | assert(0); |
---|
| 2694 | } |
---|
| 2695 | break; |
---|
| 2696 | case SIZE_2NxnD: |
---|
| 2697 | if ( uiPUIdx == 0 ) |
---|
| 2698 | { |
---|
| 2699 | memset( puhBaseLCU + uiCUAddr, uiParameter, ((uiCurrPartNumQ << 1) + (uiCurrPartNumQ >> 1)) ); |
---|
| 2700 | memset( puhBaseLCU + uiCUAddr + (uiCurrPartNumQ << 1) + uiCurrPartNumQ, uiParameter, (uiCurrPartNumQ >> 1) ); |
---|
| 2701 | } |
---|
| 2702 | else if ( uiPUIdx == 1 ) |
---|
| 2703 | { |
---|
| 2704 | memset( puhBaseLCU + uiCUAddr, uiParameter, (uiCurrPartNumQ >> 1) ); |
---|
| 2705 | memset( puhBaseLCU + uiCUAddr + uiCurrPartNumQ, uiParameter, (uiCurrPartNumQ >> 1) ); |
---|
| 2706 | } |
---|
| 2707 | else |
---|
| 2708 | { |
---|
| 2709 | assert(0); |
---|
| 2710 | } |
---|
| 2711 | break; |
---|
| 2712 | case SIZE_nLx2N: |
---|
| 2713 | if ( uiPUIdx == 0 ) |
---|
| 2714 | { |
---|
| 2715 | memset( puhBaseLCU + uiCUAddr, uiParameter, (uiCurrPartNumQ >> 2) ); |
---|
| 2716 | memset( puhBaseLCU + uiCUAddr + (uiCurrPartNumQ >> 1), uiParameter, (uiCurrPartNumQ >> 2) ); |
---|
| 2717 | memset( puhBaseLCU + uiCUAddr + (uiCurrPartNumQ << 1), uiParameter, (uiCurrPartNumQ >> 2) ); |
---|
| 2718 | memset( puhBaseLCU + uiCUAddr + (uiCurrPartNumQ << 1) + (uiCurrPartNumQ >> 1), uiParameter, (uiCurrPartNumQ >> 2) ); |
---|
| 2719 | } |
---|
| 2720 | else if ( uiPUIdx == 1 ) |
---|
| 2721 | { |
---|
| 2722 | memset( puhBaseLCU + uiCUAddr, uiParameter, (uiCurrPartNumQ >> 2) ); |
---|
| 2723 | memset( puhBaseLCU + uiCUAddr + (uiCurrPartNumQ >> 1), uiParameter, (uiCurrPartNumQ + (uiCurrPartNumQ >> 2)) ); |
---|
| 2724 | memset( puhBaseLCU + uiCUAddr + (uiCurrPartNumQ << 1), uiParameter, (uiCurrPartNumQ >> 2) ); |
---|
| 2725 | memset( puhBaseLCU + uiCUAddr + (uiCurrPartNumQ << 1) + (uiCurrPartNumQ >> 1), uiParameter, (uiCurrPartNumQ + (uiCurrPartNumQ >> 2)) ); |
---|
| 2726 | } |
---|
| 2727 | else |
---|
| 2728 | { |
---|
| 2729 | assert(0); |
---|
| 2730 | } |
---|
| 2731 | break; |
---|
| 2732 | case SIZE_nRx2N: |
---|
| 2733 | if ( uiPUIdx == 0 ) |
---|
| 2734 | { |
---|
| 2735 | memset( puhBaseLCU + uiCUAddr, uiParameter, (uiCurrPartNumQ + (uiCurrPartNumQ >> 2)) ); |
---|
| 2736 | memset( puhBaseLCU + uiCUAddr + uiCurrPartNumQ + (uiCurrPartNumQ >> 1), uiParameter, (uiCurrPartNumQ >> 2) ); |
---|
| 2737 | memset( puhBaseLCU + uiCUAddr + (uiCurrPartNumQ << 1), uiParameter, (uiCurrPartNumQ + (uiCurrPartNumQ >> 2)) ); |
---|
| 2738 | memset( puhBaseLCU + uiCUAddr + (uiCurrPartNumQ << 1) + uiCurrPartNumQ + (uiCurrPartNumQ >> 1), uiParameter, (uiCurrPartNumQ >> 2) ); |
---|
| 2739 | } |
---|
| 2740 | else if ( uiPUIdx == 1 ) |
---|
| 2741 | { |
---|
| 2742 | memset( puhBaseLCU + uiCUAddr, uiParameter, (uiCurrPartNumQ >> 2) ); |
---|
| 2743 | memset( puhBaseLCU + uiCUAddr + (uiCurrPartNumQ >> 1), uiParameter, (uiCurrPartNumQ >> 2) ); |
---|
| 2744 | memset( puhBaseLCU + uiCUAddr + (uiCurrPartNumQ << 1), uiParameter, (uiCurrPartNumQ >> 2) ); |
---|
| 2745 | memset( puhBaseLCU + uiCUAddr + (uiCurrPartNumQ << 1) + (uiCurrPartNumQ >> 1), uiParameter, (uiCurrPartNumQ >> 2) ); |
---|
| 2746 | } |
---|
| 2747 | else |
---|
| 2748 | { |
---|
| 2749 | assert(0); |
---|
| 2750 | } |
---|
| 2751 | break; |
---|
| 2752 | default: |
---|
| 2753 | assert( 0 ); |
---|
[2] | 2754 | } |
---|
| 2755 | } |
---|
| 2756 | |
---|
| 2757 | Void TComDataCU::setMergeFlagSubParts ( Bool bMergeFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) |
---|
| 2758 | { |
---|
[56] | 2759 | setSubPart( bMergeFlag, m_pbMergeFlag, uiAbsPartIdx, uiDepth, uiPartIdx ); |
---|
[2] | 2760 | } |
---|
| 2761 | |
---|
| 2762 | Void TComDataCU::setMergeIndexSubParts ( UInt uiMergeIndex, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) |
---|
| 2763 | { |
---|
[56] | 2764 | setSubPart<UChar>( uiMergeIndex, m_puhMergeIndex, uiAbsPartIdx, uiDepth, uiPartIdx ); |
---|
[2] | 2765 | } |
---|
| 2766 | |
---|
[5] | 2767 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
[2] | 2768 | Void TComDataCU::setResPredAvailSubParts( Bool bResPredAvailable, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) |
---|
| 2769 | { |
---|
[56] | 2770 | setSubPart( bResPredAvailable, m_pbResPredAvailable, uiAbsPartIdx, uiDepth, uiPartIdx ); |
---|
[2] | 2771 | } |
---|
| 2772 | |
---|
| 2773 | Void TComDataCU::setResPredFlagSubParts( Bool bResPredFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) |
---|
| 2774 | { |
---|
[56] | 2775 | setSubPart( bResPredFlag, m_pbResPredFlag, uiAbsPartIdx, uiDepth, uiPartIdx ); |
---|
[2] | 2776 | } |
---|
[5] | 2777 | #endif |
---|
[2] | 2778 | |
---|
| 2779 | Void TComDataCU::setChromIntraDirSubParts( UInt uiDir, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 2780 | { |
---|
| 2781 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
| 2782 | |
---|
| 2783 | memset( m_puhChromaIntraDir + uiAbsPartIdx, uiDir, sizeof(UChar)*uiCurrPartNumb ); |
---|
| 2784 | } |
---|
| 2785 | |
---|
| 2786 | Void TComDataCU::setInterDirSubParts( UInt uiDir, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) |
---|
| 2787 | { |
---|
[56] | 2788 | setSubPart<UChar>( uiDir, m_puhInterDir, uiAbsPartIdx, uiDepth, uiPartIdx ); |
---|
[2] | 2789 | } |
---|
| 2790 | |
---|
| 2791 | Void TComDataCU::setMVPIdxSubParts( Int iMVPIdx, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) |
---|
| 2792 | { |
---|
[56] | 2793 | setSubPart<Char>( iMVPIdx, m_apiMVPIdx[eRefPicList], uiAbsPartIdx, uiDepth, uiPartIdx ); |
---|
[2] | 2794 | } |
---|
| 2795 | |
---|
| 2796 | Void TComDataCU::setMVPNumSubParts( Int iMVPNum, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) |
---|
| 2797 | { |
---|
[56] | 2798 | setSubPart<Char>( iMVPNum, m_apiMVPNum[eRefPicList], uiAbsPartIdx, uiDepth, uiPartIdx ); |
---|
[2] | 2799 | } |
---|
| 2800 | |
---|
| 2801 | |
---|
| 2802 | Void TComDataCU::setTrIdxSubParts( UInt uiTrIdx, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 2803 | { |
---|
| 2804 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
| 2805 | |
---|
| 2806 | memset( m_puhTrIdx + uiAbsPartIdx, uiTrIdx, sizeof(UChar)*uiCurrPartNumb ); |
---|
| 2807 | } |
---|
| 2808 | |
---|
[56] | 2809 | Void TComDataCU::setNSQTIdxSubParts( UInt absPartIdx, UInt depth ) |
---|
| 2810 | { |
---|
| 2811 | UInt currPartNumb = m_pcPic->getNumPartInCU() >> (depth << 1); |
---|
| 2812 | |
---|
| 2813 | memset( m_nsqtPartIdx + absPartIdx, absPartIdx, sizeof(UChar)*currPartNumb ); |
---|
| 2814 | } |
---|
| 2815 | |
---|
| 2816 | Void TComDataCU::setNSQTIdxSubParts( UInt log2TrafoSize, UInt absPartIdx, UInt absTUPartIdx, UInt trMode ) |
---|
| 2817 | { |
---|
| 2818 | UInt trWidth, trHeight; |
---|
| 2819 | UInt nsTUWidthInBaseUnits, nsTUHeightInBaseUnits; |
---|
| 2820 | UInt lcuWidthInBaseUnits = getPic()->getNumPartInWidth(); |
---|
| 2821 | UInt minTuSize = ( 1 << getSlice()->getSPS()->getQuadtreeTULog2MinSize() ); |
---|
| 2822 | |
---|
| 2823 | trWidth = trHeight = ( 1 << log2TrafoSize ); |
---|
| 2824 | |
---|
| 2825 | if ( useNonSquareTrans( trMode, absPartIdx ) && ( trWidth > minTuSize ) ) |
---|
| 2826 | { |
---|
| 2827 | trWidth = ( m_pePartSize[absPartIdx] == SIZE_Nx2N || m_pePartSize[absPartIdx] == SIZE_nLx2N || m_pePartSize[absPartIdx] == SIZE_nRx2N )? trWidth >> 1 : trWidth << 1; |
---|
| 2828 | trHeight = ( m_pePartSize[absPartIdx] == SIZE_Nx2N || m_pePartSize[absPartIdx] == SIZE_nLx2N || m_pePartSize[absPartIdx] == SIZE_nRx2N )? trHeight << 1 : trHeight >> 1; |
---|
| 2829 | } |
---|
| 2830 | |
---|
| 2831 | nsTUWidthInBaseUnits = trWidth / getPic()->getMinCUWidth(); |
---|
| 2832 | nsTUHeightInBaseUnits = trHeight / getPic()->getMinCUHeight(); |
---|
| 2833 | |
---|
| 2834 | if ( nsTUWidthInBaseUnits > nsTUHeightInBaseUnits ) |
---|
| 2835 | { |
---|
| 2836 | UInt currPartNumb = nsTUHeightInBaseUnits*nsTUHeightInBaseUnits; |
---|
| 2837 | memset( m_nsqtPartIdx + absTUPartIdx , absPartIdx, sizeof(UChar)*(currPartNumb) ); |
---|
| 2838 | memset( m_nsqtPartIdx + g_auiRasterToZscan[g_auiZscanToRaster[absTUPartIdx]+ nsTUHeightInBaseUnits], absPartIdx, sizeof(UChar)*(currPartNumb) ); |
---|
| 2839 | memset( m_nsqtPartIdx + g_auiRasterToZscan[g_auiZscanToRaster[absTUPartIdx]+2*nsTUHeightInBaseUnits], absPartIdx, sizeof(UChar)*(currPartNumb) ); |
---|
| 2840 | memset( m_nsqtPartIdx + g_auiRasterToZscan[g_auiZscanToRaster[absTUPartIdx]+3*nsTUHeightInBaseUnits], absPartIdx, sizeof(UChar)*(currPartNumb) ); |
---|
| 2841 | } |
---|
| 2842 | else if ( nsTUWidthInBaseUnits < nsTUHeightInBaseUnits ) |
---|
| 2843 | { |
---|
| 2844 | UInt currPartNumb = nsTUWidthInBaseUnits*nsTUWidthInBaseUnits; |
---|
| 2845 | memset( m_nsqtPartIdx + absTUPartIdx , absPartIdx, sizeof(UChar)*(currPartNumb) ); |
---|
| 2846 | memset( m_nsqtPartIdx + g_auiRasterToZscan[g_auiZscanToRaster[absTUPartIdx]+ nsTUWidthInBaseUnits*lcuWidthInBaseUnits], absPartIdx, sizeof(UChar)*(currPartNumb) ); |
---|
| 2847 | memset( m_nsqtPartIdx + g_auiRasterToZscan[g_auiZscanToRaster[absTUPartIdx]+2*nsTUWidthInBaseUnits*lcuWidthInBaseUnits], absPartIdx, sizeof(UChar)*(currPartNumb) ); |
---|
| 2848 | memset( m_nsqtPartIdx + g_auiRasterToZscan[g_auiZscanToRaster[absTUPartIdx]+3*nsTUWidthInBaseUnits*lcuWidthInBaseUnits], absPartIdx, sizeof(UChar)*(currPartNumb) ); |
---|
| 2849 | } |
---|
| 2850 | else |
---|
| 2851 | { |
---|
| 2852 | UInt currPartNumb = nsTUWidthInBaseUnits*nsTUHeightInBaseUnits; |
---|
| 2853 | memset( m_nsqtPartIdx + absTUPartIdx, absPartIdx, sizeof(UChar)*(currPartNumb) ); |
---|
| 2854 | } |
---|
| 2855 | } |
---|
| 2856 | |
---|
[2] | 2857 | Void TComDataCU::setSizeSubParts( UInt uiWidth, UInt uiHeight, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 2858 | { |
---|
| 2859 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
| 2860 | |
---|
| 2861 | memset( m_puhWidth + uiAbsPartIdx, uiWidth, sizeof(UChar)*uiCurrPartNumb ); |
---|
| 2862 | memset( m_puhHeight + uiAbsPartIdx, uiHeight, sizeof(UChar)*uiCurrPartNumb ); |
---|
| 2863 | } |
---|
| 2864 | |
---|
| 2865 | UChar TComDataCU::getNumPartInter() |
---|
| 2866 | { |
---|
| 2867 | UChar iNumPart = 0; |
---|
| 2868 | |
---|
| 2869 | switch ( m_pePartSize[0] ) |
---|
| 2870 | { |
---|
| 2871 | case SIZE_2Nx2N: iNumPart = 1; break; |
---|
| 2872 | case SIZE_2NxN: iNumPart = 2; break; |
---|
| 2873 | case SIZE_Nx2N: iNumPart = 2; break; |
---|
| 2874 | case SIZE_NxN: iNumPart = 4; break; |
---|
[56] | 2875 | case SIZE_2NxnU: iNumPart = 2; break; |
---|
| 2876 | case SIZE_2NxnD: iNumPart = 2; break; |
---|
| 2877 | case SIZE_nLx2N: iNumPart = 2; break; |
---|
| 2878 | case SIZE_nRx2N: iNumPart = 2; break; |
---|
[2] | 2879 | default: assert (0); break; |
---|
| 2880 | } |
---|
| 2881 | |
---|
| 2882 | return iNumPart; |
---|
| 2883 | } |
---|
| 2884 | |
---|
[62] | 2885 | #if LG_RESTRICTEDRESPRED_M24766 |
---|
| 2886 | Void TComDataCU::getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight, UInt uiAbsPartIdx, Bool bLCU) |
---|
| 2887 | { |
---|
| 2888 | UInt uiNumPartition = bLCU ? (getWidth(uiAbsPartIdx)*getHeight(uiAbsPartIdx) >> 4) : m_uiNumPartition; |
---|
| 2889 | UInt uiTmpAbsPartIdx = bLCU ? uiAbsPartIdx : 0; |
---|
| 2890 | |
---|
| 2891 | switch ( m_pePartSize[uiTmpAbsPartIdx] ) |
---|
| 2892 | { |
---|
| 2893 | case SIZE_2NxN: |
---|
| 2894 | riWidth = getWidth(uiTmpAbsPartIdx); riHeight = getHeight(uiTmpAbsPartIdx) >> 1; ruiPartAddr = ( uiPartIdx == 0 )? 0 : uiNumPartition >> 1; |
---|
| 2895 | break; |
---|
| 2896 | case SIZE_Nx2N: |
---|
| 2897 | riWidth = getWidth(uiTmpAbsPartIdx) >> 1; riHeight = getHeight(uiTmpAbsPartIdx); ruiPartAddr = ( uiPartIdx == 0 )? 0 : uiNumPartition >> 2; |
---|
| 2898 | break; |
---|
| 2899 | case SIZE_NxN: |
---|
| 2900 | riWidth = getWidth(uiTmpAbsPartIdx) >> 1; riHeight = getHeight(uiTmpAbsPartIdx) >> 1; ruiPartAddr = ( uiNumPartition >> 2 ) * uiPartIdx; |
---|
| 2901 | break; |
---|
| 2902 | case SIZE_2NxnU: |
---|
| 2903 | riWidth = getWidth(uiTmpAbsPartIdx); |
---|
| 2904 | riHeight = ( uiPartIdx == 0 ) ? getHeight(uiTmpAbsPartIdx) >> 2 : ( getHeight(uiTmpAbsPartIdx) >> 2 ) + ( getHeight(uiTmpAbsPartIdx) >> 1 ); |
---|
| 2905 | ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : uiNumPartition >> 3; |
---|
| 2906 | break; |
---|
| 2907 | case SIZE_2NxnD: |
---|
| 2908 | riWidth = getWidth(uiTmpAbsPartIdx); |
---|
| 2909 | riHeight = ( uiPartIdx == 0 ) ? ( getHeight(uiTmpAbsPartIdx) >> 2 ) + ( getHeight(uiTmpAbsPartIdx) >> 1 ) : getHeight(uiTmpAbsPartIdx) >> 2; |
---|
| 2910 | ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : (uiNumPartition >> 1) + (uiNumPartition >> 3); |
---|
| 2911 | break; |
---|
| 2912 | case SIZE_nLx2N: |
---|
| 2913 | riWidth = ( uiPartIdx == 0 ) ? getWidth(uiTmpAbsPartIdx) >> 2 : ( getWidth(uiTmpAbsPartIdx) >> 2 ) + ( getWidth(uiTmpAbsPartIdx) >> 1 ); |
---|
| 2914 | riHeight = getHeight(uiTmpAbsPartIdx); |
---|
| 2915 | ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : uiNumPartition >> 4; |
---|
| 2916 | break; |
---|
| 2917 | case SIZE_nRx2N: |
---|
| 2918 | riWidth = ( uiPartIdx == 0 ) ? ( getWidth(uiTmpAbsPartIdx) >> 2 ) + ( getWidth(uiTmpAbsPartIdx) >> 1 ) : getWidth(uiTmpAbsPartIdx) >> 2; |
---|
| 2919 | riHeight = getHeight(uiTmpAbsPartIdx); |
---|
| 2920 | ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : (uiNumPartition >> 2) + (uiNumPartition >> 4); |
---|
| 2921 | break; |
---|
| 2922 | default: |
---|
| 2923 | assert ( m_pePartSize[0] == SIZE_2Nx2N ); |
---|
| 2924 | riWidth = getWidth(uiTmpAbsPartIdx); riHeight = getHeight(uiTmpAbsPartIdx); ruiPartAddr = 0; |
---|
| 2925 | break; |
---|
| 2926 | } |
---|
| 2927 | } |
---|
| 2928 | #else |
---|
[2] | 2929 | Void TComDataCU::getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight ) |
---|
| 2930 | { |
---|
| 2931 | switch ( m_pePartSize[0] ) |
---|
| 2932 | { |
---|
| 2933 | case SIZE_2NxN: |
---|
| 2934 | riWidth = getWidth(0); riHeight = getHeight(0) >> 1; ruiPartAddr = ( uiPartIdx == 0 )? 0 : m_uiNumPartition >> 1; |
---|
| 2935 | break; |
---|
| 2936 | case SIZE_Nx2N: |
---|
| 2937 | riWidth = getWidth(0) >> 1; riHeight = getHeight(0); ruiPartAddr = ( uiPartIdx == 0 )? 0 : m_uiNumPartition >> 2; |
---|
| 2938 | break; |
---|
| 2939 | case SIZE_NxN: |
---|
| 2940 | riWidth = getWidth(0) >> 1; riHeight = getHeight(0) >> 1; ruiPartAddr = ( m_uiNumPartition >> 2 ) * uiPartIdx; |
---|
| 2941 | break; |
---|
[56] | 2942 | case SIZE_2NxnU: |
---|
| 2943 | riWidth = getWidth(0); |
---|
| 2944 | riHeight = ( uiPartIdx == 0 ) ? getHeight(0) >> 2 : ( getHeight(0) >> 2 ) + ( getHeight(0) >> 1 ); |
---|
| 2945 | ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : m_uiNumPartition >> 3; |
---|
| 2946 | break; |
---|
| 2947 | case SIZE_2NxnD: |
---|
| 2948 | riWidth = getWidth(0); |
---|
| 2949 | riHeight = ( uiPartIdx == 0 ) ? ( getHeight(0) >> 2 ) + ( getHeight(0) >> 1 ) : getHeight(0) >> 2; |
---|
| 2950 | ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : (m_uiNumPartition >> 1) + (m_uiNumPartition >> 3); |
---|
| 2951 | break; |
---|
| 2952 | case SIZE_nLx2N: |
---|
| 2953 | riWidth = ( uiPartIdx == 0 ) ? getWidth(0) >> 2 : ( getWidth(0) >> 2 ) + ( getWidth(0) >> 1 ); |
---|
| 2954 | riHeight = getHeight(0); |
---|
| 2955 | ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : m_uiNumPartition >> 4; |
---|
| 2956 | break; |
---|
| 2957 | case SIZE_nRx2N: |
---|
| 2958 | riWidth = ( uiPartIdx == 0 ) ? ( getWidth(0) >> 2 ) + ( getWidth(0) >> 1 ) : getWidth(0) >> 2; |
---|
| 2959 | riHeight = getHeight(0); |
---|
| 2960 | ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : (m_uiNumPartition >> 2) + (m_uiNumPartition >> 4); |
---|
| 2961 | break; |
---|
[2] | 2962 | default: |
---|
| 2963 | assert ( m_pePartSize[0] == SIZE_2Nx2N ); |
---|
| 2964 | riWidth = getWidth(0); riHeight = getHeight(0); ruiPartAddr = 0; |
---|
| 2965 | break; |
---|
| 2966 | } |
---|
| 2967 | } |
---|
[62] | 2968 | #endif |
---|
[2] | 2969 | |
---|
[62] | 2970 | #if LG_RESTRICTEDRESPRED_M24766 |
---|
| 2971 | Int TComDataCU::getResiPredMode(UInt uiPartAddr) |
---|
| 2972 | { |
---|
| 2973 | Int iAddResiShift = -1; |
---|
[2] | 2974 | |
---|
[62] | 2975 | for(UInt uiRefIdx = 0; uiRefIdx < 2; uiRefIdx++) |
---|
| 2976 | { |
---|
| 2977 | RefPicList eRefList = uiRefIdx ? REF_PIC_LIST_1 : REF_PIC_LIST_0; |
---|
| 2978 | Int iBestRefIdx = getCUMvField(eRefList)->getRefIdx(uiPartAddr); |
---|
| 2979 | if(iBestRefIdx >= 0 && getSlice()->getViewId() == getSlice()->getRefViewId(eRefList, iBestRefIdx)) |
---|
| 2980 | iAddResiShift++; |
---|
| 2981 | } |
---|
| 2982 | |
---|
| 2983 | return iAddResiShift; |
---|
| 2984 | } |
---|
| 2985 | |
---|
| 2986 | Void TComDataCU::getPUResiPredShift(Int *iPUResiPredShift, UInt uiAbsPartIndex) |
---|
| 2987 | { |
---|
| 2988 | UInt uiPartSize = getPartitionSize(uiAbsPartIndex); |
---|
| 2989 | UInt uiPartAddr; |
---|
| 2990 | Int iWidth, iHeight; |
---|
| 2991 | Int iAddResiShift; |
---|
| 2992 | |
---|
| 2993 | if(uiPartSize == SIZE_2Nx2N) |
---|
| 2994 | { |
---|
| 2995 | iAddResiShift = getResiPredMode(uiAbsPartIndex); |
---|
| 2996 | for(UInt i = 0; i < 4; i++) |
---|
| 2997 | iPUResiPredShift[i] = (getSlice()->getPPS()->getUseWP() || getInterDir(uiAbsPartIndex) != 3) ? (iAddResiShift >= 0 ? 0 : -1) : (iAddResiShift >= 0 ? 1-iAddResiShift : -1); |
---|
| 2998 | return; |
---|
| 2999 | } |
---|
| 3000 | |
---|
| 3001 | if(uiPartSize == SIZE_2NxN || uiPartSize == SIZE_2NxnU || uiPartSize == SIZE_2NxnD) |
---|
| 3002 | { |
---|
| 3003 | for(UInt i = 0; i < 2; i++) |
---|
| 3004 | { |
---|
| 3005 | getPartIndexAndSize(i, uiPartAddr, iWidth, iHeight, uiAbsPartIndex, true); |
---|
| 3006 | uiPartAddr += uiAbsPartIndex; |
---|
| 3007 | iAddResiShift = getResiPredMode(uiPartAddr); |
---|
| 3008 | iPUResiPredShift[2*i] = iPUResiPredShift[2*i+1] = (getSlice()->getPPS()->getUseWP() || getInterDir(uiPartAddr) != 3) ? (iAddResiShift >= 0 ? 0 : -1) : (iAddResiShift >= 0 ? 1-iAddResiShift : -1); |
---|
| 3009 | } |
---|
| 3010 | return; |
---|
| 3011 | } |
---|
| 3012 | |
---|
| 3013 | if(uiPartSize == SIZE_Nx2N || uiPartSize == SIZE_nLx2N || uiPartSize == SIZE_nRx2N) |
---|
| 3014 | { |
---|
| 3015 | for(UInt i = 0; i < 2; i++) |
---|
| 3016 | { |
---|
| 3017 | getPartIndexAndSize(i, uiPartAddr, iWidth, iHeight, uiAbsPartIndex, true); |
---|
| 3018 | uiPartAddr += uiAbsPartIndex; |
---|
| 3019 | iAddResiShift = getResiPredMode(uiPartAddr); |
---|
| 3020 | iPUResiPredShift[i] = iPUResiPredShift[2+i] = (getSlice()->getPPS()->getUseWP() || getInterDir(uiPartAddr) != 3) ? (iAddResiShift >= 0 ? 0 : -1) : (iAddResiShift >= 0 ? 1-iAddResiShift : -1); |
---|
| 3021 | } |
---|
| 3022 | return; |
---|
| 3023 | } |
---|
| 3024 | |
---|
| 3025 | if(uiPartSize == SIZE_NxN) |
---|
| 3026 | { |
---|
| 3027 | for(UInt i = 0; i < 4; i++) |
---|
| 3028 | { |
---|
| 3029 | getPartIndexAndSize(i, uiPartAddr, iWidth, iHeight, uiAbsPartIndex, true); |
---|
| 3030 | uiPartAddr += uiAbsPartIndex; |
---|
| 3031 | iAddResiShift = getResiPredMode(uiPartAddr); |
---|
| 3032 | iPUResiPredShift[i] = (getSlice()->getPPS()->getUseWP() || getInterDir(uiPartAddr) != 3) ? (iAddResiShift >= 0 ? 0 : -1) : (iAddResiShift >= 0 ? 1-iAddResiShift : -1); |
---|
| 3033 | } |
---|
| 3034 | } |
---|
| 3035 | |
---|
| 3036 | } |
---|
| 3037 | #endif |
---|
| 3038 | |
---|
[2] | 3039 | Void TComDataCU::getMvField ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList, TComMvField& rcMvField ) |
---|
| 3040 | { |
---|
| 3041 | if ( pcCU == NULL ) // OUT OF BOUNDARY |
---|
| 3042 | { |
---|
| 3043 | TComMv cZeroMv; |
---|
| 3044 | rcMvField.setMvField( cZeroMv, NOT_VALID ); |
---|
| 3045 | return; |
---|
| 3046 | } |
---|
| 3047 | |
---|
| 3048 | TComCUMvField* pcCUMvField = pcCU->getCUMvField( eRefPicList ); |
---|
| 3049 | rcMvField.setMvField( pcCUMvField->getMv( uiAbsPartIdx ), pcCUMvField->getRefIdx( uiAbsPartIdx ) ); |
---|
| 3050 | } |
---|
| 3051 | |
---|
| 3052 | Void TComDataCU::deriveLeftRightTopIdxGeneral ( PartSize eCUMode, UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ) |
---|
| 3053 | { |
---|
| 3054 | ruiPartIdxLT = m_uiAbsIdxInLCU + uiAbsPartIdx; |
---|
| 3055 | UInt uiPUWidth = 0; |
---|
| 3056 | |
---|
| 3057 | switch ( m_pePartSize[uiAbsPartIdx] ) |
---|
| 3058 | { |
---|
| 3059 | case SIZE_2Nx2N: uiPUWidth = m_puhWidth[uiAbsPartIdx]; break; |
---|
| 3060 | case SIZE_2NxN: uiPUWidth = m_puhWidth[uiAbsPartIdx]; break; |
---|
| 3061 | case SIZE_Nx2N: uiPUWidth = m_puhWidth[uiAbsPartIdx] >> 1; break; |
---|
| 3062 | case SIZE_NxN: uiPUWidth = m_puhWidth[uiAbsPartIdx] >> 1; break; |
---|
[56] | 3063 | case SIZE_2NxnU: uiPUWidth = m_puhWidth[uiAbsPartIdx]; break; |
---|
| 3064 | case SIZE_2NxnD: uiPUWidth = m_puhWidth[uiAbsPartIdx]; break; |
---|
| 3065 | case SIZE_nLx2N: |
---|
| 3066 | if ( uiPartIdx == 0 ) |
---|
| 3067 | { |
---|
| 3068 | uiPUWidth = m_puhWidth[uiAbsPartIdx] >> 2; |
---|
| 3069 | } |
---|
| 3070 | else if ( uiPartIdx == 1 ) |
---|
| 3071 | { |
---|
| 3072 | uiPUWidth = (m_puhWidth[uiAbsPartIdx] >> 1) + (m_puhWidth[uiAbsPartIdx] >> 2); |
---|
| 3073 | } |
---|
| 3074 | else |
---|
| 3075 | { |
---|
| 3076 | assert(0); |
---|
| 3077 | } |
---|
| 3078 | break; |
---|
| 3079 | case SIZE_nRx2N: |
---|
| 3080 | if ( uiPartIdx == 0 ) |
---|
| 3081 | { |
---|
| 3082 | uiPUWidth = (m_puhWidth[uiAbsPartIdx] >> 1) + (m_puhWidth[uiAbsPartIdx] >> 2); |
---|
| 3083 | } |
---|
| 3084 | else if ( uiPartIdx == 1 ) |
---|
| 3085 | { |
---|
| 3086 | uiPUWidth = m_puhWidth[uiAbsPartIdx] >> 2; |
---|
| 3087 | } |
---|
| 3088 | else |
---|
| 3089 | { |
---|
| 3090 | assert(0); |
---|
| 3091 | } |
---|
| 3092 | break; |
---|
[2] | 3093 | default: |
---|
| 3094 | assert (0); |
---|
| 3095 | break; |
---|
| 3096 | } |
---|
| 3097 | |
---|
| 3098 | ruiPartIdxRT = g_auiRasterToZscan [g_auiZscanToRaster[ ruiPartIdxLT ] + uiPUWidth / m_pcPic->getMinCUWidth() - 1 ]; |
---|
| 3099 | } |
---|
| 3100 | |
---|
| 3101 | Void TComDataCU::deriveLeftBottomIdxGeneral( PartSize eCUMode, UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLB ) |
---|
| 3102 | { |
---|
| 3103 | UInt uiPUHeight = 0; |
---|
| 3104 | switch ( m_pePartSize[uiAbsPartIdx] ) |
---|
| 3105 | { |
---|
| 3106 | case SIZE_2Nx2N: uiPUHeight = m_puhHeight[uiAbsPartIdx]; break; |
---|
| 3107 | case SIZE_2NxN: uiPUHeight = m_puhHeight[uiAbsPartIdx] >> 1; break; |
---|
| 3108 | case SIZE_Nx2N: uiPUHeight = m_puhHeight[uiAbsPartIdx]; break; |
---|
| 3109 | case SIZE_NxN: uiPUHeight = m_puhHeight[uiAbsPartIdx] >> 1; break; |
---|
[56] | 3110 | case SIZE_2NxnU: |
---|
| 3111 | if ( uiPartIdx == 0 ) |
---|
| 3112 | { |
---|
| 3113 | uiPUHeight = m_puhHeight[uiAbsPartIdx] >> 2; |
---|
| 3114 | } |
---|
| 3115 | else if ( uiPartIdx == 1 ) |
---|
| 3116 | { |
---|
| 3117 | uiPUHeight = (m_puhHeight[uiAbsPartIdx] >> 1) + (m_puhHeight[uiAbsPartIdx] >> 2); |
---|
| 3118 | } |
---|
| 3119 | else |
---|
| 3120 | { |
---|
| 3121 | assert(0); |
---|
| 3122 | } |
---|
| 3123 | break; |
---|
| 3124 | case SIZE_2NxnD: |
---|
| 3125 | if ( uiPartIdx == 0 ) |
---|
| 3126 | { |
---|
| 3127 | uiPUHeight = (m_puhHeight[uiAbsPartIdx] >> 1) + (m_puhHeight[uiAbsPartIdx] >> 2); |
---|
| 3128 | } |
---|
| 3129 | else if ( uiPartIdx == 1 ) |
---|
| 3130 | { |
---|
| 3131 | uiPUHeight = m_puhHeight[uiAbsPartIdx] >> 2; |
---|
| 3132 | } |
---|
| 3133 | else |
---|
| 3134 | { |
---|
| 3135 | assert(0); |
---|
| 3136 | } |
---|
| 3137 | break; |
---|
| 3138 | case SIZE_nLx2N: uiPUHeight = m_puhHeight[uiAbsPartIdx]; break; |
---|
| 3139 | case SIZE_nRx2N: uiPUHeight = m_puhHeight[uiAbsPartIdx]; break; |
---|
[2] | 3140 | default: |
---|
| 3141 | assert (0); |
---|
| 3142 | break; |
---|
| 3143 | } |
---|
| 3144 | |
---|
| 3145 | ruiPartIdxLB = g_auiRasterToZscan [g_auiZscanToRaster[ m_uiAbsIdxInLCU + uiAbsPartIdx ] + ((uiPUHeight / m_pcPic->getMinCUHeight()) - 1)*m_pcPic->getNumPartInWidth()]; |
---|
| 3146 | } |
---|
| 3147 | |
---|
| 3148 | Void TComDataCU::deriveLeftRightTopIdx ( PartSize eCUMode, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ) |
---|
| 3149 | { |
---|
| 3150 | ruiPartIdxLT = m_uiAbsIdxInLCU; |
---|
| 3151 | ruiPartIdxRT = g_auiRasterToZscan [g_auiZscanToRaster[ ruiPartIdxLT ] + m_puhWidth[0] / m_pcPic->getMinCUWidth() - 1 ]; |
---|
| 3152 | |
---|
| 3153 | switch ( m_pePartSize[0] ) |
---|
| 3154 | { |
---|
| 3155 | case SIZE_2Nx2N: break; |
---|
| 3156 | case SIZE_2NxN: |
---|
| 3157 | ruiPartIdxLT += ( uiPartIdx == 0 )? 0 : m_uiNumPartition >> 1; ruiPartIdxRT += ( uiPartIdx == 0 )? 0 : m_uiNumPartition >> 1; |
---|
| 3158 | break; |
---|
| 3159 | case SIZE_Nx2N: |
---|
| 3160 | ruiPartIdxLT += ( uiPartIdx == 0 )? 0 : m_uiNumPartition >> 2; ruiPartIdxRT -= ( uiPartIdx == 1 )? 0 : m_uiNumPartition >> 2; |
---|
| 3161 | break; |
---|
| 3162 | case SIZE_NxN: |
---|
| 3163 | ruiPartIdxLT += ( m_uiNumPartition >> 2 ) * uiPartIdx; ruiPartIdxRT += ( m_uiNumPartition >> 2 ) * ( uiPartIdx - 1 ); |
---|
| 3164 | break; |
---|
[56] | 3165 | case SIZE_2NxnU: |
---|
| 3166 | ruiPartIdxLT += ( uiPartIdx == 0 )? 0 : m_uiNumPartition >> 3; |
---|
| 3167 | ruiPartIdxRT += ( uiPartIdx == 0 )? 0 : m_uiNumPartition >> 3; |
---|
| 3168 | break; |
---|
| 3169 | case SIZE_2NxnD: |
---|
| 3170 | ruiPartIdxLT += ( uiPartIdx == 0 )? 0 : ( m_uiNumPartition >> 1 ) + ( m_uiNumPartition >> 3 ); |
---|
| 3171 | ruiPartIdxRT += ( uiPartIdx == 0 )? 0 : ( m_uiNumPartition >> 1 ) + ( m_uiNumPartition >> 3 ); |
---|
| 3172 | break; |
---|
| 3173 | case SIZE_nLx2N: |
---|
| 3174 | ruiPartIdxLT += ( uiPartIdx == 0 )? 0 : m_uiNumPartition >> 4; |
---|
| 3175 | ruiPartIdxRT -= ( uiPartIdx == 1 )? 0 : ( m_uiNumPartition >> 2 ) + ( m_uiNumPartition >> 4 ); |
---|
| 3176 | break; |
---|
| 3177 | case SIZE_nRx2N: |
---|
| 3178 | ruiPartIdxLT += ( uiPartIdx == 0 )? 0 : ( m_uiNumPartition >> 2 ) + ( m_uiNumPartition >> 4 ); |
---|
| 3179 | ruiPartIdxRT -= ( uiPartIdx == 1 )? 0 : m_uiNumPartition >> 4; |
---|
| 3180 | break; |
---|
[2] | 3181 | default: |
---|
| 3182 | assert (0); |
---|
| 3183 | break; |
---|
| 3184 | } |
---|
| 3185 | |
---|
| 3186 | } |
---|
| 3187 | |
---|
| 3188 | Void TComDataCU::deriveLeftBottomIdx( PartSize eCUMode, UInt uiPartIdx, UInt& ruiPartIdxLB ) |
---|
| 3189 | { |
---|
| 3190 | ruiPartIdxLB = g_auiRasterToZscan [g_auiZscanToRaster[ m_uiAbsIdxInLCU ] + ( ((m_puhHeight[0] / m_pcPic->getMinCUHeight())>>1) - 1)*m_pcPic->getNumPartInWidth()]; |
---|
| 3191 | |
---|
| 3192 | switch ( m_pePartSize[0] ) |
---|
| 3193 | { |
---|
| 3194 | case SIZE_2Nx2N: |
---|
| 3195 | ruiPartIdxLB += m_uiNumPartition >> 1; |
---|
| 3196 | break; |
---|
| 3197 | case SIZE_2NxN: |
---|
| 3198 | ruiPartIdxLB += ( uiPartIdx == 0 )? 0 : m_uiNumPartition >> 1; |
---|
| 3199 | break; |
---|
| 3200 | case SIZE_Nx2N: |
---|
| 3201 | ruiPartIdxLB += ( uiPartIdx == 0 )? m_uiNumPartition >> 1 : (m_uiNumPartition >> 2)*3; |
---|
| 3202 | break; |
---|
| 3203 | case SIZE_NxN: |
---|
| 3204 | ruiPartIdxLB += ( m_uiNumPartition >> 2 ) * uiPartIdx; |
---|
| 3205 | break; |
---|
[56] | 3206 | case SIZE_2NxnU: |
---|
| 3207 | ruiPartIdxLB += ( uiPartIdx == 0 ) ? -((Int)m_uiNumPartition >> 3) : m_uiNumPartition >> 1; |
---|
| 3208 | break; |
---|
| 3209 | case SIZE_2NxnD: |
---|
| 3210 | ruiPartIdxLB += ( uiPartIdx == 0 ) ? (m_uiNumPartition >> 2) + (m_uiNumPartition >> 3): m_uiNumPartition >> 1; |
---|
| 3211 | break; |
---|
| 3212 | case SIZE_nLx2N: |
---|
| 3213 | ruiPartIdxLB += ( uiPartIdx == 0 ) ? m_uiNumPartition >> 1 : (m_uiNumPartition >> 1) + (m_uiNumPartition >> 4); |
---|
| 3214 | break; |
---|
| 3215 | case SIZE_nRx2N: |
---|
| 3216 | ruiPartIdxLB += ( uiPartIdx == 0 ) ? m_uiNumPartition >> 1 : (m_uiNumPartition >> 1) + (m_uiNumPartition >> 2) + (m_uiNumPartition >> 4); |
---|
| 3217 | break; |
---|
[2] | 3218 | default: |
---|
| 3219 | assert (0); |
---|
| 3220 | break; |
---|
| 3221 | } |
---|
| 3222 | } |
---|
| 3223 | |
---|
| 3224 | /** Derives the partition index of neighbouring bottom right block |
---|
[56] | 3225 | * \param [in] eCUMode |
---|
| 3226 | * \param [in] uiPartIdx |
---|
| 3227 | * \param [out] ruiPartIdxRB |
---|
[2] | 3228 | */ |
---|
| 3229 | Void TComDataCU::deriveRightBottomIdx( PartSize eCUMode, UInt uiPartIdx, UInt& ruiPartIdxRB ) |
---|
| 3230 | { |
---|
| 3231 | ruiPartIdxRB = g_auiRasterToZscan [g_auiZscanToRaster[ m_uiAbsIdxInLCU ] + ( ((m_puhHeight[0] / m_pcPic->getMinCUHeight())>>1) - 1)*m_pcPic->getNumPartInWidth() + m_puhWidth[0] / m_pcPic->getMinCUWidth() - 1]; |
---|
| 3232 | |
---|
| 3233 | switch ( m_pePartSize[0] ) |
---|
| 3234 | { |
---|
| 3235 | case SIZE_2Nx2N: |
---|
| 3236 | ruiPartIdxRB += m_uiNumPartition >> 1; |
---|
| 3237 | break; |
---|
| 3238 | case SIZE_2NxN: |
---|
| 3239 | ruiPartIdxRB += ( uiPartIdx == 0 )? 0 : m_uiNumPartition >> 1; |
---|
| 3240 | break; |
---|
| 3241 | case SIZE_Nx2N: |
---|
| 3242 | ruiPartIdxRB += ( uiPartIdx == 0 )? m_uiNumPartition >> 2 : (m_uiNumPartition >> 1); |
---|
| 3243 | break; |
---|
| 3244 | case SIZE_NxN: |
---|
| 3245 | ruiPartIdxRB += ( m_uiNumPartition >> 2 ) * ( uiPartIdx - 1 ); |
---|
| 3246 | break; |
---|
[56] | 3247 | case SIZE_2NxnU: |
---|
| 3248 | ruiPartIdxRB += ( uiPartIdx == 0 ) ? -((Int)m_uiNumPartition >> 3) : m_uiNumPartition >> 1; |
---|
| 3249 | break; |
---|
| 3250 | case SIZE_2NxnD: |
---|
| 3251 | ruiPartIdxRB += ( uiPartIdx == 0 ) ? (m_uiNumPartition >> 2) + (m_uiNumPartition >> 3): m_uiNumPartition >> 1; |
---|
| 3252 | break; |
---|
| 3253 | case SIZE_nLx2N: |
---|
| 3254 | ruiPartIdxRB += ( uiPartIdx == 0 ) ? (m_uiNumPartition >> 3) + (m_uiNumPartition >> 4): m_uiNumPartition >> 1; |
---|
| 3255 | break; |
---|
| 3256 | case SIZE_nRx2N: |
---|
| 3257 | ruiPartIdxRB += ( uiPartIdx == 0 ) ? (m_uiNumPartition >> 2) + (m_uiNumPartition >> 3) + (m_uiNumPartition >> 4) : m_uiNumPartition >> 1; |
---|
| 3258 | break; |
---|
[2] | 3259 | default: |
---|
| 3260 | assert (0); |
---|
| 3261 | break; |
---|
| 3262 | } |
---|
| 3263 | } |
---|
| 3264 | |
---|
| 3265 | Void TComDataCU::deriveLeftRightTopIdxAdi ( UInt& ruiPartIdxLT, UInt& ruiPartIdxRT, UInt uiPartOffset, UInt uiPartDepth ) |
---|
| 3266 | { |
---|
| 3267 | UInt uiNumPartInWidth = (m_puhWidth[0]/m_pcPic->getMinCUWidth())>>uiPartDepth; |
---|
| 3268 | ruiPartIdxLT = m_uiAbsIdxInLCU + uiPartOffset; |
---|
| 3269 | ruiPartIdxRT = g_auiRasterToZscan[ g_auiZscanToRaster[ ruiPartIdxLT ] + uiNumPartInWidth - 1 ]; |
---|
| 3270 | } |
---|
| 3271 | |
---|
| 3272 | Void TComDataCU::deriveLeftBottomIdxAdi( UInt& ruiPartIdxLB, UInt uiPartOffset, UInt uiPartDepth ) |
---|
| 3273 | { |
---|
| 3274 | UInt uiAbsIdx; |
---|
| 3275 | UInt uiMinCuWidth, uiWidthInMinCus; |
---|
| 3276 | |
---|
| 3277 | uiMinCuWidth = getPic()->getMinCUWidth(); |
---|
| 3278 | uiWidthInMinCus = (getWidth(0)/uiMinCuWidth)>>uiPartDepth; |
---|
| 3279 | uiAbsIdx = getZorderIdxInCU()+uiPartOffset+(m_uiNumPartition>>(uiPartDepth<<1))-1; |
---|
| 3280 | uiAbsIdx = g_auiZscanToRaster[uiAbsIdx]-(uiWidthInMinCus-1); |
---|
| 3281 | ruiPartIdxLB = g_auiRasterToZscan[uiAbsIdx]; |
---|
| 3282 | } |
---|
| 3283 | |
---|
| 3284 | Bool TComDataCU::hasEqualMotion( UInt uiAbsPartIdx, TComDataCU* pcCandCU, UInt uiCandAbsPartIdx ) |
---|
| 3285 | { |
---|
| 3286 | |
---|
| 3287 | if ( getInterDir( uiAbsPartIdx ) != pcCandCU->getInterDir( uiCandAbsPartIdx ) ) |
---|
| 3288 | { |
---|
| 3289 | return false; |
---|
| 3290 | } |
---|
| 3291 | |
---|
| 3292 | for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) |
---|
| 3293 | { |
---|
| 3294 | if ( getInterDir( uiAbsPartIdx ) & ( 1 << uiRefListIdx ) ) |
---|
| 3295 | { |
---|
| 3296 | if ( getCUMvField( RefPicList( uiRefListIdx ) )->getMv( uiAbsPartIdx ) != pcCandCU->getCUMvField( RefPicList( uiRefListIdx ) )->getMv( uiCandAbsPartIdx ) || |
---|
| 3297 | getCUMvField( RefPicList( uiRefListIdx ) )->getRefIdx( uiAbsPartIdx ) != pcCandCU->getCUMvField( RefPicList( uiRefListIdx ) )->getRefIdx( uiCandAbsPartIdx ) ) |
---|
| 3298 | { |
---|
| 3299 | return false; |
---|
| 3300 | } |
---|
| 3301 | } |
---|
| 3302 | } |
---|
| 3303 | |
---|
| 3304 | return true; |
---|
| 3305 | } |
---|
| 3306 | |
---|
[56] | 3307 | /** Constructs a list of merging candidates |
---|
| 3308 | * \param uiAbsPartIdx |
---|
| 3309 | * \param uiPUIdx |
---|
| 3310 | * \param uiDepth |
---|
| 3311 | * \param pcMvFieldNeighbours |
---|
| 3312 | * \param puhInterDirNeighbours |
---|
| 3313 | * \param numValidMergeCand |
---|
| 3314 | */ |
---|
| 3315 | #if SIMP_MRG_PRUN |
---|
| 3316 | Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx ) |
---|
| 3317 | #else |
---|
| 3318 | Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand ) |
---|
| 3319 | #endif |
---|
[2] | 3320 | { |
---|
[56] | 3321 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
| 3322 | const Int extraMergeCand = ( getSlice()->getSPS()->getMultiviewMvPredMode() ? 1 : 0 ); |
---|
| 3323 | #endif |
---|
[2] | 3324 | |
---|
[56] | 3325 | UInt uiAbsPartAddr = m_uiAbsIdxInLCU + uiAbsPartIdx; |
---|
| 3326 | UInt uiIdx = 1; |
---|
| 3327 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
| 3328 | bool abCandIsInter[ MRG_MAX_NUM_CANDS_MEM ]; |
---|
| 3329 | for( UInt ui = 0; ui < MRG_MAX_NUM_CANDS_MEM; ++ui ) |
---|
| 3330 | #else |
---|
| 3331 | bool abCandIsInter[ MRG_MAX_NUM_CANDS ]; |
---|
| 3332 | for( UInt ui = 0; ui < MRG_MAX_NUM_CANDS; ++ui ) |
---|
| 3333 | #endif |
---|
[2] | 3334 | { |
---|
[56] | 3335 | abCandIsInter[ui] = false; |
---|
[2] | 3336 | } |
---|
[56] | 3337 | // compute the location of the current PU |
---|
| 3338 | #if PARALLEL_MERGE |
---|
| 3339 | Int xP, yP, nPSW, nPSH; |
---|
| 3340 | this->getPartPosition(uiPUIdx, xP, yP, nPSW, nPSH); |
---|
| 3341 | #endif |
---|
[2] | 3342 | |
---|
[56] | 3343 | Int iCount = 0; |
---|
[2] | 3344 | |
---|
[56] | 3345 | UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB; |
---|
| 3346 | PartSize cCurPS = getPartitionSize( uiAbsPartIdx ); |
---|
| 3347 | deriveLeftRightTopIdxGeneral( cCurPS, uiAbsPartIdx, uiPUIdx, uiPartIdxLT, uiPartIdxRT ); |
---|
| 3348 | deriveLeftBottomIdxGeneral( cCurPS, uiAbsPartIdx, uiPUIdx, uiPartIdxLB ); |
---|
[2] | 3349 | |
---|
[56] | 3350 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
| 3351 | Bool bNoPdmMerge = ( m_pcSlice->getSPS()->getViewId() == 0 || ( m_pcSlice->getSPS()->getMultiviewMvPredMode() & PDM_USE_FOR_MERGE ) != PDM_USE_FOR_MERGE ); |
---|
[2] | 3352 | |
---|
[56] | 3353 | //===== add merge with predicted depth maps ===== |
---|
| 3354 | TComMv acPdmMv [2]; |
---|
| 3355 | Int aiPdmRefIdx [2] = {-1, -1}; |
---|
| 3356 | Int iPdmInterDir = getPdmMergeCandidate( uiPUIdx, aiPdmRefIdx, acPdmMv ); |
---|
[2] | 3357 | |
---|
[56] | 3358 | if( iPdmInterDir && !bNoPdmMerge && PDM_MERGE_POS == 0 ) |
---|
[2] | 3359 | { |
---|
[56] | 3360 | abCandIsInter [ iCount ] = true; |
---|
| 3361 | puhInterDirNeighbours[ iCount ] = iPdmInterDir; |
---|
| 3362 | if( ( iPdmInterDir & 1 ) == 1 ) |
---|
[2] | 3363 | { |
---|
[56] | 3364 | pcMvFieldNeighbours[ iCount<<1 ].setMvField( acPdmMv[ 0 ], aiPdmRefIdx[ 0 ] ); |
---|
[2] | 3365 | } |
---|
[56] | 3366 | if( ( iPdmInterDir & 2 ) == 2 ) |
---|
[2] | 3367 | { |
---|
[56] | 3368 | pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( acPdmMv[ 1 ], aiPdmRefIdx[ 1 ] ); |
---|
[2] | 3369 | } |
---|
[56] | 3370 | #if SIMP_MRG_PRUN |
---|
| 3371 | if ( mrgCandIdx == iCount ) |
---|
| 3372 | { |
---|
| 3373 | return; |
---|
| 3374 | } |
---|
| 3375 | #endif |
---|
| 3376 | iCount ++; |
---|
[2] | 3377 | } |
---|
[56] | 3378 | #endif |
---|
[2] | 3379 | |
---|
[56] | 3380 | //left |
---|
| 3381 | UInt uiLeftPartIdx = 0; |
---|
| 3382 | TComDataCU* pcCULeft = 0; |
---|
| 3383 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
| 3384 | pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB, true, false ); |
---|
[5] | 3385 | #else |
---|
[56] | 3386 | pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB ); |
---|
[5] | 3387 | #endif |
---|
[56] | 3388 | #if PARALLEL_MERGE |
---|
| 3389 | if (pcCULeft) |
---|
[2] | 3390 | { |
---|
[56] | 3391 | if (!pcCULeft->isDiffMER(xP -1, yP+nPSH-1, xP, yP)) |
---|
| 3392 | { |
---|
| 3393 | pcCULeft = NULL; |
---|
| 3394 | } |
---|
[2] | 3395 | } |
---|
[56] | 3396 | #endif |
---|
| 3397 | PartSize partSize = getPartitionSize( uiAbsPartIdx ); |
---|
| 3398 | if (!(uiPUIdx == 1 && (partSize == SIZE_Nx2N || partSize == SIZE_nLx2N || partSize == SIZE_nRx2N))) |
---|
[2] | 3399 | { |
---|
[56] | 3400 | if ( pcCULeft && !pcCULeft->isIntra( uiLeftPartIdx ) ) |
---|
[2] | 3401 | { |
---|
[56] | 3402 | abCandIsInter[iCount] = true; |
---|
[2] | 3403 | // get Inter Dir |
---|
[56] | 3404 | puhInterDirNeighbours[iCount] = pcCULeft->getInterDir( uiLeftPartIdx ); |
---|
[2] | 3405 | // get Mv from Left |
---|
[56] | 3406 | pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); |
---|
[2] | 3407 | if ( getSlice()->isInterB() ) |
---|
| 3408 | { |
---|
[56] | 3409 | pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); |
---|
[2] | 3410 | } |
---|
[56] | 3411 | #if SIMP_MRG_PRUN |
---|
| 3412 | if ( mrgCandIdx == iCount ) |
---|
| 3413 | { |
---|
| 3414 | return; |
---|
| 3415 | } |
---|
| 3416 | #endif |
---|
| 3417 | iCount ++; |
---|
[2] | 3418 | } |
---|
[56] | 3419 | } |
---|
[2] | 3420 | |
---|
[56] | 3421 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
| 3422 | if( iPdmInterDir && !bNoPdmMerge && PDM_MERGE_POS == 1 ) |
---|
| 3423 | { |
---|
| 3424 | abCandIsInter [ iCount ] = true; |
---|
| 3425 | puhInterDirNeighbours[ iCount ] = iPdmInterDir; |
---|
| 3426 | if( ( iPdmInterDir & 1 ) == 1 ) |
---|
| 3427 | { |
---|
| 3428 | pcMvFieldNeighbours[ iCount<<1 ].setMvField( acPdmMv[ 0 ], aiPdmRefIdx[ 0 ] ); |
---|
| 3429 | } |
---|
| 3430 | if( ( iPdmInterDir & 2 ) == 2 ) |
---|
| 3431 | { |
---|
| 3432 | pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( acPdmMv[ 1 ], aiPdmRefIdx[ 1 ] ); |
---|
| 3433 | } |
---|
| 3434 | #if SIMP_MRG_PRUN |
---|
| 3435 | if ( mrgCandIdx == iCount ) |
---|
| 3436 | { |
---|
| 3437 | return; |
---|
| 3438 | } |
---|
| 3439 | #endif |
---|
| 3440 | iCount ++; |
---|
| 3441 | } |
---|
| 3442 | #endif |
---|
[2] | 3443 | |
---|
[56] | 3444 | // above |
---|
| 3445 | #if !SIMP_MRG_PRUN |
---|
| 3446 | partSize = getPartitionSize( uiAbsPartIdx ); |
---|
| 3447 | if (!(uiPUIdx == 1 && (partSize == SIZE_2NxN || partSize == SIZE_2NxnU || partSize == SIZE_2NxnD))) |
---|
| 3448 | { |
---|
| 3449 | #endif |
---|
[2] | 3450 | UInt uiAbovePartIdx = 0; |
---|
| 3451 | TComDataCU* pcCUAbove = 0; |
---|
[56] | 3452 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
| 3453 | pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT, true, false, true ); |
---|
| 3454 | #else |
---|
| 3455 | pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT, true, true, true ); |
---|
| 3456 | #endif |
---|
| 3457 | #if PARALLEL_MERGE |
---|
| 3458 | if (pcCUAbove) |
---|
| 3459 | { |
---|
| 3460 | if (!pcCUAbove->isDiffMER(xP+nPSW-1, yP-1, xP, yP)) |
---|
| 3461 | { |
---|
| 3462 | pcCUAbove = NULL; |
---|
| 3463 | } |
---|
| 3464 | } |
---|
| 3465 | #endif |
---|
| 3466 | #if SIMP_MRG_PRUN |
---|
| 3467 | if ( pcCUAbove && !pcCUAbove->isIntra( uiAbovePartIdx ) |
---|
| 3468 | && !(uiPUIdx == 1 && (cCurPS == SIZE_2NxN || cCurPS == SIZE_2NxnU || cCurPS == SIZE_2NxnD)) |
---|
| 3469 | && ( !pcCULeft || pcCULeft->isIntra( uiLeftPartIdx ) || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAbove, uiAbovePartIdx ) ) ) |
---|
| 3470 | #else |
---|
[2] | 3471 | if ( pcCUAbove && !pcCUAbove->isIntra( uiAbovePartIdx ) ) |
---|
[56] | 3472 | #endif |
---|
[2] | 3473 | { |
---|
[56] | 3474 | abCandIsInter[iCount] = true; |
---|
[2] | 3475 | // get Inter Dir |
---|
[56] | 3476 | puhInterDirNeighbours[iCount] = pcCUAbove->getInterDir( uiAbovePartIdx ); |
---|
| 3477 | // get Mv from Left |
---|
| 3478 | pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); |
---|
[2] | 3479 | if ( getSlice()->isInterB() ) |
---|
| 3480 | { |
---|
[56] | 3481 | pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); |
---|
[2] | 3482 | } |
---|
[56] | 3483 | #if SIMP_MRG_PRUN |
---|
| 3484 | if ( mrgCandIdx == iCount ) |
---|
| 3485 | { |
---|
| 3486 | return; |
---|
| 3487 | } |
---|
| 3488 | #endif |
---|
| 3489 | iCount ++; |
---|
[2] | 3490 | } |
---|
[56] | 3491 | #if !SIMP_MRG_PRUN |
---|
| 3492 | } |
---|
| 3493 | #endif |
---|
[2] | 3494 | |
---|
[56] | 3495 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
| 3496 | if( iPdmInterDir && !bNoPdmMerge && PDM_MERGE_POS == 2 ) |
---|
[2] | 3497 | { |
---|
[56] | 3498 | abCandIsInter [ iCount ] = true; |
---|
| 3499 | puhInterDirNeighbours[ iCount ] = iPdmInterDir; |
---|
| 3500 | if( ( iPdmInterDir & 1 ) == 1 ) |
---|
[2] | 3501 | { |
---|
[56] | 3502 | pcMvFieldNeighbours[ iCount<<1 ].setMvField( acPdmMv[ 0 ], aiPdmRefIdx[ 0 ] ); |
---|
[2] | 3503 | } |
---|
[56] | 3504 | if( ( iPdmInterDir & 2 ) == 2 ) |
---|
[2] | 3505 | { |
---|
[56] | 3506 | pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( acPdmMv[ 1 ], aiPdmRefIdx[ 1 ] ); |
---|
[2] | 3507 | } |
---|
[56] | 3508 | #if SIMP_MRG_PRUN |
---|
| 3509 | if ( mrgCandIdx == iCount ) |
---|
[2] | 3510 | { |
---|
[56] | 3511 | return; |
---|
[2] | 3512 | } |
---|
[56] | 3513 | #endif |
---|
| 3514 | iCount ++; |
---|
| 3515 | } |
---|
| 3516 | #endif |
---|
| 3517 | |
---|
| 3518 | // above right |
---|
| 3519 | UInt uiAboveRightPartIdx = 0; |
---|
| 3520 | TComDataCU* pcCUAboveRight = 0; |
---|
| 3521 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
| 3522 | pcCUAboveRight = getPUAboveRight( uiAboveRightPartIdx, uiPartIdxRT, true, false, true ); |
---|
| 3523 | #else |
---|
| 3524 | pcCUAboveRight = getPUAboveRight( uiAboveRightPartIdx, uiPartIdxRT, true, true, true); |
---|
| 3525 | #endif |
---|
| 3526 | #if PARALLEL_MERGE |
---|
| 3527 | if (pcCUAboveRight) |
---|
| 3528 | { |
---|
| 3529 | if (!pcCUAboveRight->isDiffMER(xP+nPSW, yP-1, xP, yP)) |
---|
[2] | 3530 | { |
---|
[56] | 3531 | pcCUAboveRight = NULL; |
---|
[2] | 3532 | } |
---|
[56] | 3533 | } |
---|
| 3534 | #endif |
---|
| 3535 | #if SIMP_MRG_PRUN |
---|
| 3536 | if ( pcCUAboveRight && !pcCUAboveRight->isIntra( uiAboveRightPartIdx ) && ( !pcCUAbove || pcCUAbove->isIntra( uiAbovePartIdx ) || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveRight, uiAboveRightPartIdx ) ) ) |
---|
| 3537 | #else |
---|
| 3538 | if ( pcCUAboveRight && !pcCUAboveRight->isIntra( uiAboveRightPartIdx ) ) |
---|
| 3539 | #endif |
---|
| 3540 | { |
---|
| 3541 | abCandIsInter[iCount] = true; |
---|
| 3542 | // get Inter Dir |
---|
| 3543 | puhInterDirNeighbours[iCount] = pcCUAboveRight->getInterDir( uiAboveRightPartIdx ); |
---|
| 3544 | // get Mv from Left |
---|
| 3545 | pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); |
---|
| 3546 | if ( getSlice()->isInterB() ) |
---|
[2] | 3547 | { |
---|
[56] | 3548 | pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); |
---|
[2] | 3549 | } |
---|
[56] | 3550 | #if SIMP_MRG_PRUN |
---|
| 3551 | if ( mrgCandIdx == iCount ) |
---|
[2] | 3552 | { |
---|
[56] | 3553 | return; |
---|
[2] | 3554 | } |
---|
[56] | 3555 | #endif |
---|
| 3556 | iCount ++; |
---|
| 3557 | } |
---|
| 3558 | |
---|
| 3559 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
| 3560 | if( iPdmInterDir && !bNoPdmMerge && PDM_MERGE_POS == 3 ) |
---|
| 3561 | { |
---|
| 3562 | abCandIsInter [ iCount ] = true; |
---|
| 3563 | puhInterDirNeighbours[ iCount ] = iPdmInterDir; |
---|
| 3564 | if( ( iPdmInterDir & 1 ) == 1 ) |
---|
[2] | 3565 | { |
---|
[56] | 3566 | pcMvFieldNeighbours[ iCount<<1 ].setMvField( acPdmMv[ 0 ], aiPdmRefIdx[ 0 ] ); |
---|
[2] | 3567 | } |
---|
[56] | 3568 | if( ( iPdmInterDir & 2 ) == 2 ) |
---|
[2] | 3569 | { |
---|
[56] | 3570 | pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( acPdmMv[ 1 ], aiPdmRefIdx[ 1 ] ); |
---|
[2] | 3571 | } |
---|
[56] | 3572 | #if SIMP_MRG_PRUN |
---|
| 3573 | if ( mrgCandIdx == iCount ) |
---|
[2] | 3574 | { |
---|
[56] | 3575 | return; |
---|
[2] | 3576 | } |
---|
[56] | 3577 | #endif |
---|
| 3578 | iCount ++; |
---|
[2] | 3579 | } |
---|
| 3580 | #endif |
---|
| 3581 | |
---|
[56] | 3582 | //left bottom |
---|
| 3583 | UInt uiLeftBottomPartIdx = 0; |
---|
| 3584 | TComDataCU* pcCULeftBottom = 0; |
---|
| 3585 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
| 3586 | pcCULeftBottom = this->getPUBelowLeft( uiLeftBottomPartIdx, uiPartIdxLB, true, false ); |
---|
| 3587 | #else |
---|
| 3588 | pcCULeftBottom = this->getPUBelowLeft( uiLeftBottomPartIdx, uiPartIdxLB ); |
---|
| 3589 | #endif |
---|
| 3590 | #if PARALLEL_MERGE |
---|
| 3591 | if (pcCULeftBottom) |
---|
[2] | 3592 | { |
---|
[56] | 3593 | if (!pcCULeftBottom->isDiffMER(xP-1, yP+nPSH, xP, yP)) |
---|
| 3594 | { |
---|
| 3595 | pcCULeftBottom = NULL; |
---|
| 3596 | } |
---|
[2] | 3597 | } |
---|
[56] | 3598 | #endif |
---|
| 3599 | #if SIMP_MRG_PRUN |
---|
| 3600 | if ( pcCULeftBottom && !pcCULeftBottom->isIntra( uiLeftBottomPartIdx ) && ( !pcCULeft || pcCULeft->isIntra( uiLeftPartIdx ) || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCULeftBottom, uiLeftBottomPartIdx ) ) ) |
---|
| 3601 | #else |
---|
| 3602 | if ( pcCULeftBottom && !pcCULeftBottom->isIntra( uiLeftBottomPartIdx ) ) |
---|
| 3603 | #endif |
---|
[2] | 3604 | { |
---|
[56] | 3605 | abCandIsInter[iCount] = true; |
---|
| 3606 | // get Inter Dir |
---|
| 3607 | puhInterDirNeighbours[iCount] = pcCULeftBottom->getInterDir( uiLeftBottomPartIdx ); |
---|
| 3608 | // get Mv from Left |
---|
| 3609 | pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); |
---|
| 3610 | if ( getSlice()->isInterB() ) |
---|
| 3611 | { |
---|
| 3612 | pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); |
---|
| 3613 | } |
---|
| 3614 | #if SIMP_MRG_PRUN |
---|
| 3615 | if ( mrgCandIdx == iCount ) |
---|
| 3616 | { |
---|
| 3617 | return; |
---|
| 3618 | } |
---|
| 3619 | #endif |
---|
| 3620 | iCount ++; |
---|
[2] | 3621 | } |
---|
[56] | 3622 | |
---|
| 3623 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
| 3624 | if( iPdmInterDir && !bNoPdmMerge && PDM_MERGE_POS == 4 ) |
---|
[2] | 3625 | { |
---|
[56] | 3626 | abCandIsInter [ iCount ] = true; |
---|
| 3627 | puhInterDirNeighbours[ iCount ] = iPdmInterDir; |
---|
| 3628 | if( ( iPdmInterDir & 1 ) == 1 ) |
---|
[2] | 3629 | { |
---|
[56] | 3630 | pcMvFieldNeighbours[ iCount<<1 ].setMvField( acPdmMv[ 0 ], aiPdmRefIdx[ 0 ] ); |
---|
[2] | 3631 | } |
---|
[56] | 3632 | if( ( iPdmInterDir & 2 ) == 2 ) |
---|
[2] | 3633 | { |
---|
[56] | 3634 | pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( acPdmMv[ 1 ], aiPdmRefIdx[ 1 ] ); |
---|
[2] | 3635 | } |
---|
[56] | 3636 | #if SIMP_MRG_PRUN |
---|
| 3637 | if ( mrgCandIdx == iCount ) |
---|
[2] | 3638 | { |
---|
[56] | 3639 | return; |
---|
[2] | 3640 | } |
---|
[56] | 3641 | #endif |
---|
| 3642 | iCount ++; |
---|
[2] | 3643 | } |
---|
| 3644 | #endif |
---|
[56] | 3645 | |
---|
| 3646 | // above left |
---|
| 3647 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
| 3648 | if( iCount < 4 + extraMergeCand ) |
---|
[2] | 3649 | #else |
---|
[56] | 3650 | if( iCount < 4 ) |
---|
[2] | 3651 | #endif |
---|
| 3652 | { |
---|
[56] | 3653 | UInt uiAboveLeftPartIdx = 0; |
---|
| 3654 | TComDataCU* pcCUAboveLeft = 0; |
---|
| 3655 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
| 3656 | pcCUAboveLeft = getPUAboveLeft( uiAboveLeftPartIdx, uiAbsPartAddr, true, false, true ); |
---|
[2] | 3657 | #else |
---|
[56] | 3658 | pcCUAboveLeft = getPUAboveLeft( uiAboveLeftPartIdx, uiAbsPartAddr, true, true, true ); |
---|
[2] | 3659 | #endif |
---|
[56] | 3660 | #if PARALLEL_MERGE |
---|
| 3661 | if (pcCUAboveLeft) |
---|
| 3662 | { |
---|
| 3663 | if (!pcCUAboveLeft->isDiffMER(xP-1, yP-1, xP, yP)) |
---|
[2] | 3664 | { |
---|
[56] | 3665 | pcCUAboveLeft = NULL; |
---|
[2] | 3666 | } |
---|
[56] | 3667 | } |
---|
[2] | 3668 | #endif |
---|
[56] | 3669 | #if SIMP_MRG_PRUN |
---|
| 3670 | if( pcCUAboveLeft && !pcCUAboveLeft->isIntra( uiAboveLeftPartIdx ) |
---|
| 3671 | && ( !pcCULeft || pcCULeft->isIntra( uiLeftPartIdx ) || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) ) |
---|
| 3672 | && ( !pcCUAbove || pcCUAbove->isIntra( uiAbovePartIdx ) || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) ) |
---|
| 3673 | ) |
---|
[2] | 3674 | #else |
---|
[56] | 3675 | if( pcCUAboveLeft && !pcCUAboveLeft->isIntra( uiAboveLeftPartIdx ) ) |
---|
[2] | 3676 | #endif |
---|
[56] | 3677 | { |
---|
| 3678 | abCandIsInter[iCount] = true; |
---|
| 3679 | // get Inter Dir |
---|
| 3680 | puhInterDirNeighbours[iCount] = pcCUAboveLeft->getInterDir( uiAboveLeftPartIdx ); |
---|
| 3681 | // get Mv from Left |
---|
| 3682 | pcCUAboveLeft->getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); |
---|
| 3683 | if ( getSlice()->isInterB() ) |
---|
| 3684 | { |
---|
| 3685 | pcCUAboveLeft->getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); |
---|
[2] | 3686 | } |
---|
[56] | 3687 | #if SIMP_MRG_PRUN |
---|
| 3688 | if ( mrgCandIdx == iCount ) |
---|
[2] | 3689 | { |
---|
[56] | 3690 | return; |
---|
[2] | 3691 | } |
---|
[56] | 3692 | #endif |
---|
| 3693 | iCount ++; |
---|
[2] | 3694 | } |
---|
| 3695 | } |
---|
[56] | 3696 | |
---|
| 3697 | if ( getSlice()->getPPS()->getEnableTMVPFlag() ) |
---|
| 3698 | { |
---|
| 3699 | // col [2] |
---|
| 3700 | Int iRefIdxSkip[2] = {-1, -1}; |
---|
| 3701 | for (Int i=0; i<2; i++) |
---|
[2] | 3702 | { |
---|
[56] | 3703 | RefPicList eRefPicList = ( i==1 ? REF_PIC_LIST_1 : REF_PIC_LIST_0 ); |
---|
| 3704 | #if SET_MERGE_TMVP_REFIDX |
---|
| 3705 | Int iRefIdxTmp; |
---|
| 3706 | if ( uiPUIdx != 0 ) |
---|
| 3707 | { |
---|
| 3708 | iRefIdxTmp = 0; |
---|
[2] | 3709 | } |
---|
| 3710 | else |
---|
[56] | 3711 | { |
---|
| 3712 | iRefIdxTmp = (pcCULeft != NULL) ? pcCULeft->getCUMvField(eRefPicList)->getRefIdx(uiLeftPartIdx) : -1; |
---|
[2] | 3713 | } |
---|
[56] | 3714 | #else |
---|
| 3715 | Int iRefIdxTmp = (pcCULeft != NULL) ? pcCULeft->getCUMvField(eRefPicList)->getRefIdx(uiLeftPartIdx) : -1; |
---|
| 3716 | #endif |
---|
| 3717 | iRefIdxSkip[i] = (iRefIdxTmp != -1) ? iRefIdxTmp : 0; |
---|
[2] | 3718 | } |
---|
[56] | 3719 | //>> MTK colocated-RightBottom |
---|
| 3720 | UInt uiPartIdxRB; |
---|
| 3721 | Int uiLCUIdx = getAddr(); |
---|
| 3722 | PartSize eCUMode = getPartitionSize( 0 ); |
---|
[2] | 3723 | |
---|
[56] | 3724 | deriveRightBottomIdx( eCUMode, uiPUIdx, uiPartIdxRB ); |
---|
[2] | 3725 | |
---|
[56] | 3726 | UInt uiAbsPartIdxTmp = g_auiZscanToRaster[uiPartIdxRB]; |
---|
| 3727 | UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth(); |
---|
[2] | 3728 | |
---|
[56] | 3729 | TComMv cColMv; |
---|
| 3730 | Int iRefIdx; |
---|
| 3731 | |
---|
| 3732 | if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() ) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples() ) // image boundary check |
---|
[2] | 3733 | { |
---|
[56] | 3734 | uiLCUIdx = -1; |
---|
[2] | 3735 | } |
---|
[56] | 3736 | else if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples() ) |
---|
[2] | 3737 | { |
---|
[56] | 3738 | uiLCUIdx = -1; |
---|
[2] | 3739 | } |
---|
[56] | 3740 | else |
---|
[2] | 3741 | { |
---|
[56] | 3742 | if ( ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) && // is not at the last column of LCU |
---|
| 3743 | ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) ) // is not at the last row of LCU |
---|
[2] | 3744 | { |
---|
[56] | 3745 | uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + uiNumPartInCUWidth + 1 ]; |
---|
| 3746 | uiLCUIdx = getAddr(); |
---|
[2] | 3747 | } |
---|
[56] | 3748 | else if ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) // is not at the last column of LCU But is last row of LCU |
---|
[2] | 3749 | { |
---|
[56] | 3750 | uiAbsPartAddr = g_auiRasterToZscan[ (uiAbsPartIdxTmp + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ]; |
---|
| 3751 | uiLCUIdx = -1 ; |
---|
[2] | 3752 | } |
---|
[56] | 3753 | else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU |
---|
| 3754 | { |
---|
| 3755 | uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + 1 ]; |
---|
| 3756 | uiLCUIdx = getAddr() + 1; |
---|
| 3757 | } |
---|
| 3758 | else //is the right bottom corner of LCU |
---|
| 3759 | { |
---|
| 3760 | uiAbsPartAddr = 0; |
---|
| 3761 | uiLCUIdx = -1 ; |
---|
| 3762 | } |
---|
[2] | 3763 | } |
---|
[56] | 3764 | iRefIdx = iRefIdxSkip[0]; |
---|
| 3765 | |
---|
| 3766 | Bool bExistMV = false; |
---|
| 3767 | UInt uiPartIdxCenter; |
---|
| 3768 | UInt uiCurLCUIdx = getAddr(); |
---|
| 3769 | xDeriveCenterIdx( eCUMode, uiPUIdx, uiPartIdxCenter ); |
---|
| 3770 | bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_0, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx ); |
---|
| 3771 | if( bExistMV == false ) |
---|
[2] | 3772 | { |
---|
[56] | 3773 | bExistMV = xGetColMVP( REF_PIC_LIST_0, uiCurLCUIdx, uiPartIdxCenter, cColMv, iRefIdx ); |
---|
[2] | 3774 | } |
---|
[56] | 3775 | if( bExistMV ) |
---|
[2] | 3776 | { |
---|
[56] | 3777 | UInt uiArrayAddr = iCount; |
---|
| 3778 | abCandIsInter[uiArrayAddr] = true; |
---|
| 3779 | pcMvFieldNeighbours[uiArrayAddr << 1].setMvField( cColMv, iRefIdx ); |
---|
| 3780 | |
---|
| 3781 | if ( getSlice()->isInterB() ) |
---|
| 3782 | { |
---|
| 3783 | iRefIdx = iRefIdxSkip[1]; |
---|
| 3784 | bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_1, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx); |
---|
| 3785 | if( bExistMV == false ) |
---|
| 3786 | { |
---|
| 3787 | bExistMV = xGetColMVP( REF_PIC_LIST_1, uiCurLCUIdx, uiPartIdxCenter, cColMv, iRefIdx ); |
---|
| 3788 | } |
---|
| 3789 | if( bExistMV ) |
---|
| 3790 | { |
---|
| 3791 | pcMvFieldNeighbours[ ( uiArrayAddr << 1 ) + 1 ].setMvField( cColMv, iRefIdx ); |
---|
| 3792 | puhInterDirNeighbours[uiArrayAddr] = 3; |
---|
| 3793 | } |
---|
| 3794 | else |
---|
| 3795 | { |
---|
| 3796 | puhInterDirNeighbours[uiArrayAddr] = 1; |
---|
| 3797 | } |
---|
[2] | 3798 | } |
---|
| 3799 | else |
---|
| 3800 | { |
---|
[56] | 3801 | puhInterDirNeighbours[uiArrayAddr] = 1; |
---|
[2] | 3802 | } |
---|
[56] | 3803 | #if SIMP_MRG_PRUN |
---|
| 3804 | if ( mrgCandIdx == iCount ) |
---|
| 3805 | { |
---|
| 3806 | return; |
---|
| 3807 | } |
---|
| 3808 | iCount++; |
---|
| 3809 | #endif |
---|
[2] | 3810 | } |
---|
[56] | 3811 | uiIdx++; |
---|
| 3812 | |
---|
[2] | 3813 | } |
---|
| 3814 | |
---|
[56] | 3815 | #if SIMP_MRG_PRUN |
---|
| 3816 | UInt uiArrayAddr = iCount; |
---|
[2] | 3817 | #else |
---|
[56] | 3818 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
| 3819 | for( UInt uiOuter = 0; uiOuter < MRG_MAX_NUM_CANDS_MEM; uiOuter++ ) |
---|
| 3820 | #else |
---|
| 3821 | for( UInt uiOuter = 0; uiOuter < MRG_MAX_NUM_CANDS; uiOuter++ ) |
---|
[2] | 3822 | #endif |
---|
| 3823 | { |
---|
[56] | 3824 | if( abCandIsInter[ uiOuter ] ) |
---|
[2] | 3825 | { |
---|
[56] | 3826 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
| 3827 | for( UInt uiIter = uiOuter + 1; uiIter < MRG_MAX_NUM_CANDS_MEM; uiIter++ ) |
---|
| 3828 | #else |
---|
| 3829 | for( UInt uiIter = uiOuter + 1; uiIter < MRG_MAX_NUM_CANDS; uiIter++ ) |
---|
| 3830 | #endif |
---|
[2] | 3831 | { |
---|
[56] | 3832 | UInt uiMvFieldNeighIdxCurr = uiOuter << 1; |
---|
| 3833 | UInt uiMvFieldNeighIdxComp = uiIter << 1; |
---|
| 3834 | if( getSlice()->isInterB() ) |
---|
[2] | 3835 | { |
---|
[56] | 3836 | if( puhInterDirNeighbours[ uiOuter ] == 3 ) |
---|
| 3837 | { |
---|
| 3838 | if( pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getRefIdx() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getRefIdx() && pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr + 1 ].getRefIdx() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp + 1 ].getRefIdx() && |
---|
| 3839 | pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getMv() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getMv() && pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr + 1 ].getMv() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp + 1 ].getMv() && |
---|
| 3840 | puhInterDirNeighbours[ uiOuter ] == puhInterDirNeighbours[ uiIter ] ) |
---|
| 3841 | { |
---|
| 3842 | abCandIsInter[ uiIter ] = false; |
---|
| 3843 | } |
---|
| 3844 | } |
---|
| 3845 | else if( puhInterDirNeighbours[ uiOuter ] == 2 ) |
---|
| 3846 | { |
---|
| 3847 | if( pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr + 1 ].getRefIdx() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp + 1 ].getRefIdx() && |
---|
| 3848 | pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr + 1 ].getMv() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp + 1 ].getMv() && |
---|
| 3849 | puhInterDirNeighbours[ uiOuter ] == puhInterDirNeighbours[ uiIter ] ) |
---|
| 3850 | { |
---|
| 3851 | abCandIsInter[ uiIter ] = false; |
---|
| 3852 | } |
---|
| 3853 | } |
---|
| 3854 | else |
---|
| 3855 | { |
---|
| 3856 | if( pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getRefIdx() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getRefIdx() && |
---|
| 3857 | pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getMv() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getMv() && |
---|
| 3858 | puhInterDirNeighbours[ uiOuter ] == puhInterDirNeighbours[ uiIter ] ) |
---|
| 3859 | { |
---|
| 3860 | abCandIsInter[ uiIter ] = false; |
---|
| 3861 | } |
---|
| 3862 | } |
---|
[2] | 3863 | } |
---|
[56] | 3864 | else |
---|
[2] | 3865 | { |
---|
[56] | 3866 | if( pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getRefIdx() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getRefIdx() && |
---|
| 3867 | pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getMv() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getMv() ) |
---|
| 3868 | { |
---|
| 3869 | assert( puhInterDirNeighbours[ uiOuter ] == puhInterDirNeighbours[ uiIter ] ); |
---|
| 3870 | abCandIsInter[ uiIter ] = false; |
---|
| 3871 | } |
---|
[2] | 3872 | } |
---|
| 3873 | } |
---|
| 3874 | } |
---|
| 3875 | } |
---|
| 3876 | |
---|
[56] | 3877 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
| 3878 | bool abCandIsInterFlag[MRG_MAX_NUM_CANDS_MEM]; |
---|
| 3879 | for (int i=0; i<MRG_MAX_NUM_CANDS_MEM; i++) |
---|
| 3880 | #else |
---|
| 3881 | bool abCandIsInterFlag[MRG_MAX_NUM_CANDS]; |
---|
| 3882 | for (int i=0; i<MRG_MAX_NUM_CANDS; i++) |
---|
| 3883 | #endif |
---|
| 3884 | { |
---|
| 3885 | abCandIsInterFlag[i] = abCandIsInter[ i ]; |
---|
| 3886 | abCandIsInter[ i ] = false; |
---|
| 3887 | } |
---|
[2] | 3888 | |
---|
[56] | 3889 | UInt uiArrayAddr = 0; |
---|
| 3890 | |
---|
[5] | 3891 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
[56] | 3892 | for (int i=0; i<MRG_MAX_NUM_CANDS_MEM; i++) |
---|
| 3893 | #else |
---|
| 3894 | for (int i=0; i<MRG_MAX_NUM_CANDS; i++) |
---|
| 3895 | #endif |
---|
[2] | 3896 | { |
---|
[56] | 3897 | if (abCandIsInterFlag[i]) |
---|
[2] | 3898 | { |
---|
[56] | 3899 | abCandIsInter[uiArrayAddr] = true; |
---|
| 3900 | puhInterDirNeighbours[uiArrayAddr] = puhInterDirNeighbours[i]; |
---|
| 3901 | pcMvFieldNeighbours[uiArrayAddr<<1].setMvField(pcMvFieldNeighbours[i<<1].getMv(), pcMvFieldNeighbours[i<<1].getRefIdx()); |
---|
| 3902 | pcMvFieldNeighbours[(uiArrayAddr<<1)+1].setMvField(pcMvFieldNeighbours[(i<<1)+1].getMv(), pcMvFieldNeighbours[(i<<1)+1].getRefIdx()); |
---|
| 3903 | ++uiArrayAddr; |
---|
[2] | 3904 | } |
---|
| 3905 | } |
---|
[56] | 3906 | |
---|
| 3907 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
| 3908 | for (int i=uiArrayAddr; i<MRG_MAX_NUM_CANDS_MEM; i++) |
---|
| 3909 | #else |
---|
| 3910 | for (int i=uiArrayAddr; i<MRG_MAX_NUM_CANDS; i++) |
---|
| 3911 | #endif |
---|
[2] | 3912 | { |
---|
[56] | 3913 | puhInterDirNeighbours[i] = (getSlice()->isInterB()) ? 3 : 1; |
---|
| 3914 | abCandIsInter[i] = false; |
---|
| 3915 | TComMv tmpMv; |
---|
| 3916 | tmpMv.set(0,0); |
---|
| 3917 | pcMvFieldNeighbours[i<<1].setMvField(tmpMv, 0); |
---|
| 3918 | if ( getSlice()->isInterB() ) |
---|
[2] | 3919 | { |
---|
[56] | 3920 | pcMvFieldNeighbours[(i<<1)+1].setMvField(tmpMv, 0); |
---|
[2] | 3921 | } |
---|
| 3922 | } |
---|
[5] | 3923 | #endif |
---|
[56] | 3924 | UInt uiCutoff = uiArrayAddr; |
---|
| 3925 | |
---|
| 3926 | if ( getSlice()->isInterB() ) |
---|
| 3927 | { |
---|
| 3928 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
| 3929 | Int iCombinedCount = 0; |
---|
| 3930 | Int iMaxCombCount = ( extraMergeCand ? 6 : 5 ); |
---|
| 3931 | Int iMaxIdx = ( extraMergeCand ? 20 : 12 ); |
---|
| 3932 | UInt uiPriorityList0[20] = {0 , 1, 0, 2, 1, 2, 0, 3, 1, 3, 2, 3, 0, 4, 1, 4, 2, 4, 3, 4 }; |
---|
| 3933 | UInt uiPriorityList1[20] = {1 , 0, 2, 0, 2, 1, 3, 0, 3, 1, 3, 2, 4, 0, 4, 1, 4, 2, 4, 3 }; |
---|
[2] | 3934 | |
---|
[56] | 3935 | for (Int idx=0; idx<uiCutoff*(uiCutoff-1) && uiArrayAddr!=MRG_MAX_NUM_CANDS_MEM && iCombinedCount<iMaxCombCount && idx < iMaxIdx; idx++) |
---|
| 3936 | #else |
---|
| 3937 | Int iCombinedCount = 0; |
---|
| 3938 | UInt uiPriorityList0[12] = {0 , 1, 0, 2, 1, 2, 0, 3, 1, 3, 2, 3}; |
---|
| 3939 | UInt uiPriorityList1[12] = {1 , 0, 2, 0, 2, 1, 3, 0, 3, 1, 3, 2}; |
---|
[2] | 3940 | |
---|
[56] | 3941 | for (Int idx=0; idx<uiCutoff*(uiCutoff-1) && uiArrayAddr!=MRG_MAX_NUM_CANDS && iCombinedCount<5 && idx < 12; idx++) |
---|
| 3942 | #endif |
---|
[2] | 3943 | { |
---|
[56] | 3944 | Int i = uiPriorityList0[idx]; Int j = uiPriorityList1[idx]; |
---|
| 3945 | if (abCandIsInter[i] && abCandIsInter[j]&& (puhInterDirNeighbours[i]&0x1)&&(puhInterDirNeighbours[j]&0x2)) |
---|
[2] | 3946 | { |
---|
[56] | 3947 | abCandIsInter[uiArrayAddr] = true; |
---|
| 3948 | puhInterDirNeighbours[uiArrayAddr] = 3; |
---|
| 3949 | |
---|
| 3950 | // get Mv from cand[i] and cand[j] |
---|
| 3951 | pcMvFieldNeighbours[uiArrayAddr << 1].setMvField(pcMvFieldNeighbours[i<<1].getMv(), pcMvFieldNeighbours[i<<1].getRefIdx()); |
---|
| 3952 | pcMvFieldNeighbours[( uiArrayAddr << 1 ) + 1].setMvField(pcMvFieldNeighbours[(j<<1)+1].getMv(), pcMvFieldNeighbours[(j<<1)+1].getRefIdx()); |
---|
| 3953 | |
---|
| 3954 | Int iRefPOCL0 = m_pcSlice->getRefPOC ( REF_PIC_LIST_0, pcMvFieldNeighbours[(uiArrayAddr<<1)].getRefIdx() ); |
---|
| 3955 | Int iRefViewIdL0 = m_pcSlice->getRefViewId( REF_PIC_LIST_0, pcMvFieldNeighbours[(uiArrayAddr<<1)].getRefIdx() ); |
---|
| 3956 | Int iRefPOCL1 = m_pcSlice->getRefPOC ( REF_PIC_LIST_1, pcMvFieldNeighbours[(uiArrayAddr<<1)+1].getRefIdx() ); |
---|
| 3957 | Int iRefViewIdL1 = m_pcSlice->getRefViewId( REF_PIC_LIST_1, pcMvFieldNeighbours[(uiArrayAddr<<1)+1].getRefIdx() ); |
---|
| 3958 | if(iRefPOCL0 == iRefPOCL1 && iRefViewIdL0 == iRefViewIdL1 && pcMvFieldNeighbours[(uiArrayAddr<<1)].getMv() == pcMvFieldNeighbours[(uiArrayAddr<<1)+1].getMv()) |
---|
[2] | 3959 | { |
---|
[56] | 3960 | abCandIsInter[uiArrayAddr] = false; |
---|
| 3961 | } |
---|
| 3962 | else |
---|
| 3963 | { |
---|
| 3964 | uiArrayAddr++; |
---|
| 3965 | iCombinedCount++; |
---|
| 3966 | } |
---|
| 3967 | } |
---|
| 3968 | } |
---|
| 3969 | #if !REMOVE_NON_SCALED |
---|
| 3970 | Int iScaledCount = 0; |
---|
| 3971 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
| 3972 | for (int i=0; i<uiCutoff && uiArrayAddr!=MRG_MAX_NUM_CANDS_MEM && iScaledCount<1; i++) |
---|
| 3973 | #else |
---|
| 3974 | for (int i=0; i<uiCutoff && uiArrayAddr!=MRG_MAX_NUM_CANDS && iScaledCount<1; i++) |
---|
| 3975 | #endif |
---|
| 3976 | { |
---|
| 3977 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
| 3978 | for (int j=0; j<2 && uiArrayAddr!=MRG_MAX_NUM_CANDS_MEM && iScaledCount<1; j++) |
---|
| 3979 | #else |
---|
| 3980 | for (int j=0; j<2 && uiArrayAddr!=MRG_MAX_NUM_CANDS && iScaledCount<1; j++) |
---|
| 3981 | #endif |
---|
| 3982 | { |
---|
| 3983 | if (abCandIsInter[i] && pcMvFieldNeighbours[(i<<1)+j].getRefIdx()>=0 && pcMvFieldNeighbours[(i<<1)+j].getRefIdx() < m_pcSlice->getNumRefIdx((j==0)?REF_PIC_LIST_1:REF_PIC_LIST_0)) |
---|
| 3984 | { |
---|
| 3985 | Int iCurrPOC = m_pcSlice->getPOC(); |
---|
| 3986 | Int iCurrRefPOC1 = m_pcSlice->getRefPOC( (j==0)?REF_PIC_LIST_1:REF_PIC_LIST_0, pcMvFieldNeighbours[(i<<1)+j].getRefIdx() ); |
---|
| 3987 | Int iCurrRefPOC2 = m_pcSlice->getRefPOC( (j==0)?REF_PIC_LIST_0:REF_PIC_LIST_1, pcMvFieldNeighbours[(i<<1)+j].getRefIdx() ); |
---|
| 3988 | |
---|
| 3989 | if (iCurrRefPOC1 != iCurrRefPOC2 && abs(iCurrPOC-iCurrRefPOC1) == abs(iCurrPOC-iCurrRefPOC2)) |
---|
[2] | 3990 | { |
---|
[56] | 3991 | abCandIsInter[uiArrayAddr] = true; |
---|
| 3992 | puhInterDirNeighbours[uiArrayAddr] = 3; |
---|
| 3993 | |
---|
| 3994 | TComMv cMvPred = pcMvFieldNeighbours[(i<<1)+j].getMv(); |
---|
| 3995 | TComMv rcMv; |
---|
| 3996 | |
---|
| 3997 | rcMv.set(-1*cMvPred.getHor(), -1*cMvPred.getVer()); |
---|
| 3998 | |
---|
| 3999 | if (j==0) |
---|
[2] | 4000 | { |
---|
[56] | 4001 | pcMvFieldNeighbours[uiArrayAddr << 1].setMvField(pcMvFieldNeighbours[(i<<1)].getMv(), pcMvFieldNeighbours[(i<<1)].getRefIdx()); |
---|
| 4002 | pcMvFieldNeighbours[( uiArrayAddr << 1 ) + 1].setMvField(rcMv, pcMvFieldNeighbours[(i<<1)].getRefIdx()); |
---|
[2] | 4003 | } |
---|
| 4004 | else |
---|
| 4005 | { |
---|
[56] | 4006 | pcMvFieldNeighbours[uiArrayAddr << 1].setMvField(rcMv, pcMvFieldNeighbours[(i<<1)+1].getRefIdx()); |
---|
| 4007 | pcMvFieldNeighbours[( uiArrayAddr << 1 ) + 1].setMvField(pcMvFieldNeighbours[(i<<1)+1].getMv(), pcMvFieldNeighbours[(i<<1)+1].getRefIdx()); |
---|
[2] | 4008 | } |
---|
[56] | 4009 | |
---|
| 4010 | uiArrayAddr++; |
---|
| 4011 | iScaledCount++; |
---|
[2] | 4012 | } |
---|
| 4013 | } |
---|
| 4014 | } |
---|
| 4015 | } |
---|
[56] | 4016 | #endif |
---|
[2] | 4017 | } |
---|
[56] | 4018 | |
---|
| 4019 | Int iNumRefIdx = (getSlice()->isInterB()) ? min(m_pcSlice->getNumRefIdx(REF_PIC_LIST_0), m_pcSlice->getNumRefIdx(REF_PIC_LIST_1)) : m_pcSlice->getNumRefIdx(REF_PIC_LIST_0); |
---|
| 4020 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
| 4021 | for (int r=0; r<iNumRefIdx && uiArrayAddr!=MRG_MAX_NUM_CANDS_MEM; r++) |
---|
| 4022 | #else |
---|
| 4023 | for (int r=0; r<iNumRefIdx && uiArrayAddr!=MRG_MAX_NUM_CANDS; r++) |
---|
| 4024 | #endif |
---|
[2] | 4025 | { |
---|
[56] | 4026 | abCandIsInter[uiArrayAddr] = true; |
---|
| 4027 | puhInterDirNeighbours[uiArrayAddr] = 1; |
---|
| 4028 | pcMvFieldNeighbours[uiArrayAddr << 1].setMvField( TComMv(0, 0), r); |
---|
| 4029 | |
---|
| 4030 | if ( getSlice()->isInterB() ) |
---|
[2] | 4031 | { |
---|
[56] | 4032 | puhInterDirNeighbours[uiArrayAddr] = 3; |
---|
| 4033 | pcMvFieldNeighbours[(uiArrayAddr << 1) + 1].setMvField(TComMv(0, 0), r); |
---|
[2] | 4034 | } |
---|
[56] | 4035 | uiArrayAddr++; |
---|
[2] | 4036 | } |
---|
[56] | 4037 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
| 4038 | if (uiArrayAddr > MRG_MAX_NUM_CANDS_SIGNALED + extraMergeCand ) |
---|
[2] | 4039 | { |
---|
[56] | 4040 | uiArrayAddr = MRG_MAX_NUM_CANDS_SIGNALED + extraMergeCand; |
---|
| 4041 | } |
---|
| 4042 | #else |
---|
| 4043 | if (uiArrayAddr > MRG_MAX_NUM_CANDS_SIGNALED) |
---|
| 4044 | { |
---|
| 4045 | uiArrayAddr = MRG_MAX_NUM_CANDS_SIGNALED; |
---|
| 4046 | } |
---|
| 4047 | #endif |
---|
| 4048 | numValidMergeCand = uiArrayAddr; |
---|
| 4049 | } |
---|
| 4050 | |
---|
| 4051 | /** Check the duplicated candidate in the list |
---|
| 4052 | * \param pcMvFieldNeighbours |
---|
| 4053 | * \param puhInterDirNeighbours |
---|
| 4054 | * \param pbCandIsInter |
---|
| 4055 | * \param ruiArrayAddr |
---|
| 4056 | * \returns Void |
---|
| 4057 | */ |
---|
| 4058 | Void TComDataCU::xCheckDuplicateCand(TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, bool* pbCandIsInter, UInt& ruiArrayAddr) |
---|
| 4059 | { |
---|
| 4060 | if (getSlice()->isInterB()) |
---|
| 4061 | { |
---|
| 4062 | UInt uiMvFieldNeighIdxCurr = ruiArrayAddr << 1; |
---|
| 4063 | Int iRefIdxL0 = pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getRefIdx(); |
---|
| 4064 | Int iRefIdxL1 = pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr + 1 ].getRefIdx(); |
---|
| 4065 | TComMv MvL0 = pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getMv(); |
---|
| 4066 | TComMv MvL1 = pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr + 1 ].getMv(); |
---|
| 4067 | |
---|
| 4068 | for (int k=0; k<ruiArrayAddr; k++) |
---|
[2] | 4069 | { |
---|
[56] | 4070 | UInt uiMvFieldNeighIdxComp = k << 1; |
---|
| 4071 | if (iRefIdxL0 == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getRefIdx() && |
---|
| 4072 | iRefIdxL1 == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp + 1 ].getRefIdx() && |
---|
| 4073 | MvL0 == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getMv() && |
---|
| 4074 | MvL1 == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp + 1 ].getMv() && |
---|
| 4075 | puhInterDirNeighbours[ ruiArrayAddr ] == puhInterDirNeighbours[ k ] ) |
---|
| 4076 | { |
---|
| 4077 | pbCandIsInter[ruiArrayAddr] = false; |
---|
| 4078 | break; |
---|
| 4079 | } |
---|
[2] | 4080 | } |
---|
| 4081 | } |
---|
[56] | 4082 | else |
---|
| 4083 | { |
---|
| 4084 | UInt uiMvFieldNeighIdxCurr = ruiArrayAddr << 1; |
---|
| 4085 | Int iRefIdxL0 = pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getRefIdx(); |
---|
| 4086 | TComMv MvL0 = pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getMv(); |
---|
| 4087 | |
---|
| 4088 | for (int k=0; k<ruiArrayAddr; k++) |
---|
| 4089 | { |
---|
| 4090 | UInt uiMvFieldNeighIdxComp = k << 1; |
---|
| 4091 | if (iRefIdxL0 == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getRefIdx() && |
---|
| 4092 | MvL0 == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getMv() && |
---|
| 4093 | puhInterDirNeighbours[ ruiArrayAddr ] == puhInterDirNeighbours[ k ] ) |
---|
| 4094 | { |
---|
| 4095 | pbCandIsInter[ruiArrayAddr] = false; |
---|
| 4096 | break; |
---|
| 4097 | } |
---|
| 4098 | } |
---|
| 4099 | } |
---|
| 4100 | |
---|
| 4101 | if (pbCandIsInter[ruiArrayAddr]) |
---|
| 4102 | { |
---|
| 4103 | ++ruiArrayAddr; |
---|
| 4104 | } |
---|
[2] | 4105 | } |
---|
| 4106 | |
---|
| 4107 | Void TComDataCU::xCheckCornerCand( TComDataCU* pcCorner, UInt uiCornerPUIdx, UInt uiIter, Bool& rbValidCand ) |
---|
| 4108 | { |
---|
| 4109 | if( uiIter == 0 ) |
---|
| 4110 | { |
---|
| 4111 | if( pcCorner && !pcCorner->isIntra( uiCornerPUIdx ) ) |
---|
| 4112 | { |
---|
| 4113 | rbValidCand = true; |
---|
| 4114 | if( getSlice()->isInterB() ) |
---|
| 4115 | { |
---|
| 4116 | if ( pcCorner->getInterDir( uiCornerPUIdx ) == 1 ) |
---|
| 4117 | { |
---|
| 4118 | if( pcCorner->getCUMvField(REF_PIC_LIST_0)->getRefIdx( uiCornerPUIdx ) != 0 ) |
---|
| 4119 | { |
---|
| 4120 | rbValidCand = false; |
---|
| 4121 | } |
---|
| 4122 | } |
---|
| 4123 | else if ( pcCorner->getInterDir( uiCornerPUIdx ) == 2 ) |
---|
| 4124 | { |
---|
| 4125 | if( pcCorner->getCUMvField(REF_PIC_LIST_1)->getRefIdx( uiCornerPUIdx ) != 0 ) |
---|
| 4126 | { |
---|
| 4127 | rbValidCand = false; |
---|
| 4128 | } |
---|
| 4129 | } |
---|
| 4130 | else |
---|
| 4131 | { |
---|
| 4132 | if( pcCorner->getCUMvField(REF_PIC_LIST_0)->getRefIdx( uiCornerPUIdx ) != 0 || pcCorner->getCUMvField(REF_PIC_LIST_1)->getRefIdx( uiCornerPUIdx ) != 0 ) |
---|
| 4133 | { |
---|
| 4134 | rbValidCand = false; |
---|
| 4135 | } |
---|
| 4136 | } |
---|
| 4137 | } |
---|
| 4138 | else if( pcCorner->getCUMvField(REF_PIC_LIST_0)->getRefIdx( uiCornerPUIdx ) != 0 ) |
---|
| 4139 | { |
---|
| 4140 | rbValidCand = false; |
---|
| 4141 | } |
---|
| 4142 | } |
---|
| 4143 | } |
---|
| 4144 | else |
---|
| 4145 | { |
---|
| 4146 | if( pcCorner && !pcCorner->isIntra( uiCornerPUIdx ) ) |
---|
| 4147 | { |
---|
| 4148 | rbValidCand = true; |
---|
| 4149 | if( getSlice()->isInterB() ) |
---|
| 4150 | { |
---|
| 4151 | if ( pcCorner->getInterDir( uiCornerPUIdx ) == 1 ) |
---|
| 4152 | { |
---|
| 4153 | if( pcCorner->getCUMvField(REF_PIC_LIST_0)->getRefIdx( uiCornerPUIdx ) < 0 ) |
---|
| 4154 | { |
---|
| 4155 | rbValidCand = false; |
---|
| 4156 | } |
---|
| 4157 | } |
---|
| 4158 | else if ( pcCorner->getInterDir( uiCornerPUIdx ) == 2 ) |
---|
| 4159 | { |
---|
| 4160 | if( pcCorner->getCUMvField(REF_PIC_LIST_1)->getRefIdx( uiCornerPUIdx ) < 0 ) |
---|
| 4161 | { |
---|
| 4162 | rbValidCand = false; |
---|
| 4163 | } |
---|
| 4164 | } |
---|
| 4165 | else |
---|
| 4166 | { |
---|
| 4167 | if( pcCorner->getCUMvField(REF_PIC_LIST_0)->getRefIdx( uiCornerPUIdx ) < 0 || pcCorner->getCUMvField(REF_PIC_LIST_1)->getRefIdx( uiCornerPUIdx ) < 0 ) |
---|
| 4168 | { |
---|
| 4169 | rbValidCand = false; |
---|
| 4170 | } |
---|
| 4171 | } |
---|
| 4172 | } |
---|
| 4173 | else if( pcCorner->getCUMvField(REF_PIC_LIST_0)->getRefIdx( uiCornerPUIdx ) < 0 ) |
---|
| 4174 | { |
---|
| 4175 | rbValidCand = false; |
---|
| 4176 | } |
---|
| 4177 | } |
---|
| 4178 | } |
---|
| 4179 | } |
---|
[56] | 4180 | #if PARALLEL_MERGE |
---|
| 4181 | /** Check whether the current PU and a spatial neighboring PU are in a same ME region. |
---|
| 4182 | * \param xN, xN location of the upper-left corner pixel of a neighboring PU |
---|
| 4183 | * \param xP, yP location of the upper-left corner pixel of the current PU |
---|
| 4184 | * \returns Bool |
---|
| 4185 | */ |
---|
| 4186 | Bool TComDataCU::isDiffMER(Int xN, Int yN, Int xP, Int yP) |
---|
| 4187 | { |
---|
[2] | 4188 | |
---|
[56] | 4189 | UInt plevel = this->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() + 2; |
---|
| 4190 | if ((xN>>plevel)!= (xP>>plevel)) |
---|
| 4191 | { |
---|
| 4192 | return true; |
---|
| 4193 | } |
---|
| 4194 | if ((yN>>plevel)!= (yP>>plevel)) |
---|
| 4195 | { |
---|
| 4196 | return true; |
---|
| 4197 | } |
---|
| 4198 | return false; |
---|
| 4199 | } |
---|
| 4200 | /** calculate the location of upper-left corner pixel and size of the current PU. |
---|
| 4201 | * \param partIdx PU index within a CU |
---|
| 4202 | * \param xP, yP location of the upper-left corner pixel of the current PU |
---|
| 4203 | * \param PSW, nPSH size of the curren PU |
---|
| 4204 | * \returns Void |
---|
| 4205 | */ |
---|
| 4206 | Void TComDataCU::getPartPosition( UInt partIdx, Int& xP, Int& yP, Int& nPSW, Int& nPSH) |
---|
[2] | 4207 | { |
---|
[56] | 4208 | UInt col = m_uiCUPelX; |
---|
| 4209 | UInt row = m_uiCUPelY; |
---|
| 4210 | |
---|
| 4211 | switch ( m_pePartSize[0] ) |
---|
| 4212 | { |
---|
| 4213 | case SIZE_2NxN: |
---|
| 4214 | nPSW = getWidth(0); |
---|
| 4215 | nPSH = getHeight(0) >> 1; |
---|
| 4216 | xP = col; |
---|
| 4217 | yP = (partIdx ==0)? row: row + nPSH; |
---|
| 4218 | break; |
---|
| 4219 | case SIZE_Nx2N: |
---|
| 4220 | nPSW = getWidth(0) >> 1; |
---|
| 4221 | nPSH = getHeight(0); |
---|
| 4222 | xP = (partIdx ==0)? col: col + nPSW; |
---|
| 4223 | yP = row; |
---|
| 4224 | break; |
---|
| 4225 | case SIZE_NxN: |
---|
| 4226 | nPSW = getWidth(0) >> 1; |
---|
| 4227 | nPSH = getHeight(0) >> 1; |
---|
| 4228 | xP = col + (partIdx&0x1)*nPSW; |
---|
| 4229 | yP = row + (partIdx>>1)*nPSH; |
---|
| 4230 | break; |
---|
| 4231 | case SIZE_2NxnU: |
---|
| 4232 | nPSW = getWidth(0); |
---|
| 4233 | nPSH = ( partIdx == 0 ) ? getHeight(0) >> 2 : ( getHeight(0) >> 2 ) + ( getHeight(0) >> 1 ); |
---|
| 4234 | xP = col; |
---|
| 4235 | yP = (partIdx ==0)? row: row + getHeight(0) - nPSH; |
---|
| 4236 | |
---|
| 4237 | break; |
---|
| 4238 | case SIZE_2NxnD: |
---|
| 4239 | nPSW = getWidth(0); |
---|
| 4240 | nPSH = ( partIdx == 0 ) ? ( getHeight(0) >> 2 ) + ( getHeight(0) >> 1 ) : getHeight(0) >> 2; |
---|
| 4241 | xP = col; |
---|
| 4242 | yP = (partIdx ==0)? row: row + getHeight(0) - nPSH; |
---|
| 4243 | break; |
---|
| 4244 | case SIZE_nLx2N: |
---|
| 4245 | nPSW = ( partIdx == 0 ) ? getWidth(0) >> 2 : ( getWidth(0) >> 2 ) + ( getWidth(0) >> 1 ); |
---|
| 4246 | nPSH = getHeight(0); |
---|
| 4247 | xP = (partIdx ==0)? col: col + getWidth(0) - nPSW; |
---|
| 4248 | yP = row; |
---|
| 4249 | break; |
---|
| 4250 | case SIZE_nRx2N: |
---|
| 4251 | nPSW = ( partIdx == 0 ) ? ( getWidth(0) >> 2 ) + ( getWidth(0) >> 1 ) : getWidth(0) >> 2; |
---|
| 4252 | nPSH = getHeight(0); |
---|
| 4253 | xP = (partIdx ==0)? col: col + getWidth(0) - nPSW; |
---|
| 4254 | yP = row; |
---|
| 4255 | break; |
---|
| 4256 | default: |
---|
| 4257 | assert ( m_pePartSize[0] == SIZE_2Nx2N ); |
---|
| 4258 | nPSW = getWidth(0); |
---|
| 4259 | nPSH = getHeight(0); |
---|
| 4260 | xP = col ; |
---|
| 4261 | yP = row ; |
---|
| 4262 | |
---|
| 4263 | break; |
---|
| 4264 | } |
---|
[2] | 4265 | } |
---|
| 4266 | |
---|
[56] | 4267 | #endif |
---|
[2] | 4268 | AMVP_MODE TComDataCU::getAMVPMode(UInt uiIdx) |
---|
| 4269 | { |
---|
| 4270 | return m_pcSlice->getSPS()->getAMVPMode(m_puhDepth[uiIdx]); |
---|
| 4271 | } |
---|
| 4272 | |
---|
| 4273 | /** Constructs a list of candidates for AMVP |
---|
| 4274 | * \param uiPartIdx |
---|
| 4275 | * \param uiPartAddr |
---|
| 4276 | * \param eRefPicList |
---|
| 4277 | * \param iRefIdx |
---|
| 4278 | * \param pInfo |
---|
| 4279 | */ |
---|
| 4280 | Void TComDataCU::fillMvpCand ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo ) |
---|
| 4281 | { |
---|
[56] | 4282 | PartSize eCUMode = getPartitionSize( 0 ); |
---|
[2] | 4283 | |
---|
| 4284 | TComMv cMvPred; |
---|
[56] | 4285 | Bool bAddedSmvp = false; |
---|
| 4286 | |
---|
| 4287 | pInfo->iN = 0; |
---|
[2] | 4288 | if (iRefIdx < 0) |
---|
| 4289 | { |
---|
| 4290 | return; |
---|
| 4291 | } |
---|
[56] | 4292 | |
---|
[5] | 4293 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
[2] | 4294 | #if ( PDM_AMVP_POS == 0 ) |
---|
| 4295 | // get inter-view mv predictor (at position 0) |
---|
| 4296 | TComMv cPdmMvPred; |
---|
| 4297 | if( getPdmMvPred( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred ) ) |
---|
| 4298 | { |
---|
| 4299 | clipMv( cPdmMvPred ); |
---|
| 4300 | pInfo->m_acMvCand[ pInfo->iN++ ] = cPdmMvPred; |
---|
| 4301 | } |
---|
| 4302 | #endif |
---|
[5] | 4303 | #endif |
---|
[2] | 4304 | |
---|
| 4305 | //-- Get Spatial MV |
---|
| 4306 | UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB; |
---|
| 4307 | UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth(); |
---|
| 4308 | Bool bAdded = false; |
---|
| 4309 | |
---|
| 4310 | deriveLeftRightTopIdx( eCUMode, uiPartIdx, uiPartIdxLT, uiPartIdxRT ); |
---|
| 4311 | deriveLeftBottomIdx( eCUMode, uiPartIdx, uiPartIdxLB ); |
---|
| 4312 | |
---|
[56] | 4313 | TComDataCU* tmpCU = NULL; |
---|
| 4314 | UInt idx; |
---|
| 4315 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
| 4316 | tmpCU = getPUBelowLeft(idx, uiPartIdxLB, true, false); |
---|
| 4317 | #else |
---|
| 4318 | tmpCU = getPUBelowLeft(idx, uiPartIdxLB); |
---|
| 4319 | #endif |
---|
| 4320 | bAddedSmvp = (tmpCU != NULL) && (tmpCU->getPredictionMode(idx) != MODE_INTRA); |
---|
| 4321 | |
---|
| 4322 | if (!bAddedSmvp) |
---|
| 4323 | { |
---|
| 4324 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
| 4325 | tmpCU = getPULeft(idx, uiPartIdxLB, true, false); |
---|
| 4326 | #else |
---|
| 4327 | tmpCU = getPULeft(idx, uiPartIdxLB); |
---|
| 4328 | #endif |
---|
| 4329 | bAddedSmvp = (tmpCU != NULL) && (tmpCU->getPredictionMode(idx) != MODE_INTRA); |
---|
| 4330 | } |
---|
| 4331 | |
---|
[2] | 4332 | // Left predictor search |
---|
| 4333 | bAdded = xAddMVPCand( pInfo, eRefPicList, iRefIdx, uiPartIdxLB, MD_BELOW_LEFT); |
---|
| 4334 | if (!bAdded) |
---|
| 4335 | { |
---|
| 4336 | bAdded = xAddMVPCand( pInfo, eRefPicList, iRefIdx, uiPartIdxLB, MD_LEFT ); |
---|
| 4337 | } |
---|
| 4338 | |
---|
| 4339 | if(!bAdded) |
---|
| 4340 | { |
---|
| 4341 | bAdded = xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxLB, MD_BELOW_LEFT); |
---|
| 4342 | if (!bAdded) |
---|
| 4343 | { |
---|
| 4344 | bAdded = xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxLB, MD_LEFT ); |
---|
| 4345 | } |
---|
| 4346 | } |
---|
| 4347 | |
---|
[5] | 4348 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
[2] | 4349 | #if ( PDM_AMVP_POS == 1 ) |
---|
| 4350 | // get inter-view mv predictor (at position 1) |
---|
| 4351 | TComMv cPdmMvPred; |
---|
| 4352 | if( getPdmMvPred( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred ) ) |
---|
| 4353 | { |
---|
| 4354 | clipMv( cPdmMvPred ); |
---|
| 4355 | pInfo->m_acMvCand[ pInfo->iN++ ] = cPdmMvPred; |
---|
| 4356 | } |
---|
| 4357 | #endif |
---|
[5] | 4358 | #endif |
---|
[2] | 4359 | |
---|
| 4360 | // Above predictor search |
---|
| 4361 | bAdded = xAddMVPCand( pInfo, eRefPicList, iRefIdx, uiPartIdxRT, MD_ABOVE_RIGHT); |
---|
[56] | 4362 | |
---|
[2] | 4363 | if (!bAdded) |
---|
| 4364 | { |
---|
| 4365 | bAdded = xAddMVPCand( pInfo, eRefPicList, iRefIdx, uiPartIdxRT, MD_ABOVE); |
---|
| 4366 | } |
---|
[56] | 4367 | |
---|
[2] | 4368 | if(!bAdded) |
---|
| 4369 | { |
---|
| 4370 | bAdded = xAddMVPCand( pInfo, eRefPicList, iRefIdx, uiPartIdxLT, MD_ABOVE_LEFT); |
---|
| 4371 | } |
---|
[56] | 4372 | bAdded = bAddedSmvp; |
---|
| 4373 | if (pInfo->iN==2) bAdded = true; |
---|
| 4374 | |
---|
[2] | 4375 | if(!bAdded) |
---|
| 4376 | { |
---|
| 4377 | bAdded = xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxRT, MD_ABOVE_RIGHT); |
---|
| 4378 | if (!bAdded) |
---|
| 4379 | { |
---|
| 4380 | bAdded = xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxRT, MD_ABOVE); |
---|
| 4381 | } |
---|
[56] | 4382 | |
---|
[2] | 4383 | if(!bAdded) |
---|
| 4384 | { |
---|
| 4385 | bAdded = xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxLT, MD_ABOVE_LEFT); |
---|
| 4386 | } |
---|
| 4387 | } |
---|
| 4388 | |
---|
| 4389 | if (getAMVPMode(uiPartAddr) == AM_NONE) //Should be optimized later for special cases |
---|
| 4390 | { |
---|
| 4391 | assert(pInfo->iN > 0); |
---|
| 4392 | pInfo->iN = 1; |
---|
| 4393 | return; |
---|
| 4394 | } |
---|
| 4395 | |
---|
[5] | 4396 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
[2] | 4397 | #if ( PDM_AMVP_POS == 2 ) |
---|
| 4398 | // get inter-view mv predictor (at position 2) |
---|
| 4399 | TComMv cPdmMvPred; |
---|
| 4400 | if( getPdmMvPred( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred ) ) |
---|
| 4401 | { |
---|
| 4402 | clipMv( cPdmMvPred ); |
---|
| 4403 | pInfo->m_acMvCand[ pInfo->iN++ ] = cPdmMvPred; |
---|
[56] | 4404 | } |
---|
[2] | 4405 | #endif |
---|
[5] | 4406 | #endif |
---|
[2] | 4407 | |
---|
[56] | 4408 | #if AMVP_PRUNING_SIMPLIFICATION |
---|
| 4409 | if ( pInfo->iN == 2 ) |
---|
[2] | 4410 | { |
---|
[56] | 4411 | if ( pInfo->m_acMvCand[ 0 ] == pInfo->m_acMvCand[ 1 ] ) |
---|
[2] | 4412 | { |
---|
[56] | 4413 | pInfo->iN = 1; |
---|
[2] | 4414 | } |
---|
| 4415 | } |
---|
| 4416 | #endif |
---|
| 4417 | |
---|
[56] | 4418 | if ( getSlice()->getPPS()->getEnableTMVPFlag() ) |
---|
| 4419 | { |
---|
| 4420 | // Get Temporal Motion Predictor |
---|
| 4421 | int iRefIdx_Col = iRefIdx; |
---|
| 4422 | TComMv cColMv; |
---|
| 4423 | UInt uiPartIdxRB; |
---|
| 4424 | UInt uiAbsPartIdx; |
---|
| 4425 | UInt uiAbsPartAddr; |
---|
| 4426 | int uiLCUIdx = getAddr(); |
---|
| 4427 | |
---|
| 4428 | deriveRightBottomIdx( eCUMode, uiPartIdx, uiPartIdxRB ); |
---|
| 4429 | uiAbsPartAddr = m_uiAbsIdxInLCU + uiPartAddr; |
---|
| 4430 | |
---|
| 4431 | //---- co-located RightBottom Temporal Predictor (H) ---// |
---|
| 4432 | uiAbsPartIdx = g_auiZscanToRaster[uiPartIdxRB]; |
---|
| 4433 | if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdx] + m_pcPic->getMinCUWidth() ) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples() ) // image boundary check |
---|
[2] | 4434 | { |
---|
[56] | 4435 | uiLCUIdx = -1; |
---|
[2] | 4436 | } |
---|
[56] | 4437 | else if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdx] + m_pcPic->getMinCUHeight() ) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples() ) |
---|
[2] | 4438 | { |
---|
[56] | 4439 | uiLCUIdx = -1; |
---|
[2] | 4440 | } |
---|
| 4441 | else |
---|
| 4442 | { |
---|
[56] | 4443 | if ( ( uiAbsPartIdx % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) && // is not at the last column of LCU |
---|
| 4444 | ( uiAbsPartIdx / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) ) // is not at the last row of LCU |
---|
| 4445 | { |
---|
| 4446 | uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdx + uiNumPartInCUWidth + 1 ]; |
---|
| 4447 | uiLCUIdx = getAddr(); |
---|
| 4448 | } |
---|
| 4449 | else if ( uiAbsPartIdx % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) // is not at the last column of LCU But is last row of LCU |
---|
| 4450 | { |
---|
| 4451 | uiAbsPartAddr = g_auiRasterToZscan[ (uiAbsPartIdx + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ]; |
---|
| 4452 | uiLCUIdx = -1 ; |
---|
| 4453 | } |
---|
| 4454 | else if ( uiAbsPartIdx / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU |
---|
| 4455 | { |
---|
| 4456 | uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdx + 1 ]; |
---|
| 4457 | uiLCUIdx = getAddr() + 1; |
---|
| 4458 | } |
---|
| 4459 | else //is the right bottom corner of LCU |
---|
| 4460 | { |
---|
| 4461 | uiAbsPartAddr = 0; |
---|
| 4462 | uiLCUIdx = -1 ; |
---|
| 4463 | } |
---|
[2] | 4464 | } |
---|
[56] | 4465 | if ( uiLCUIdx >= 0 && xGetColMVP( eRefPicList, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx_Col ) ) |
---|
[2] | 4466 | { |
---|
[56] | 4467 | pInfo->m_acMvCand[pInfo->iN++] = cColMv; |
---|
[2] | 4468 | } |
---|
[56] | 4469 | else |
---|
[2] | 4470 | { |
---|
[56] | 4471 | UInt uiPartIdxCenter; |
---|
| 4472 | UInt uiCurLCUIdx = getAddr(); |
---|
| 4473 | xDeriveCenterIdx( eCUMode, uiPartIdx, uiPartIdxCenter ); |
---|
| 4474 | if (xGetColMVP( eRefPicList, uiCurLCUIdx, uiPartIdxCenter, cColMv, iRefIdx_Col )) |
---|
| 4475 | { |
---|
| 4476 | pInfo->m_acMvCand[pInfo->iN++] = cColMv; |
---|
| 4477 | } |
---|
[2] | 4478 | } |
---|
[56] | 4479 | //---- co-located RightBottom Temporal Predictor ---// |
---|
[2] | 4480 | } |
---|
| 4481 | |
---|
[5] | 4482 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
[2] | 4483 | #if ( PDM_AMVP_POS == 3 ) |
---|
| 4484 | // get inter-view mv predictor (at position 3) |
---|
| 4485 | TComMv cPdmMvPred; |
---|
| 4486 | if( getPdmMvPred( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred ) ) |
---|
| 4487 | { |
---|
| 4488 | clipMv( cPdmMvPred ); |
---|
| 4489 | pInfo->m_acMvCand[ pInfo->iN++ ] = cPdmMvPred; |
---|
| 4490 | } |
---|
| 4491 | #endif |
---|
[5] | 4492 | #endif |
---|
[2] | 4493 | |
---|
[56] | 4494 | #if !AMVP_PRUNING_SIMPLIFICATION |
---|
[2] | 4495 | // Check No MV Candidate |
---|
| 4496 | xUniqueMVPCand( pInfo ); |
---|
[56] | 4497 | #endif |
---|
[2] | 4498 | |
---|
[56] | 4499 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
| 4500 | const Int iNumAMVPCands = AMVP_MAX_NUM_CANDS + ( getSlice()->getSPS()->getMultiviewMvPredMode() ? 1 : 0 ); |
---|
| 4501 | if (pInfo->iN > iNumAMVPCands) |
---|
[2] | 4502 | { |
---|
[56] | 4503 | pInfo->iN = iNumAMVPCands; |
---|
[2] | 4504 | } |
---|
[56] | 4505 | else if (pInfo->iN < iNumAMVPCands) |
---|
| 4506 | #else |
---|
| 4507 | if (pInfo->iN > AMVP_MAX_NUM_CANDS) |
---|
[2] | 4508 | { |
---|
[56] | 4509 | pInfo->iN = AMVP_MAX_NUM_CANDS; |
---|
[2] | 4510 | } |
---|
[56] | 4511 | else if (pInfo->iN < AMVP_MAX_NUM_CANDS) |
---|
| 4512 | #endif |
---|
[2] | 4513 | { |
---|
[56] | 4514 | #if !AMVP_ZERO_CHECKING_REMOVAL |
---|
| 4515 | int j; |
---|
| 4516 | for (j=0; j<pInfo->iN; j++) |
---|
[2] | 4517 | { |
---|
[56] | 4518 | if (pInfo->m_acMvCand[j].getHor() == 0 && pInfo->m_acMvCand[j].getVer() == 0) |
---|
[2] | 4519 | { |
---|
[56] | 4520 | break; |
---|
[2] | 4521 | } |
---|
| 4522 | } |
---|
[56] | 4523 | if (j == pInfo->iN) |
---|
[2] | 4524 | { |
---|
[56] | 4525 | #endif |
---|
| 4526 | pInfo->m_acMvCand[pInfo->iN].set(0,0); |
---|
| 4527 | pInfo->iN++; |
---|
| 4528 | #if !AMVP_ZERO_CHECKING_REMOVAL |
---|
[2] | 4529 | } |
---|
| 4530 | #endif |
---|
| 4531 | } |
---|
[56] | 4532 | return ; |
---|
[2] | 4533 | } |
---|
| 4534 | |
---|
| 4535 | Void TComDataCU::clipMv (TComMv& rcMv) |
---|
| 4536 | { |
---|
| 4537 | Int iMvShift = 2; |
---|
[5] | 4538 | #if HHI_FULL_PEL_DEPTH_MAP_MV_ACC |
---|
[56] | 4539 | if( getSlice()->getIsDepth() ) |
---|
[2] | 4540 | iMvShift = 0; |
---|
| 4541 | #endif |
---|
[56] | 4542 | Int iOffset = 8; |
---|
| 4543 | Int iHorMax = ( m_pcSlice->getSPS()->getPicWidthInLumaSamples() + iOffset - m_uiCUPelX - 1 ) << iMvShift; |
---|
| 4544 | Int iHorMin = ( -(Int)g_uiMaxCUWidth - iOffset - (Int)m_uiCUPelX + 1 ) << iMvShift; |
---|
[2] | 4545 | |
---|
[56] | 4546 | Int iVerMax = ( m_pcSlice->getSPS()->getPicHeightInLumaSamples() + iOffset - m_uiCUPelY - 1 ) << iMvShift; |
---|
| 4547 | Int iVerMin = ( -(Int)g_uiMaxCUHeight - iOffset - (Int)m_uiCUPelY + 1 ) << iMvShift; |
---|
[2] | 4548 | |
---|
[56] | 4549 | rcMv.setHor( min (iHorMax, max (iHorMin, rcMv.getHor())) ); |
---|
| 4550 | rcMv.setVer( min (iVerMax, max (iVerMin, rcMv.getVer())) ); |
---|
[2] | 4551 | } |
---|
| 4552 | |
---|
| 4553 | |
---|
| 4554 | Void TComDataCU::convertTransIdx( UInt uiAbsPartIdx, UInt uiTrIdx, UInt& ruiLumaTrMode, UInt& ruiChromaTrMode ) |
---|
| 4555 | { |
---|
| 4556 | ruiLumaTrMode = uiTrIdx; |
---|
| 4557 | ruiChromaTrMode = uiTrIdx; |
---|
| 4558 | return; |
---|
| 4559 | } |
---|
| 4560 | |
---|
| 4561 | UInt TComDataCU::getIntraSizeIdx(UInt uiAbsPartIdx) |
---|
| 4562 | { |
---|
| 4563 | UInt uiShift = ( (m_puhTrIdx[uiAbsPartIdx]==0) && (m_pePartSize[uiAbsPartIdx]==SIZE_NxN) ) ? m_puhTrIdx[uiAbsPartIdx]+1 : m_puhTrIdx[uiAbsPartIdx]; |
---|
| 4564 | uiShift = ( m_pePartSize[uiAbsPartIdx]==SIZE_NxN ? 1 : 0 ); |
---|
| 4565 | |
---|
| 4566 | UChar uiWidth = m_puhWidth[uiAbsPartIdx]>>uiShift; |
---|
| 4567 | UInt uiCnt = 0; |
---|
| 4568 | while( uiWidth ) |
---|
| 4569 | { |
---|
| 4570 | uiCnt++; |
---|
| 4571 | uiWidth>>=1; |
---|
| 4572 | } |
---|
| 4573 | uiCnt-=2; |
---|
| 4574 | return uiCnt > 6 ? 6 : uiCnt; |
---|
| 4575 | } |
---|
| 4576 | |
---|
| 4577 | Void TComDataCU::clearCbf( UInt uiIdx, TextType eType, UInt uiNumParts ) |
---|
| 4578 | { |
---|
| 4579 | ::memset( &m_puhCbf[g_aucConvertTxtTypeToIdx[eType]][uiIdx], 0, sizeof(UChar)*uiNumParts); |
---|
| 4580 | } |
---|
| 4581 | |
---|
[56] | 4582 | /** Set a I_PCM flag for all sub-partitions of a partition. |
---|
| 4583 | * \param bIpcmFlag I_PCM flag |
---|
| 4584 | * \param uiAbsPartIdx patition index |
---|
| 4585 | * \param uiDepth CU depth |
---|
| 4586 | * \returns Void |
---|
[2] | 4587 | */ |
---|
[56] | 4588 | Void TComDataCU::setIPCMFlagSubParts (Bool bIpcmFlag, UInt uiAbsPartIdx, UInt uiDepth) |
---|
| 4589 | { |
---|
| 4590 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
| 4591 | |
---|
| 4592 | memset(m_pbIPCMFlag + uiAbsPartIdx, bIpcmFlag, sizeof(Bool)*uiCurrPartNumb ); |
---|
| 4593 | } |
---|
| 4594 | |
---|
| 4595 | /** Test whether the current block is skipped |
---|
| 4596 | * \param uiPartIdx Block index |
---|
| 4597 | * \returns Flag indicating whether the block is skipped |
---|
| 4598 | */ |
---|
[2] | 4599 | Bool TComDataCU::isSkipped( UInt uiPartIdx ) |
---|
| 4600 | { |
---|
| 4601 | if ( m_pcSlice->isIntra () ) |
---|
| 4602 | { |
---|
| 4603 | return false; |
---|
| 4604 | } |
---|
| 4605 | return ( m_pePredMode[ uiPartIdx ] == MODE_SKIP && getMergeFlag( uiPartIdx ) && !getQtRootCbf( uiPartIdx ) ); |
---|
| 4606 | } |
---|
| 4607 | |
---|
| 4608 | // ==================================================================================================================== |
---|
| 4609 | // Protected member functions |
---|
| 4610 | // ==================================================================================================================== |
---|
| 4611 | |
---|
| 4612 | Bool TComDataCU::xAddMVPCand( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir ) |
---|
| 4613 | { |
---|
| 4614 | TComDataCU* pcTmpCU = NULL; |
---|
| 4615 | UInt uiIdx; |
---|
| 4616 | switch( eDir ) |
---|
| 4617 | { |
---|
| 4618 | case MD_LEFT: |
---|
| 4619 | { |
---|
[56] | 4620 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
| 4621 | pcTmpCU = getPULeft(uiIdx, uiPartUnitIdx, true, false); |
---|
| 4622 | #else |
---|
[2] | 4623 | pcTmpCU = getPULeft(uiIdx, uiPartUnitIdx); |
---|
[56] | 4624 | #endif |
---|
[2] | 4625 | break; |
---|
| 4626 | } |
---|
| 4627 | case MD_ABOVE: |
---|
| 4628 | { |
---|
[56] | 4629 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
| 4630 | pcTmpCU = getPUAbove(uiIdx, uiPartUnitIdx, true, false, true); |
---|
| 4631 | #else |
---|
| 4632 | pcTmpCU = getPUAbove(uiIdx, uiPartUnitIdx, true, true, true); |
---|
| 4633 | #endif |
---|
[2] | 4634 | break; |
---|
| 4635 | } |
---|
| 4636 | case MD_ABOVE_RIGHT: |
---|
| 4637 | { |
---|
[56] | 4638 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
| 4639 | pcTmpCU = getPUAboveRight(uiIdx, uiPartUnitIdx, true, false, true); |
---|
| 4640 | #else |
---|
| 4641 | pcTmpCU = getPUAboveRight(uiIdx, uiPartUnitIdx, true, true, true); |
---|
| 4642 | #endif |
---|
[2] | 4643 | break; |
---|
| 4644 | } |
---|
| 4645 | case MD_BELOW_LEFT: |
---|
| 4646 | { |
---|
[56] | 4647 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
| 4648 | pcTmpCU = getPUBelowLeft(uiIdx, uiPartUnitIdx, true, false); |
---|
| 4649 | #else |
---|
[2] | 4650 | pcTmpCU = getPUBelowLeft(uiIdx, uiPartUnitIdx); |
---|
[56] | 4651 | #endif |
---|
[2] | 4652 | break; |
---|
| 4653 | } |
---|
| 4654 | case MD_ABOVE_LEFT: |
---|
| 4655 | { |
---|
[56] | 4656 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
| 4657 | pcTmpCU = getPUAboveLeft(uiIdx, uiPartUnitIdx, true, false, true); |
---|
| 4658 | #else |
---|
| 4659 | pcTmpCU = getPUAboveLeft(uiIdx, uiPartUnitIdx, true, true, true); |
---|
| 4660 | #endif |
---|
[2] | 4661 | break; |
---|
| 4662 | } |
---|
| 4663 | default: |
---|
| 4664 | { |
---|
| 4665 | break; |
---|
| 4666 | } |
---|
| 4667 | } |
---|
| 4668 | |
---|
| 4669 | if ( pcTmpCU != NULL && m_pcSlice->isEqualRef(eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx), iRefIdx) ) |
---|
| 4670 | { |
---|
| 4671 | TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx); |
---|
| 4672 | |
---|
| 4673 | pInfo->m_acMvCand[ pInfo->iN++] = cMvPred; |
---|
| 4674 | return true; |
---|
| 4675 | } |
---|
[56] | 4676 | |
---|
| 4677 | if ( pcTmpCU == NULL ) |
---|
| 4678 | { |
---|
| 4679 | return false; |
---|
| 4680 | } |
---|
| 4681 | |
---|
| 4682 | RefPicList eRefPicList2nd = REF_PIC_LIST_0; |
---|
| 4683 | if( eRefPicList == REF_PIC_LIST_0 ) |
---|
| 4684 | { |
---|
| 4685 | eRefPicList2nd = REF_PIC_LIST_1; |
---|
| 4686 | } |
---|
| 4687 | else if ( eRefPicList == REF_PIC_LIST_1) |
---|
| 4688 | { |
---|
| 4689 | eRefPicList2nd = REF_PIC_LIST_0; |
---|
| 4690 | } |
---|
| 4691 | |
---|
| 4692 | |
---|
| 4693 | Int iCurrRefPOC = m_pcSlice->getRefPic( eRefPicList, iRefIdx)->getPOC(); |
---|
| 4694 | Int iNeibRefPOC; |
---|
| 4695 | |
---|
| 4696 | |
---|
| 4697 | if( pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) >= 0 ) |
---|
| 4698 | { |
---|
| 4699 | if( pcTmpCU->getSlice()->getRefViewId( eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) ) != m_pcSlice->getRefViewId( eRefPicList, iRefIdx ) ) |
---|
| 4700 | { |
---|
| 4701 | return false; |
---|
| 4702 | } |
---|
| 4703 | iNeibRefPOC = pcTmpCU->getSlice()->getRefPOC( eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) ); |
---|
| 4704 | if( iNeibRefPOC == iCurrRefPOC ) // Same Reference Frame But Diff List// |
---|
| 4705 | { |
---|
| 4706 | TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList2nd)->getMv(uiIdx); |
---|
| 4707 | pInfo->m_acMvCand[ pInfo->iN++] = cMvPred; |
---|
| 4708 | return true; |
---|
| 4709 | } |
---|
| 4710 | } |
---|
[2] | 4711 | return false; |
---|
| 4712 | } |
---|
| 4713 | |
---|
[56] | 4714 | #if !AMVP_PRUNING_SIMPLIFICATION |
---|
| 4715 | /** |
---|
| 4716 | * Reduce list of motion vector predictors to a set of unique predictors |
---|
| 4717 | * \param pInfo list of motion vector predictors |
---|
| 4718 | */ |
---|
[2] | 4719 | Void TComDataCU::xUniqueMVPCand(AMVPInfo* pInfo) |
---|
| 4720 | { |
---|
[56] | 4721 | Int n = 1; |
---|
[2] | 4722 | if ( pInfo->iN == 0 ) |
---|
| 4723 | { |
---|
[56] | 4724 | #if AMVP_ZERO_CHECKING_REMOVAL |
---|
[2] | 4725 | return; |
---|
[56] | 4726 | #else |
---|
| 4727 | // Add a zero candidate is none is available |
---|
| 4728 | pInfo->m_acMvCand[ 0 ].setZero(); |
---|
| 4729 | #endif |
---|
[2] | 4730 | } |
---|
[56] | 4731 | else |
---|
[2] | 4732 | { |
---|
[56] | 4733 | for (Int i = 1; i < pInfo->iN; i++) |
---|
[2] | 4734 | { |
---|
[56] | 4735 | Int j; |
---|
| 4736 | for (j = n - 1; j >= 0; j--) |
---|
| 4737 | { |
---|
| 4738 | if ( pInfo->m_acMvCand[ i ] == pInfo->m_acMvCand[ j ] ) |
---|
| 4739 | { |
---|
| 4740 | break; |
---|
| 4741 | } |
---|
| 4742 | } |
---|
| 4743 | if ( j < 0 ) |
---|
| 4744 | { |
---|
| 4745 | pInfo->m_acMvCand[ n++ ] = pInfo->m_acMvCand[ i ]; |
---|
| 4746 | } |
---|
[2] | 4747 | } |
---|
| 4748 | } |
---|
[56] | 4749 | pInfo->iN = n; |
---|
[2] | 4750 | } |
---|
[56] | 4751 | #endif |
---|
[2] | 4752 | |
---|
| 4753 | /** |
---|
| 4754 | * \param pInfo |
---|
| 4755 | * \param eRefPicList |
---|
| 4756 | * \param iRefIdx |
---|
| 4757 | * \param uiPartUnitIdx |
---|
| 4758 | * \param eDir |
---|
| 4759 | * \returns Bool |
---|
| 4760 | */ |
---|
| 4761 | Bool TComDataCU::xAddMVPCandOrder( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir ) |
---|
| 4762 | { |
---|
| 4763 | TComDataCU* pcTmpCU = NULL; |
---|
| 4764 | UInt uiIdx; |
---|
| 4765 | switch( eDir ) |
---|
| 4766 | { |
---|
| 4767 | case MD_LEFT: |
---|
| 4768 | { |
---|
[56] | 4769 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
| 4770 | pcTmpCU = getPULeft(uiIdx, uiPartUnitIdx, true, false); |
---|
| 4771 | #else |
---|
[2] | 4772 | pcTmpCU = getPULeft(uiIdx, uiPartUnitIdx); |
---|
[56] | 4773 | #endif |
---|
[2] | 4774 | break; |
---|
| 4775 | } |
---|
| 4776 | case MD_ABOVE: |
---|
| 4777 | { |
---|
[56] | 4778 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
| 4779 | pcTmpCU = getPUAbove(uiIdx, uiPartUnitIdx, true, false, true); |
---|
| 4780 | #else |
---|
| 4781 | pcTmpCU = getPUAbove(uiIdx, uiPartUnitIdx, true, true, true); |
---|
| 4782 | #endif |
---|
[2] | 4783 | break; |
---|
| 4784 | } |
---|
| 4785 | case MD_ABOVE_RIGHT: |
---|
| 4786 | { |
---|
[56] | 4787 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
| 4788 | pcTmpCU = getPUAboveRight(uiIdx, uiPartUnitIdx, true, false, true); |
---|
| 4789 | #else |
---|
| 4790 | pcTmpCU = getPUAboveRight(uiIdx, uiPartUnitIdx, true, true, true); |
---|
| 4791 | #endif |
---|
[2] | 4792 | break; |
---|
| 4793 | } |
---|
| 4794 | case MD_BELOW_LEFT: |
---|
| 4795 | { |
---|
[56] | 4796 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
| 4797 | pcTmpCU = getPUBelowLeft(uiIdx, uiPartUnitIdx, true, false); |
---|
| 4798 | #else |
---|
[2] | 4799 | pcTmpCU = getPUBelowLeft(uiIdx, uiPartUnitIdx); |
---|
[56] | 4800 | #endif |
---|
[2] | 4801 | break; |
---|
| 4802 | } |
---|
| 4803 | case MD_ABOVE_LEFT: |
---|
| 4804 | { |
---|
[56] | 4805 | #if MVP_AT_ENTROPYSLICE_BOUNDARY |
---|
| 4806 | pcTmpCU = getPUAboveLeft(uiIdx, uiPartUnitIdx, true, false, true); |
---|
| 4807 | #else |
---|
| 4808 | pcTmpCU = getPUAboveLeft(uiIdx, uiPartUnitIdx, true, true, true); |
---|
| 4809 | #endif |
---|
[2] | 4810 | break; |
---|
| 4811 | } |
---|
| 4812 | default: |
---|
| 4813 | { |
---|
| 4814 | break; |
---|
| 4815 | } |
---|
| 4816 | } |
---|
| 4817 | |
---|
| 4818 | if ( pcTmpCU == NULL ) |
---|
[56] | 4819 | { |
---|
[2] | 4820 | return false; |
---|
[56] | 4821 | } |
---|
| 4822 | |
---|
[2] | 4823 | RefPicList eRefPicList2nd = REF_PIC_LIST_0; |
---|
| 4824 | if( eRefPicList == REF_PIC_LIST_0 ) |
---|
[56] | 4825 | { |
---|
[2] | 4826 | eRefPicList2nd = REF_PIC_LIST_1; |
---|
[56] | 4827 | } |
---|
[2] | 4828 | else if ( eRefPicList == REF_PIC_LIST_1) |
---|
[56] | 4829 | { |
---|
[2] | 4830 | eRefPicList2nd = REF_PIC_LIST_0; |
---|
[56] | 4831 | } |
---|
[2] | 4832 | |
---|
| 4833 | Int iCurrPOC = m_pcSlice->getPOC(); |
---|
| 4834 | Int iCurrRefPOC = m_pcSlice->getRefPic( eRefPicList, iRefIdx)->getPOC(); |
---|
| 4835 | Int iNeibPOC = iCurrPOC; |
---|
| 4836 | Int iNeibRefPOC; |
---|
| 4837 | |
---|
| 4838 | //--------------- V1 (END) ------------------// |
---|
| 4839 | if( pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) >= 0) |
---|
| 4840 | { |
---|
| 4841 | iNeibRefPOC = pcTmpCU->getSlice()->getRefPOC( eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ); |
---|
| 4842 | TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx); |
---|
| 4843 | TComMv rcMv; |
---|
| 4844 | |
---|
[56] | 4845 | if( pcTmpCU->getSlice()->getRefViewId( eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ) != m_pcSlice->getRefViewId( eRefPicList, iRefIdx ) ) |
---|
| 4846 | { |
---|
[2] | 4847 | return false; |
---|
[56] | 4848 | } |
---|
[2] | 4849 | |
---|
| 4850 | Int iScale = xGetDistScaleFactor( iCurrPOC, iCurrRefPOC, iNeibPOC, iNeibRefPOC ); |
---|
[56] | 4851 | if ( iScale == 4096 ) |
---|
[2] | 4852 | { |
---|
| 4853 | rcMv = cMvPred; |
---|
| 4854 | } |
---|
| 4855 | else |
---|
| 4856 | { |
---|
| 4857 | rcMv = cMvPred.scaleMv( iScale ); |
---|
| 4858 | } |
---|
| 4859 | pInfo->m_acMvCand[ pInfo->iN++] = rcMv; |
---|
| 4860 | return true; |
---|
| 4861 | } |
---|
| 4862 | //---------------------- V2(END) --------------------// |
---|
| 4863 | if( pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) >= 0) |
---|
| 4864 | { |
---|
| 4865 | iNeibRefPOC = pcTmpCU->getSlice()->getRefPOC( eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) ); |
---|
| 4866 | TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList2nd)->getMv(uiIdx); |
---|
| 4867 | TComMv rcMv; |
---|
| 4868 | |
---|
[56] | 4869 | if( pcTmpCU->getSlice()->getRefViewId( eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) ) != m_pcSlice->getRefViewId( eRefPicList, iRefIdx ) ) |
---|
| 4870 | { |
---|
[2] | 4871 | return false; |
---|
[56] | 4872 | } |
---|
[2] | 4873 | |
---|
| 4874 | Int iScale = xGetDistScaleFactor( iCurrPOC, iCurrRefPOC, iNeibPOC, iNeibRefPOC ); |
---|
[56] | 4875 | if ( iScale == 4096 ) |
---|
[2] | 4876 | { |
---|
| 4877 | rcMv = cMvPred; |
---|
| 4878 | } |
---|
| 4879 | else |
---|
| 4880 | { |
---|
| 4881 | rcMv = cMvPred.scaleMv( iScale ); |
---|
| 4882 | } |
---|
| 4883 | pInfo->m_acMvCand[ pInfo->iN++] = rcMv; |
---|
| 4884 | return true; |
---|
| 4885 | } |
---|
| 4886 | //---------------------- V3(END) --------------------// |
---|
| 4887 | return false; |
---|
| 4888 | } |
---|
| 4889 | |
---|
| 4890 | /** |
---|
| 4891 | * \param eRefPicList |
---|
| 4892 | * \param uiCUAddr |
---|
| 4893 | * \param uiPartUnitIdx |
---|
| 4894 | * \param riRefIdx |
---|
| 4895 | * \returns Bool |
---|
| 4896 | */ |
---|
| 4897 | Bool TComDataCU::xGetColMVP( RefPicList eRefPicList, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int& riRefIdx ) |
---|
| 4898 | { |
---|
| 4899 | UInt uiAbsPartAddr = uiPartUnitIdx; |
---|
| 4900 | |
---|
| 4901 | RefPicList eColRefPicList; |
---|
| 4902 | Int iColPOC, iColRefPOC, iCurrPOC, iCurrRefPOC, iScale; |
---|
[21] | 4903 | #if SONY_COLPIC_AVAILABILITY |
---|
[56] | 4904 | Int iColViewOrderIdx, iColRefViewOrderIdx, iCurrViewOrderIdx, iCurrRefViewOrderIdx; |
---|
[21] | 4905 | #endif |
---|
[2] | 4906 | TComMv cColMv; |
---|
| 4907 | |
---|
[21] | 4908 | #if SONY_COLPIC_AVAILABILITY |
---|
[56] | 4909 | iCurrViewOrderIdx = m_pcSlice->getViewOrderIdx(); |
---|
| 4910 | iCurrRefViewOrderIdx = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getViewOrderIdx(); |
---|
[21] | 4911 | #endif |
---|
[2] | 4912 | // use coldir. |
---|
[56] | 4913 | #if COLLOCATED_REF_IDX |
---|
| 4914 | TComPic *pColPic = getSlice()->getRefPic( RefPicList(getSlice()->isInterB() ? getSlice()->getColDir() : 0), getSlice()->getColRefIdx()); |
---|
| 4915 | #else |
---|
[2] | 4916 | TComPic *pColPic = getSlice()->getRefPic( RefPicList(getSlice()->isInterB() ? getSlice()->getColDir() : 0), 0); |
---|
[56] | 4917 | #endif |
---|
[2] | 4918 | TComDataCU *pColCU = pColPic->getCU( uiCUAddr ); |
---|
[56] | 4919 | if(pColCU->getPic()==0||pColCU->getPartitionSize(uiPartUnitIdx)==SIZE_NONE) |
---|
| 4920 | { |
---|
| 4921 | return false; |
---|
| 4922 | } |
---|
| 4923 | iCurrPOC = m_pcSlice->getPOC(); |
---|
| 4924 | iCurrRefPOC = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getPOC(); |
---|
[2] | 4925 | iColPOC = pColCU->getSlice()->getPOC(); |
---|
[21] | 4926 | #if SONY_COLPIC_AVAILABILITY |
---|
[56] | 4927 | iColViewOrderIdx = pColCU->getSlice()->getViewOrderIdx(); |
---|
[21] | 4928 | #endif |
---|
[2] | 4929 | |
---|
| 4930 | if (pColCU->isIntra(uiAbsPartAddr)) |
---|
| 4931 | { |
---|
| 4932 | return false; |
---|
| 4933 | } |
---|
[56] | 4934 | |
---|
[21] | 4935 | #if !SONY_COLPIC_AVAILABILITY |
---|
[56] | 4936 | if( m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getViewId() != m_pcSlice->getViewId() ) |
---|
[2] | 4937 | return false; |
---|
[21] | 4938 | #endif |
---|
[2] | 4939 | |
---|
[56] | 4940 | if ( !pColPic->getUsedForTMVP() ) |
---|
| 4941 | { |
---|
| 4942 | return false; |
---|
| 4943 | } |
---|
[2] | 4944 | |
---|
[56] | 4945 | eColRefPicList = getSlice()->getCheckLDC() ? eRefPicList : RefPicList(1-getSlice()->getColDir()); |
---|
| 4946 | |
---|
| 4947 | Int iColRefIdx = pColCU->getCUMvField(RefPicList(eColRefPicList))->getRefIdx(uiAbsPartAddr); |
---|
| 4948 | |
---|
| 4949 | if (iColRefIdx < 0 ) |
---|
[2] | 4950 | { |
---|
[56] | 4951 | eColRefPicList = RefPicList(1 - eColRefPicList); |
---|
| 4952 | iColRefIdx = pColCU->getCUMvField(RefPicList(eColRefPicList))->getRefIdx(uiAbsPartAddr); |
---|
[21] | 4953 | |
---|
[56] | 4954 | if (iColRefIdx < 0 ) |
---|
[2] | 4955 | { |
---|
[56] | 4956 | return false; |
---|
[2] | 4957 | } |
---|
| 4958 | } |
---|
[56] | 4959 | |
---|
[2] | 4960 | // Scale the vector. |
---|
[56] | 4961 | iColRefPOC = pColCU->getSlice()->getRefPOC(eColRefPicList, iColRefIdx); |
---|
| 4962 | |
---|
[21] | 4963 | #if SONY_COLPIC_AVAILABILITY |
---|
[56] | 4964 | iColRefViewOrderIdx = pColCU->getSlice()->getRefPic( eColRefPicList, pColCU->getCUMvField(eColRefPicList)->getRefIdx(uiAbsPartAddr))->getViewOrderIdx(); |
---|
| 4965 | #else |
---|
| 4966 | if( pColCU->getSlice()->getRefViewId( eColRefPicList, iColRefIdx ) != m_pcSlice->getRefPic( eRefPicList, riRefIdx )->getViewId() ) |
---|
| 4967 | { |
---|
| 4968 | return false; |
---|
| 4969 | } |
---|
[21] | 4970 | #endif |
---|
[2] | 4971 | |
---|
[56] | 4972 | cColMv = pColCU->getCUMvField(eColRefPicList)->getMv(uiAbsPartAddr); |
---|
| 4973 | |
---|
[2] | 4974 | iCurrRefPOC = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getPOC(); |
---|
[21] | 4975 | #if SONY_COLPIC_AVAILABILITY |
---|
[56] | 4976 | iScale = 0; |
---|
| 4977 | iCurrRefViewOrderIdx = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getViewOrderIdx(); |
---|
| 4978 | if((iColPOC != iColRefPOC)&&(iCurrPOC != iCurrRefPOC)) |
---|
| 4979 | iScale = xGetDistScaleFactor(iCurrPOC, iCurrRefPOC, iColPOC, iColRefPOC); |
---|
| 4980 | else if((iColPOC == iColRefPOC)&&(iCurrPOC == iCurrRefPOC)) |
---|
| 4981 | iScale = xGetDistScaleFactor(iCurrViewOrderIdx, iCurrRefViewOrderIdx, iColViewOrderIdx, iColRefViewOrderIdx); |
---|
[21] | 4982 | #else |
---|
| 4983 | iScale = xGetDistScaleFactor(iCurrPOC, iCurrRefPOC, iColPOC, iColRefPOC); |
---|
| 4984 | #endif |
---|
[56] | 4985 | if ( iScale == 4096 ) |
---|
[2] | 4986 | { |
---|
| 4987 | rcMv = cColMv; |
---|
| 4988 | } |
---|
| 4989 | else |
---|
| 4990 | { |
---|
| 4991 | rcMv = cColMv.scaleMv( iScale ); |
---|
| 4992 | } |
---|
[56] | 4993 | |
---|
[2] | 4994 | return true; |
---|
| 4995 | } |
---|
| 4996 | |
---|
| 4997 | UInt TComDataCU::xGetMvdBits(TComMv cMvd) |
---|
| 4998 | { |
---|
| 4999 | return ( xGetComponentBits(cMvd.getHor()) + xGetComponentBits(cMvd.getVer()) ); |
---|
| 5000 | } |
---|
| 5001 | |
---|
| 5002 | UInt TComDataCU::xGetComponentBits(Int iVal) |
---|
| 5003 | { |
---|
| 5004 | UInt uiLength = 1; |
---|
| 5005 | UInt uiTemp = ( iVal <= 0) ? (-iVal<<1)+1: (iVal<<1); |
---|
| 5006 | |
---|
| 5007 | assert ( uiTemp ); |
---|
| 5008 | |
---|
| 5009 | while ( 1 != uiTemp ) |
---|
| 5010 | { |
---|
| 5011 | uiTemp >>= 1; |
---|
| 5012 | uiLength += 2; |
---|
| 5013 | } |
---|
| 5014 | |
---|
| 5015 | return uiLength; |
---|
| 5016 | } |
---|
| 5017 | |
---|
| 5018 | |
---|
| 5019 | Int TComDataCU::xGetDistScaleFactor(Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC) |
---|
| 5020 | { |
---|
| 5021 | Int iDiffPocD = iColPOC - iColRefPOC; |
---|
| 5022 | Int iDiffPocB = iCurrPOC - iCurrRefPOC; |
---|
| 5023 | |
---|
| 5024 | if( iDiffPocD == iDiffPocB ) |
---|
| 5025 | { |
---|
[56] | 5026 | return 4096; |
---|
[2] | 5027 | } |
---|
| 5028 | else |
---|
| 5029 | { |
---|
| 5030 | Int iTDB = Clip3( -128, 127, iDiffPocB ); |
---|
| 5031 | Int iTDD = Clip3( -128, 127, iDiffPocD ); |
---|
| 5032 | Int iX = (0x4000 + abs(iTDD/2)) / iTDD; |
---|
[56] | 5033 | Int iScale = Clip3( -4096, 4095, (iTDB * iX + 32) >> 6 ); |
---|
[2] | 5034 | return iScale; |
---|
| 5035 | } |
---|
| 5036 | } |
---|
| 5037 | |
---|
| 5038 | /** |
---|
| 5039 | * \param eCUMode |
---|
| 5040 | * \param uiPartIdx |
---|
| 5041 | * \param ruiPartIdxCenter |
---|
| 5042 | * \returns Void |
---|
| 5043 | */ |
---|
| 5044 | Void TComDataCU::xDeriveCenterIdx( PartSize eCUMode, UInt uiPartIdx, UInt& ruiPartIdxCenter ) |
---|
| 5045 | { |
---|
| 5046 | UInt uiPartAddr; |
---|
| 5047 | Int iPartWidth; |
---|
| 5048 | Int iPartHeight; |
---|
| 5049 | getPartIndexAndSize( uiPartIdx, uiPartAddr, iPartWidth, iPartHeight); |
---|
| 5050 | |
---|
| 5051 | ruiPartIdxCenter = m_uiAbsIdxInLCU+uiPartAddr; // partition origin. |
---|
| 5052 | ruiPartIdxCenter = g_auiRasterToZscan[ g_auiZscanToRaster[ ruiPartIdxCenter ] |
---|
[56] | 5053 | + ( iPartHeight/m_pcPic->getMinCUHeight() )/2*m_pcPic->getNumPartInWidth() |
---|
| 5054 | + ( iPartWidth/m_pcPic->getMinCUWidth() )/2]; |
---|
[2] | 5055 | } |
---|
| 5056 | |
---|
| 5057 | /** |
---|
| 5058 | * \param uiPartIdx |
---|
| 5059 | * \param eRefPicList |
---|
| 5060 | * \param iRefIdx |
---|
| 5061 | * \param pcMv |
---|
| 5062 | * \returns Bool |
---|
| 5063 | */ |
---|
| 5064 | Bool TComDataCU::xGetCenterCol( UInt uiPartIdx, RefPicList eRefPicList, int iRefIdx, TComMv *pcMv ) |
---|
| 5065 | { |
---|
[56] | 5066 | PartSize eCUMode = getPartitionSize( 0 ); |
---|
[2] | 5067 | |
---|
| 5068 | Int iCurrPOC = m_pcSlice->getPOC(); |
---|
| 5069 | |
---|
| 5070 | // use coldir. |
---|
[56] | 5071 | #if COLLOCATED_REF_IDX |
---|
| 5072 | TComPic *pColPic = getSlice()->getRefPic( RefPicList(getSlice()->isInterB() ? getSlice()->getColDir() : 0), getSlice()->getColRefIdx()); |
---|
| 5073 | #else |
---|
[2] | 5074 | TComPic *pColPic = getSlice()->getRefPic( RefPicList(getSlice()->isInterB() ? getSlice()->getColDir() : 0), 0); |
---|
[56] | 5075 | #endif |
---|
[2] | 5076 | TComDataCU *pColCU = pColPic->getCU( m_uiCUAddr ); |
---|
| 5077 | |
---|
| 5078 | Int iColPOC = pColCU->getSlice()->getPOC(); |
---|
| 5079 | UInt uiPartIdxCenter; |
---|
| 5080 | xDeriveCenterIdx( eCUMode, uiPartIdx, uiPartIdxCenter ); |
---|
| 5081 | |
---|
| 5082 | if (pColCU->isIntra(uiPartIdxCenter)) |
---|
[56] | 5083 | { |
---|
[2] | 5084 | return false; |
---|
[56] | 5085 | } |
---|
[2] | 5086 | |
---|
[56] | 5087 | if( m_pcSlice->getRefPic( eRefPicList, iRefIdx )->getViewId() != m_pcSlice->getViewId() ) |
---|
| 5088 | { |
---|
[2] | 5089 | return false; |
---|
[56] | 5090 | } |
---|
[2] | 5091 | |
---|
| 5092 | // Prefer a vector crossing us. Prefer shortest. |
---|
| 5093 | RefPicList eColRefPicList = REF_PIC_LIST_0; |
---|
| 5094 | bool bFirstCrosses = false; |
---|
| 5095 | Int iFirstColDist = -1; |
---|
| 5096 | for (Int l = 0; l < 2; l++) |
---|
| 5097 | { |
---|
| 5098 | bool bSaveIt = false; |
---|
| 5099 | int iColRefIdx = pColCU->getCUMvField(RefPicList(l))->getRefIdx(uiPartIdxCenter); |
---|
| 5100 | if (iColRefIdx < 0) |
---|
[56] | 5101 | { |
---|
[2] | 5102 | continue; |
---|
[56] | 5103 | } |
---|
[2] | 5104 | int iColRefPOC = pColCU->getSlice()->getRefPOC(RefPicList(l), iColRefIdx); |
---|
[56] | 5105 | if( pColCU->getSlice()->getRefViewId( RefPicList(l), iColRefIdx ) != pColCU->getSlice()->getViewId() ) |
---|
| 5106 | { |
---|
[2] | 5107 | continue; |
---|
[56] | 5108 | } |
---|
[2] | 5109 | int iColDist = abs(iColRefPOC - iColPOC); |
---|
| 5110 | bool bCrosses = iColPOC < iCurrPOC ? iColRefPOC > iCurrPOC : iColRefPOC < iCurrPOC; |
---|
| 5111 | if (iFirstColDist < 0) |
---|
[56] | 5112 | { |
---|
[2] | 5113 | bSaveIt = true; |
---|
[56] | 5114 | } |
---|
[2] | 5115 | else if (bCrosses && !bFirstCrosses) |
---|
[56] | 5116 | { |
---|
[2] | 5117 | bSaveIt = true; |
---|
[56] | 5118 | } |
---|
[2] | 5119 | else if (bCrosses == bFirstCrosses && l == eRefPicList) |
---|
[56] | 5120 | { |
---|
[2] | 5121 | bSaveIt = true; |
---|
[56] | 5122 | } |
---|
[2] | 5123 | |
---|
| 5124 | if (bSaveIt) |
---|
| 5125 | { |
---|
| 5126 | bFirstCrosses = bCrosses; |
---|
| 5127 | iFirstColDist = iColDist; |
---|
| 5128 | eColRefPicList = RefPicList(l); |
---|
| 5129 | } |
---|
| 5130 | } |
---|
[56] | 5131 | |
---|
[2] | 5132 | // Scale the vector. |
---|
| 5133 | Int iColRefPOC = pColCU->getSlice()->getRefPOC(eColRefPicList, pColCU->getCUMvField(eColRefPicList)->getRefIdx(uiPartIdxCenter)); |
---|
| 5134 | TComMv cColMv = pColCU->getCUMvField(eColRefPicList)->getMv(uiPartIdxCenter); |
---|
| 5135 | |
---|
| 5136 | Int iCurrRefPOC = m_pcSlice->getRefPic(eRefPicList, iRefIdx)->getPOC(); |
---|
| 5137 | Int iScale = xGetDistScaleFactor(iCurrPOC, iCurrRefPOC, iColPOC, iColRefPOC); |
---|
[56] | 5138 | if ( iScale == 4096 ) |
---|
[2] | 5139 | { |
---|
| 5140 | pcMv[0] = cColMv; |
---|
| 5141 | } |
---|
| 5142 | else |
---|
| 5143 | { |
---|
| 5144 | pcMv[0] = cColMv.scaleMv( iScale ); |
---|
| 5145 | } |
---|
| 5146 | |
---|
| 5147 | return true; |
---|
| 5148 | } |
---|
| 5149 | |
---|
| 5150 | Void TComDataCU::compressMV() |
---|
| 5151 | { |
---|
[56] | 5152 | Int scaleFactor = 4 * AMVP_DECIMATION_FACTOR / m_unitSize; |
---|
| 5153 | if (scaleFactor > 0) |
---|
| 5154 | { |
---|
| 5155 | #if HHI_MPI |
---|
| 5156 | m_acCUMvField[0].compress(m_pePredMode, m_puhInterDir, scaleFactor); |
---|
| 5157 | m_acCUMvField[1].compress(m_pePredMode, m_puhInterDir, scaleFactor); |
---|
| 5158 | #else |
---|
| 5159 | m_acCUMvField[0].compress(m_pePredMode, scaleFactor); |
---|
| 5160 | m_acCUMvField[1].compress(m_pePredMode, scaleFactor); |
---|
| 5161 | #endif |
---|
| 5162 | } |
---|
[2] | 5163 | } |
---|
| 5164 | |
---|
| 5165 | UInt TComDataCU::getCoefScanIdx(UInt uiAbsPartIdx, UInt uiWidth, Bool bIsLuma, Bool bIsIntra) |
---|
| 5166 | { |
---|
[56] | 5167 | #if !LOGI_INTRA_NAME_3MPM |
---|
| 5168 | static const UChar aucIntraDirToScanIdx[MAX_CU_DEPTH][NUM_INTRA_MODE] = |
---|
[2] | 5169 | { |
---|
[56] | 5170 | {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 |
---|
| 5171 | }, |
---|
| 5172 | {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 |
---|
| 5173 | }, |
---|
| 5174 | {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 |
---|
| 5175 | }, |
---|
| 5176 | {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 |
---|
| 5177 | }, |
---|
| 5178 | {0, 1, 2, 0, 0, 1, 1, 0, 2, 2, 0, 0, 1, 1, 0, 0, 2, 2, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0 |
---|
| 5179 | }, |
---|
| 5180 | {0, 1, 2, 0, 0, 1, 1, 0, 2, 2, 0, 0, 1, 1, 0, 0, 2, 2, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0 |
---|
| 5181 | }, |
---|
| 5182 | {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 |
---|
| 5183 | }, |
---|
[2] | 5184 | }; |
---|
[56] | 5185 | #endif |
---|
| 5186 | |
---|
[2] | 5187 | UInt uiCTXIdx; |
---|
| 5188 | UInt uiScanIdx; |
---|
| 5189 | UInt uiDirMode; |
---|
| 5190 | |
---|
| 5191 | if ( !bIsIntra ) |
---|
| 5192 | { |
---|
| 5193 | uiScanIdx = SCAN_ZIGZAG; |
---|
| 5194 | return uiScanIdx; |
---|
| 5195 | } |
---|
| 5196 | |
---|
| 5197 | switch(uiWidth) |
---|
| 5198 | { |
---|
| 5199 | case 2: uiCTXIdx = 6; break; |
---|
| 5200 | case 4: uiCTXIdx = 5; break; |
---|
| 5201 | case 8: uiCTXIdx = 4; break; |
---|
| 5202 | case 16: uiCTXIdx = 3; break; |
---|
| 5203 | case 32: uiCTXIdx = 2; break; |
---|
| 5204 | case 64: uiCTXIdx = 1; break; |
---|
| 5205 | default: uiCTXIdx = 0; break; |
---|
| 5206 | } |
---|
| 5207 | |
---|
| 5208 | if ( bIsLuma ) |
---|
| 5209 | { |
---|
| 5210 | uiDirMode = getLumaIntraDir(uiAbsPartIdx); |
---|
[56] | 5211 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
| 5212 | mapDMMtoIntraMode( uiDirMode ); |
---|
[2] | 5213 | #endif |
---|
[56] | 5214 | |
---|
| 5215 | #if LOGI_INTRA_NAME_3MPM |
---|
| 5216 | uiScanIdx = SCAN_ZIGZAG; |
---|
| 5217 | if (uiCTXIdx >3 && uiCTXIdx < 6) //if multiple scans supported for PU size |
---|
| 5218 | { |
---|
| 5219 | uiScanIdx = abs((Int) uiDirMode - VER_IDX) < 5 ? 1 : (abs((Int)uiDirMode - HOR_IDX) < 5 ? 2 : 0); |
---|
| 5220 | } |
---|
| 5221 | #else |
---|
| 5222 | uiScanIdx = aucIntraDirToScanIdx[uiCTXIdx][uiDirMode]; |
---|
| 5223 | #endif |
---|
[2] | 5224 | } |
---|
| 5225 | else |
---|
| 5226 | { |
---|
[56] | 5227 | uiDirMode = getChromaIntraDir(uiAbsPartIdx); |
---|
| 5228 | if( uiDirMode == DM_CHROMA_IDX ) |
---|
| 5229 | { |
---|
| 5230 | // get number of partitions in current CU |
---|
| 5231 | UInt depth = getDepth(uiAbsPartIdx); |
---|
| 5232 | UInt numParts = getPic()->getNumPartInCU() >> (2 * depth); |
---|
| 5233 | |
---|
| 5234 | // get luma mode from upper-left corner of current CU |
---|
| 5235 | uiDirMode = getLumaIntraDir((uiAbsPartIdx/numParts)*numParts); |
---|
| 5236 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
| 5237 | mapDMMtoIntraMode( uiDirMode ); |
---|
[2] | 5238 | #endif |
---|
[56] | 5239 | } |
---|
| 5240 | #if LOGI_INTRA_NAME_3MPM |
---|
| 5241 | uiScanIdx = SCAN_ZIGZAG; |
---|
| 5242 | if (uiCTXIdx >4 && uiCTXIdx < 7) //if multiple scans supported for PU size |
---|
| 5243 | { |
---|
| 5244 | uiScanIdx = abs((Int) uiDirMode - VER_IDX) < 5 ? 1 : (abs((Int)uiDirMode - HOR_IDX) < 5 ? 2 : 0); |
---|
| 5245 | } |
---|
| 5246 | #else |
---|
| 5247 | uiScanIdx = aucIntraDirToScanIdx[max<Int>(uiCTXIdx-1,0)][uiDirMode]; |
---|
[2] | 5248 | #endif |
---|
| 5249 | } |
---|
| 5250 | |
---|
| 5251 | return uiScanIdx; |
---|
| 5252 | } |
---|
| 5253 | |
---|
[56] | 5254 | Bool TComDataCU::useNonSquareTrans(UInt uiTrMode, Int absPartIdx) |
---|
[2] | 5255 | { |
---|
[56] | 5256 | UInt minTuSize = ( 1 << ( getSlice()->getSPS()->getQuadtreeTULog2MinSize() + 1 ) ); |
---|
| 5257 | const UInt uiLog2TrSize = g_aucConvertToBit[ getSlice()->getSPS()->getMaxCUWidth() >> ( m_puhDepth[ absPartIdx ] + uiTrMode ) ] + 2; |
---|
| 5258 | if ( uiTrMode && uiLog2TrSize < getSlice()->getSPS()->getQuadtreeTULog2MaxSize() && ( getWidth( absPartIdx ) > minTuSize ) && |
---|
| 5259 | ( m_pePartSize[absPartIdx] == SIZE_Nx2N || m_pePartSize[absPartIdx] == SIZE_2NxN || ( m_pePartSize[absPartIdx] >= SIZE_2NxnU && m_pePartSize[absPartIdx] <= SIZE_nRx2N ) ) ) |
---|
| 5260 | { |
---|
| 5261 | return getSlice()->getSPS()->getUseNSQT(); |
---|
| 5262 | } |
---|
| 5263 | else |
---|
| 5264 | { |
---|
| 5265 | return false; |
---|
| 5266 | } |
---|
| 5267 | } |
---|
| 5268 | |
---|
| 5269 | Void TComDataCU::getNSQTSize(Int trMode, Int absPartIdx, Int &trWidth, Int &trHeight) |
---|
| 5270 | { |
---|
| 5271 | UInt minTuSize = ( 1 << getSlice()->getSPS()->getQuadtreeTULog2MinSize() ); |
---|
| 5272 | if ( useNonSquareTrans( trMode, absPartIdx ) && ( trWidth > minTuSize ) ) |
---|
| 5273 | { |
---|
| 5274 | trWidth = ( m_pePartSize[absPartIdx] == SIZE_Nx2N || m_pePartSize[absPartIdx] == SIZE_nLx2N || m_pePartSize[absPartIdx] == SIZE_nRx2N )? trWidth >> 1 : trWidth << 1; |
---|
| 5275 | trHeight = ( m_pePartSize[absPartIdx] == SIZE_Nx2N || m_pePartSize[absPartIdx] == SIZE_nLx2N || m_pePartSize[absPartIdx] == SIZE_nRx2N )? trHeight << 1 : trHeight >> 1; |
---|
| 5276 | } |
---|
| 5277 | } |
---|
| 5278 | Bool TComDataCU::useNonSquarePU(UInt absPartIdx) |
---|
| 5279 | { |
---|
| 5280 | if ( ( m_pePartSize[absPartIdx] == SIZE_Nx2N ) || ( m_pePartSize[absPartIdx] == SIZE_2NxN ) || ( m_pePartSize[absPartIdx] >= SIZE_2NxnU && m_pePartSize[absPartIdx] <= SIZE_nRx2N ) ) |
---|
| 5281 | { |
---|
[2] | 5282 | return true; |
---|
[56] | 5283 | } |
---|
| 5284 | else |
---|
[2] | 5285 | { |
---|
| 5286 | return false; |
---|
| 5287 | } |
---|
[56] | 5288 | } |
---|
| 5289 | |
---|
| 5290 | UInt TComDataCU::getInterTUSplitDirection( Int trWidth, Int trHeight, Int trLastWidth, Int trLastHeight ) |
---|
| 5291 | { |
---|
| 5292 | UInt interTUSplitDirection = 2; |
---|
| 5293 | if ( ( trWidth == trLastWidth ) && ( trHeight < trLastHeight ) ) |
---|
| 5294 | { |
---|
| 5295 | interTUSplitDirection = 0; |
---|
| 5296 | } |
---|
| 5297 | else if ( ( trWidth < trLastWidth ) && ( trHeight == trLastHeight ) ) |
---|
| 5298 | { |
---|
| 5299 | interTUSplitDirection = 1; |
---|
| 5300 | } |
---|
| 5301 | |
---|
| 5302 | return interTUSplitDirection; |
---|
| 5303 | } |
---|
| 5304 | |
---|
| 5305 | UInt TComDataCU::getNSAbsPartIdx ( UInt log2TrafoSize, UInt absPartIdx, UInt absTUPartIdx, UInt innerQuadIdx, UInt trMode ) |
---|
| 5306 | { |
---|
| 5307 | Int trWidth, trHeight, trLastWidth, trLastHeight; |
---|
| 5308 | UInt lcuWidthInBaseUnits = getPic()->getNumPartInWidth(); |
---|
| 5309 | UInt nsTUWidthInBaseUnits, nsTUHeightInBaseUnits; |
---|
| 5310 | UInt interTUSplitDirection; |
---|
[2] | 5311 | |
---|
[56] | 5312 | if( isIntra(absPartIdx) ) |
---|
[2] | 5313 | { |
---|
[56] | 5314 | return absPartIdx; |
---|
| 5315 | } |
---|
| 5316 | |
---|
| 5317 | trWidth = trHeight = ( 1 << log2TrafoSize ); |
---|
| 5318 | trLastWidth = trWidth << 1, trLastHeight = trHeight << 1; |
---|
| 5319 | |
---|
| 5320 | getNSQTSize( trMode, absPartIdx, trWidth, trHeight ); |
---|
| 5321 | getNSQTSize( trMode - 1, absPartIdx, trLastWidth, trLastHeight ); |
---|
| 5322 | interTUSplitDirection = getInterTUSplitDirection ( trWidth, trHeight, trLastWidth, trLastHeight ); |
---|
| 5323 | |
---|
| 5324 | nsTUWidthInBaseUnits = trWidth / getPic()->getMinCUWidth(); |
---|
| 5325 | nsTUHeightInBaseUnits = trHeight / getPic()->getMinCUHeight(); |
---|
| 5326 | |
---|
| 5327 | if ( interTUSplitDirection != 2 ) |
---|
| 5328 | { |
---|
| 5329 | UInt uiNSTUBaseUnits = nsTUWidthInBaseUnits < nsTUHeightInBaseUnits ? nsTUWidthInBaseUnits : nsTUHeightInBaseUnits; |
---|
| 5330 | absTUPartIdx = g_auiRasterToZscan[ g_auiZscanToRaster[absTUPartIdx] + innerQuadIdx * uiNSTUBaseUnits * lcuWidthInBaseUnits * ( 1 - interTUSplitDirection ) + innerQuadIdx * uiNSTUBaseUnits * interTUSplitDirection ]; |
---|
| 5331 | } |
---|
| 5332 | else |
---|
| 5333 | { |
---|
| 5334 | absTUPartIdx = g_auiRasterToZscan[ g_auiZscanToRaster[absTUPartIdx] + (innerQuadIdx & 0x01) * nsTUWidthInBaseUnits + ( ( innerQuadIdx >> 1 ) & 0x01 ) * nsTUHeightInBaseUnits * lcuWidthInBaseUnits ]; |
---|
| 5335 | } |
---|
| 5336 | |
---|
| 5337 | return absTUPartIdx; |
---|
| 5338 | } |
---|
| 5339 | |
---|
| 5340 | UInt TComDataCU::getNSAddrChroma( UInt uiLog2TrSizeC, UInt uiTrModeC, UInt uiQuadrant, UInt absTUPartIdx ) |
---|
| 5341 | { |
---|
| 5342 | if( uiLog2TrSizeC != getSlice()->getSPS()->getQuadtreeTULog2MinSize() ) |
---|
| 5343 | { |
---|
| 5344 | return absTUPartIdx; |
---|
| 5345 | } |
---|
| 5346 | |
---|
| 5347 | UInt lcuWidthInBaseUnits = getPic()->getNumPartInWidth(); |
---|
| 5348 | Int trWidth = ( 1 << ( uiLog2TrSizeC + 1 ) ); |
---|
| 5349 | Int trHeight = ( 1 << ( uiLog2TrSizeC + 1 ) ); |
---|
| 5350 | Int trLastWidth = trWidth << 1, trLastHeight = trHeight << 1; |
---|
| 5351 | |
---|
| 5352 | getNSQTSize ( uiTrModeC - 1, absTUPartIdx, trLastWidth, trLastHeight ); |
---|
| 5353 | getNSQTSize ( uiTrModeC, absTUPartIdx, trWidth, trHeight ); |
---|
| 5354 | |
---|
| 5355 | UInt interTUSplitDirection = getInterTUSplitDirection ( trWidth, trHeight, trLastWidth, trLastHeight ); |
---|
| 5356 | UInt nsTUWidthInBaseUnits = trWidth / getPic()->getMinCUWidth(); |
---|
| 5357 | UInt nsTUHeightInBaseUnits = trHeight / getPic()->getMinCUHeight(); |
---|
| 5358 | UInt firstTURasterIdx = 0, absTUPartIdxC = 0; |
---|
| 5359 | |
---|
| 5360 | if(interTUSplitDirection != 2) |
---|
| 5361 | { |
---|
| 5362 | UInt uiNSTUBaseUnits = nsTUWidthInBaseUnits < nsTUHeightInBaseUnits ? 1 : lcuWidthInBaseUnits; |
---|
| 5363 | firstTURasterIdx = g_auiZscanToRaster[absTUPartIdx] - uiQuadrant * uiNSTUBaseUnits; |
---|
| 5364 | absTUPartIdxC = g_auiRasterToZscan[firstTURasterIdx] + uiQuadrant * nsTUWidthInBaseUnits * nsTUHeightInBaseUnits; |
---|
| 5365 | } |
---|
| 5366 | else |
---|
| 5367 | { |
---|
| 5368 | UInt uiNSTUBaseUnits = nsTUWidthInBaseUnits < nsTUHeightInBaseUnits ? 2 * lcuWidthInBaseUnits : 2; |
---|
| 5369 | firstTURasterIdx = g_auiZscanToRaster[absTUPartIdx] - ( ( uiQuadrant >> 1 ) & 0x01 ) * nsTUHeightInBaseUnits * lcuWidthInBaseUnits - ( uiQuadrant & 0x01 ) * nsTUWidthInBaseUnits; |
---|
| 5370 | absTUPartIdxC = g_auiRasterToZscan[firstTURasterIdx + uiQuadrant * uiNSTUBaseUnits]; |
---|
| 5371 | } |
---|
| 5372 | |
---|
| 5373 | return absTUPartIdxC; |
---|
| 5374 | } |
---|
| 5375 | |
---|
| 5376 | |
---|
| 5377 | UInt TComDataCU::getSCUAddr() |
---|
| 5378 | { |
---|
| 5379 | return getPic()->getPicSym()->getInverseCUOrderMap(m_uiCUAddr)*(1<<(m_pcSlice->getSPS()->getMaxCUDepth()<<1))+m_uiAbsIdxInLCU; |
---|
| 5380 | } |
---|
| 5381 | |
---|
| 5382 | /** Set neighboring blocks availabilities for non-deblocked filtering |
---|
| 5383 | * \param numLCUInPicWidth number of LCUs in picture width |
---|
| 5384 | * \param numLCUInPicHeight number of LCUs in picture height |
---|
| 5385 | * \param numSUInLCUWidth number of SUs in LCU width |
---|
| 5386 | * \param numSUInLCUHeight number of SUs in LCU height |
---|
| 5387 | * \param picWidth picture width |
---|
| 5388 | * \param picHeight picture height |
---|
| 5389 | * \param bIndependentSliceBoundaryEnabled true for independent slice boundary enabled |
---|
| 5390 | * \param bTopTileBoundary true means that top boundary coincides tile boundary |
---|
| 5391 | * \param bDownTileBoundary true means that bottom boundary coincides tile boundary |
---|
| 5392 | * \param bLeftTileBoundary true means that left boundary coincides tile boundary |
---|
| 5393 | * \param bRightTileBoundary true means that right boundary coincides tile boundary |
---|
| 5394 | * \param bIndependentTileBoundaryEnabled true for independent tile boundary enabled |
---|
| 5395 | */ |
---|
| 5396 | Void TComDataCU::setNDBFilterBlockBorderAvailability(UInt numLCUInPicWidth, UInt numLCUInPicHeight, UInt numSUInLCUWidth, UInt numSUInLCUHeight, UInt picWidth, UInt picHeight |
---|
| 5397 | ,Bool bIndependentSliceBoundaryEnabled |
---|
| 5398 | ,Bool bTopTileBoundary, Bool bDownTileBoundary, Bool bLeftTileBoundary, Bool bRightTileBoundary |
---|
| 5399 | ,Bool bIndependentTileBoundaryEnabled) |
---|
| 5400 | { |
---|
| 5401 | UInt numSUInLCU = numSUInLCUWidth*numSUInLCUHeight; |
---|
| 5402 | Int* pSliceIDMapLCU = m_piSliceSUMap; |
---|
| 5403 | |
---|
| 5404 | UInt uiLPelX, uiTPelY; |
---|
| 5405 | UInt width, height; |
---|
| 5406 | Bool bPicRBoundary, bPicBBoundary, bPicTBoundary, bPicLBoundary; |
---|
| 5407 | Bool bLCURBoundary= false, bLCUBBoundary= false, bLCUTBoundary= false, bLCULBoundary= false; |
---|
| 5408 | Bool* pbAvailBorder; |
---|
| 5409 | Bool* pbAvail; |
---|
| 5410 | UInt rTLSU, rBRSU, widthSU, heightSU; |
---|
| 5411 | UInt zRefSU; |
---|
| 5412 | Int* pRefID; |
---|
| 5413 | Int* pRefMapLCU; |
---|
| 5414 | UInt rTRefSU= 0, rBRefSU= 0, rLRefSU= 0, rRRefSU= 0; |
---|
| 5415 | Int* pRRefMapLCU= NULL; |
---|
| 5416 | Int* pLRefMapLCU= NULL; |
---|
| 5417 | Int* pTRefMapLCU= NULL; |
---|
| 5418 | Int* pBRefMapLCU= NULL; |
---|
| 5419 | Int sliceID; |
---|
| 5420 | UInt numSGU = (UInt)m_vNDFBlock.size(); |
---|
| 5421 | |
---|
| 5422 | for(Int i=0; i< numSGU; i++) |
---|
| 5423 | { |
---|
| 5424 | NDBFBlockInfo& rSGU = m_vNDFBlock[i]; |
---|
| 5425 | |
---|
| 5426 | sliceID = rSGU.sliceID; |
---|
| 5427 | uiLPelX = rSGU.posX; |
---|
| 5428 | uiTPelY = rSGU.posY; |
---|
| 5429 | width = rSGU.width; |
---|
| 5430 | height = rSGU.height; |
---|
| 5431 | |
---|
| 5432 | rTLSU = g_auiZscanToRaster[ rSGU.startSU ]; |
---|
| 5433 | rBRSU = g_auiZscanToRaster[ rSGU.endSU ]; |
---|
| 5434 | widthSU = rSGU.widthSU; |
---|
| 5435 | heightSU = rSGU.heightSU; |
---|
| 5436 | |
---|
| 5437 | pbAvailBorder = rSGU.isBorderAvailable; |
---|
| 5438 | |
---|
| 5439 | bPicTBoundary= (uiTPelY == 0 )?(true):(false); |
---|
| 5440 | bPicLBoundary= (uiLPelX == 0 )?(true):(false); |
---|
| 5441 | bPicRBoundary= (!(uiLPelX+ width < picWidth ) )?(true):(false); |
---|
| 5442 | bPicBBoundary= (!(uiTPelY + height < picHeight))?(true):(false); |
---|
| 5443 | |
---|
| 5444 | bLCULBoundary = (rTLSU % numSUInLCUWidth == 0)?(true):(false); |
---|
| 5445 | bLCURBoundary = ( (rTLSU+ widthSU) % numSUInLCUWidth == 0)?(true):(false); |
---|
| 5446 | bLCUTBoundary = ( (UInt)(rTLSU / numSUInLCUWidth)== 0)?(true):(false); |
---|
| 5447 | bLCUBBoundary = ( (UInt)(rBRSU / numSUInLCUWidth) == (numSUInLCUHeight-1) )?(true):(false); |
---|
| 5448 | |
---|
| 5449 | // SGU_L |
---|
| 5450 | pbAvail = &(pbAvailBorder[SGU_L]); |
---|
| 5451 | if(bPicLBoundary) |
---|
[2] | 5452 | { |
---|
[56] | 5453 | *pbAvail = false; |
---|
| 5454 | } |
---|
| 5455 | else if (!bIndependentSliceBoundaryEnabled) |
---|
| 5456 | { |
---|
| 5457 | *pbAvail = true; |
---|
| 5458 | } |
---|
| 5459 | else |
---|
| 5460 | { |
---|
| 5461 | // bLCULBoundary = (rTLSU % uiNumSUInLCUWidth == 0)?(true):(false); |
---|
| 5462 | if(bLCULBoundary) |
---|
[2] | 5463 | { |
---|
[56] | 5464 | rLRefSU = rTLSU + numSUInLCUWidth -1; |
---|
| 5465 | zRefSU = g_auiRasterToZscan[rLRefSU]; |
---|
| 5466 | pRefMapLCU = pLRefMapLCU= (pSliceIDMapLCU - numSUInLCU); |
---|
[2] | 5467 | } |
---|
[56] | 5468 | else |
---|
[2] | 5469 | { |
---|
[56] | 5470 | zRefSU = g_auiRasterToZscan[rTLSU - 1]; |
---|
| 5471 | pRefMapLCU = pSliceIDMapLCU; |
---|
[2] | 5472 | } |
---|
[56] | 5473 | pRefID = pRefMapLCU + zRefSU; |
---|
| 5474 | *pbAvail = (*pRefID == sliceID)?(true):(false); |
---|
| 5475 | } |
---|
| 5476 | |
---|
| 5477 | // SGU_R |
---|
| 5478 | pbAvail = &(pbAvailBorder[SGU_R]); |
---|
| 5479 | if(bPicRBoundary) |
---|
| 5480 | { |
---|
| 5481 | *pbAvail = false; |
---|
| 5482 | } |
---|
| 5483 | else if (!bIndependentSliceBoundaryEnabled) |
---|
| 5484 | { |
---|
| 5485 | *pbAvail = true; |
---|
| 5486 | } |
---|
| 5487 | else |
---|
| 5488 | { |
---|
| 5489 | // bLCURBoundary = ( (rTLSU+ uiWidthSU) % uiNumSUInLCUWidth == 0)?(true):(false); |
---|
| 5490 | if(bLCURBoundary) |
---|
[2] | 5491 | { |
---|
[56] | 5492 | rRRefSU = rTLSU + widthSU - numSUInLCUWidth; |
---|
| 5493 | zRefSU = g_auiRasterToZscan[rRRefSU]; |
---|
| 5494 | pRefMapLCU = pRRefMapLCU= (pSliceIDMapLCU + numSUInLCU); |
---|
[2] | 5495 | } |
---|
[56] | 5496 | else |
---|
| 5497 | { |
---|
| 5498 | zRefSU = g_auiRasterToZscan[rTLSU + widthSU]; |
---|
| 5499 | pRefMapLCU = pSliceIDMapLCU; |
---|
| 5500 | } |
---|
| 5501 | pRefID = pRefMapLCU + zRefSU; |
---|
| 5502 | *pbAvail = (*pRefID == sliceID)?(true):(false); |
---|
[2] | 5503 | } |
---|
[56] | 5504 | |
---|
| 5505 | // SGU_T |
---|
| 5506 | pbAvail = &(pbAvailBorder[SGU_T]); |
---|
| 5507 | if(bPicTBoundary) |
---|
[2] | 5508 | { |
---|
[56] | 5509 | *pbAvail = false; |
---|
| 5510 | } |
---|
| 5511 | else if (!bIndependentSliceBoundaryEnabled) |
---|
| 5512 | { |
---|
| 5513 | *pbAvail = true; |
---|
| 5514 | } |
---|
| 5515 | else |
---|
| 5516 | { |
---|
| 5517 | // bLCUTBoundary = ( (UInt)(rTLSU / uiNumSUInLCUWidth)== 0)?(true):(false); |
---|
| 5518 | if(bLCUTBoundary) |
---|
[2] | 5519 | { |
---|
[56] | 5520 | rTRefSU = numSUInLCU - (numSUInLCUWidth - rTLSU); |
---|
| 5521 | zRefSU = g_auiRasterToZscan[rTRefSU]; |
---|
| 5522 | pRefMapLCU = pTRefMapLCU= (pSliceIDMapLCU - (numLCUInPicWidth*numSUInLCU)); |
---|
[2] | 5523 | } |
---|
[56] | 5524 | else |
---|
[2] | 5525 | { |
---|
[56] | 5526 | zRefSU = g_auiRasterToZscan[rTLSU - numSUInLCUWidth]; |
---|
| 5527 | pRefMapLCU = pSliceIDMapLCU; |
---|
[2] | 5528 | } |
---|
[56] | 5529 | pRefID = pRefMapLCU + zRefSU; |
---|
| 5530 | *pbAvail = (*pRefID == sliceID)?(true):(false); |
---|
| 5531 | } |
---|
| 5532 | |
---|
| 5533 | // SGU_B |
---|
| 5534 | pbAvail = &(pbAvailBorder[SGU_B]); |
---|
| 5535 | if(bPicBBoundary) |
---|
| 5536 | { |
---|
| 5537 | *pbAvail = false; |
---|
| 5538 | } |
---|
| 5539 | else if (!bIndependentSliceBoundaryEnabled) |
---|
| 5540 | { |
---|
| 5541 | *pbAvail = true; |
---|
| 5542 | } |
---|
| 5543 | else |
---|
| 5544 | { |
---|
| 5545 | // bLCUBBoundary = ( (UInt)(rBRSU / uiNumSUInLCUWidth) == (uiNumSUInLCUHeight-1) )?(true):(false); |
---|
| 5546 | if(bLCUBBoundary) |
---|
[2] | 5547 | { |
---|
[56] | 5548 | rBRefSU = rTLSU % numSUInLCUWidth; |
---|
| 5549 | zRefSU = g_auiRasterToZscan[rBRefSU]; |
---|
| 5550 | pRefMapLCU = pBRefMapLCU= (pSliceIDMapLCU + (numLCUInPicWidth*numSUInLCU)); |
---|
[2] | 5551 | } |
---|
[56] | 5552 | else |
---|
| 5553 | { |
---|
| 5554 | zRefSU = g_auiRasterToZscan[rTLSU + (heightSU*numSUInLCUWidth)]; |
---|
| 5555 | pRefMapLCU = pSliceIDMapLCU; |
---|
| 5556 | } |
---|
| 5557 | pRefID = pRefMapLCU + zRefSU; |
---|
| 5558 | *pbAvail = (*pRefID == sliceID)?(true):(false); |
---|
[2] | 5559 | } |
---|
[56] | 5560 | |
---|
| 5561 | // SGU_TL |
---|
| 5562 | pbAvail = &(pbAvailBorder[SGU_TL]); |
---|
| 5563 | if(bPicTBoundary || bPicLBoundary) |
---|
[2] | 5564 | { |
---|
[56] | 5565 | *pbAvail = false; |
---|
| 5566 | } |
---|
| 5567 | else if (!bIndependentSliceBoundaryEnabled) |
---|
| 5568 | { |
---|
| 5569 | *pbAvail = true; |
---|
| 5570 | } |
---|
| 5571 | else |
---|
| 5572 | { |
---|
| 5573 | if(bLCUTBoundary && bLCULBoundary) |
---|
[2] | 5574 | { |
---|
[56] | 5575 | zRefSU = numSUInLCU -1; |
---|
| 5576 | pRefMapLCU = pSliceIDMapLCU - ( (numLCUInPicWidth+1)*numSUInLCU); |
---|
[2] | 5577 | } |
---|
[56] | 5578 | else if(bLCUTBoundary) |
---|
[2] | 5579 | { |
---|
[56] | 5580 | zRefSU = g_auiRasterToZscan[ rTRefSU- 1]; |
---|
| 5581 | pRefMapLCU = pTRefMapLCU; |
---|
[2] | 5582 | } |
---|
[56] | 5583 | else if(bLCULBoundary) |
---|
[2] | 5584 | { |
---|
[56] | 5585 | zRefSU = g_auiRasterToZscan[ rLRefSU- numSUInLCUWidth ]; |
---|
| 5586 | pRefMapLCU = pLRefMapLCU; |
---|
[2] | 5587 | } |
---|
[56] | 5588 | else //inside LCU |
---|
| 5589 | { |
---|
| 5590 | zRefSU = g_auiRasterToZscan[ rTLSU - numSUInLCUWidth -1]; |
---|
| 5591 | pRefMapLCU = pSliceIDMapLCU; |
---|
| 5592 | } |
---|
| 5593 | pRefID = pRefMapLCU + zRefSU; |
---|
| 5594 | *pbAvail = (*pRefID == sliceID)?(true):(false); |
---|
[2] | 5595 | } |
---|
[56] | 5596 | |
---|
| 5597 | // SGU_TR |
---|
| 5598 | pbAvail = &(pbAvailBorder[SGU_TR]); |
---|
| 5599 | if(bPicTBoundary || bPicRBoundary) |
---|
[2] | 5600 | { |
---|
[56] | 5601 | *pbAvail = false; |
---|
[2] | 5602 | } |
---|
[56] | 5603 | else if (!bIndependentSliceBoundaryEnabled) |
---|
[2] | 5604 | { |
---|
[56] | 5605 | *pbAvail = true; |
---|
[2] | 5606 | } |
---|
[56] | 5607 | else |
---|
[2] | 5608 | { |
---|
[56] | 5609 | if(bLCUTBoundary && bLCURBoundary) |
---|
| 5610 | { |
---|
| 5611 | zRefSU = g_auiRasterToZscan[numSUInLCU - numSUInLCUWidth]; |
---|
| 5612 | pRefMapLCU = pSliceIDMapLCU - ( (numLCUInPicWidth-1)*numSUInLCU); |
---|
| 5613 | } |
---|
| 5614 | else if(bLCUTBoundary) |
---|
| 5615 | { |
---|
| 5616 | zRefSU = g_auiRasterToZscan[ rTRefSU+ widthSU]; |
---|
| 5617 | pRefMapLCU = pTRefMapLCU; |
---|
| 5618 | } |
---|
| 5619 | else if(bLCURBoundary) |
---|
| 5620 | { |
---|
| 5621 | zRefSU = g_auiRasterToZscan[ rRRefSU- numSUInLCUWidth ]; |
---|
| 5622 | pRefMapLCU = pRRefMapLCU; |
---|
| 5623 | } |
---|
| 5624 | else //inside LCU |
---|
| 5625 | { |
---|
| 5626 | zRefSU = g_auiRasterToZscan[ rTLSU - numSUInLCUWidth +widthSU]; |
---|
| 5627 | pRefMapLCU = pSliceIDMapLCU; |
---|
| 5628 | } |
---|
| 5629 | pRefID = pRefMapLCU + zRefSU; |
---|
| 5630 | *pbAvail = (*pRefID == sliceID)?(true):(false); |
---|
[2] | 5631 | } |
---|
[56] | 5632 | |
---|
| 5633 | // SGU_BL |
---|
| 5634 | pbAvail = &(pbAvailBorder[SGU_BL]); |
---|
| 5635 | if(bPicBBoundary || bPicLBoundary) |
---|
[2] | 5636 | { |
---|
[56] | 5637 | *pbAvail = false; |
---|
[2] | 5638 | } |
---|
[56] | 5639 | else if (!bIndependentSliceBoundaryEnabled) |
---|
[2] | 5640 | { |
---|
[56] | 5641 | *pbAvail = true; |
---|
[2] | 5642 | } |
---|
[56] | 5643 | else |
---|
[2] | 5644 | { |
---|
[56] | 5645 | if(bLCUBBoundary && bLCULBoundary) |
---|
| 5646 | { |
---|
| 5647 | zRefSU = g_auiRasterToZscan[numSUInLCUWidth - 1]; |
---|
| 5648 | pRefMapLCU = pSliceIDMapLCU + ( (numLCUInPicWidth-1)*numSUInLCU); |
---|
| 5649 | } |
---|
| 5650 | else if(bLCUBBoundary) |
---|
| 5651 | { |
---|
| 5652 | zRefSU = g_auiRasterToZscan[ rBRefSU - 1]; |
---|
| 5653 | pRefMapLCU = pBRefMapLCU; |
---|
| 5654 | } |
---|
| 5655 | else if(bLCULBoundary) |
---|
| 5656 | { |
---|
| 5657 | zRefSU = g_auiRasterToZscan[ rLRefSU+ heightSU*numSUInLCUWidth ]; |
---|
| 5658 | pRefMapLCU = pLRefMapLCU; |
---|
| 5659 | } |
---|
| 5660 | else //inside LCU |
---|
| 5661 | { |
---|
| 5662 | zRefSU = g_auiRasterToZscan[ rTLSU + heightSU*numSUInLCUWidth -1]; |
---|
| 5663 | pRefMapLCU = pSliceIDMapLCU; |
---|
| 5664 | } |
---|
| 5665 | pRefID = pRefMapLCU + zRefSU; |
---|
| 5666 | *pbAvail = (*pRefID == sliceID)?(true):(false); |
---|
[2] | 5667 | } |
---|
[56] | 5668 | |
---|
| 5669 | // SGU_BR |
---|
| 5670 | pbAvail = &(pbAvailBorder[SGU_BR]); |
---|
| 5671 | if(bPicBBoundary || bPicRBoundary) |
---|
[2] | 5672 | { |
---|
[56] | 5673 | *pbAvail = false; |
---|
[2] | 5674 | } |
---|
[56] | 5675 | else if (!bIndependentSliceBoundaryEnabled) |
---|
[2] | 5676 | { |
---|
[56] | 5677 | *pbAvail = true; |
---|
[2] | 5678 | } |
---|
[56] | 5679 | else |
---|
[2] | 5680 | { |
---|
[56] | 5681 | if(bLCUBBoundary && bLCURBoundary) |
---|
| 5682 | { |
---|
| 5683 | zRefSU = 0; |
---|
| 5684 | pRefMapLCU = pSliceIDMapLCU+ ( (numLCUInPicWidth+1)*numSUInLCU); |
---|
| 5685 | } |
---|
| 5686 | else if(bLCUBBoundary) |
---|
| 5687 | { |
---|
| 5688 | zRefSU = g_auiRasterToZscan[ rBRefSU + widthSU]; |
---|
| 5689 | pRefMapLCU = pBRefMapLCU; |
---|
| 5690 | } |
---|
| 5691 | else if(bLCURBoundary) |
---|
| 5692 | { |
---|
| 5693 | zRefSU = g_auiRasterToZscan[ rRRefSU + (heightSU*numSUInLCUWidth)]; |
---|
| 5694 | pRefMapLCU = pRRefMapLCU; |
---|
| 5695 | } |
---|
| 5696 | else //inside LCU |
---|
| 5697 | { |
---|
| 5698 | zRefSU = g_auiRasterToZscan[ rTLSU + (heightSU*numSUInLCUWidth)+ widthSU]; |
---|
| 5699 | pRefMapLCU = pSliceIDMapLCU; |
---|
| 5700 | } |
---|
| 5701 | pRefID = pRefMapLCU + zRefSU; |
---|
| 5702 | *pbAvail = (*pRefID == sliceID)?(true):(false); |
---|
[2] | 5703 | } |
---|
[56] | 5704 | |
---|
| 5705 | if(bIndependentTileBoundaryEnabled) |
---|
| 5706 | { |
---|
| 5707 | //left LCU boundary |
---|
| 5708 | if(!bPicLBoundary && bLCULBoundary) |
---|
| 5709 | { |
---|
| 5710 | if(bLeftTileBoundary) |
---|
| 5711 | { |
---|
| 5712 | pbAvailBorder[SGU_L] = pbAvailBorder[SGU_TL] = pbAvailBorder[SGU_BL] = false; |
---|
| 5713 | } |
---|
| 5714 | } |
---|
| 5715 | //right LCU boundary |
---|
| 5716 | if(!bPicRBoundary && bLCURBoundary) |
---|
| 5717 | { |
---|
| 5718 | if(bRightTileBoundary) |
---|
| 5719 | { |
---|
| 5720 | pbAvailBorder[SGU_R] = pbAvailBorder[SGU_TR] = pbAvailBorder[SGU_BR] = false; |
---|
| 5721 | } |
---|
| 5722 | } |
---|
| 5723 | //top LCU boundary |
---|
| 5724 | if(!bPicTBoundary && bLCUTBoundary) |
---|
| 5725 | { |
---|
| 5726 | if(bTopTileBoundary) |
---|
| 5727 | { |
---|
| 5728 | pbAvailBorder[SGU_T] = pbAvailBorder[SGU_TL] = pbAvailBorder[SGU_TR] = false; |
---|
| 5729 | } |
---|
| 5730 | } |
---|
| 5731 | //down LCU boundary |
---|
| 5732 | if(!bPicBBoundary && bLCUBBoundary) |
---|
| 5733 | { |
---|
| 5734 | if(bDownTileBoundary) |
---|
| 5735 | { |
---|
| 5736 | pbAvailBorder[SGU_B] = pbAvailBorder[SGU_BL] = pbAvailBorder[SGU_BR] = false; |
---|
| 5737 | } |
---|
| 5738 | } |
---|
| 5739 | } |
---|
| 5740 | #if LCU_SYNTAX_ALF |
---|
| 5741 | rSGU.allBordersAvailable = true; |
---|
| 5742 | for(Int b=0; b< NUM_SGU_BORDER; b++) |
---|
| 5743 | { |
---|
| 5744 | if(pbAvailBorder[b] == false) |
---|
| 5745 | { |
---|
| 5746 | rSGU.allBordersAvailable = false; |
---|
| 5747 | break; |
---|
| 5748 | } |
---|
| 5749 | } |
---|
| 5750 | #endif |
---|
| 5751 | |
---|
[2] | 5752 | } |
---|
| 5753 | } |
---|
[56] | 5754 | |
---|
| 5755 | Void TComDataCU::getPosInPic( UInt uiAbsPartIndex, Int& riPosX, Int& riPosY ) |
---|
| 5756 | { |
---|
| 5757 | riPosX = g_auiRasterToPelX[g_auiZscanToRaster[uiAbsPartIndex]] + getCUPelX(); |
---|
| 5758 | riPosY = g_auiRasterToPelY[g_auiZscanToRaster[uiAbsPartIndex]] + getCUPelY(); |
---|
| 5759 | } |
---|
| 5760 | |
---|
| 5761 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 5762 | // public functions for depth model modes |
---|
| 5763 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 5764 | #if HHI_DMM_WEDGE_INTRA |
---|
| 5765 | Void TComDataCU::setWedgeFullTabIdxSubParts( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 5766 | { |
---|
| 5767 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
| 5768 | |
---|
| 5769 | for ( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
| 5770 | { |
---|
| 5771 | m_puiWedgeFullTabIdx[uiAbsPartIdx+ui] = uiTIdx; |
---|
| 5772 | } |
---|
| 5773 | } |
---|
| 5774 | |
---|
| 5775 | Void TComDataCU::setWedgeFullDeltaDC1SubParts( Int iDC1, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 5776 | { |
---|
| 5777 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
| 5778 | |
---|
| 5779 | for ( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
| 5780 | { |
---|
| 5781 | m_piWedgeFullDeltaDC1[uiAbsPartIdx+ui] = iDC1; |
---|
| 5782 | } |
---|
| 5783 | } |
---|
| 5784 | |
---|
| 5785 | Void TComDataCU::setWedgeFullDeltaDC2SubParts( Int iDC2, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 5786 | { |
---|
| 5787 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
| 5788 | |
---|
| 5789 | for ( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
| 5790 | { |
---|
| 5791 | m_piWedgeFullDeltaDC2[uiAbsPartIdx+ui] = iDC2; |
---|
| 5792 | } |
---|
| 5793 | } |
---|
| 5794 | |
---|
| 5795 | Void TComDataCU::setWedgePredDirTabIdxSubParts( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 5796 | { |
---|
| 5797 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
| 5798 | |
---|
| 5799 | for ( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
| 5800 | { |
---|
| 5801 | m_puiWedgePredDirTabIdx[uiAbsPartIdx+ui] = uiTIdx; |
---|
| 5802 | } |
---|
| 5803 | } |
---|
| 5804 | |
---|
| 5805 | Void TComDataCU::setWedgePredDirDeltaDC1SubParts( Int iDC1, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 5806 | { |
---|
| 5807 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
| 5808 | |
---|
| 5809 | for ( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
| 5810 | { |
---|
| 5811 | m_piWedgePredDirDeltaDC1[uiAbsPartIdx+ui] = iDC1; |
---|
| 5812 | } |
---|
| 5813 | } |
---|
| 5814 | |
---|
| 5815 | Void TComDataCU::setWedgePredDirDeltaDC2SubParts( Int iDC2, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 5816 | { |
---|
| 5817 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
| 5818 | |
---|
| 5819 | for ( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
| 5820 | { |
---|
| 5821 | m_piWedgePredDirDeltaDC2[uiAbsPartIdx+ui] = iDC2; |
---|
| 5822 | } |
---|
| 5823 | } |
---|
| 5824 | |
---|
| 5825 | Void TComDataCU::setWedgePredDirDeltaEndSubParts( Int iDelta, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 5826 | { |
---|
| 5827 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
| 5828 | |
---|
| 5829 | for ( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
| 5830 | { |
---|
| 5831 | m_piWedgePredDirDeltaEnd[uiAbsPartIdx+ui] = iDelta; |
---|
| 5832 | } |
---|
| 5833 | } |
---|
[2] | 5834 | #endif |
---|
[56] | 5835 | #if HHI_DMM_PRED_TEX |
---|
| 5836 | Void TComDataCU::setWedgePredTexTabIdxSubParts( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 5837 | { |
---|
| 5838 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
[2] | 5839 | |
---|
[56] | 5840 | for ( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
| 5841 | { |
---|
| 5842 | m_puiWedgePredTexTabIdx[uiAbsPartIdx+ui] = uiTIdx; |
---|
| 5843 | } |
---|
| 5844 | } |
---|
| 5845 | |
---|
| 5846 | Void TComDataCU::setWedgePredTexDeltaDC1SubParts( Int iDC1, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 5847 | { |
---|
| 5848 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
| 5849 | |
---|
| 5850 | for ( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
| 5851 | { |
---|
| 5852 | m_piWedgePredTexDeltaDC1[uiAbsPartIdx+ui] = iDC1; |
---|
| 5853 | } |
---|
| 5854 | } |
---|
| 5855 | |
---|
| 5856 | Void TComDataCU::setWedgePredTexDeltaDC2SubParts( Int iDC2, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 5857 | { |
---|
| 5858 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
| 5859 | |
---|
| 5860 | for ( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
| 5861 | { |
---|
| 5862 | m_piWedgePredTexDeltaDC2[uiAbsPartIdx+ui] = iDC2; |
---|
| 5863 | } |
---|
| 5864 | } |
---|
| 5865 | |
---|
| 5866 | Void TComDataCU::setContourPredTexDeltaDC1SubParts( Int iDC1, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 5867 | { |
---|
| 5868 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
| 5869 | |
---|
| 5870 | for ( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
| 5871 | { |
---|
| 5872 | m_piContourPredTexDeltaDC1[uiAbsPartIdx+ui] = iDC1; |
---|
| 5873 | } |
---|
| 5874 | } |
---|
| 5875 | |
---|
| 5876 | Void TComDataCU::setContourPredTexDeltaDC2SubParts( Int iDC2, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 5877 | { |
---|
| 5878 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
| 5879 | |
---|
| 5880 | for ( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
| 5881 | { |
---|
| 5882 | m_piContourPredTexDeltaDC2[uiAbsPartIdx+ui] = iDC2; |
---|
| 5883 | } |
---|
| 5884 | } |
---|
| 5885 | #endif |
---|
| 5886 | |
---|
[5] | 5887 | #if HHI_MPI |
---|
[2] | 5888 | Void TComDataCU::setTextureModeDepthSubParts( Int iTextureModeDepth, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 5889 | { |
---|
| 5890 | UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
| 5891 | |
---|
| 5892 | for (UInt ui = 0; ui < uiCurrPartNumb; ui++ ) |
---|
| 5893 | { |
---|
| 5894 | m_piTextureModeDepth[uiAbsPartIdx + ui] = iTextureModeDepth; |
---|
| 5895 | } |
---|
| 5896 | } |
---|
| 5897 | |
---|
| 5898 | Void TComDataCU::copyTextureMotionDataFrom( TComDataCU* pcCU, UInt uiDepth, UInt uiAbsPartIdxSrc, UInt uiAbsPartIdxDst ) |
---|
| 5899 | { |
---|
[56] | 5900 | assert( getSlice()->getIsDepth() && ! pcCU->getSlice()->getIsDepth() ); |
---|
[2] | 5901 | UInt uiNumPartition = m_pcPic->getNumPartInCU() >> (uiDepth << 1); |
---|
| 5902 | |
---|
[56] | 5903 | memcpy( m_pePredMode + uiAbsPartIdxDst, pcCU->getPredictionMode() + uiAbsPartIdxSrc, sizeof( m_pePredMode[0] ) * uiNumPartition ); |
---|
| 5904 | memcpy( m_puhInterDir + uiAbsPartIdxDst, pcCU->getInterDir() + uiAbsPartIdxSrc, sizeof( m_puhInterDir[0] ) * uiNumPartition ); |
---|
[2] | 5905 | |
---|
[56] | 5906 | memcpy( m_apiMVPIdx[0] + uiAbsPartIdxDst, pcCU->getMVPIdx(REF_PIC_LIST_0) + uiAbsPartIdxSrc, sizeof(*m_apiMVPIdx[0]) * uiNumPartition ); |
---|
| 5907 | memcpy( m_apiMVPIdx[1] + uiAbsPartIdxDst, pcCU->getMVPIdx(REF_PIC_LIST_1) + uiAbsPartIdxSrc, sizeof(*m_apiMVPIdx[0]) * uiNumPartition ); |
---|
| 5908 | memcpy( m_apiMVPNum[0] + uiAbsPartIdxDst, pcCU->getMVPNum(REF_PIC_LIST_0) + uiAbsPartIdxSrc, sizeof(*m_apiMVPNum[0]) * uiNumPartition ); |
---|
| 5909 | memcpy( m_apiMVPNum[1] + uiAbsPartIdxDst, pcCU->getMVPNum(REF_PIC_LIST_1) + uiAbsPartIdxSrc, sizeof(*m_apiMVPNum[0]) * uiNumPartition ); |
---|
[2] | 5910 | |
---|
| 5911 | pcCU->getCUMvField( REF_PIC_LIST_0 )->copyTo( &m_acCUMvField[0], -Int(uiAbsPartIdxSrc) + uiAbsPartIdxDst, uiAbsPartIdxSrc, uiNumPartition ); |
---|
| 5912 | pcCU->getCUMvField( REF_PIC_LIST_1 )->copyTo( &m_acCUMvField[1], -Int(uiAbsPartIdxSrc) + uiAbsPartIdxDst, uiAbsPartIdxSrc, uiNumPartition ); |
---|
[56] | 5913 | |
---|
[5] | 5914 | #if HHI_FULL_PEL_DEPTH_MAP_MV_ACC |
---|
[56] | 5915 | m_acCUMvField[0].decreaseMvAccuracy( uiAbsPartIdxDst, uiNumPartition, 2 ); |
---|
| 5916 | m_acCUMvField[1].decreaseMvAccuracy( uiAbsPartIdxDst, uiNumPartition, 2 ); |
---|
| 5917 | #endif |
---|
| 5918 | } |
---|
| 5919 | #endif |
---|
[2] | 5920 | |
---|
[56] | 5921 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 5922 | // public functions for Multi-view tools |
---|
| 5923 | // ------------------------------------------------------------------------------------------------------------------- |
---|
| 5924 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
| 5925 | Int |
---|
| 5926 | TComDataCU::getPdmMergeCandidate( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv ) |
---|
| 5927 | { |
---|
| 5928 | TComDepthMapGenerator* pcDepthMapGenerator = m_pcSlice->getSPS()->getDepthMapGenerator(); |
---|
| 5929 | ROFRS( pcDepthMapGenerator, 0 ); |
---|
| 5930 | return pcDepthMapGenerator->getPdmMergeCandidate( this, uiPartIdx, paiPdmRefIdx, pacPdmMv ); |
---|
| 5931 | } |
---|
[2] | 5932 | |
---|
| 5933 | |
---|
[56] | 5934 | Bool |
---|
| 5935 | TComDataCU::getPdmMvPred( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, Bool bMerge ) |
---|
| 5936 | { |
---|
| 5937 | TComDepthMapGenerator* pcDepthMapGenerator = m_pcSlice->getSPS()->getDepthMapGenerator(); |
---|
| 5938 | ROFRS( pcDepthMapGenerator, false ); |
---|
| 5939 | return pcDepthMapGenerator->getPdmMvPred( this, uiPartIdx, eRefPicList, iRefIdx, rcMv, bMerge ); |
---|
| 5940 | } |
---|
| 5941 | |
---|
| 5942 | |
---|
| 5943 | Bool |
---|
| 5944 | TComDataCU::getIViewOrgDepthMvPred( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv ) |
---|
| 5945 | { |
---|
| 5946 | TComDepthMapGenerator* pcDepthMapGenerator = m_pcSlice->getSPS()->getDepthMapGenerator(); |
---|
| 5947 | ROFRS( pcDepthMapGenerator, false ); |
---|
| 5948 | return pcDepthMapGenerator->getIViewOrgDepthMvPred( this, uiPartIdx, eRefPicList, iRefIdx, rcMv ); |
---|
| 5949 | } |
---|
[2] | 5950 | #endif |
---|
[56] | 5951 | |
---|
| 5952 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
| 5953 | Bool |
---|
[66] | 5954 | TComDataCU::getResidualSamples( UInt uiPartIdx, |
---|
| 5955 | #if QC_SIMPLIFIEDIVRP_M24938 |
---|
| 5956 | Bool bRecon , |
---|
| 5957 | #endif |
---|
| 5958 | TComYuv* pcYuv ) |
---|
[56] | 5959 | { |
---|
| 5960 | TComResidualGenerator* pcResidualGenerator = m_pcSlice->getSPS()->getResidualGenerator(); |
---|
| 5961 | ROFRS( pcResidualGenerator, false ); |
---|
[66] | 5962 | return pcResidualGenerator->getResidualSamples( this, uiPartIdx, pcYuv |
---|
| 5963 | #if QC_SIMPLIFIEDIVRP_M24938 |
---|
| 5964 | , bRecon |
---|
| 5965 | #endif |
---|
| 5966 | ); |
---|
[2] | 5967 | } |
---|
[5] | 5968 | #endif |
---|
[2] | 5969 | |
---|
[56] | 5970 | //! \} |
---|