Changeset 494 in SHVCSoftware for trunk/source/Lib/TLibEncoder/TEncSlice.cpp
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/SHM-4.0-dev (added) merged: 444-493
- Property svn:mergeinfo changed
-
trunk/source
- Property svn:mergeinfo changed
/branches/SHM-4.0-dev/source (added) merged: 445-471,473-479,481-486,488-493
- Property svn:mergeinfo changed
-
trunk/source/Lib/TLibEncoder/TEncSlice.cpp
r442 r494 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 81 #if AUXILIARY_PICTURES 82 Void TEncSlice::create( Int iWidth, Int iHeight, ChromaFormat chromaFormat, UInt iMaxCUWidth, UInt iMaxCUHeight, UChar uhTotalDepth ) 83 { 84 // create prediction picture 85 if ( m_apcPicYuvPred == NULL ) 86 { 87 m_apcPicYuvPred = new TComPicYuv; 88 m_apcPicYuvPred->create( iWidth, iHeight, chromaFormat, iMaxCUWidth, iMaxCUHeight, uhTotalDepth ); 89 } 90 91 // create residual picture 92 if( m_apcPicYuvResi == NULL ) 93 { 94 m_apcPicYuvResi = new TComPicYuv; 95 m_apcPicYuvResi->create( iWidth, iHeight, chromaFormat, iMaxCUWidth, iMaxCUHeight, uhTotalDepth ); 96 } 97 } 98 #else 81 99 Void TEncSlice::create( Int iWidth, Int iHeight, UInt iMaxCUWidth, UInt iMaxCUHeight, UChar uhTotalDepth ) 82 100 { … … 87 105 m_apcPicYuvPred->create( iWidth, iHeight, iMaxCUWidth, iMaxCUHeight, uhTotalDepth ); 88 106 } 89 107 90 108 // create residual picture 91 109 if( m_apcPicYuvResi == NULL ) … … 95 113 } 96 114 } 115 #endif 97 116 98 117 Void TEncSlice::destroy() … … 105 124 m_apcPicYuvPred = NULL; 106 125 } 107 126 108 127 // destroy residual picture 109 128 if ( m_apcPicYuvResi ) … … 113 132 m_apcPicYuvResi = NULL; 114 133 } 115 134 116 135 // free lambda and QP arrays 117 136 if ( m_pdRdPicLambda ) { xFree( m_pdRdPicLambda ); m_pdRdPicLambda = NULL; } … … 139 158 #if SVC_EXTENSION 140 159 m_ppcTEncTop = pcEncTop->getLayerEnc(); 141 #endif 160 #endif 142 161 m_pcGOPEncoder = pcEncTop->getGOPEncoder(); 143 162 m_pcCuEncoder = pcEncTop->getCuEncoder(); 144 163 m_pcPredSearch = pcEncTop->getPredSearch(); 145 164 146 165 m_pcEntropyCoder = pcEncTop->getEntropyCoder(); 147 166 m_pcCavlcCoder = pcEncTop->getCavlcCoder(); … … 149 168 m_pcBinCABAC = pcEncTop->getBinCABAC(); 150 169 m_pcTrQuant = pcEncTop->getTrQuant(); 151 170 152 171 m_pcBitCounter = pcEncTop->getBitCounter(); 153 172 m_pcRdCost = pcEncTop->getRdCost(); 154 173 m_pppcRDSbacCoder = pcEncTop->getRDSbacCoder(); 155 174 m_pcRDGoOnSbacCoder = pcEncTop->getRDGoOnSbacCoder(); 156 175 157 176 // create lambda and QP arrays 158 177 m_pdRdPicLambda = (Double*)xMalloc( Double, m_pcCfg->getDeltaQpRD() * 2 + 1 ); … … 187 206 Double dQP; 188 207 Double dLambda; 189 208 190 209 rpcSlice = pcPic->getSlice(0); 191 210 rpcSlice->setSPS( pSPS ); … … 202 221 rpcSlice->setPicOutputFlag( true ); 203 222 rpcSlice->setPOC( pocCurr ); 204 223 205 224 // depth computation based on GOP size 206 225 Int depth; … … 230 249 } 231 250 } 232 251 233 252 // slice type 234 253 SliceType eSliceType; 235 254 236 255 eSliceType=B_SLICE; 237 256 eSliceType = (pocLast == 0 || pocCurr % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType; 238 257 239 258 rpcSlice->setSliceType ( eSliceType ); 240 259 241 260 // ------------------------------------------------------------------------------------------------------------------ 242 261 // Non-referenced frame marking 243 262 // ------------------------------------------------------------------------------------------------------------------ 244 263 245 264 if(pocLast == 0) 246 265 { … … 252 271 } 253 272 rpcSlice->setReferenced(true); 254 273 255 274 // ------------------------------------------------------------------------------------------------------------------ 256 275 // QP setting 257 276 // ------------------------------------------------------------------------------------------------------------------ 258 277 259 278 dQP = m_pcCfg->getQP(); 260 279 if(eSliceType!=I_SLICE) 261 280 { 262 281 #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()))) 282 if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getQpBDOffsetY() ) && (rpcSlice->getSPS()->getUseLossless()))) 283 #else 284 if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getSPS()->getQpBDOffsetY() ) && (rpcSlice->getSPS()->getUseLossless()))) 266 285 #endif 267 286 { … … 269 288 } 270 289 } 271 290 272 291 // modify QP 273 292 Int* pdQPs = m_pcCfg->getdQPs(); … … 285 304 // Lambda computation 286 305 // ------------------------------------------------------------------------------------------------------------------ 287 306 288 307 Int iQP; 289 308 Double dOrigQP = dQP; … … 294 313 // compute QP value 295 314 dQP = dOrigQP + ((iDQpIdx+1)>>1)*(iDQpIdx%2 ? -1 : 1); 296 315 297 316 // compute lambda value 298 317 Int NumberBFrames = ( m_pcCfg->getGOPSize() - 1 ); … … 326 345 #endif 327 346 } 328 347 329 348 // if hadamard is used in ME process 330 349 if ( !m_pcCfg->getUseHADME() && rpcSlice->getSliceType( ) != I_SLICE ) … … 332 351 dLambda *= 0.95; 333 352 } 334 353 335 354 #if REPN_FORMAT_IN_VPS 336 355 iQP = max( -rpcSlice->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) ); … … 343 362 m_piRdPicQp [iDQpIdx] = iQP; 344 363 } 345 364 346 365 // obtain dQP = 0 case 347 366 dLambda = m_pdRdPicLambda[0]; 348 367 dQP = m_pdRdPicQp [0]; 349 368 iQP = m_piRdPicQp [0]; 350 369 351 370 if( rpcSlice->getSliceType( ) != I_SLICE ) 352 371 { … … 359 378 Int nCurLayer = rpcSlice->getLayerId(); 360 379 Double gamma = xCalEnhLambdaFactor( m_ppcTEncTop[nCurLayer-1]->getQP() - m_ppcTEncTop[nCurLayer]->getQP() , 361 1.0 * m_ppcTEncTop[nCurLayer]->getSourceWidth() * m_ppcTEncTop[nCurLayer]->getSourceHeight() 380 1.0 * m_ppcTEncTop[nCurLayer]->getSourceWidth() * m_ppcTEncTop[nCurLayer]->getSourceHeight() 362 381 / m_ppcTEncTop[nCurLayer-1]->getSourceWidth() / m_ppcTEncTop[nCurLayer-1]->getSourceHeight() ); 363 382 dLambda *= gamma; … … 392 411 #endif 393 412 394 #if RDOQ_CHROMA_LAMBDA 413 #if RDOQ_CHROMA_LAMBDA 395 414 // for RDOQ 396 m_pcTrQuant->setLambda( dLambda, dLambda / weight ); 415 m_pcTrQuant->setLambda( dLambda, dLambda / weight ); 397 416 #else 398 417 m_pcTrQuant->setLambda( dLambda ); … … 401 420 #if SAO_CHROMA_LAMBDA 402 421 // For SAO 403 rpcSlice ->setLambda( dLambda, dLambda / weight ); 422 rpcSlice ->setLambda( dLambda, dLambda / weight ); 404 423 #else 405 424 rpcSlice ->setLambda( dLambda ); 406 425 #endif 407 426 408 427 #if HB_LAMBDA_FOR_LDC 409 428 // restore original slice type 410 429 eSliceType = (pocLast == 0 || pocCurr % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType; 411 430 412 431 #if SVC_EXTENSION 413 432 if(m_pcCfg->getLayerId() > 0) … … 418 437 rpcSlice->setSliceType ( eSliceType ); 419 438 #endif 420 439 421 440 if (m_pcCfg->getUseRecalculateQPAccordingToLambda()) 422 441 { 423 442 dQP = xGetQPValueAccordingToLambda( dLambda ); 424 443 #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 ) ) ); 444 iQP = max( -rpcSlice->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) ); 445 #else 446 iQP = max( -pSPS->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) ); 428 447 #endif 429 448 } … … 438 457 rpcSlice->setNumRefIdx(REF_PIC_LIST_0,m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive); 439 458 rpcSlice->setNumRefIdx(REF_PIC_LIST_1,m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive); 440 459 441 460 if ( m_pcCfg->getDeblockingFilterMetric() ) 442 461 { … … 479 498 480 499 rpcSlice->setDepth ( depth ); 481 500 482 501 pcPic->setTLayer( m_pcCfg->getGOPEntry(iGOPid).m_temporalId ); 483 #if TEMP_SCALABILITY_FIX 484 if((eSliceType==I_SLICE) || (rpcSlice->getPOC() == 0)) 485 #else 502 486 503 if(eSliceType==I_SLICE) 487 #endif488 504 { 489 505 pcPic->setTLayer(0); … … 493 509 assert( m_apcPicYuvPred ); 494 510 assert( m_apcPicYuvResi ); 495 511 496 512 pcPic->setPicYuvPred( m_apcPicYuvPred ); 497 513 pcPic->setPicYuvResi( m_apcPicYuvResi ); … … 557 573 #endif 558 574 559 #if RDOQ_CHROMA_LAMBDA 575 #if RDOQ_CHROMA_LAMBDA 560 576 // for RDOQ 561 577 m_pcTrQuant->setLambda( lambda, lambda / weight ); … … 665 681 #endif 666 682 667 #if RDOQ_CHROMA_LAMBDA 683 #if RDOQ_CHROMA_LAMBDA 668 684 // for RDOQ 669 m_pcTrQuant->setLambda( lambda, lambda / weight ); 685 m_pcTrQuant->setLambda( lambda, lambda / weight ); 670 686 #else 671 687 m_pcTrQuant->setLambda( lambda ); … … 674 690 #if SAO_CHROMA_LAMBDA 675 691 // For SAO 676 pcSlice ->setLambda( lambda, lambda / weight ); 692 pcSlice ->setLambda( lambda, lambda / weight ); 677 693 #else 678 694 pcSlice ->setLambda( lambda ); … … 692 708 Int iMaxSR = m_pcCfg->getSearchRange(); 693 709 Int iNumPredDir = pcSlice->isInterP() ? 1 : 2; 694 710 695 711 for (Int iDir = 0; iDir <= iNumPredDir; iDir++) 696 712 { … … 726 742 } 727 743 #endif 728 744 729 745 TComSlice* pcSlice = rpcPic->getSlice(getSliceIdx()); 730 746 Double dPicRdCostBest = MAX_DOUBLE; 731 747 UInt uiQpIdxBest = 0; 732 748 733 749 Double dFrameLambda; 734 750 #if FULL_NBIT … … 737 753 Int SHIFT_QP = 12; 738 754 #endif 739 755 740 756 // set frame lambda 741 757 if (m_pcCfg->getGOPSize() > 1) … … 748 764 } 749 765 m_pcRdCost ->setFrameLambda(dFrameLambda); 750 766 751 767 // for each QP candidate 752 768 for ( UInt uiQpIdx = 0; uiQpIdx < 2 * m_pcCfg->getDeltaQpRD() + 1; uiQpIdx++ ) … … 776 792 #endif 777 793 778 #if RDOQ_CHROMA_LAMBDA 794 #if RDOQ_CHROMA_LAMBDA 779 795 // for RDOQ 780 796 m_pcTrQuant ->setLambda( m_pdRdPicLambda[uiQpIdx], m_pdRdPicLambda[uiQpIdx] / weight ); … … 784 800 #if SAO_CHROMA_LAMBDA 785 801 // For SAO 786 pcSlice ->setLambda ( m_pdRdPicLambda[uiQpIdx], m_pdRdPicLambda[uiQpIdx] / weight ); 802 pcSlice ->setLambda ( m_pdRdPicLambda[uiQpIdx], m_pdRdPicLambda[uiQpIdx] / weight ); 787 803 #else 788 804 pcSlice ->setLambda ( m_pdRdPicLambda[uiQpIdx] ); 789 805 #endif 790 806 791 807 // try compress 792 808 compressSlice ( rpcPic ); 793 809 794 810 Double dPicRdCost; 795 811 UInt64 uiPicDist = m_uiPicDist; 796 812 UInt64 uiALFBits = 0; 797 813 798 814 m_pcGOPEncoder->preLoopFilterPicAll( rpcPic, uiPicDist, uiALFBits ); 799 815 800 816 // compute RD cost and choose the best 801 817 dPicRdCost = m_pcRdCost->calcRdCost64( m_uiPicTotalBits + uiALFBits, uiPicDist, true, DF_SSE_FRAME); 802 818 803 819 if ( dPicRdCost < dPicRdCostBest ) 804 820 { … … 807 823 } 808 824 } 809 825 810 826 // set best values 811 827 pcSlice ->setSliceQp ( m_piRdPicQp [uiQpIdxBest] ); … … 832 848 #endif 833 849 834 #if RDOQ_CHROMA_LAMBDA 835 // for RDOQ 836 m_pcTrQuant ->setLambda( m_pdRdPicLambda[uiQpIdxBest], m_pdRdPicLambda[uiQpIdxBest] / weight ); 850 #if RDOQ_CHROMA_LAMBDA 851 // for RDOQ 852 m_pcTrQuant ->setLambda( m_pdRdPicLambda[uiQpIdxBest], m_pdRdPicLambda[uiQpIdxBest] / weight ); 837 853 #else 838 854 m_pcTrQuant ->setLambda ( m_pdRdPicLambda[uiQpIdxBest] ); … … 840 856 #if SAO_CHROMA_LAMBDA 841 857 // For SAO 842 pcSlice ->setLambda ( m_pdRdPicLambda[uiQpIdxBest], m_pdRdPicLambda[uiQpIdxBest] / weight ); 858 pcSlice ->setLambda ( m_pdRdPicLambda[uiQpIdxBest], m_pdRdPicLambda[uiQpIdxBest] / weight ); 843 859 #else 844 860 pcSlice ->setLambda ( m_pdRdPicLambda[uiQpIdxBest] ); … … 862 878 863 879 UInt uiEncCUOrder; 864 uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU()); 880 uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU()); 865 881 for( uiEncCUOrder = uiStartCUAddr/rpcPic->getNumPartInCU(); 866 882 uiEncCUOrder < (uiBoundingCUAddr+(rpcPic->getNumPartInCU()-1))/rpcPic->getNumPartInCU(); … … 898 914 TComSlice* pcSlice = rpcPic->getSlice(getSliceIdx()); 899 915 xDetermineStartAndBoundingCUAddr ( uiStartCUAddr, uiBoundingCUAddr, rpcPic, false ); 900 916 901 917 // initialize cost values 902 918 m_uiPicTotalBits = 0; 903 919 m_dPicRdCost = 0; 904 920 m_uiPicDist = 0; 905 921 906 922 // set entropy coder 907 923 if( m_pcCfg->getUseSBACRD() ) … … 921 937 m_pcEntropyCoder->setBitstream ( m_pcBitCounter ); 922 938 } 923 939 924 940 //------------------------------------------------------------------------------ 925 941 // Weighted Prediction parameters estimation. … … 930 946 xCalcACDCParamSlice(pcSlice); 931 947 } 948 #if O0194_WEIGHTED_PREDICTION_CGS 949 else 950 { 951 // Calculate for the base layer to be used in EL as Inter layer reference 952 estimateILWpParam( pcSlice ); 953 } 954 #endif 932 955 933 956 Bool bWp_explicit = (pcSlice->getSliceType()==P_SLICE && pcSlice->getPPS()->getUseWP()) || (pcSlice->getSliceType()==B_SLICE && pcSlice->getPPS()->getWPBiPred()); … … 1021 1044 m_pcBufferSbacCoders[uiTileCol].loadContexts( CTXMem[1] ); 1022 1045 Int iNumSubstreamsPerTile = iNumSubstreams/rpcPic->getPicSym()->getNumTiles(); 1023 uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU()); 1046 uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU()); 1024 1047 uiLin = uiCUAddr / uiWidthInLCUs; 1025 1048 uiSubStrm = rpcPic->getPicSym()->getTileIdxMap(rpcPic->getPicSym()->getCUOrderMap(uiCUAddr))*iNumSubstreamsPerTile … … 1098 1121 pcCUTR = rpcPic->getCU( uiCUAddr - uiWidthInCU + 1 ); 1099 1122 } 1100 if ( ((pcCUTR==NULL) || (pcCUTR->getSlice()==NULL) || 1123 if ( ((pcCUTR==NULL) || (pcCUTR->getSlice()==NULL) || 1101 1124 (pcCUTR->getSCUAddr()+uiMaxParts-1 < pcSlice->getSliceCurStartCUAddr()) || 1102 1125 ((rpcPic->getPicSym()->getTileIdxMap( pcCUTR->getAddr() ) != rpcPic->getPicSym()->getTileIdxMap(uiCUAddr))) … … 1137 1160 m_pcEntropyCoder->setEntropyCoder ( m_pcRDGoOnSbacCoder, pcSlice ); 1138 1161 m_pcEntropyCoder->setBitstream( &pcBitCounters[uiSubStrm] ); 1139 1162 1140 1163 ((TEncBinCABAC*)m_pcRDGoOnSbacCoder->getEncBinIf())->setBinCountingEnableFlag(true); 1141 1164 … … 1242 1265 m_pcRdCost->setLambda(oldLambda); 1243 1266 #if RATE_CONTROL_INTRA 1244 m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda, 1267 m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda, 1245 1268 pcCU->getSlice()->getSliceType() == I_SLICE ? 0 : m_pcCfg->getLCULevelRC() ); 1246 1269 #else … … 1250 1273 #endif 1251 1274 #endif 1252 1275 1253 1276 // restore entropy coder to an initial stage 1254 1277 m_pcEntropyCoder->setEntropyCoder ( m_pppcRDSbacCoder[0][CI_CURR_BEST], pcSlice ); … … 1275 1298 { 1276 1299 ppppcRDSbacCoders[uiSubStrm][0][CI_CURR_BEST]->load( m_pppcRDSbacCoder[0][CI_CURR_BEST] ); 1277 1300 1278 1301 //Store probabilties of second LCU in line into buffer 1279 1302 if ( ( uiCol == uiTileLCUX+1) && (depSliceSegmentsEnabled || (pcSlice->getPPS()->getNumSubstreams() > 1)) && m_pcCfg->getWaveFrontsynchro()) … … 1325 1348 1326 1349 #if RATE_CONTROL_INTRA 1327 m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda, 1350 m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda, 1328 1351 pcCU->getSlice()->getSliceType() == I_SLICE ? 0 : m_pcCfg->getLCULevelRC() ); 1329 1352 #else … … 1350 1373 } 1351 1374 } 1352 1375 1353 1376 m_uiPicTotalBits += pcCU->getTotalBits(); 1354 1377 m_dPicRdCost += pcCU->getTotalCost(); … … 1401 1424 m_pcEntropyCoder->setEntropyCoder ( m_pcSbacCoder, pcSlice ); 1402 1425 } 1403 1426 1404 1427 m_pcCuEncoder->setBitCounter( NULL ); 1405 1428 m_pcBitCounter = NULL; … … 1427 1450 m_pcBufferSbacCoders[ui].load(m_pcSbacCoder); //init. state 1428 1451 } 1429 1452 1430 1453 for (Int iSubstrmIdx=0; iSubstrmIdx < iNumSubstreams; iSubstrmIdx++) 1431 1454 { … … 1524 1547 } 1525 1548 if ( (true/*bEnforceSliceRestriction*/ && 1526 ((pcCUTR==NULL) || (pcCUTR->getSlice()==NULL) || 1549 ((pcCUTR==NULL) || (pcCUTR->getSlice()==NULL) || 1527 1550 (pcCUTR->getSCUAddr()+uiMaxParts-1 < pcSlice->getSliceCurStartCUAddr()) || 1528 1551 ((rpcPic->getPicSym()->getTileIdxMap( pcCUTR->getAddr() ) != rpcPic->getPicSym()->getTileIdxMap(uiCUAddr))) … … 1579 1602 } 1580 1603 1581 TComDataCU*& pcCU = rpcPic->getCU( uiCUAddr ); 1604 TComDataCU*& pcCU = rpcPic->getCU( uiCUAddr ); 1582 1605 if ( pcSlice->getSPS()->getUseSAO() && (pcSlice->getSaoEnabledFlag()||pcSlice->getSaoEnabledFlagChroma()) ) 1583 1606 { … … 1613 1636 if (allowMergeLeft) 1614 1637 { 1615 m_pcEntropyCoder->m_pcEntropyCoderIf->codeSaoMerge(mergeLeft); 1638 m_pcEntropyCoder->m_pcEntropyCoderIf->codeSaoMerge(mergeLeft); 1616 1639 } 1617 1640 else … … 1676 1699 #if ENC_DEC_TRACE 1677 1700 g_bJustDoIt = g_bEncDecTraceDisable; 1678 #endif 1701 #endif 1679 1702 if( m_pcCfg->getUseSBACRD() ) 1680 1703 { 1681 1704 pcSbacCoders[uiSubStrm].load(m_pcSbacCoder); //load back status of the entropy coder after encoding the LCU into relevant bitstream entropy coder 1682 1705 1683 1706 1684 1707 //Store probabilties of second LCU in line into buffer … … 1733 1756 UInt uiNumberOfCUsInFrame = rpcPic->getNumCUsInFrame(); 1734 1757 uiBoundingCUAddrSlice = uiNumberOfCUsInFrame; 1735 if (bEncodeSlice) 1758 if (bEncodeSlice) 1736 1759 { 1737 1760 UInt uiCUAddrIncrement; … … 1769 1792 uiBoundingCUAddrSlice = uiNumberOfCUsInFrame*rpcPic->getNumPartInCU(); 1770 1793 break; 1771 } 1794 } 1772 1795 // WPP: if a slice does not start at the beginning of a CTB row, it must end within the same CTB row 1773 1796 if (pcSlice->getPPS()->getNumSubstreams() > 1 && (uiStartCUAddrSlice % (rpcPic->getFrameWidthInCU()*rpcPic->getNumPartInCU()) != 0)) … … 1809 1832 uiBoundingCUAddrSlice = uiNumberOfCUsInFrame*rpcPic->getNumPartInCU(); 1810 1833 break; 1811 } 1834 } 1812 1835 // WPP: if a slice does not start at the beginning of a CTB row, it must end within the same CTB row 1813 1836 if (pcSlice->getPPS()->getNumSubstreams() > 1 && (uiStartCUAddrSlice % (rpcPic->getFrameWidthInCU()*rpcPic->getNumPartInCU()) != 0)) … … 1819 1842 1820 1843 Bool tileBoundary = false; 1821 if ((m_pcCfg->getSliceMode() == FIXED_NUMBER_OF_LCU || m_pcCfg->getSliceMode() == FIXED_NUMBER_OF_BYTES) && 1844 if ((m_pcCfg->getSliceMode() == FIXED_NUMBER_OF_LCU || m_pcCfg->getSliceMode() == FIXED_NUMBER_OF_BYTES) && 1822 1845 (m_pcCfg->getNumRowsMinus1() > 0 || m_pcCfg->getNumColumnsMinus1() > 0)) 1823 1846 { … … 1832 1855 } 1833 1856 tileBoundingCUAddrSlice = lcuEncAddr*rpcPic->getNumPartInCU(); 1834 1857 1835 1858 if (tileBoundingCUAddrSlice < uiBoundingCUAddrSlice) 1836 1859 { … … 1845 1868 startCUAddrSliceSegment = pcSlice->getSliceSegmentCurStartCUAddr(); 1846 1869 boundingCUAddrSliceSegment = uiNumberOfCUsInFrame; 1847 if (bEncodeSlice) 1870 if (bEncodeSlice) 1848 1871 { 1849 1872 UInt uiCUAddrIncrement; … … 1880 1903 boundingCUAddrSliceSegment = uiNumberOfCUsInFrame*rpcPic->getNumPartInCU(); 1881 1904 break; 1882 } 1905 } 1883 1906 // WPP: if a slice segment does not start at the beginning of a CTB row, it must end within the same CTB row 1884 1907 if (pcSlice->getPPS()->getNumSubstreams() > 1 && (startCUAddrSliceSegment % (rpcPic->getFrameWidthInCU()*rpcPic->getNumPartInCU()) != 0)) … … 1919 1942 boundingCUAddrSliceSegment = uiNumberOfCUsInFrame*rpcPic->getNumPartInCU(); 1920 1943 break; 1921 } 1944 } 1922 1945 // WPP: if a slice segment does not start at the beginning of a CTB row, it must end within the same CTB row 1923 1946 if (pcSlice->getPPS()->getNumSubstreams() > 1 && (startCUAddrSliceSegment % (rpcPic->getFrameWidthInCU()*rpcPic->getNumPartInCU()) != 0)) … … 1927 1950 pcSlice->setSliceSegmentCurEndCUAddr( boundingCUAddrSliceSegment ); 1928 1951 } 1929 if ((m_pcCfg->getSliceSegmentMode() == FIXED_NUMBER_OF_LCU || m_pcCfg->getSliceSegmentMode() == FIXED_NUMBER_OF_BYTES) && 1952 if ((m_pcCfg->getSliceSegmentMode() == FIXED_NUMBER_OF_LCU || m_pcCfg->getSliceSegmentMode() == FIXED_NUMBER_OF_BYTES) && 1930 1953 (m_pcCfg->getNumRowsMinus1() > 0 || m_pcCfg->getNumColumnsMinus1() > 0)) 1931 1954 { … … 1979 2002 } 1980 2003 UInt uiRealStartAddress = rpcPic->getPicSym()->getPicSCUEncOrder(uiExternalAddress*rpcPic->getNumPartInCU()+uiInternalAddress); 1981 2004 1982 2005 pcSlice->setSliceSegmentCurStartCUAddr(uiRealStartAddress); 1983 2006 startCUAddrSliceSegment=uiRealStartAddress; 1984 2007 1985 2008 //calculate real slice start address 1986 2009 uiInternalAddress = rpcPic->getPicSym()->getPicSCUAddr(pcSlice->getSliceCurStartCUAddr()) % rpcPic->getNumPartInCU(); … … 2007 2030 } 2008 2031 uiRealStartAddress = rpcPic->getPicSym()->getPicSCUEncOrder(uiExternalAddress*rpcPic->getNumPartInCU()+uiInternalAddress); 2009 2032 2010 2033 pcSlice->setSliceCurStartCUAddr(uiRealStartAddress); 2011 2034 uiStartCUAddrSlice=uiRealStartAddress; 2012 2035 2013 2036 // Make a joint decision based on reconstruction and dependent slice bounds 2014 2037 startCUAddr = max(uiStartCUAddrSlice , startCUAddrSliceSegment ); … … 2022 2045 if ( (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_LCU && m_pcCfg->getSliceSegmentMode()==FIXED_NUMBER_OF_LCU) 2023 2046 || (m_pcCfg->getSliceMode()==0 && m_pcCfg->getSliceSegmentMode()==FIXED_NUMBER_OF_LCU) 2024 || (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_LCU && m_pcCfg->getSliceSegmentMode()==0) 2047 || (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_LCU && m_pcCfg->getSliceSegmentMode()==0) 2025 2048 || (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) 2049 || (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_TILES && m_pcCfg->getSliceSegmentMode()==0) 2027 2050 || (m_pcCfg->getSliceSegmentMode()==FIXED_NUMBER_OF_TILES && m_pcCfg->getSliceMode()==0) 2028 2051 || tileBoundary … … 2066 2089 } 2067 2090 #endif 2091 #if O0194_WEIGHTED_PREDICTION_CGS 2092 Void TEncSlice::estimateILWpParam( TComSlice* pcSlice ) 2093 { 2094 xCalcACDCParamSlice(pcSlice); 2095 wpACDCParam * temp_weightACDCParam; 2096 2097 pcSlice->getWpAcDcParam(temp_weightACDCParam); 2098 g_refWeightACDCParam = (void *) temp_weightACDCParam; 2099 } 2100 #endif 2068 2101 //! \}
Note: See TracChangeset for help on using the changeset viewer.