Changeset 1313 in 3DVCSoftware for trunk/source/Lib/TLibDecoder/TDecEntropy.cpp
- Timestamp:
- 13 Aug 2015, 17:38:13 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/Lib/TLibDecoder/TDecEntropy.cpp
r1196 r1313 2 2 * License, included below. This software may be subject to other third party 3 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-2015, ITU/ISO/IEC6 * Copyright (c) 2010-2015, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 37 37 38 38 #include "TDecEntropy.h" 39 #include "TLibCommon/TComTU.h" 40 #include "TLibCommon/TComPrediction.h" 41 42 #if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST 43 #include "../TLibCommon/Debug.h" 44 static const Bool bDebugRQT = DebugOptionList::DebugRQT.getInt()!=0; 45 static const Bool bDebugPredEnabled = DebugOptionList::DebugPred.getInt()!=0; 46 #endif 39 47 40 48 //! \ingroup TLibDecoder … … 52 60 m_pcEntropyDecoderIf->parseSkipFlag( pcCU, uiAbsPartIdx, uiDepth ); 53 61 } 54 #if H_3D62 #if NH_3D_DIS 55 63 Void TDecEntropy::decodeDIS( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 56 64 { … … 59 67 return; 60 68 } 61 62 69 m_pcEntropyDecoderIf->parseDIS( pcCU, uiAbsPartIdx, uiDepth ); 63 70 } … … 68 75 m_pcEntropyDecoderIf->parseCUTransquantBypassFlag( pcCU, uiAbsPartIdx, uiDepth ); 69 76 } 77 70 78 71 79 /** decode merge flag 72 80 * \param pcSubCU 73 * \param uiAbsPartIdx 81 * \param uiAbsPartIdx 74 82 * \param uiDepth 75 * \param uiPUIdx 83 * \param uiPUIdx 76 84 * \returns Void 77 85 */ 78 86 Void TDecEntropy::decodeMergeFlag( TComDataCU* pcSubCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx ) 79 { 87 { 80 88 // at least one merge candidate exists 81 89 m_pcEntropyDecoderIf->parseMergeFlag( pcSubCU, uiAbsPartIdx, uiDepth, uiPUIdx ); … … 84 92 /** decode merge index 85 93 * \param pcCU 86 * \param uiPartIdx 87 * \param uiAbsPartIdx 88 * \param puhInterDirNeighbours pointer to list of inter direction from the casual neighbours 89 * \param pcMvFieldNeighbours pointer to list of motion vector field from the casual neighbours 94 * \param uiPartIdx 95 * \param uiAbsPartIdx 90 96 * \param uiDepth 91 97 * \returns Void … … 98 104 } 99 105 100 #if H_3D_ARP106 #if NH_3D_ARP 101 107 Void TDecEntropy::decodeARPW( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 102 108 { … … 117 123 #endif 118 124 119 #if H_3D_IC125 #if NH_3D_IC 120 126 Void TDecEntropy::decodeICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 121 127 { 122 128 pcCU->setICFlagSubParts( false , uiAbsPartIdx, 0, uiDepth ); 123 129 130 #if NH_3D_ARP 124 131 if ( pcCU->isIntra( uiAbsPartIdx ) || ( pcCU->getSlice()->getViewIndex() == 0 ) || pcCU->getSlice()->getIsDepth() || pcCU->getARPW( uiAbsPartIdx ) > 0 ) 132 #else 133 if ( pcCU->isIntra( uiAbsPartIdx ) || ( pcCU->getSlice()->getViewIndex() == 0 ) || pcCU->getSlice()->getIsDepth() ) 134 #endif 125 135 { 126 136 return; … … 155 165 { 156 166 decodeIntraDirModeLuma ( pcCU, uiAbsPartIdx, uiDepth ); 157 #if H_3D_DIM_SDC 158 decodeSDCFlag ( pcCU, uiAbsPartIdx, uiDepth ); 159 #if H_3D_DISABLE_CHROMA 160 if(!pcCU->getSDCFlag(uiAbsPartIdx) && pcCU->getSlice()->getSPS()->getChromaFormatIdc() != 0 ) 161 #else 162 if(!pcCU->getSDCFlag(uiAbsPartIdx)) 163 #endif 164 #endif 165 decodeIntraDirModeChroma( pcCU, uiAbsPartIdx, uiDepth ); 167 #if NH_3D_SDC_INTRA 168 decodeSDCFlag ( pcCU, uiAbsPartIdx, uiDepth ); 169 #endif 170 if (pcCU->getPic()->getChromaFormat()!=CHROMA_400) 171 { 172 decodeIntraDirModeChroma( pcCU, uiAbsPartIdx, uiDepth ); 173 if (enable4ChromaPUsInIntraNxNCU(pcCU->getPic()->getChromaFormat()) && pcCU->getPartitionSize( uiAbsPartIdx )==SIZE_NxN) 174 { 175 UInt uiPartOffset = ( pcCU->getPic()->getNumPartitionsInCtu() >> ( pcCU->getDepth(uiAbsPartIdx) << 1 ) ) >> 2; 176 decodeIntraDirModeChroma( pcCU, uiAbsPartIdx + uiPartOffset, uiDepth+1 ); 177 decodeIntraDirModeChroma( pcCU, uiAbsPartIdx + uiPartOffset*2, uiDepth+1 ); 178 decodeIntraDirModeChroma( pcCU, uiAbsPartIdx + uiPartOffset*3, uiDepth+1 ); 179 } 180 } 166 181 } 167 182 else // if it is Inter mode, encode motion vector and reference index … … 171 186 } 172 187 173 /** Parse I_PCM information. 188 /** Parse I_PCM information. 174 189 * \param pcCU pointer to CUpointer to CU 175 190 * \param uiAbsPartIdx CU index … … 185 200 return; 186 201 } 187 202 188 203 m_pcEntropyDecoderIf->parseIPCMInfo( pcCU, uiAbsPartIdx, uiDepth ); 189 204 } … … 197 212 { 198 213 m_pcEntropyDecoderIf->parseIntraDirChroma( pcCU, uiAbsPartIdx, uiDepth ); 199 } 214 #if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST 215 if (bDebugPredEnabled) 216 { 217 UInt cdir=pcCU->getIntraDir(CHANNEL_TYPE_CHROMA, uiAbsPartIdx); 218 if (cdir==36) 219 { 220 cdir=pcCU->getIntraDir(CHANNEL_TYPE_LUMA, uiAbsPartIdx); 221 } 222 printf("coding chroma Intra dir: %d, uiAbsPartIdx: %d, luma dir: %d\n", cdir, uiAbsPartIdx, pcCU->getIntraDir(CHANNEL_TYPE_LUMA, uiAbsPartIdx)); 223 } 224 #endif 225 } 226 200 227 201 228 /** decode motion information for every PU block. 202 229 * \param pcCU 203 * \param uiAbsPartIdx 230 * \param uiAbsPartIdx 204 231 * \param uiDepth 205 232 * \param pcSubCU … … 210 237 PartSize ePartSize = pcCU->getPartitionSize( uiAbsPartIdx ); 211 238 UInt uiNumPU = ( ePartSize == SIZE_2Nx2N ? 1 : ( ePartSize == SIZE_NxN ? 4 : 2 ) ); 212 UInt uiPUOffset = ( g_auiPUOffset[UInt( ePartSize )] << ( ( pcCU->getSlice()->getSPS()->getMax CUDepth() - uiDepth ) << 1 ) ) >> 4;213 214 #if H_3D_IV_MERGE239 UInt uiPUOffset = ( g_auiPUOffset[UInt( ePartSize )] << ( ( pcCU->getSlice()->getSPS()->getMaxTotalCUDepth() - uiDepth ) << 1 ) ) >> 4; 240 //#if H_3D_IV_MERGE 241 #if NH_3D_MLC 215 242 TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists 216 243 UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM]; … … 219 246 UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS]; 220 247 #endif 221 #if H_3D_SPIVMP248 #if NH_3D_SPIVMP 222 249 Bool bSPIVMPFlag[MRG_MAX_NUM_CANDS_MEM]; 223 TComMvField* pcMvFieldSP = new TComMvField[pcCU->getPic()->getPicSym()->getNumPartition()*2]; 224 UChar* puhInterDirSP = new UChar[pcCU->getPic()->getPicSym()->getNumPartition()]; 250 TComMvField* pcMvFieldSP = new TComMvField[pcCU->getPic()->getPicSym()->getNumPartitionsInCtu()*2]; 251 UChar* puhInterDirSP = new UChar[pcCU->getPic()->getPicSym()->getNumPartitionsInCtu()]; 252 #endif 253 #if NH_3D_IV_MERGE 254 pcSubCU->copyDVInfoFrom( pcCU, uiAbsPartIdx); 225 255 #endif 226 256 for ( UInt ui = 0; ui < pcCU->getSlice()->getMaxNumMergeCand(); ui++ ) … … 229 259 } 230 260 Int numValidMergeCand = 0; 231 Bool isMerged= false;261 Bool hasMergedCandList = false; 232 262 233 263 pcSubCU->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0 ); 234 264 pcSubCU->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_1 ); 235 #if H_3D_IV_MERGE 236 pcSubCU->copyDVInfoFrom( pcCU, uiAbsPartIdx); 237 #endif 238 #if H_3D 265 #if NH_3D 239 266 for ( UInt uiPartIdx = 0, uiSubPartIdx = uiAbsPartIdx; uiPartIdx < uiNumPU; uiPartIdx++, uiSubPartIdx += uiPUOffset ) 240 267 { … … 268 295 269 296 ////// Parse CUs extension syntax 297 #if NH_3D_DBBP 270 298 decodeDBBPFlag( pcCU, uiAbsPartIdx, uiDepth ); 271 decodeSDCFlag ( pcCU, uiAbsPartIdx, uiDepth ); 272 273 #if H_3D_ARP 299 #endif 300 #if NH_3D_SDC_INTER 301 decodeSDCFlag ( pcCU, uiAbsPartIdx, uiDepth ); 302 #endif 303 #if NH_3D_ARP 274 304 decodeARPW ( pcCU, uiAbsPartIdx, uiDepth ); 275 305 #endif 276 #if H_3D_IC306 #if NH_3D_IC 277 307 decodeICFlag( pcCU, uiAbsPartIdx, uiDepth ); 278 308 #endif … … 284 314 { 285 315 UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx); 286 #if H_3D_DBBP 316 #if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST 317 if (bDebugPredEnabled) 318 { 319 std::cout << "Coded merge flag, CU absPartIdx: " << uiAbsPartIdx << " PU(" << uiPartIdx << ") absPartIdx: " << uiSubPartIdx; 320 std::cout << " merge index: " << (UInt)pcCU->getMergeIndex(uiSubPartIdx) << std::endl; 321 } 322 #endif 323 324 #if NH_3D_DBBP 287 325 if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && ePartSize != SIZE_2Nx2N && pcSubCU->getWidth( 0 ) <= 8 && pcCU->getDBBPFlag(uiAbsPartIdx) == false ) 288 326 #else … … 290 328 #endif 291 329 { 292 pcSubCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); 293 if ( !isMerged ) 294 { 295 #if H_3D_VSP 330 if ( !hasMergedCandList ) 331 { 332 pcSubCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); // temporarily set. 333 334 #if NH_3D_MLC 335 #if NH_3D_VSP 296 336 Int vspFlag[MRG_MAX_NUM_CANDS_MEM]; 297 337 memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM); 298 #if H_3D_SPIVMP 338 #endif 339 #if NH_3D_SPIVMP 299 340 memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM); 300 341 #endif 301 342 pcSubCU->initAvailableFlags(); 302 pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand); 343 #endif 344 pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand ); 345 #if NH_3D_MLC 303 346 pcSubCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours 304 #if H_3D_SPIVMP347 #if NH_3D_SPIVMP 305 348 , pcMvFieldSP, puhInterDirSP 306 349 #endif 307 350 , numValidMergeCand ); 308 pcSubCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours, vspFlag 309 #if H_3D_SPIVMP 351 pcSubCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours 352 #if NH_3D_VSP 353 , vspFlag 354 #endif 355 #if NH_3D_SPIVMP 310 356 , bSPIVMPFlag 311 357 #endif 312 358 , numValidMergeCand ); 359 #if NH_3D_VSP 313 360 pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth ); 314 315 #else 316 #if H_3D 317 pcSubCU->initAvailableFlags(); 318 pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand); 319 pcSubCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand ); 320 321 #else 322 pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand ); 323 #endif 324 #endif 325 isMerged = true; 326 } 327 pcSubCU->setPartSizeSubParts( ePartSize, 0, uiDepth ); 361 #endif 362 #endif 363 pcSubCU->setPartSizeSubParts( ePartSize, 0, uiDepth ); // restore. 364 hasMergedCandList = true; 365 } 328 366 } 329 367 else 330 368 { 331 uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx); 332 #if H_3D_VSP369 #if NH_3D_MLC 370 #if NH_3D_VSP 333 371 Int vspFlag[MRG_MAX_NUM_CANDS_MEM]; 334 372 memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM); 335 #if H_3D_SPIVMP 373 #endif 374 #if NH_3D_SPIVMP 336 375 memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM); 337 376 #endif 338 377 pcSubCU->initAvailableFlags(); 378 #endif 339 379 pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); 380 #if NH_3D_MLC 340 381 pcSubCU->xGetInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours 341 #if H_3D_SPIVMP382 #if NH_3D_SPIVMP 342 383 , pcMvFieldSP, puhInterDirSP 343 384 #endif 344 385 ,numValidMergeCand, uiMergeIndex ); 345 pcSubCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours, vspFlag 346 #if H_3D_SPIVMP 386 pcSubCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours 387 #if NH_3D_VSP 388 , vspFlag 389 #endif 390 #if NH_3D_SPIVMP 347 391 , bSPIVMPFlag 348 392 #endif 349 393 ,numValidMergeCand ); 394 #if NH_3D_VSP 350 395 pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth ); 351 #else352 #if H_3D353 pcSubCU->initAvailableFlags();354 pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );355 pcSubCU->xGetInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );356 #else357 pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );358 396 #endif 359 397 #endif … … 363 401 TComMv cTmpMv( 0, 0 ); 364 402 for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) 365 { 403 { 366 404 if ( pcCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 ) 367 405 { … … 370 408 pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvd( cTmpMv, ePartSize, uiSubPartIdx, uiDepth, uiPartIdx ); 371 409 pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvField( cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ], ePartSize, uiSubPartIdx, uiDepth, uiPartIdx ); 372 #if H_3D_VSP373 #if H_3D_DBBP410 #if NH_3D_VSP 411 #if NH_3D_DBBP 374 412 if( pcCU->getVSPFlag( uiSubPartIdx ) != 0 && !pcCU->getDBBPFlag( uiAbsPartIdx ) ) 375 413 #else … … 390 428 } 391 429 } 392 #if H_3D_SPIVMP430 #if NH_3D_SPIVMP 393 431 pcCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth ); 394 432 if (bSPIVMPFlag[uiMergeIndex] != 0) … … 421 459 { 422 460 decodeMvsAMVP ( pcSubCU, uiSubPartIdx-uiAbsPartIdx, uiDepth, uiPartIdx, RefPicList( uiRefListIdx ) ); 461 #if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST 462 if (bDebugPredEnabled) 463 { 464 std::cout << "refListIdx: " << uiRefListIdx << std::endl; 465 std::cout << "MVD horizontal: " << pcCU->getCUMvField(RefPicList(uiRefListIdx))->getMvd( uiAbsPartIdx ).getHor() << std::endl; 466 std::cout << "MVD vertical: " << pcCU->getCUMvField(RefPicList(uiRefListIdx))->getMvd( uiAbsPartIdx ).getVer() << std::endl; 467 std::cout << "MVPIdxPU: " << pcCU->getMVPIdx(RefPicList( uiRefListIdx ), uiSubPartIdx) << std::endl; 468 std::cout << "InterDir: " << (UInt)pcCU->getInterDir(uiSubPartIdx) << std::endl; 469 } 470 #endif 423 471 } 424 472 } … … 445 493 { 446 494 decodeMergeIndex( pcCU, uiPartIdx, uiSubPartIdx, uiDepth ); 495 #if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST 496 if (bDebugPredEnabled) 497 { 498 std::cout << "Coded merge flag, CU absPartIdx: " << uiAbsPartIdx << " PU(" << uiPartIdx << ") absPartIdx: " << uiSubPartIdx; 499 std::cout << " merge index: " << (UInt)pcCU->getMergeIndex(uiSubPartIdx) << std::endl; 500 } 501 #endif 502 #if NH_3D_IC 503 decodeICFlag( pcCU, uiAbsPartIdx, uiDepth ); 504 #endif 505 447 506 UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx); 448 if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && ePartSize != SIZE_2Nx2N && pcSubCU->getWidth( 0 ) <= 8 ) 449 { 450 pcSubCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); 451 if ( !isMerged ) 452 { 507 if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && ePartSize != SIZE_2Nx2N && pcSubCU->getWidth( 0 ) <= 8 ) 508 { 509 if ( !hasMergedCandList ) 510 { 511 pcSubCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); // temporarily set. 512 513 #if NH_3D_MLC 514 #if NH_3D_VSP 515 Int vspFlag[MRG_MAX_NUM_CANDS_MEM]; 516 memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM); 517 #endif 518 #if NH_3D_SPIVMP 519 memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM); 520 #endif 521 pcSubCU->initAvailableFlags(); 522 #endif 453 523 pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand ); 454 isMerged = true; 455 } 456 pcSubCU->setPartSizeSubParts( ePartSize, 0, uiDepth ); 524 #if NH_3D_MLC 525 pcSubCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours 526 #if NH_3D_SPIVMP 527 , pcMvFieldSP, puhInterDirSP 528 #endif 529 , numValidMergeCand ); 530 pcSubCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours 531 #if NH_3D_VSP 532 , vspFlag 533 #endif 534 #if NH_3D_SPIVMP 535 , bSPIVMPFlag 536 #endif 537 , numValidMergeCand ); 538 #if NH_3D_VSP 539 pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth ); 540 #endif 541 #endif 542 pcSubCU->setPartSizeSubParts( ePartSize, 0, uiDepth ); // restore. 543 hasMergedCandList = true; 544 } 457 545 } 458 546 else 459 547 { 460 548 uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx); 549 550 #if NH_3D_MLC 551 #if NH_3D_VSP 552 Int vspFlag[MRG_MAX_NUM_CANDS_MEM]; 553 memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM); 554 #endif 555 #if NH_3D_SPIVMP 556 memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM); 557 #endif 558 pcSubCU->initAvailableFlags(); 559 #endif 461 560 pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); 462 } 561 #if NH_3D_MLC 562 pcSubCU->xGetInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours 563 #if NH_3D_SPIVMP 564 , pcMvFieldSP, puhInterDirSP 565 #endif 566 ,numValidMergeCand, uiMergeIndex ); 567 pcSubCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours 568 #if NH_3D_VSP 569 , vspFlag 570 #endif 571 #if NH_3D_SPIVMP 572 , bSPIVMPFlag 573 #endif 574 ,numValidMergeCand ); 575 #if NH_3D_VSP 576 pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth ); 577 #endif 578 #endif 579 } 580 463 581 pcCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth ); 464 582 465 583 TComMv cTmpMv( 0, 0 ); 466 584 for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) 467 { 585 { 468 586 if ( pcCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 ) 469 587 { … … 472 590 pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvd( cTmpMv, ePartSize, uiSubPartIdx, uiDepth, uiPartIdx ); 473 591 pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvField( cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ], ePartSize, uiSubPartIdx, uiDepth, uiPartIdx ); 474 } 475 } 592 #if NH_3D_VSP 593 if( pcCU->getVSPFlag( uiSubPartIdx ) != 0 ) 594 { 595 if ( uhInterDirNeighbours[ uiMergeIndex ] & (1<<uiRefListIdx) ) 596 { 597 UInt dummy; 598 Int vspSize; 599 Int width, height; 600 pcCU->getPartIndexAndSize( uiPartIdx, dummy, width, height, uiSubPartIdx, pcCU->getTotalNumPart()==256 ); 601 pcCU->setMvFieldPUForVSP( pcCU, uiSubPartIdx, width, height, RefPicList( uiRefListIdx ), cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ].getRefIdx(), vspSize ); 602 pcCU->setVSPFlag( uiSubPartIdx, vspSize ); 603 } 604 } 605 #endif 606 } 607 } 608 #if NH_3D_SPIVMP 609 pcCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth ); 610 if (bSPIVMPFlag[uiMergeIndex] != 0) 611 { 612 Int iWidth, iHeight; 613 UInt uiIdx; 614 pcCU->getPartIndexAndSize( uiPartIdx, uiIdx, iWidth, iHeight, uiSubPartIdx, true ); 615 616 UInt uiSPAddr; 617 618 Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight; 619 620 pcCU->getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight); 621 622 for (Int iPartitionIdx = 0; iPartitionIdx < iNumSP; iPartitionIdx++) 623 { 624 pcCU->getSPAbsPartIdx(uiSubPartIdx, iSPWidth, iSPHeight, iPartitionIdx, iNumSPInOneLine, uiSPAddr); 625 pcCU->setInterDirSP(puhInterDirSP[iPartitionIdx], uiSPAddr, iSPWidth, iSPHeight); 626 pcCU->getCUMvField( REF_PIC_LIST_0 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx], iSPWidth, iSPHeight); 627 pcCU->getCUMvField( REF_PIC_LIST_1 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx + 1], iSPWidth, iSPHeight); 628 } 629 } 630 #endif 476 631 } 477 632 else … … 479 634 decodeInterDirPU( pcCU, uiSubPartIdx, uiDepth, uiPartIdx ); 480 635 for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) 481 { 636 { 482 637 if ( pcCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 ) 483 638 { … … 485 640 decodeMvdPU ( pcCU, uiSubPartIdx, uiDepth, uiPartIdx, RefPicList( uiRefListIdx ) ); 486 641 decodeMVPIdxPU ( pcSubCU, uiSubPartIdx-uiAbsPartIdx, uiDepth, uiPartIdx, RefPicList( uiRefListIdx ) ); 487 } 488 } 489 } 642 #if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST 643 if (bDebugPredEnabled) 644 { 645 std::cout << "refListIdx: " << uiRefListIdx << std::endl; 646 std::cout << "MVD horizontal: " << pcCU->getCUMvField(RefPicList(uiRefListIdx))->getMvd( uiAbsPartIdx ).getHor() << std::endl; 647 std::cout << "MVD vertical: " << pcCU->getCUMvField(RefPicList(uiRefListIdx))->getMvd( uiAbsPartIdx ).getVer() << std::endl; 648 std::cout << "MVPIdxPU: " << pcCU->getMVPIdx(RefPicList( uiRefListIdx ), uiSubPartIdx) << std::endl; 649 std::cout << "InterDir: " << (UInt)pcCU->getInterDir(uiSubPartIdx) << std::endl; 650 } 651 #endif 652 } 653 } 654 #if NH_3D_IC 655 decodeICFlag( pcCU, uiAbsPartIdx, uiDepth ); 656 #endif 657 } 658 490 659 if ( (pcCU->getInterDir(uiSubPartIdx) == 3) && pcSubCU->isBipredRestriction(uiPartIdx) ) 491 660 { … … 496 665 } 497 666 #endif 498 #if H_3D_SPIVMP667 #if NH_3D_SPIVMP 499 668 delete[] pcMvFieldSP; 500 669 delete[] puhInterDirSP; … … 505 674 /** decode inter direction for a PU block 506 675 * \param pcCU 507 * \param uiAbsPartIdx 676 * \param uiAbsPartIdx 508 677 * \param uiDepth 509 * \param uiPartIdx 678 * \param uiPartIdx 510 679 * \returns Void 511 680 */ … … 550 719 /** decode motion vector difference for a PU block 551 720 * \param pcCU 552 * \param uiAbsPartIdx 721 * \param uiAbsPartIdx 553 722 * \param uiDepth 554 723 * \param uiPartIdx 555 * \param eRefList 724 * \param eRefList 556 725 * \returns Void 557 726 */ … … 564 733 } 565 734 566 #if H_3D735 #if NH_3D 567 736 Void TDecEntropy::decodeMVPIdxPU( TComDataCU* pcSubCU, UInt uiPartAddr, UInt uiDepth, UInt uiPartIdx, RefPicList eRefList ) 568 737 { … … 656 825 #endif 657 826 658 Void TDecEntropy::xDecodeTransform( TComDataCU* pcCU, UInt offsetLuma, UInt offsetChroma, UInt uiAbsPartIdx, UInt uiDepth, UInt width, UInt height, UInt uiTrIdx, Bool& bCodeDQP, Int quadtreeTULog2MinSizeInCU) 659 { 827 Void TDecEntropy::xDecodeTransform ( Bool& bCodeDQP, Bool& isChromaQpAdjCoded, TComTU &rTu, const Int quadtreeTULog2MinSizeInCU ) 828 { 829 830 TComDataCU *pcCU=rTu.getCU(); 831 const UInt uiAbsPartIdx=rTu.GetAbsPartIdxTU(); 832 const UInt uiDepth=rTu.GetTransformDepthTotal(); 833 const UInt uiTrDepth = rTu.GetTransformDepthRel(); 660 834 661 835 #if H_MV_ENC_DEC_TRAC … … 663 837 UInt uiLPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ]; 664 838 UInt uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ]; 665 839 666 840 DTRACE_TU_S("=========== transform_tree ===========\n") 667 841 DTRACE_TU("x0", uiLPelX) 668 842 DTRACE_TU("x1", uiTPelY) 669 DTRACE_TU("log2TrafoSize", g_uiMaxCUWidth>>uiDepth) 843 844 DTRACE_TU("log2TrafoSize", pcCU->getSlice()->getSPS()->getMaxCUWidth() >> uiDepth ) 670 845 DTRACE_TU("trafoDepth" , uiDepth) 671 846 #endif … … 673 848 674 849 UInt uiSubdiv; 675 const UInt uiLog2TrafoSize = g_aucConvertToBit[pcCU->getSlice()->getSPS()->getMaxCUWidth()]+2 - uiDepth; 676 677 if(uiTrIdx==0) 678 { 679 m_bakAbsPartIdxCU = uiAbsPartIdx; 680 } 681 if( uiLog2TrafoSize == 2 ) 682 { 683 UInt partNum = pcCU->getPic()->getNumPartInCU() >> ( ( uiDepth - 1 ) << 1 ); 684 if( ( uiAbsPartIdx % partNum ) == 0 ) 685 { 686 m_uiBakAbsPartIdx = uiAbsPartIdx; 687 m_uiBakChromaOffset = offsetChroma; 688 } 689 } 690 if( pcCU->getPredictionMode(uiAbsPartIdx) == MODE_INTRA && pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_NxN && uiDepth == pcCU->getDepth(uiAbsPartIdx) ) 850 const UInt numValidComponent = pcCU->getPic()->getNumberValidComponents(); 851 const Bool bChroma = isChromaEnabled(pcCU->getPic()->getChromaFormat()); 852 853 const UInt uiLog2TrafoSize = rTu.GetLog2LumaTrSize(); 854 #if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST 855 if (bDebugRQT) 856 { 857 printf("x..codeTransform: offsetLuma=%d offsetChroma=%d absPartIdx=%d, uiDepth=%d\n width=%d, height=%d, uiTrIdx=%d, uiInnerQuadIdx=%d\n", 858 rTu.getCoefficientOffset(COMPONENT_Y), rTu.getCoefficientOffset(COMPONENT_Cb), uiAbsPartIdx, uiDepth, rTu.getRect(COMPONENT_Y).width, rTu.getRect(COMPONENT_Y).height, rTu.GetTransformDepthRel(), rTu.GetSectionNumber()); 859 fflush(stdout); 860 } 861 #endif 862 863 if( pcCU->isIntra(uiAbsPartIdx) && pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_NxN && uiDepth == pcCU->getDepth(uiAbsPartIdx) ) 691 864 { 692 865 uiSubdiv = 1; 693 866 } 694 else if( (pcCU->getSlice()->getSPS()->getQuadtreeTUMaxDepthInter() == 1) && (pcCU-> getPredictionMode(uiAbsPartIdx) == MODE_INTER) && ( pcCU->getPartitionSize(uiAbsPartIdx) != SIZE_2Nx2N ) && (uiDepth == pcCU->getDepth(uiAbsPartIdx)) )695 { 696 uiSubdiv = (uiLog2TrafoSize > 867 else if( (pcCU->getSlice()->getSPS()->getQuadtreeTUMaxDepthInter() == 1) && (pcCU->isInter(uiAbsPartIdx)) && ( pcCU->getPartitionSize(uiAbsPartIdx) != SIZE_2Nx2N ) && (uiDepth == pcCU->getDepth(uiAbsPartIdx)) ) 868 { 869 uiSubdiv = (uiLog2TrafoSize >quadtreeTULog2MinSizeInCU); 697 870 } 698 871 else if( uiLog2TrafoSize > pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() ) … … 713 886 m_pcEntropyDecoderIf->parseTransformSubdivFlag( uiSubdiv, 5 - uiLog2TrafoSize ); 714 887 } 715 716 const UInt uiTrDepth = uiDepth - pcCU->getDepth( uiAbsPartIdx ); 717 { 888 889 for(Int chan=COMPONENT_Cb; chan<numValidComponent; chan++) 890 { 891 const ComponentID compID=ComponentID(chan); 892 const UInt trDepthTotalAdj=rTu.GetTransformDepthTotalAdj(compID); 893 718 894 const Bool bFirstCbfOfCU = uiTrDepth == 0; 895 719 896 if( bFirstCbfOfCU ) 720 897 { 721 pcCU->setCbfSubParts( 0, TEXT_CHROMA_U, uiAbsPartIdx, uiDepth ); 722 pcCU->setCbfSubParts( 0, TEXT_CHROMA_V, uiAbsPartIdx, uiDepth ); 723 } 724 if( bFirstCbfOfCU || uiLog2TrafoSize > 2 ) 725 { 726 #if H_3D_DISABLE_CHROMA 727 if (pcCU->getSlice()->getSPS()->getChromaFormatIdc() != 0 ) 728 { 729 if( bFirstCbfOfCU || pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth - 1 ) ) 730 { 731 m_pcEntropyDecoderIf->parseQtCbf( pcCU, uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth, uiDepth ); 732 } 733 if( bFirstCbfOfCU || pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepth - 1 ) ) 734 { 735 m_pcEntropyDecoderIf->parseQtCbf( pcCU, uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepth, uiDepth ); 736 } 737 } 738 else 739 { 740 if( bFirstCbfOfCU || pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth - 1 ) ) 741 { 742 pcCU->setCbfSubParts( 0, TEXT_CHROMA_U, uiAbsPartIdx, uiTrDepth - 1 ); 743 } 744 if( bFirstCbfOfCU || pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepth - 1 ) ) 745 { 746 pcCU->setCbfSubParts( 0, TEXT_CHROMA_V, uiAbsPartIdx, uiTrDepth - 1 ); 747 } 748 } 749 #else 750 if( bFirstCbfOfCU || pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth - 1 ) ) 751 { 752 m_pcEntropyDecoderIf->parseQtCbf( pcCU, uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth, uiDepth ); 753 } 754 if( bFirstCbfOfCU || pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepth - 1 ) ) 755 { 756 m_pcEntropyDecoderIf->parseQtCbf( pcCU, uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepth, uiDepth ); 757 } 758 #endif 759 } 760 else 761 { 762 pcCU->setCbfSubParts( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth - 1 ) << uiTrDepth, TEXT_CHROMA_U, uiAbsPartIdx, uiDepth ); 763 pcCU->setCbfSubParts( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepth - 1 ) << uiTrDepth, TEXT_CHROMA_V, uiAbsPartIdx, uiDepth ); 764 } 765 } 766 898 pcCU->setCbfSubParts( 0, compID, rTu.GetAbsPartIdxTU(compID), trDepthTotalAdj); 899 } 900 if( bFirstCbfOfCU || rTu.ProcessingAllQuadrants(compID) ) 901 { 902 if( bFirstCbfOfCU || pcCU->getCbf( uiAbsPartIdx, compID, uiTrDepth - 1 ) ) 903 { 904 m_pcEntropyDecoderIf->parseQtCbf( rTu, compID, (uiSubdiv == 0) ); 905 } 906 } 907 } 908 767 909 if( uiSubdiv ) 768 910 { 769 UInt size; 770 width >>= 1; 771 height >>= 1; 772 size = width*height; 773 uiTrIdx++; 774 ++uiDepth; 775 const UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1); 776 const UInt uiStartAbsPartIdx = uiAbsPartIdx; 777 UInt uiYCbf = 0; 778 UInt uiUCbf = 0; 779 UInt uiVCbf = 0; 780 781 for( Int i = 0; i < 4; i++ ) 782 { 783 xDecodeTransform( pcCU, offsetLuma, offsetChroma, uiAbsPartIdx, uiDepth, width, height, uiTrIdx, bCodeDQP, quadtreeTULog2MinSizeInCU ); 784 uiYCbf |= pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiTrDepth+1 ); 785 uiUCbf |= pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth+1 ); 786 uiVCbf |= pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepth+1 ); 787 uiAbsPartIdx += uiQPartNum; 788 offsetLuma += size; offsetChroma += (size>>2); 789 } 790 791 for( UInt ui = 0; ui < 4 * uiQPartNum; ++ui ) 792 { 793 pcCU->getCbf( TEXT_LUMA )[uiStartAbsPartIdx + ui] |= uiYCbf << uiTrDepth; 794 pcCU->getCbf( TEXT_CHROMA_U )[uiStartAbsPartIdx + ui] |= uiUCbf << uiTrDepth; 795 pcCU->getCbf( TEXT_CHROMA_V )[uiStartAbsPartIdx + ui] |= uiVCbf << uiTrDepth; 911 const UInt uiQPartNum = pcCU->getPic()->getNumPartitionsInCtu() >> ((uiDepth+1) << 1); 912 UInt uiYUVCbf[MAX_NUM_COMPONENT] = {0,0,0}; 913 914 TComTURecurse tuRecurseChild(rTu, true); 915 916 do 917 { 918 xDecodeTransform( bCodeDQP, isChromaQpAdjCoded, tuRecurseChild, quadtreeTULog2MinSizeInCU ); 919 UInt childTUAbsPartIdx=tuRecurseChild.GetAbsPartIdxTU(); 920 for(UInt ch=0; ch<numValidComponent; ch++) 921 { 922 uiYUVCbf[ch] |= pcCU->getCbf(childTUAbsPartIdx , ComponentID(ch), uiTrDepth+1 ); 923 } 924 } while (tuRecurseChild.nextSection(rTu) ); 925 926 for(UInt ch=0; ch<numValidComponent; ch++) 927 { 928 UChar *pBase = pcCU->getCbf( ComponentID(ch) ) + uiAbsPartIdx; 929 const UChar flag = uiYUVCbf[ch] << uiTrDepth; 930 931 for( UInt ui = 0; ui < 4 * uiQPartNum; ++ui ) 932 { 933 pBase[ui] |= flag; 934 } 796 935 } 797 936 } … … 800 939 assert( uiDepth >= pcCU->getDepth( uiAbsPartIdx ) ); 801 940 pcCU->setTrIdxSubParts( uiTrDepth, uiAbsPartIdx, uiDepth ); 802 941 803 942 #if !H_MV_ENC_DEC_TRAC 804 943 { … … 813 952 } 814 953 #endif 815 816 pcCU->setCbfSubParts ( 0, TEXT_LUMA, uiAbsPartIdx, uiDepth ); 817 if( pcCU->getPredictionMode(uiAbsPartIdx) != MODE_INTRA && uiDepth == pcCU->getDepth( uiAbsPartIdx ) && !pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, 0 ) && !pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, 0 ) ) 818 { 819 pcCU->setCbfSubParts( 1 << uiTrDepth, TEXT_LUMA, uiAbsPartIdx, uiDepth ); 954 955 pcCU->setCbfSubParts ( 0, COMPONENT_Y, uiAbsPartIdx, uiDepth ); 956 957 if( (!pcCU->isIntra(uiAbsPartIdx)) && uiDepth == pcCU->getDepth( uiAbsPartIdx ) && ((!bChroma) || (!pcCU->getCbf( uiAbsPartIdx, COMPONENT_Cb, 0 ) && !pcCU->getCbf( uiAbsPartIdx, COMPONENT_Cr, 0 )) )) 958 { 959 pcCU->setCbfSubParts( 1 << uiTrDepth, COMPONENT_Y, uiAbsPartIdx, uiDepth ); 820 960 } 821 961 else 822 962 { 823 m_pcEntropyDecoderIf->parseQtCbf( pcCU, uiAbsPartIdx, TEXT_LUMA, uiTrDepth, uiDepth);963 m_pcEntropyDecoderIf->parseQtCbf( rTu, COMPONENT_Y, true ); 824 964 } 825 965 826 966 827 967 // transform_unit begin 828 UInt cbfY = pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA , uiTrIdx ); 829 UInt cbfU = pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrIdx ); 830 UInt cbfV = pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrIdx ); 831 if( uiLog2TrafoSize == 2 ) 832 { 833 UInt partNum = pcCU->getPic()->getNumPartInCU() >> ( ( uiDepth - 1 ) << 1 ); 834 if( ( uiAbsPartIdx % partNum ) == (partNum - 1) ) 835 { 836 cbfU = pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_U, uiTrIdx ); 837 cbfV = pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_V, uiTrIdx ); 838 } 839 } 840 if ( cbfY || cbfU || cbfV ) 841 { 842 // dQP: only for LCU 968 UInt cbf[MAX_NUM_COMPONENT]={0,0,0}; 969 Bool validCbf = false; 970 Bool validChromaCbf = false; 971 const UInt uiTrIdx = rTu.GetTransformDepthRel(); 972 973 for(UInt ch=0; ch<pcCU->getPic()->getNumberValidComponents(); ch++) 974 { 975 const ComponentID compID = ComponentID(ch); 976 977 cbf[compID] = pcCU->getCbf( uiAbsPartIdx, compID, uiTrIdx ); 978 979 if (cbf[compID] != 0) 980 { 981 validCbf = true; 982 if (isChroma(compID)) 983 { 984 validChromaCbf = true; 985 } 986 } 987 } 988 989 if ( validCbf ) 990 { 991 992 // dQP: only for CTU 843 993 if ( pcCU->getSlice()->getPPS()->getUseDQP() ) 844 994 { 845 995 if ( bCodeDQP ) 846 996 { 847 decodeQP( pcCU, m_bakAbsPartIdxCU); 997 const UInt uiAbsPartIdxCU=rTu.GetAbsPartIdxCU(); 998 decodeQP( pcCU, uiAbsPartIdxCU); 848 999 bCodeDQP = false; 849 1000 } 850 1001 } 851 } 852 if( cbfY ) 853 { 854 Int trWidth = width; 855 Int trHeight = height; 856 m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffY()+offsetLuma), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_LUMA ); 857 } 858 if( uiLog2TrafoSize > 2 ) 859 { 860 Int trWidth = width >> 1; 861 Int trHeight = height >> 1; 862 if( cbfU ) 863 { 864 m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCb()+offsetChroma), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_U ); 865 } 866 if( cbfV ) 867 { 868 m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCr()+offsetChroma), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_V ); 869 } 870 } 871 else 872 { 873 UInt partNum = pcCU->getPic()->getNumPartInCU() >> ( ( uiDepth - 1 ) << 1 ); 874 if( ( uiAbsPartIdx % partNum ) == (partNum - 1) ) 875 { 876 Int trWidth = width; 877 Int trHeight = height; 878 if( cbfU ) 879 { 880 m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCb()+m_uiBakChromaOffset), m_uiBakAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_U ); 881 } 882 if( cbfV ) 883 { 884 m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCr()+m_uiBakChromaOffset), m_uiBakAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_V ); 1002 1003 if ( pcCU->getSlice()->getUseChromaQpAdj() ) 1004 { 1005 if ( validChromaCbf && isChromaQpAdjCoded && !pcCU->getCUTransquantBypass(rTu.GetAbsPartIdxCU()) ) 1006 { 1007 decodeChromaQpAdjustment( pcCU, rTu.GetAbsPartIdxCU() ); 1008 isChromaQpAdjCoded = false; 1009 } 1010 } 1011 1012 const UInt numValidComp=pcCU->getPic()->getNumberValidComponents(); 1013 1014 for(UInt ch=COMPONENT_Y; ch<numValidComp; ch++) 1015 { 1016 const ComponentID compID=ComponentID(ch); 1017 1018 if( rTu.ProcessComponentSection(compID) ) 1019 { 1020 #if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST 1021 if (bDebugRQT) 1022 { 1023 printf("Call NxN for chan %d width=%d height=%d cbf=%d\n", compID, rTu.getRect(compID).width, rTu.getRect(compID).height, 1); 1024 } 1025 #endif 1026 1027 if (rTu.getRect(compID).width != rTu.getRect(compID).height) 1028 { 1029 //code two sub-TUs 1030 TComTURecurse subTUIterator(rTu, false, TComTU::VERTICAL_SPLIT, true, compID); 1031 1032 do 1033 { 1034 const UInt subTUCBF = pcCU->getCbf(subTUIterator.GetAbsPartIdxTU(), compID, (uiTrIdx + 1)); 1035 1036 if (subTUCBF != 0) 1037 { 1038 #if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST 1039 if (bDebugRQT) 1040 { 1041 printf("Call NxN for chan %d width=%d height=%d cbf=%d\n", compID, subTUIterator.getRect(compID).width, subTUIterator.getRect(compID).height, 1); 1042 } 1043 #endif 1044 m_pcEntropyDecoderIf->parseCoeffNxN( subTUIterator, compID ); 1045 } 1046 } while (subTUIterator.nextSection(rTu)); 1047 } 1048 else 1049 { 1050 if(isChroma(compID) && (cbf[COMPONENT_Y] != 0)) 1051 { 1052 m_pcEntropyDecoderIf->parseCrossComponentPrediction( rTu, compID ); 1053 } 1054 1055 if(cbf[compID] != 0) 1056 { 1057 m_pcEntropyDecoderIf->parseCoeffNxN( rTu, compID ); 1058 } 1059 } 885 1060 } 886 1061 } … … 898 1073 } 899 1074 900 901 /** decode coefficients 902 * \param pcCU 903 * \param uiAbsPartIdx 904 * \param uiDepth 905 * \param uiWidth 906 * \param uiHeight 907 * \returns Void 908 */ 909 Void TDecEntropy::decodeCoeff( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiWidth, UInt uiHeight, Bool& bCodeDQP ) 910 { 911 UInt uiMinCoeffSize = pcCU->getPic()->getMinCUWidth()*pcCU->getPic()->getMinCUHeight(); 912 UInt uiLumaOffset = uiMinCoeffSize*uiAbsPartIdx; 913 UInt uiChromaOffset = uiLumaOffset>>2; 914 #if H_3D_DIM_SDC 1075 Void TDecEntropy::decodeChromaQpAdjustment( TComDataCU* pcCU, UInt uiAbsPartIdx ) 1076 { 1077 if ( pcCU->getSlice()->getUseChromaQpAdj() ) 1078 { 1079 m_pcEntropyDecoderIf->parseChromaQpAdjustment( pcCU, uiAbsPartIdx, pcCU->getDepth( uiAbsPartIdx ) ); 1080 } 1081 } 1082 1083 1084 //! decode coefficients 1085 Void TDecEntropy::decodeCoeff( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, Bool& bCodeDQP, Bool& isChromaQpAdjCoded ) 1086 { 1087 #if NH_3D_SDC_INTRA 915 1088 if( pcCU->getSDCFlag( uiAbsPartIdx ) && pcCU->isIntra( uiAbsPartIdx) ) 916 1089 { 917 1090 assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N ); 918 1091 assert( pcCU->getTransformIdx(uiAbsPartIdx) == 0 ); 919 assert( pcCU->getCbf(uiAbsPartIdx, TEXT_LUMA) == 1 ); 920 #if H_3D_DISABLE_CHROMA 921 if (pcCU->getSlice()->getSPS()->getChromaFormatIdc() != 0 ) 922 { 923 assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_U) == 1 ); 924 assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_V) == 1 ); 925 } 926 #else 927 assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_U) == 1 ); 928 assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_V) == 1 ); 929 #endif 930 } 931 932 #if H_3D_INTER_SDC 1092 assert( pcCU->getCbf(uiAbsPartIdx, COMPONENT_Y) == 1 ); 1093 } 1094 #endif 1095 #if NH_3D_SDC_INTER 933 1096 if( pcCU->getSDCFlag( uiAbsPartIdx ) && !pcCU->isIntra( uiAbsPartIdx) ) 934 1097 { … … 938 1101 } 939 1102 #endif 940 if( pcCU->getSlice()->getIsDepth() && ( pcCU->getSDCFlag( uiAbsPartIdx ) || pcCU->isIntra( uiAbsPartIdx ) ) ) 941 { 942 Int iPartNum = ( pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_NxN ) ? 4 : 1; 943 UInt uiPartOffset = ( pcCU->getPic()->getNumPartInCU() >> ( pcCU->getDepth( uiAbsPartIdx ) << 1 ) ) >> 2; 944 945 if( !pcCU->getSDCFlag( uiAbsPartIdx ) ) 946 { 947 for( Int iPart = 0; iPart < iPartNum; iPart++ ) 948 { 949 if( getDimType( pcCU->getLumaIntraDir( uiAbsPartIdx + uiPartOffset*iPart ) ) < DIM_NUM_TYPE ) 950 { 951 m_pcEntropyDecoderIf->parseDeltaDC( pcCU, uiAbsPartIdx + uiPartOffset*iPart, uiDepth + ( pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_NxN ) ); 952 } 953 } 954 } 955 else 1103 #if NH_3D 1104 if( pcCU->getSlice()->getIsDepth() ) 1105 { 1106 #if NH_3D_SDC_INTRA || NH_3D_SDC_INTER 1107 if( pcCU->getSDCFlag( uiAbsPartIdx ) ) 956 1108 { 957 1109 m_pcEntropyDecoderIf->parseDeltaDC( pcCU, uiAbsPartIdx, uiDepth ); 958 1110 return; 959 1111 } 1112 #endif 1113 #if NH_3D_DMM 1114 if( pcCU->isIntra( uiAbsPartIdx ) ) 1115 { 1116 Int iPartNum = ( pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_NxN ) ? 4 : 1; 1117 UInt uiPartOffset = ( pcCU->getPic()->getNumPartitionsInCtu() >> ( pcCU->getDepth( uiAbsPartIdx ) << 1 ) ) >> 2; 1118 for( Int iPart = 0; iPart < iPartNum; iPart++ ) 1119 { 1120 if( isDmmMode( pcCU->getIntraDir( CHANNEL_TYPE_LUMA, uiAbsPartIdx + uiPartOffset*iPart ) ) ) 1121 { 1122 m_pcEntropyDecoderIf->parseDeltaDC( pcCU, uiAbsPartIdx + uiPartOffset*iPart, uiDepth + ( pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_NxN ) ); 1123 } 1124 } 1125 } 1126 #endif 960 1127 } 961 1128 #endif … … 973 1140 if ( !uiQtRootCbf ) 974 1141 { 975 pcCU->setCbfSubParts( 0, 0, 0, uiAbsPartIdx, uiDepth ); 1142 static const UInt cbfZero[MAX_NUM_COMPONENT]={0,0,0}; 1143 pcCU->setCbfSubParts( cbfZero, uiAbsPartIdx, uiDepth ); 976 1144 pcCU->setTrIdxSubParts( 0 , uiAbsPartIdx, uiDepth ); 977 1145 return; 978 1146 } 979 980 } 981 982 Int getQuadtreeTULog2MinSizeInCU = pcCU->getQuadtreeTULog2MinSizeInCU(uiAbsPartIdx); 983 984 xDecodeTransform( pcCU, uiLumaOffset, uiChromaOffset, uiAbsPartIdx, uiDepth, uiWidth, uiHeight, 0, bCodeDQP, getQuadtreeTULog2MinSizeInCU ); 985 } 986 987 #if H_3D_INTER_SDC 1147 1148 } 1149 1150 TComTURecurse tuRecurse(pcCU, uiAbsPartIdx, uiDepth); 1151 1152 #if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST 1153 if (bDebugRQT) 1154 { 1155 printf("..codeCoeff: uiAbsPartIdx=%d, PU format=%d, 2Nx2N=%d, NxN=%d\n", uiAbsPartIdx, pcCU->getPartitionSize(uiAbsPartIdx), SIZE_2Nx2N, SIZE_NxN); 1156 } 1157 #endif 1158 1159 Int quadtreeTULog2MinSizeInCU = pcCU->getQuadtreeTULog2MinSizeInCU(uiAbsPartIdx); 1160 1161 xDecodeTransform( bCodeDQP, isChromaQpAdjCoded, tuRecurse, quadtreeTULog2MinSizeInCU ); 1162 } 1163 1164 #if NH_3D_SDC_INTRA || NH_3D_SDC_INTER 988 1165 Void TDecEntropy::decodeSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 989 1166 { … … 1010 1187 } 1011 1188 #endif 1012 #if H_3D_DBBP1189 #if NH_3D_DBBP 1013 1190 Void TDecEntropy::decodeDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 1014 1191 { … … 1020 1197 #endif 1021 1198 1199 1200 1022 1201 //! \}
Note: See TracChangeset for help on using the changeset viewer.