Changeset 1287 in SHVCSoftware for branches/SHM-dev/source/Lib/TLibEncoder/TEncSlice.cpp
- Timestamp:
- 17 Jul 2015, 05:43:37 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified branches/SHM-dev/source/Lib/TLibEncoder/TEncSlice.cpp ¶
r1260 r1287 171 171 172 172 // store lambda 173 m_pcRdCost ->setLambda( dLambda ); 173 #if SVC_EXTENSION 174 m_pcRdCost ->setLambda( dLambda, slice->getBitDepths() ); 175 #else 176 m_pcRdCost ->setLambda( dLambda, slice->getSPS()->getBitDepths() ); 177 #endif 174 178 175 179 // for RDO … … 187 191 { 188 192 dLambdas[0] = dLambda * 1.1; 189 m_pcRdCost->setLambda( dLambdas[0] );193 m_pcRdCost->setLambda( dLambdas[0], slice->getBitDepths() ); 190 194 191 195 m_pcRdCost->setDistortionWeight(compID, tmpWeight * 1.15); … … 227 231 \param iGOPid POC offset for hierarchical structure 228 232 \param rpcSlice slice header class 229 \param pSPS SPS associated with the slice230 \param pPPS PPS associated with the slice231 233 \param isField true for field coding 232 234 */ 233 #if SVC_EXTENSION 235 234 236 Void TEncSlice::initEncSlice( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, Int iGOPid, TComSlice*& rpcSlice, Bool isField ) 235 #else236 Void TEncSlice::initEncSlice( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, Int iGOPid, TComSlice*& rpcSlice, const TComSPS* pSPS, const TComPPS *pPPS, Bool isField )237 #endif238 237 { 239 238 Double dQP; … … 351 350 { 352 351 #if SVC_EXTENSION 353 if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getQpBDOffset Y() ) && (rpcSlice->getPPS()->getTransquantBypassEnableFlag())))352 if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getQpBDOffset(CHANNEL_TYPE_LUMA) ) && (rpcSlice->getPPS()->getTransquantBypassEnableFlag()))) 354 353 #else 355 354 if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA) ) && (rpcSlice->getPPS()->getTransquantBypassEnableFlag()))) … … 393 392 394 393 #if FULL_NBIT 395 Int bitdepth_luma_qp_scale = 6 * (g_bitDepth[CHANNEL_TYPE_LUMA] - 8); 394 #if SVC_EXTENSION 395 Int bitdepth_luma_qp_scale = 6 * (rpcSlice->getBitDepth(CHANNEL_TYPE_LUMA) - 8); 396 #else 397 Int bitdepth_luma_qp_scale = 6 * (rpcSlice->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) - 8); 398 #endif 396 399 #else 397 400 Int bitdepth_luma_qp_scale = 0; … … 425 428 426 429 #if SVC_EXTENSION 427 iQP = max( -rpcSlice->getQpBDOffset Y(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );428 #else 429 iQP = max( - pSPS->getQpBDOffset(CHANNEL_TYPE_LUMA), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );430 iQP = max( -rpcSlice->getQpBDOffset(CHANNEL_TYPE_LUMA), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) ); 431 #else 432 iQP = max( -rpcSlice->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) ); 430 433 #endif 431 434 … … 486 489 dQP = xGetQPValueAccordingToLambda( dLambda ); 487 490 #if SVC_EXTENSION 488 iQP = max( -rpcSlice->getQpBDOffset Y(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );489 #else 490 iQP = max( - pSPS->getQpBDOffset(CHANNEL_TYPE_LUMA), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );491 iQP = max( -rpcSlice->getQpBDOffset(CHANNEL_TYPE_LUMA), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) ); 492 #else 493 iQP = max( -rpcSlice->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) ); 491 494 #endif 492 495 } … … 499 502 rpcSlice->setSliceChromaQpDelta( COMPONENT_Cb, 0 ); 500 503 rpcSlice->setSliceChromaQpDelta( COMPONENT_Cr, 0 ); 501 rpcSlice->setUseChromaQpAdj( pPPS->getChromaQpAdjTableSize() > 0 );504 rpcSlice->setUseChromaQpAdj( rpcSlice->getPPS()->getChromaQpAdjTableSize() > 0 ); 502 505 rpcSlice->setNumRefIdx(REF_PIC_LIST_0,m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive); 503 506 rpcSlice->setNumRefIdx(REF_PIC_LIST_1,m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive); … … 644 647 Double dFrameLambda; 645 648 #if FULL_NBIT 646 Int SHIFT_QP = 12 + 6 * (g_bitDepth[CHANNEL_TYPE_LUMA] - 8); 649 #if SVC_EXTENSION 650 Int SHIFT_QP = 12 + 6 * (pcSlice->getBitDepth(CHANNEL_TYPE_LUMA) - 8); 651 #else 652 Int SHIFT_QP = 12 + 6 * (pcSlice->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) - 8); 653 #endif 647 654 #else 648 655 Int SHIFT_QP = 12; … … 706 713 Void TEncSlice::calCostSliceI(TComPic* pcPic) 707 714 { 708 UInt ctuRsAddr; 709 UInt startCtuTsAddr; 710 UInt boundingCtuTsAddr; 711 Int iSumHad, shift = g_bitDepth[CHANNEL_TYPE_LUMA]-8, offset = (shift>0)?(1<<(shift-1)):0;; 712 Double iSumHadSlice = 0; 713 714 pcPic->getSlice(getSliceIdx())->setSliceSegmentBits(0); 715 TComSlice* pcSlice = pcPic->getSlice(getSliceIdx()); 715 Double iSumHadSlice = 0; 716 TComSlice * const pcSlice = pcPic->getSlice(getSliceIdx()); 717 const TComSPS &sps = *(pcSlice->getSPS()); 718 #if SVC_EXTENSION 719 const Int shift = pcSlice->getBitDepth(CHANNEL_TYPE_LUMA)-8; 720 #else 721 const Int shift = sps.getBitDepth(CHANNEL_TYPE_LUMA)-8; 722 #endif 723 const Int offset = (shift>0)?(1<<(shift-1)):0; 724 725 pcSlice->setSliceSegmentBits(0); 726 727 UInt startCtuTsAddr, boundingCtuTsAddr; 716 728 xDetermineStartAndBoundingCtuTsAddr ( startCtuTsAddr, boundingCtuTsAddr, pcPic, false ); 717 729 718 UInt ctuTsAddr;719 ctuRsAddr = pcPic->getPicSym()->getCtuTsToRsAddrMap( startCtuTsAddr);720 for( ctuTsAddr = startCtuTsAddr; ctuTsAddr < boundingCtuTsAddr;ctuRsAddr = pcPic->getPicSym()->getCtuTsToRsAddrMap(++ctuTsAddr) )730 for( UInt ctuTsAddr = startCtuTsAddr, ctuRsAddr = pcPic->getPicSym()->getCtuTsToRsAddrMap( startCtuTsAddr); 731 ctuTsAddr < boundingCtuTsAddr; 732 ctuRsAddr = pcPic->getPicSym()->getCtuTsToRsAddrMap(++ctuTsAddr) ) 721 733 { 722 734 // initialize CU encoder … … 725 737 726 738 #if SVC_EXTENSION 727 Int height = min( pcSlice->getSPS()->getMaxCUHeight(),pcSlice->getPicHeightInLumaSamples() - ctuRsAddr / pcPic->getFrameWidthInCtus() * pcSlice->getSPS()->getMaxCUHeight() );728 Int width = min( pcSlice->getSPS()->getMaxCUWidth(),pcSlice->getPicWidthInLumaSamples() - ctuRsAddr % pcPic->getFrameWidthInCtus() * pcSlice->getSPS()->getMaxCUWidth() );729 #else 730 Int height = min( pcSlice->getSPS()->getMaxCUHeight(),pcSlice->getSPS()->getPicHeightInLumaSamples() - ctuRsAddr / pcPic->getFrameWidthInCtus() * pcSlice->getSPS()->getMaxCUHeight() );731 Int width = min( pcSlice->getSPS()->getMaxCUWidth(),pcSlice->getSPS()->getPicWidthInLumaSamples() - ctuRsAddr % pcPic->getFrameWidthInCtus() * pcSlice->getSPS()->getMaxCUWidth() );732 #endif 733 734 iSumHad = m_pcCuEncoder->updateCtuDataISlice(pCtu, width, height);739 Int height = min( sps.getMaxCUHeight(),pcSlice->getPicHeightInLumaSamples() - ctuRsAddr / pcPic->getFrameWidthInCtus() * sps.getMaxCUHeight() ); 740 Int width = min( sps.getMaxCUWidth(),pcSlice->getPicWidthInLumaSamples() - ctuRsAddr % pcPic->getFrameWidthInCtus() * sps.getMaxCUWidth() ); 741 #else 742 Int height = min( sps.getMaxCUHeight(),sps.getPicHeightInLumaSamples() - ctuRsAddr / pcPic->getFrameWidthInCtus() * sps.getMaxCUHeight() ); 743 Int width = min( sps.getMaxCUWidth(), sps.getPicWidthInLumaSamples() - ctuRsAddr % pcPic->getFrameWidthInCtus() * sps.getMaxCUWidth() ); 744 #endif 745 746 Int iSumHad = m_pcCuEncoder->updateCtuDataISlice(pCtu, width, height); 735 747 736 748 (m_pcRateCtrl->getRCPic()->getLCU(ctuRsAddr)).m_costIntra=(iSumHad+offset)>>shift; … … 901 913 902 914 #if SVC_EXTENSION 903 estQP = Clip3( -pcSlice->getQpBDOffsetY(), MAX_QP, estQP ); 915 estQP = Clip3( -pcSlice->getQpBDOffset(CHANNEL_TYPE_LUMA), MAX_QP, estQP ); 916 917 m_pcRdCost->setLambda(estLambda, pcSlice->getBitDepths()); 904 918 #else 905 919 estQP = Clip3( -pcSlice->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA), MAX_QP, estQP ); 906 #endif 907 908 m_pcRdCost->setLambda(estLambda); 920 921 m_pcRdCost->setLambda(estLambda, pcSlice->getSPS()->getBitDepths()); 922 #endif 909 923 910 924 #if RDOQ_CHROMA_LAMBDA … … 1000 1014 actualQP = pCtu->getQP( 0 ); 1001 1015 } 1002 m_pcRdCost->setLambda(oldLambda); 1016 #if SVC_EXTENSION 1017 m_pcRdCost->setLambda(oldLambda, pcSlice->getBitDepths()); 1018 #else 1019 m_pcRdCost->setLambda(oldLambda, pcSlice->getSPS()->getBitDepths()); 1020 #endif 1003 1021 m_pcRateCtrl->getRCPic()->updateAfterCTU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda, 1004 1022 pCtu->getSlice()->getSliceType() == I_SLICE ? 0 : m_pcCfg->getLCULevelRC() ); … … 1158 1176 1159 1177 #if SVC_EXTENSION 1160 m_pcEntropyCoder->encodeSAOBlkParam(saoblkParam, m_ppcTEncTop[pcSlice->getLayerIdx()]->getSAO()->getSaoMaxOffsetQVal(), sliceEnabled, leftMergeAvail, aboveMergeAvail);1161 #else 1162 m_pcEntropyCoder->encodeSAOBlkParam(saoblkParam, sliceEnabled, leftMergeAvail, aboveMergeAvail);1178 m_pcEntropyCoder->encodeSAOBlkParam(saoblkParam, pcPic->getPicSym()->getSlice(0)->getBitDepths(), sliceEnabled, leftMergeAvail, aboveMergeAvail); 1179 #else 1180 m_pcEntropyCoder->encodeSAOBlkParam(saoblkParam, pcPic->getPicSym()->getSPS().getBitDepths(), sliceEnabled, leftMergeAvail, aboveMergeAvail); 1163 1181 #endif 1164 1182 } … … 1364 1382 { 1365 1383 xCalcACDCParamSlice(pcSlice); 1366 WPACDCParam * temp_weightACDCParam;1367 1368 pcSlice->getWpAcDcParam(temp_weightACDCParam);1369 g_refWeightACDCParam = (void *) temp_weightACDCParam;1370 1384 } 1371 1385 #endif //SVC_EXTENSION
Note: See TracChangeset for help on using the changeset viewer.