Changeset 466 in SHVCSoftware for branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncSlice.cpp
- Timestamp:
- 13 Nov 2013, 23:25:47 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncSlice.cpp
r442 r466 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 6 * Copyright (c) 2010-2013, ITU/ISO/IEC … … 51 51 m_apcPicYuvPred = NULL; 52 52 m_apcPicYuvResi = NULL; 53 53 54 54 m_pdRdPicLambda = NULL; 55 55 m_pdRdPicQp = NULL; … … 69 69 } 70 70 71 Void TEncSlice::initCtxMem( UInt i ) 72 { 71 Void TEncSlice::initCtxMem( UInt i ) 72 { 73 73 for (std::vector<TEncSbac*>::iterator j = CTXMem.begin(); j != CTXMem.end(); j++) 74 74 { 75 75 delete (*j); 76 76 } 77 CTXMem.clear(); 78 CTXMem.resize(i); 77 CTXMem.clear(); 78 CTXMem.resize(i); 79 79 } 80 80 … … 87 87 m_apcPicYuvPred->create( iWidth, iHeight, iMaxCUWidth, iMaxCUHeight, uhTotalDepth ); 88 88 } 89 89 90 90 // create residual picture 91 91 if( m_apcPicYuvResi == NULL ) … … 105 105 m_apcPicYuvPred = NULL; 106 106 } 107 107 108 108 // destroy residual picture 109 109 if ( m_apcPicYuvResi ) … … 113 113 m_apcPicYuvResi = NULL; 114 114 } 115 115 116 116 // free lambda and QP arrays 117 117 if ( m_pdRdPicLambda ) { xFree( m_pdRdPicLambda ); m_pdRdPicLambda = NULL; } … … 139 139 #if SVC_EXTENSION 140 140 m_ppcTEncTop = pcEncTop->getLayerEnc(); 141 #endif 141 #endif 142 142 m_pcGOPEncoder = pcEncTop->getGOPEncoder(); 143 143 m_pcCuEncoder = pcEncTop->getCuEncoder(); 144 144 m_pcPredSearch = pcEncTop->getPredSearch(); 145 145 146 146 m_pcEntropyCoder = pcEncTop->getEntropyCoder(); 147 147 m_pcCavlcCoder = pcEncTop->getCavlcCoder(); … … 149 149 m_pcBinCABAC = pcEncTop->getBinCABAC(); 150 150 m_pcTrQuant = pcEncTop->getTrQuant(); 151 151 152 152 m_pcBitCounter = pcEncTop->getBitCounter(); 153 153 m_pcRdCost = pcEncTop->getRdCost(); 154 154 m_pppcRDSbacCoder = pcEncTop->getRDSbacCoder(); 155 155 m_pcRDGoOnSbacCoder = pcEncTop->getRDGoOnSbacCoder(); 156 156 157 157 // create lambda and QP arrays 158 158 m_pdRdPicLambda = (Double*)xMalloc( Double, m_pcCfg->getDeltaQpRD() * 2 + 1 ); … … 187 187 Double dQP; 188 188 Double dLambda; 189 189 190 190 rpcSlice = pcPic->getSlice(0); 191 191 rpcSlice->setSPS( pSPS ); … … 202 202 rpcSlice->setPicOutputFlag( true ); 203 203 rpcSlice->setPOC( pocCurr ); 204 204 205 205 // depth computation based on GOP size 206 206 Int depth; … … 230 230 } 231 231 } 232 232 233 233 // slice type 234 234 SliceType eSliceType; 235 235 236 236 eSliceType=B_SLICE; 237 237 eSliceType = (pocLast == 0 || pocCurr % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType; 238 238 239 239 rpcSlice->setSliceType ( eSliceType ); 240 240 241 241 // ------------------------------------------------------------------------------------------------------------------ 242 242 // Non-referenced frame marking 243 243 // ------------------------------------------------------------------------------------------------------------------ 244 244 245 245 if(pocLast == 0) 246 246 { … … 252 252 } 253 253 rpcSlice->setReferenced(true); 254 254 255 255 // ------------------------------------------------------------------------------------------------------------------ 256 256 // QP setting 257 257 // ------------------------------------------------------------------------------------------------------------------ 258 258 259 259 dQP = m_pcCfg->getQP(); 260 260 if(eSliceType!=I_SLICE) 261 261 { 262 262 #if REPN_FORMAT_IN_VPS 263 if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getQpBDOffsetY() ) && (rpcSlice->getSPS()->getUseLossless()))) 264 #else 265 if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getSPS()->getQpBDOffsetY() ) && (rpcSlice->getSPS()->getUseLossless()))) 263 if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getQpBDOffsetY() ) && (rpcSlice->getSPS()->getUseLossless()))) 264 #else 265 if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getSPS()->getQpBDOffsetY() ) && (rpcSlice->getSPS()->getUseLossless()))) 266 266 #endif 267 267 { … … 269 269 } 270 270 } 271 271 272 272 // modify QP 273 273 Int* pdQPs = m_pcCfg->getdQPs(); … … 285 285 // Lambda computation 286 286 // ------------------------------------------------------------------------------------------------------------------ 287 287 288 288 Int iQP; 289 289 Double dOrigQP = dQP; … … 294 294 // compute QP value 295 295 dQP = dOrigQP + ((iDQpIdx+1)>>1)*(iDQpIdx%2 ? -1 : 1); 296 296 297 297 // compute lambda value 298 298 Int NumberBFrames = ( m_pcCfg->getGOPSize() - 1 ); … … 326 326 #endif 327 327 } 328 328 329 329 // if hadamard is used in ME process 330 330 if ( !m_pcCfg->getUseHADME() && rpcSlice->getSliceType( ) != I_SLICE ) … … 332 332 dLambda *= 0.95; 333 333 } 334 334 335 335 #if REPN_FORMAT_IN_VPS 336 336 iQP = max( -rpcSlice->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) ); … … 343 343 m_piRdPicQp [iDQpIdx] = iQP; 344 344 } 345 345 346 346 // obtain dQP = 0 case 347 347 dLambda = m_pdRdPicLambda[0]; 348 348 dQP = m_pdRdPicQp [0]; 349 349 iQP = m_piRdPicQp [0]; 350 350 351 351 if( rpcSlice->getSliceType( ) != I_SLICE ) 352 352 { … … 359 359 Int nCurLayer = rpcSlice->getLayerId(); 360 360 Double gamma = xCalEnhLambdaFactor( m_ppcTEncTop[nCurLayer-1]->getQP() - m_ppcTEncTop[nCurLayer]->getQP() , 361 1.0 * m_ppcTEncTop[nCurLayer]->getSourceWidth() * m_ppcTEncTop[nCurLayer]->getSourceHeight() 361 1.0 * m_ppcTEncTop[nCurLayer]->getSourceWidth() * m_ppcTEncTop[nCurLayer]->getSourceHeight() 362 362 / m_ppcTEncTop[nCurLayer-1]->getSourceWidth() / m_ppcTEncTop[nCurLayer-1]->getSourceHeight() ); 363 363 dLambda *= gamma; … … 392 392 #endif 393 393 394 #if RDOQ_CHROMA_LAMBDA 394 #if RDOQ_CHROMA_LAMBDA 395 395 // for RDOQ 396 m_pcTrQuant->setLambda( dLambda, dLambda / weight ); 396 m_pcTrQuant->setLambda( dLambda, dLambda / weight ); 397 397 #else 398 398 m_pcTrQuant->setLambda( dLambda ); … … 401 401 #if SAO_CHROMA_LAMBDA 402 402 // For SAO 403 rpcSlice ->setLambda( dLambda, dLambda / weight ); 403 rpcSlice ->setLambda( dLambda, dLambda / weight ); 404 404 #else 405 405 rpcSlice ->setLambda( dLambda ); 406 406 #endif 407 407 408 408 #if HB_LAMBDA_FOR_LDC 409 409 // restore original slice type 410 410 eSliceType = (pocLast == 0 || pocCurr % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType; 411 411 412 412 #if SVC_EXTENSION 413 413 if(m_pcCfg->getLayerId() > 0) … … 418 418 rpcSlice->setSliceType ( eSliceType ); 419 419 #endif 420 420 421 421 if (m_pcCfg->getUseRecalculateQPAccordingToLambda()) 422 422 { 423 423 dQP = xGetQPValueAccordingToLambda( dLambda ); 424 424 #if REPN_FORMAT_IN_VPS 425 iQP = max( -rpcSlice->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) ); 426 #else 427 iQP = max( -pSPS->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) ); 425 iQP = max( -rpcSlice->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) ); 426 #else 427 iQP = max( -pSPS->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) ); 428 428 #endif 429 429 } … … 438 438 rpcSlice->setNumRefIdx(REF_PIC_LIST_0,m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive); 439 439 rpcSlice->setNumRefIdx(REF_PIC_LIST_1,m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive); 440 440 441 441 if ( m_pcCfg->getDeblockingFilterMetric() ) 442 442 { … … 479 479 480 480 rpcSlice->setDepth ( depth ); 481 481 482 482 pcPic->setTLayer( m_pcCfg->getGOPEntry(iGOPid).m_temporalId ); 483 483 #if TEMP_SCALABILITY_FIX … … 493 493 assert( m_apcPicYuvPred ); 494 494 assert( m_apcPicYuvResi ); 495 495 496 496 pcPic->setPicYuvPred( m_apcPicYuvPred ); 497 497 pcPic->setPicYuvResi( m_apcPicYuvResi ); … … 557 557 #endif 558 558 559 #if RDOQ_CHROMA_LAMBDA 559 #if RDOQ_CHROMA_LAMBDA 560 560 // for RDOQ 561 561 m_pcTrQuant->setLambda( lambda, lambda / weight ); … … 665 665 #endif 666 666 667 #if RDOQ_CHROMA_LAMBDA 667 #if RDOQ_CHROMA_LAMBDA 668 668 // for RDOQ 669 m_pcTrQuant->setLambda( lambda, lambda / weight ); 669 m_pcTrQuant->setLambda( lambda, lambda / weight ); 670 670 #else 671 671 m_pcTrQuant->setLambda( lambda ); … … 674 674 #if SAO_CHROMA_LAMBDA 675 675 // For SAO 676 pcSlice ->setLambda( lambda, lambda / weight ); 676 pcSlice ->setLambda( lambda, lambda / weight ); 677 677 #else 678 678 pcSlice ->setLambda( lambda ); … … 692 692 Int iMaxSR = m_pcCfg->getSearchRange(); 693 693 Int iNumPredDir = pcSlice->isInterP() ? 1 : 2; 694 694 695 695 for (Int iDir = 0; iDir <= iNumPredDir; iDir++) 696 696 { … … 726 726 } 727 727 #endif 728 728 729 729 TComSlice* pcSlice = rpcPic->getSlice(getSliceIdx()); 730 730 Double dPicRdCostBest = MAX_DOUBLE; 731 731 UInt uiQpIdxBest = 0; 732 732 733 733 Double dFrameLambda; 734 734 #if FULL_NBIT … … 737 737 Int SHIFT_QP = 12; 738 738 #endif 739 739 740 740 // set frame lambda 741 741 if (m_pcCfg->getGOPSize() > 1) … … 748 748 } 749 749 m_pcRdCost ->setFrameLambda(dFrameLambda); 750 750 751 751 // for each QP candidate 752 752 for ( UInt uiQpIdx = 0; uiQpIdx < 2 * m_pcCfg->getDeltaQpRD() + 1; uiQpIdx++ ) … … 776 776 #endif 777 777 778 #if RDOQ_CHROMA_LAMBDA 778 #if RDOQ_CHROMA_LAMBDA 779 779 // for RDOQ 780 780 m_pcTrQuant ->setLambda( m_pdRdPicLambda[uiQpIdx], m_pdRdPicLambda[uiQpIdx] / weight ); … … 784 784 #if SAO_CHROMA_LAMBDA 785 785 // For SAO 786 pcSlice ->setLambda ( m_pdRdPicLambda[uiQpIdx], m_pdRdPicLambda[uiQpIdx] / weight ); 786 pcSlice ->setLambda ( m_pdRdPicLambda[uiQpIdx], m_pdRdPicLambda[uiQpIdx] / weight ); 787 787 #else 788 788 pcSlice ->setLambda ( m_pdRdPicLambda[uiQpIdx] ); 789 789 #endif 790 790 791 791 // try compress 792 792 compressSlice ( rpcPic ); 793 793 794 794 Double dPicRdCost; 795 795 UInt64 uiPicDist = m_uiPicDist; 796 796 UInt64 uiALFBits = 0; 797 797 798 798 m_pcGOPEncoder->preLoopFilterPicAll( rpcPic, uiPicDist, uiALFBits ); 799 799 800 800 // compute RD cost and choose the best 801 801 dPicRdCost = m_pcRdCost->calcRdCost64( m_uiPicTotalBits + uiALFBits, uiPicDist, true, DF_SSE_FRAME); 802 802 803 803 if ( dPicRdCost < dPicRdCostBest ) 804 804 { … … 807 807 } 808 808 } 809 809 810 810 // set best values 811 811 pcSlice ->setSliceQp ( m_piRdPicQp [uiQpIdxBest] ); … … 832 832 #endif 833 833 834 #if RDOQ_CHROMA_LAMBDA 835 // for RDOQ 836 m_pcTrQuant ->setLambda( m_pdRdPicLambda[uiQpIdxBest], m_pdRdPicLambda[uiQpIdxBest] / weight ); 834 #if RDOQ_CHROMA_LAMBDA 835 // for RDOQ 836 m_pcTrQuant ->setLambda( m_pdRdPicLambda[uiQpIdxBest], m_pdRdPicLambda[uiQpIdxBest] / weight ); 837 837 #else 838 838 m_pcTrQuant ->setLambda ( m_pdRdPicLambda[uiQpIdxBest] ); … … 840 840 #if SAO_CHROMA_LAMBDA 841 841 // For SAO 842 pcSlice ->setLambda ( m_pdRdPicLambda[uiQpIdxBest], m_pdRdPicLambda[uiQpIdxBest] / weight ); 842 pcSlice ->setLambda ( m_pdRdPicLambda[uiQpIdxBest], m_pdRdPicLambda[uiQpIdxBest] / weight ); 843 843 #else 844 844 pcSlice ->setLambda ( m_pdRdPicLambda[uiQpIdxBest] ); … … 862 862 863 863 UInt uiEncCUOrder; 864 uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU()); 864 uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU()); 865 865 for( uiEncCUOrder = uiStartCUAddr/rpcPic->getNumPartInCU(); 866 866 uiEncCUOrder < (uiBoundingCUAddr+(rpcPic->getNumPartInCU()-1))/rpcPic->getNumPartInCU(); … … 898 898 TComSlice* pcSlice = rpcPic->getSlice(getSliceIdx()); 899 899 xDetermineStartAndBoundingCUAddr ( uiStartCUAddr, uiBoundingCUAddr, rpcPic, false ); 900 900 901 901 // initialize cost values 902 902 m_uiPicTotalBits = 0; 903 903 m_dPicRdCost = 0; 904 904 m_uiPicDist = 0; 905 905 906 906 // set entropy coder 907 907 if( m_pcCfg->getUseSBACRD() ) … … 921 921 m_pcEntropyCoder->setBitstream ( m_pcBitCounter ); 922 922 } 923 923 924 924 //------------------------------------------------------------------------------ 925 925 // Weighted Prediction parameters estimation. … … 930 930 xCalcACDCParamSlice(pcSlice); 931 931 } 932 #if O0194_WEIGHTED_PREDICTION_CGS 933 else{ 934 // Calculate for the base layer to be used in EL as Inter layer reference 935 xCalcACDCParamSlice(pcSlice); 936 wpACDCParam * temp_weightACDCParam; 937 938 pcSlice->getWpAcDcParam(temp_weightACDCParam); 939 g_refWeightACDCParam = (void *) temp_weightACDCParam; 940 } 941 #endif 932 942 933 943 Bool bWp_explicit = (pcSlice->getSliceType()==P_SLICE && pcSlice->getPPS()->getUseWP()) || (pcSlice->getSliceType()==B_SLICE && pcSlice->getPPS()->getWPBiPred()); … … 1021 1031 m_pcBufferSbacCoders[uiTileCol].loadContexts( CTXMem[1] ); 1022 1032 Int iNumSubstreamsPerTile = iNumSubstreams/rpcPic->getPicSym()->getNumTiles(); 1023 uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU()); 1033 uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU()); 1024 1034 uiLin = uiCUAddr / uiWidthInLCUs; 1025 1035 uiSubStrm = rpcPic->getPicSym()->getTileIdxMap(rpcPic->getPicSym()->getCUOrderMap(uiCUAddr))*iNumSubstreamsPerTile … … 1098 1108 pcCUTR = rpcPic->getCU( uiCUAddr - uiWidthInCU + 1 ); 1099 1109 } 1100 if ( ((pcCUTR==NULL) || (pcCUTR->getSlice()==NULL) || 1110 if ( ((pcCUTR==NULL) || (pcCUTR->getSlice()==NULL) || 1101 1111 (pcCUTR->getSCUAddr()+uiMaxParts-1 < pcSlice->getSliceCurStartCUAddr()) || 1102 1112 ((rpcPic->getPicSym()->getTileIdxMap( pcCUTR->getAddr() ) != rpcPic->getPicSym()->getTileIdxMap(uiCUAddr))) … … 1137 1147 m_pcEntropyCoder->setEntropyCoder ( m_pcRDGoOnSbacCoder, pcSlice ); 1138 1148 m_pcEntropyCoder->setBitstream( &pcBitCounters[uiSubStrm] ); 1139 1149 1140 1150 ((TEncBinCABAC*)m_pcRDGoOnSbacCoder->getEncBinIf())->setBinCountingEnableFlag(true); 1141 1151 … … 1242 1252 m_pcRdCost->setLambda(oldLambda); 1243 1253 #if RATE_CONTROL_INTRA 1244 m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda, 1254 m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda, 1245 1255 pcCU->getSlice()->getSliceType() == I_SLICE ? 0 : m_pcCfg->getLCULevelRC() ); 1246 1256 #else … … 1250 1260 #endif 1251 1261 #endif 1252 1262 1253 1263 // restore entropy coder to an initial stage 1254 1264 m_pcEntropyCoder->setEntropyCoder ( m_pppcRDSbacCoder[0][CI_CURR_BEST], pcSlice ); … … 1275 1285 { 1276 1286 ppppcRDSbacCoders[uiSubStrm][0][CI_CURR_BEST]->load( m_pppcRDSbacCoder[0][CI_CURR_BEST] ); 1277 1287 1278 1288 //Store probabilties of second LCU in line into buffer 1279 1289 if ( ( uiCol == uiTileLCUX+1) && (depSliceSegmentsEnabled || (pcSlice->getPPS()->getNumSubstreams() > 1)) && m_pcCfg->getWaveFrontsynchro()) … … 1325 1335 1326 1336 #if RATE_CONTROL_INTRA 1327 m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda, 1337 m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda, 1328 1338 pcCU->getSlice()->getSliceType() == I_SLICE ? 0 : m_pcCfg->getLCULevelRC() ); 1329 1339 #else … … 1350 1360 } 1351 1361 } 1352 1362 1353 1363 m_uiPicTotalBits += pcCU->getTotalBits(); 1354 1364 m_dPicRdCost += pcCU->getTotalCost(); … … 1401 1411 m_pcEntropyCoder->setEntropyCoder ( m_pcSbacCoder, pcSlice ); 1402 1412 } 1403 1413 1404 1414 m_pcCuEncoder->setBitCounter( NULL ); 1405 1415 m_pcBitCounter = NULL; … … 1427 1437 m_pcBufferSbacCoders[ui].load(m_pcSbacCoder); //init. state 1428 1438 } 1429 1439 1430 1440 for (Int iSubstrmIdx=0; iSubstrmIdx < iNumSubstreams; iSubstrmIdx++) 1431 1441 { … … 1524 1534 } 1525 1535 if ( (true/*bEnforceSliceRestriction*/ && 1526 ((pcCUTR==NULL) || (pcCUTR->getSlice()==NULL) || 1536 ((pcCUTR==NULL) || (pcCUTR->getSlice()==NULL) || 1527 1537 (pcCUTR->getSCUAddr()+uiMaxParts-1 < pcSlice->getSliceCurStartCUAddr()) || 1528 1538 ((rpcPic->getPicSym()->getTileIdxMap( pcCUTR->getAddr() ) != rpcPic->getPicSym()->getTileIdxMap(uiCUAddr))) … … 1579 1589 } 1580 1590 1581 TComDataCU*& pcCU = rpcPic->getCU( uiCUAddr ); 1591 TComDataCU*& pcCU = rpcPic->getCU( uiCUAddr ); 1582 1592 if ( pcSlice->getSPS()->getUseSAO() && (pcSlice->getSaoEnabledFlag()||pcSlice->getSaoEnabledFlagChroma()) ) 1583 1593 { … … 1613 1623 if (allowMergeLeft) 1614 1624 { 1615 m_pcEntropyCoder->m_pcEntropyCoderIf->codeSaoMerge(mergeLeft); 1625 m_pcEntropyCoder->m_pcEntropyCoderIf->codeSaoMerge(mergeLeft); 1616 1626 } 1617 1627 else … … 1676 1686 #if ENC_DEC_TRACE 1677 1687 g_bJustDoIt = g_bEncDecTraceDisable; 1678 #endif 1688 #endif 1679 1689 if( m_pcCfg->getUseSBACRD() ) 1680 1690 { 1681 1691 pcSbacCoders[uiSubStrm].load(m_pcSbacCoder); //load back status of the entropy coder after encoding the LCU into relevant bitstream entropy coder 1682 1692 1683 1693 1684 1694 //Store probabilties of second LCU in line into buffer … … 1733 1743 UInt uiNumberOfCUsInFrame = rpcPic->getNumCUsInFrame(); 1734 1744 uiBoundingCUAddrSlice = uiNumberOfCUsInFrame; 1735 if (bEncodeSlice) 1745 if (bEncodeSlice) 1736 1746 { 1737 1747 UInt uiCUAddrIncrement; … … 1769 1779 uiBoundingCUAddrSlice = uiNumberOfCUsInFrame*rpcPic->getNumPartInCU(); 1770 1780 break; 1771 } 1781 } 1772 1782 // WPP: if a slice does not start at the beginning of a CTB row, it must end within the same CTB row 1773 1783 if (pcSlice->getPPS()->getNumSubstreams() > 1 && (uiStartCUAddrSlice % (rpcPic->getFrameWidthInCU()*rpcPic->getNumPartInCU()) != 0)) … … 1809 1819 uiBoundingCUAddrSlice = uiNumberOfCUsInFrame*rpcPic->getNumPartInCU(); 1810 1820 break; 1811 } 1821 } 1812 1822 // WPP: if a slice does not start at the beginning of a CTB row, it must end within the same CTB row 1813 1823 if (pcSlice->getPPS()->getNumSubstreams() > 1 && (uiStartCUAddrSlice % (rpcPic->getFrameWidthInCU()*rpcPic->getNumPartInCU()) != 0)) … … 1819 1829 1820 1830 Bool tileBoundary = false; 1821 if ((m_pcCfg->getSliceMode() == FIXED_NUMBER_OF_LCU || m_pcCfg->getSliceMode() == FIXED_NUMBER_OF_BYTES) && 1831 if ((m_pcCfg->getSliceMode() == FIXED_NUMBER_OF_LCU || m_pcCfg->getSliceMode() == FIXED_NUMBER_OF_BYTES) && 1822 1832 (m_pcCfg->getNumRowsMinus1() > 0 || m_pcCfg->getNumColumnsMinus1() > 0)) 1823 1833 { … … 1832 1842 } 1833 1843 tileBoundingCUAddrSlice = lcuEncAddr*rpcPic->getNumPartInCU(); 1834 1844 1835 1845 if (tileBoundingCUAddrSlice < uiBoundingCUAddrSlice) 1836 1846 { … … 1845 1855 startCUAddrSliceSegment = pcSlice->getSliceSegmentCurStartCUAddr(); 1846 1856 boundingCUAddrSliceSegment = uiNumberOfCUsInFrame; 1847 if (bEncodeSlice) 1857 if (bEncodeSlice) 1848 1858 { 1849 1859 UInt uiCUAddrIncrement; … … 1880 1890 boundingCUAddrSliceSegment = uiNumberOfCUsInFrame*rpcPic->getNumPartInCU(); 1881 1891 break; 1882 } 1892 } 1883 1893 // WPP: if a slice segment does not start at the beginning of a CTB row, it must end within the same CTB row 1884 1894 if (pcSlice->getPPS()->getNumSubstreams() > 1 && (startCUAddrSliceSegment % (rpcPic->getFrameWidthInCU()*rpcPic->getNumPartInCU()) != 0)) … … 1919 1929 boundingCUAddrSliceSegment = uiNumberOfCUsInFrame*rpcPic->getNumPartInCU(); 1920 1930 break; 1921 } 1931 } 1922 1932 // WPP: if a slice segment does not start at the beginning of a CTB row, it must end within the same CTB row 1923 1933 if (pcSlice->getPPS()->getNumSubstreams() > 1 && (startCUAddrSliceSegment % (rpcPic->getFrameWidthInCU()*rpcPic->getNumPartInCU()) != 0)) … … 1927 1937 pcSlice->setSliceSegmentCurEndCUAddr( boundingCUAddrSliceSegment ); 1928 1938 } 1929 if ((m_pcCfg->getSliceSegmentMode() == FIXED_NUMBER_OF_LCU || m_pcCfg->getSliceSegmentMode() == FIXED_NUMBER_OF_BYTES) && 1939 if ((m_pcCfg->getSliceSegmentMode() == FIXED_NUMBER_OF_LCU || m_pcCfg->getSliceSegmentMode() == FIXED_NUMBER_OF_BYTES) && 1930 1940 (m_pcCfg->getNumRowsMinus1() > 0 || m_pcCfg->getNumColumnsMinus1() > 0)) 1931 1941 { … … 1979 1989 } 1980 1990 UInt uiRealStartAddress = rpcPic->getPicSym()->getPicSCUEncOrder(uiExternalAddress*rpcPic->getNumPartInCU()+uiInternalAddress); 1981 1991 1982 1992 pcSlice->setSliceSegmentCurStartCUAddr(uiRealStartAddress); 1983 1993 startCUAddrSliceSegment=uiRealStartAddress; 1984 1994 1985 1995 //calculate real slice start address 1986 1996 uiInternalAddress = rpcPic->getPicSym()->getPicSCUAddr(pcSlice->getSliceCurStartCUAddr()) % rpcPic->getNumPartInCU(); … … 2007 2017 } 2008 2018 uiRealStartAddress = rpcPic->getPicSym()->getPicSCUEncOrder(uiExternalAddress*rpcPic->getNumPartInCU()+uiInternalAddress); 2009 2019 2010 2020 pcSlice->setSliceCurStartCUAddr(uiRealStartAddress); 2011 2021 uiStartCUAddrSlice=uiRealStartAddress; 2012 2022 2013 2023 // Make a joint decision based on reconstruction and dependent slice bounds 2014 2024 startCUAddr = max(uiStartCUAddrSlice , startCUAddrSliceSegment ); … … 2022 2032 if ( (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_LCU && m_pcCfg->getSliceSegmentMode()==FIXED_NUMBER_OF_LCU) 2023 2033 || (m_pcCfg->getSliceMode()==0 && m_pcCfg->getSliceSegmentMode()==FIXED_NUMBER_OF_LCU) 2024 || (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_LCU && m_pcCfg->getSliceSegmentMode()==0) 2034 || (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_LCU && m_pcCfg->getSliceSegmentMode()==0) 2025 2035 || (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_TILES && m_pcCfg->getSliceSegmentMode()==FIXED_NUMBER_OF_LCU) 2026 || (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_TILES && m_pcCfg->getSliceSegmentMode()==0) 2036 || (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_TILES && m_pcCfg->getSliceSegmentMode()==0) 2027 2037 || (m_pcCfg->getSliceSegmentMode()==FIXED_NUMBER_OF_TILES && m_pcCfg->getSliceMode()==0) 2028 2038 || tileBoundary
Note: See TracChangeset for help on using the changeset viewer.