Changeset 532 in SHVCSoftware for branches/SHM-4.1-dev/source/Lib/TLibEncoder/TEncSearch.cpp
- Timestamp:
- 2 Jan 2014, 07:21:30 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-4.1-dev/source/Lib/TLibEncoder/TEncSearch.cpp
r494 r532 720 720 Pel* piRefPos; 721 721 Int iRefStride = m_filteredBlock[0][0].getStride(); 722 #if NS_HAD723 m_pcRdCost->setDistParam( pcPatternKey, m_filteredBlock[0][0].getLumaAddr(), iRefStride, 1, m_cDistParam, m_pcEncCfg->getUseHADME(), m_pcEncCfg->getUseNSQT() );724 #else725 722 m_pcRdCost->setDistParam( pcPatternKey, m_filteredBlock[0][0].getLumaAddr(), iRefStride, 1, m_cDistParam, m_pcEncCfg->getUseHADME() ); 726 #endif727 723 728 724 const TComMv* pcMvRefine = (iFrac == 2 ? s_acMvRefineH : s_acMvRefineQ); … … 737 733 piRefPos = m_filteredBlock[ verVal & 3 ][ horVal & 3 ].getLumaAddr(); 738 734 if ( horVal == 2 && ( verVal & 1 ) == 0 ) 735 { 739 736 piRefPos += 1; 737 } 740 738 if ( ( horVal & 1 ) == 0 && verVal == 2 ) 739 { 741 740 piRefPos += iRefStride; 741 } 742 742 cMvTest = pcMvRefine[i]; 743 743 cMvTest += rcMvFrac; … … 774 774 UInt uiLog2TrafoSize = g_aucConvertToBit[pcCU->getSlice()->getSPS()->getMaxCUWidth()] + 2 - uiFullDepth; 775 775 776 { 777 if( pcCU->getPredictionMode(0) == MODE_INTRA && pcCU->getPartitionSize(0) == SIZE_NxN && uiTrDepth == 0 ) 778 { 779 assert( uiSubdiv ); 780 } 781 else if( uiLog2TrafoSize > pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() ) 782 { 783 assert( uiSubdiv ); 784 } 785 else if( uiLog2TrafoSize == pcCU->getSlice()->getSPS()->getQuadtreeTULog2MinSize() ) 786 { 787 assert( !uiSubdiv ); 788 } 789 else if( uiLog2TrafoSize == pcCU->getQuadtreeTULog2MinSizeInCU(uiAbsPartIdx) ) 790 { 791 assert( !uiSubdiv ); 792 } 793 else 794 { 795 assert( uiLog2TrafoSize > pcCU->getQuadtreeTULog2MinSizeInCU(uiAbsPartIdx) ); 796 if( bLuma ) 797 { 798 m_pcEntropyCoder->encodeTransformSubdivFlag( uiSubdiv, 5 - uiLog2TrafoSize ); 799 } 776 if( pcCU->getPredictionMode(0) == MODE_INTRA && pcCU->getPartitionSize(0) == SIZE_NxN && uiTrDepth == 0 ) 777 { 778 assert( uiSubdiv ); 779 } 780 else if( uiLog2TrafoSize > pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() ) 781 { 782 assert( uiSubdiv ); 783 } 784 else if( uiLog2TrafoSize == pcCU->getSlice()->getSPS()->getQuadtreeTULog2MinSize() ) 785 { 786 assert( !uiSubdiv ); 787 } 788 else if( uiLog2TrafoSize == pcCU->getQuadtreeTULog2MinSizeInCU(uiAbsPartIdx) ) 789 { 790 assert( !uiSubdiv ); 791 } 792 else 793 { 794 assert( uiLog2TrafoSize > pcCU->getQuadtreeTULog2MinSizeInCU(uiAbsPartIdx) ); 795 if( bLuma ) 796 { 797 m_pcEntropyCoder->encodeTransformSubdivFlag( uiSubdiv, 5 - uiLog2TrafoSize ); 800 798 } 801 799 } … … 806 804 { 807 805 if( uiTrDepth==0 || pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth-1 ) ) 806 { 808 807 m_pcEntropyCoder->encodeQtCbf( pcCU, uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth ); 808 } 809 809 if( uiTrDepth==0 || pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepth-1 ) ) 810 { 810 811 m_pcEntropyCoder->encodeQtCbf( pcCU, uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepth ); 812 } 811 813 } 812 814 } … … 822 824 } 823 825 824 { 825 //===== Cbfs ===== 826 if( bLuma ) 827 { 828 m_pcEntropyCoder->encodeQtCbf( pcCU, uiAbsPartIdx, TEXT_LUMA, uiTrMode ); 829 } 826 //===== Cbfs ===== 827 if( bLuma ) 828 { 829 m_pcEntropyCoder->encodeQtCbf( pcCU, uiAbsPartIdx, TEXT_LUMA, uiTrMode ); 830 830 } 831 831 } … … 944 944 } 945 945 } 946 947 946 if( bChroma ) 948 947 { … … 1306 1305 1307 1306 #if RDOQ_CHROMA_LAMBDA 1308 m_pcTrQuant->selectLambda (TEXT_CHROMA);1307 m_pcTrQuant->selectLambda(eText); 1309 1308 #endif 1310 1309 m_pcTrQuant->transformNxN ( pcCU, piResi, uiStride, pcCoeff, … … 1358 1357 1359 1358 //===== update distortion ===== 1360 #if WEIGHTED_CHROMA_DISTORTION1361 1359 ruiDist += m_pcRdCost->getDistPart(g_bitDepthC, piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight, eText ); 1362 #else1363 ruiDist += m_pcRdCost->getDistPart(g_bitDepthC, piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight );1364 #endif1365 1360 } 1366 1361 … … 2539 2534 2540 2535 for( Int j=0; j < numCand; j++) 2541 2542 2536 { 2543 2537 Bool mostProbableModeIncluded = false; … … 3039 3033 pcYuvOrg->getLumaAddr( uiAbsPartIdx ), pcYuvOrg->getStride(), 3040 3034 m_tmpYuvPred .getLumaAddr( uiAbsPartIdx ), m_tmpYuvPred .getStride(), 3041 #if NS_HAD3042 iWidth, iHeight, m_pcEncCfg->getUseHADME(), m_pcEncCfg->getUseNSQT() );3043 #else3044 3035 iWidth, iHeight, m_pcEncCfg->getUseHADME() ); 3045 #endif3046 3036 ruiErr = cDistParam.DistFunc( &cDistParam ); 3047 3037 } … … 3246 3236 3247 3237 UInt uiCostTempL0[MAX_NUM_REF]; 3248 for (Int iNumRef=0; iNumRef < MAX_NUM_REF; iNumRef++) uiCostTempL0[iNumRef] = MAX_UINT; 3238 for (Int iNumRef=0; iNumRef < MAX_NUM_REF; iNumRef++) 3239 { 3240 uiCostTempL0[iNumRef] = MAX_UINT; 3241 } 3249 3242 UInt uiBitsTempL0[MAX_NUM_REF]; 3250 3243 … … 3716 3709 { 3717 3710 uiLastMode = 2; 3718 { 3719 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMv( cMvBi[0], ePartSize, uiPartAddr, 0, iPartIdx ); 3720 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllRefIdx( iRefIdxBi[0], ePartSize, uiPartAddr, 0, iPartIdx ); 3721 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMv( cMvBi[1], ePartSize, uiPartAddr, 0, iPartIdx ); 3722 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllRefIdx( iRefIdxBi[1], ePartSize, uiPartAddr, 0, iPartIdx ); 3723 } 3724 { 3725 TempMv = cMvBi[0] - cMvPredBi[0][iRefIdxBi[0]]; 3726 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvd ( TempMv, ePartSize, uiPartAddr, 0, iPartIdx ); 3727 } 3728 { 3729 TempMv = cMvBi[1] - cMvPredBi[1][iRefIdxBi[1]]; 3730 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvd ( TempMv, ePartSize, uiPartAddr, 0, iPartIdx ); 3731 } 3711 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMv( cMvBi[0], ePartSize, uiPartAddr, 0, iPartIdx ); 3712 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllRefIdx( iRefIdxBi[0], ePartSize, uiPartAddr, 0, iPartIdx ); 3713 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMv( cMvBi[1], ePartSize, uiPartAddr, 0, iPartIdx ); 3714 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllRefIdx( iRefIdxBi[1], ePartSize, uiPartAddr, 0, iPartIdx ); 3715 3716 TempMv = cMvBi[0] - cMvPredBi[0][iRefIdxBi[0]]; 3717 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvd ( TempMv, ePartSize, uiPartAddr, 0, iPartIdx ); 3718 3719 TempMv = cMvBi[1] - cMvPredBi[1][iRefIdxBi[1]]; 3720 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvd ( TempMv, ePartSize, uiPartAddr, 0, iPartIdx ); 3732 3721 3733 3722 pcCU->setInterDirSubParts( 3, uiPartAddr, iPartIdx, pcCU->getDepth(0) ); … … 3743 3732 { 3744 3733 uiLastMode = 0; 3745 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMv( cMv[0], ePartSize, uiPartAddr, 0, iPartIdx ); 3746 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllRefIdx( iRefIdx[0], ePartSize, uiPartAddr, 0, iPartIdx ); 3747 { 3748 TempMv = cMv[0] - cMvPred[0][iRefIdx[0]]; 3749 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvd ( TempMv, ePartSize, uiPartAddr, 0, iPartIdx ); 3750 } 3734 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMv( cMv[0], ePartSize, uiPartAddr, 0, iPartIdx ); 3735 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllRefIdx( iRefIdx[0], ePartSize, uiPartAddr, 0, iPartIdx ); 3736 TempMv = cMv[0] - cMvPred[0][iRefIdx[0]]; 3737 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvd ( TempMv, ePartSize, uiPartAddr, 0, iPartIdx ); 3751 3738 pcCU->setInterDirSubParts( 1, uiPartAddr, iPartIdx, pcCU->getDepth(0) ); 3752 3739 … … 3759 3746 { 3760 3747 uiLastMode = 1; 3761 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMv( cMv[1], ePartSize, uiPartAddr, 0, iPartIdx ); 3762 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllRefIdx( iRefIdx[1], ePartSize, uiPartAddr, 0, iPartIdx ); 3763 { 3764 TempMv = cMv[1] - cMvPred[1][iRefIdx[1]]; 3765 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvd ( TempMv, ePartSize, uiPartAddr, 0, iPartIdx ); 3766 } 3748 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMv( cMv[1], ePartSize, uiPartAddr, 0, iPartIdx ); 3749 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllRefIdx( iRefIdx[1], ePartSize, uiPartAddr, 0, iPartIdx ); 3750 TempMv = cMv[1] - cMvPred[1][iRefIdx[1]]; 3751 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvd ( TempMv, ePartSize, uiPartAddr, 0, iPartIdx ); 3767 3752 pcCU->setInterDirSubParts( 2, uiPartAddr, iPartIdx, pcCU->getDepth(0) ); 3768 3753 … … 3816 3801 pcCU->setMergeIndexSubParts( uiMRGIndex, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 3817 3802 pcCU->setInterDirSubParts ( uiMRGInterDir, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 3818 { 3819 pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMRGMvField[0], ePartSize, uiPartAddr, 0, iPartIdx ); 3820 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMRGMvField[1], ePartSize, uiPartAddr, 0, iPartIdx ); 3821 } 3803 pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMRGMvField[0], ePartSize, uiPartAddr, 0, iPartIdx ); 3804 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMRGMvField[1], ePartSize, uiPartAddr, 0, iPartIdx ); 3822 3805 3823 3806 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvd ( cMvZero, ePartSize, uiPartAddr, 0, iPartIdx ); … … 3834 3817 pcCU->setMergeFlagSubParts( false, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 3835 3818 pcCU->setInterDirSubParts ( uiMEInterDir, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 3836 { 3837 pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMEMvField[0], ePartSize, uiPartAddr, 0, iPartIdx ); 3838 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMEMvField[1], ePartSize, uiPartAddr, 0, iPartIdx ); 3839 } 3819 pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMEMvField[0], ePartSize, uiPartAddr, 0, iPartIdx ); 3820 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMEMvField[1], ePartSize, uiPartAddr, 0, iPartIdx ); 3840 3821 } 3841 3822 } … … 3944 3925 3945 3926 if (iNum == 1) 3927 { 3946 3928 return 0; 3929 } 3947 3930 3948 3931 UInt uiLength = 1; … … 4123 4106 pcOrgYuv->getLumaAddr(uiPartAddr), pcOrgYuv->getStride(), 4124 4107 pcTemplateCand->getLumaAddr(uiPartAddr), pcTemplateCand->getStride(), 4125 #if NS_HAD4126 iSizeX, iSizeY, m_pcEncCfg->getUseHADME(), m_pcEncCfg->getUseNSQT() );4127 #else4128 4108 iSizeX, iSizeY, m_pcEncCfg->getUseHADME() ); 4129 #endif4130 4109 ruiDist = cDistParam.DistFunc( &cDistParam ); 4131 4110 uiCost = ruiDist + m_pcRdCost->getCost( m_auiMVPIdxCost[iMVPIdx][iMVPNum] ); 4132 4111 #else 4133 #if WEIGHTED_CHROMA_DISTORTION4134 4112 uiCost = m_pcRdCost->getDistPart(g_bitDepthY, pcTemplateCand->getLumaAddr(uiPartAddr), pcTemplateCand->getStride(), pcOrgYuv->getLumaAddr(uiPartAddr), pcOrgYuv->getStride(), iSizeX, iSizeY, TEXT_LUMA, DF_SAD ); 4135 #else4136 uiCost = m_pcRdCost->getDistPart(g_bitDepthY, pcTemplateCand->getLumaAddr(uiPartAddr), pcTemplateCand->getStride(), pcOrgYuv->getLumaAddr(uiPartAddr), pcOrgYuv->getStride(), iSizeX, iSizeY, DF_SAD );4137 #endif4138 4113 uiCost = (UInt) m_pcRdCost->calcRdCost( m_auiMVPIdxCost[iMVPIdx][iMVPNum], uiCost, false, DF_SAD ); 4139 4114 #endif … … 4228 4203 m_pcRdCost->getMotionCost( 1, 0 ); 4229 4204 m_pcRdCost->setCostScale ( 1 ); 4230 4231 { 4205 4232 4206 #if REF_IDX_ME_ZEROMV 4233 4234 4235 4236 4237 4238 4239 4240 4207 if( pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxPred )->isILR(pcCU->getLayerId())) //ILR reference pic 4208 { 4209 xPatternSearchFracDIFMv0( pcCU, pcPatternKey, piRefY, iRefStride, &rcMv, cMvHalf, cMvQter, ruiCost, bBi ); 4210 } 4211 else //non ILR reference pic 4212 { 4213 xPatternSearchFracDIF( pcCU, pcPatternKey, piRefY, iRefStride, &rcMv, cMvHalf, cMvQter, ruiCost, bBi ); 4214 } 4241 4215 #else 4242 xPatternSearchFracDIF( pcCU, pcPatternKey, piRefY, iRefStride, &rcMv, cMvHalf, cMvQter, ruiCost 4243 ,bBi 4244 ); 4245 #endif 4246 } 4247 4248 4249 4216 xPatternSearchFracDIF( pcCU, pcPatternKey, piRefY, iRefStride, &rcMv, cMvHalf, cMvQter, ruiCost,bBi ); 4217 #endif 4218 4250 4219 m_pcRdCost->setCostScale( 0 ); 4251 4220 rcMv <<= 2; … … 4601 4570 pcYuvPred->copyToPartYuv( rpcYuvRec, 0 ); 4602 4571 4603 #if WEIGHTED_CHROMA_DISTORTION4604 4572 uiDistortion = m_pcRdCost->getDistPart(g_bitDepthY, rpcYuvRec->getLumaAddr(), rpcYuvRec->getStride(), pcYuvOrg->getLumaAddr(), pcYuvOrg->getStride(), uiWidth, uiHeight ) 4605 4573 + m_pcRdCost->getDistPart(g_bitDepthC, rpcYuvRec->getCbAddr(), rpcYuvRec->getCStride(), pcYuvOrg->getCbAddr(), pcYuvOrg->getCStride(), uiWidth >> 1, uiHeight >> 1, TEXT_CHROMA_U ) 4606 4574 + m_pcRdCost->getDistPart(g_bitDepthC, rpcYuvRec->getCrAddr(), rpcYuvRec->getCStride(), pcYuvOrg->getCrAddr(), pcYuvOrg->getCStride(), uiWidth >> 1, uiHeight >> 1, TEXT_CHROMA_V ); 4607 #else4608 uiDistortion = m_pcRdCost->getDistPart(g_bitDepthY, rpcYuvRec->getLumaAddr(), rpcYuvRec->getStride(), pcYuvOrg->getLumaAddr(), pcYuvOrg->getStride(), uiWidth, uiHeight )4609 + m_pcRdCost->getDistPart(g_bitDepthC, rpcYuvRec->getCbAddr(), rpcYuvRec->getCStride(), pcYuvOrg->getCbAddr(), pcYuvOrg->getCStride(), uiWidth >> 1, uiHeight >> 1 )4610 + m_pcRdCost->getDistPart(g_bitDepthC, rpcYuvRec->getCrAddr(), rpcYuvRec->getCStride(), pcYuvOrg->getCrAddr(), pcYuvOrg->getCStride(), uiWidth >> 1, uiHeight >> 1 );4611 #endif4612 4575 4613 4576 if( m_bUseSBACRD ) 4577 { 4614 4578 m_pcRDGoOnSbacCoder->load(m_pppcRDSbacCoder[pcCU->getDepth(0)][CI_CURR_BEST]); 4579 } 4615 4580 4616 4581 m_pcEntropyCoder->resetBits(); … … 4628 4593 4629 4594 if( m_bUseSBACRD ) 4595 { 4630 4596 m_pcRDGoOnSbacCoder->store(m_pppcRDSbacCoder[pcCU->getDepth(0)][CI_TEMP_BEST]); 4597 } 4631 4598 4632 4599 pcCU->setCbfSubParts( 0, 0, 0, 0, pcCU->getDepth( 0 ) ); … … 4799 4766 4800 4767 // update with clipped distortion and cost (qp estimation loop uses unclipped values) 4801 #if WEIGHTED_CHROMA_DISTORTION4802 4768 uiDistortionBest = m_pcRdCost->getDistPart(g_bitDepthY, rpcYuvRec->getLumaAddr(), rpcYuvRec->getStride(), pcYuvOrg->getLumaAddr(), pcYuvOrg->getStride(), uiWidth, uiHeight ) 4803 4769 + m_pcRdCost->getDistPart(g_bitDepthC, rpcYuvRec->getCbAddr(), rpcYuvRec->getCStride(), pcYuvOrg->getCbAddr(), pcYuvOrg->getCStride(), uiWidth >> 1, uiHeight >> 1, TEXT_CHROMA_U ) 4804 4770 + m_pcRdCost->getDistPart(g_bitDepthC, rpcYuvRec->getCrAddr(), rpcYuvRec->getCStride(), pcYuvOrg->getCrAddr(), pcYuvOrg->getCStride(), uiWidth >> 1, uiHeight >> 1, TEXT_CHROMA_V ); 4805 #else4806 uiDistortionBest = m_pcRdCost->getDistPart(g_bitDepthY, rpcYuvRec->getLumaAddr(), rpcYuvRec->getStride(), pcYuvOrg->getLumaAddr(), pcYuvOrg->getStride(), uiWidth, uiHeight )4807 + m_pcRdCost->getDistPart(g_bitDepthC, rpcYuvRec->getCbAddr(), rpcYuvRec->getCStride(), pcYuvOrg->getCbAddr(), pcYuvOrg->getCStride(), uiWidth >> 1, uiHeight >> 1 )4808 + m_pcRdCost->getDistPart(g_bitDepthC, rpcYuvRec->getCrAddr(), rpcYuvRec->getCStride(), pcYuvOrg->getCrAddr(), pcYuvOrg->getCStride(), uiWidth >> 1, uiHeight >> 1 );4809 #endif4810 4771 dCostBest = m_pcRdCost->calcRdCost( uiBitsBest, uiDistortionBest ); 4811 4772 … … 4832 4793 Bool bCheckFull; 4833 4794 if ( SplitFlag && uiDepth == pcCU->getDepth(uiAbsPartIdx) && ( uiLog2TrSize > pcCU->getQuadtreeTULog2MinSizeInCU(uiAbsPartIdx) ) ) 4795 { 4834 4796 bCheckFull = false; 4797 } 4835 4798 else 4799 { 4836 4800 bCheckFull = ( uiLog2TrSize <= pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() ); 4801 } 4837 4802 4838 4803 const Bool bCheckSplit = ( uiLog2TrSize > pcCU->getQuadtreeTULog2MinSizeInCU(uiAbsPartIdx) ); … … 4932 4897 4933 4898 #if RDOQ_CHROMA_LAMBDA 4934 m_pcTrQuant->selectLambda(TEXT_CHROMA );4899 m_pcTrQuant->selectLambda(TEXT_CHROMA_U); 4935 4900 #endif 4936 4901 … … 4943 4908 curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCrQpOffset() + pcCU->getSlice()->getSliceQpDeltaCr(); 4944 4909 m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), curChromaQpOffset ); 4910 4911 #if RDOQ_CHROMA_LAMBDA 4912 m_pcTrQuant->selectLambda(TEXT_CHROMA_V); 4913 #endif 4914 4945 4915 m_pcTrQuant->transformNxN( pcCU, pcResi->getCrAddr(absTUPartIdxC), pcResi->getCStride(), pcCoeffCurrV, 4946 4916 #if ADAPTIVE_QP_SELECTION … … 4955 4925 m_pcEntropyCoder->resetBits(); 4956 4926 4957 { 4958 m_pcEntropyCoder->encodeQtCbf( pcCU, uiAbsPartIdx, TEXT_LUMA, uiTrMode ); 4959 } 4960 4927 m_pcEntropyCoder->encodeQtCbf( pcCU, uiAbsPartIdx, TEXT_LUMA, uiTrMode ); 4928 4961 4929 m_pcEntropyCoder->encodeCoeffNxN( pcCU, pcCoeffCurrY, uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_LUMA ); 4962 4930 const UInt uiSingleBitsY = m_pcEntropyCoder->getNumberOfWrittenBits(); … … 4966 4934 if( bCodeChroma ) 4967 4935 { 4968 { 4969 m_pcEntropyCoder->encodeQtCbf ( pcCU, uiAbsPartIdx, TEXT_CHROMA_U, uiTrMode ); 4970 } 4936 m_pcEntropyCoder->encodeQtCbf ( pcCU, uiAbsPartIdx, TEXT_CHROMA_U, uiTrMode ); 4971 4937 m_pcEntropyCoder->encodeCoeffNxN( pcCU, pcCoeffCurrU, uiAbsPartIdx, trWidthC, trHeightC, uiDepth, TEXT_CHROMA_U ); 4972 4938 uiSingleBitsU = m_pcEntropyCoder->getNumberOfWrittenBits() - uiSingleBitsY; 4973 4939 4974 { 4975 m_pcEntropyCoder->encodeQtCbf ( pcCU, uiAbsPartIdx, TEXT_CHROMA_V, uiTrMode ); 4976 } 4940 m_pcEntropyCoder->encodeQtCbf ( pcCU, uiAbsPartIdx, TEXT_CHROMA_V, uiTrMode ); 4977 4941 m_pcEntropyCoder->encodeCoeffNxN( pcCU, pcCoeffCurrV, uiAbsPartIdx, trWidthC, trHeightC, uiDepth, TEXT_CHROMA_V ); 4978 4942 uiSingleBitsV = m_pcEntropyCoder->getNumberOfWrittenBits() - ( uiSingleBitsY + uiSingleBitsU ); … … 5003 4967 assert(scalingListType < 6); 5004 4968 m_pcTrQuant->invtransformNxN( pcCU->getCUTransquantBypass(uiAbsPartIdx), TEXT_LUMA,REG_DCT, pcResiCurrY, m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(), pcCoeffCurrY, trWidth, trHeight, scalingListType );//this is for inter mode only 4969 5005 4970 const UInt uiNonzeroDistY = m_pcRdCost->getDistPart(g_bitDepthY, m_pcQTTempTComYuv[uiQTTempAccessLayer].getLumaAddr( absTUPartIdx ), m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(), 5006 4971 pcResi->getLumaAddr( absTUPartIdx ), pcResi->getStride(), trWidth,trHeight ); … … 5059 5024 { 5060 5025 uiDistU = m_pcRdCost->getDistPart(g_bitDepthC, m_pTempPel, trWidthC, pcResi->getCbAddr( absTUPartIdxC ), pcResi->getCStride(), trWidthC, trHeightC 5061 #if WEIGHTED_CHROMA_DISTORTION5062 5026 , TEXT_CHROMA_U 5063 #endif5064 5027 ); // initialized with zero residual destortion 5065 5028 if ( puiZeroDist ) … … 5080 5043 const UInt uiNonzeroDistU = m_pcRdCost->getDistPart(g_bitDepthC, m_pcQTTempTComYuv[uiQTTempAccessLayer].getCbAddr( absTUPartIdxC), m_pcQTTempTComYuv[uiQTTempAccessLayer].getCStride(), 5081 5044 pcResi->getCbAddr( absTUPartIdxC), pcResi->getCStride(), trWidthC, trHeightC 5082 #if WEIGHTED_CHROMA_DISTORTION5083 5045 , TEXT_CHROMA_U 5084 #endif5085 5046 ); 5086 5047 … … 5118 5079 { 5119 5080 m_pcEntropyCoder->resetBits(); 5120 m_pcEntropyCoder->encodeQtCbfZero( pcCU, TEXT_CHROMA_U, uiTrMode C);5081 m_pcEntropyCoder->encodeQtCbfZero( pcCU, TEXT_CHROMA_U, uiTrMode ); 5121 5082 const UInt uiNullBitsU = m_pcEntropyCoder->getNumberOfWrittenBits(); 5122 5083 minCostU = m_pcRdCost->calcRdCost( uiNullBitsU, uiDistU ); … … 5134 5095 5135 5096 uiDistV = m_pcRdCost->getDistPart(g_bitDepthC, m_pTempPel, trWidthC, pcResi->getCrAddr( absTUPartIdxC), pcResi->getCStride(), trWidthC, trHeightC 5136 #if WEIGHTED_CHROMA_DISTORTION5137 5097 , TEXT_CHROMA_V 5138 #endif5139 5098 ); // initialized with zero residual destortion 5140 5099 if ( puiZeroDist ) … … 5154 5113 const UInt uiNonzeroDistV = m_pcRdCost->getDistPart(g_bitDepthC, m_pcQTTempTComYuv[uiQTTempAccessLayer].getCrAddr( absTUPartIdxC ), m_pcQTTempTComYuv[uiQTTempAccessLayer].getCStride(), 5155 5114 pcResi->getCrAddr( absTUPartIdxC ), pcResi->getCStride(), trWidthC, trHeightC 5156 #if WEIGHTED_CHROMA_DISTORTION5157 5115 , TEXT_CHROMA_V 5158 #endif5159 5116 ); 5160 5117 if (pcCU->isLosslessCoded(0)) … … 5191 5148 { 5192 5149 m_pcEntropyCoder->resetBits(); 5193 m_pcEntropyCoder->encodeQtCbfZero( pcCU, TEXT_CHROMA_V, uiTrMode C);5150 m_pcEntropyCoder->encodeQtCbfZero( pcCU, TEXT_CHROMA_V, uiTrMode ); 5194 5151 const UInt uiNullBitsV = m_pcEntropyCoder->getNumberOfWrittenBits(); 5195 5152 minCostV = m_pcRdCost->calcRdCost( uiNullBitsV, uiDistV ); … … 5352 5309 5353 5310 #if RDOQ_CHROMA_LAMBDA 5354 m_pcTrQuant->selectLambda(TEXT_CHROMA );5311 m_pcTrQuant->selectLambda(TEXT_CHROMA_U); 5355 5312 #endif 5356 5313 … … 5362 5319 curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCrQpOffset() + pcCU->getSlice()->getSliceQpDeltaCr(); 5363 5320 m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), curChromaQpOffset ); 5321 #if RDOQ_CHROMA_LAMBDA 5322 m_pcTrQuant->selectLambda(TEXT_CHROMA_V); 5323 #endif 5364 5324 m_pcTrQuant->transformNxN( pcCU, pcResi->getCrAddr(absTUPartIdxC), pcResi->getCStride(), pcCoeffCurrV, 5365 5325 #if ADAPTIVE_QP_SELECTION … … 5391 5351 uiNonzeroDistU = m_pcRdCost->getDistPart(g_bitDepthC, m_pcQTTempTComYuv[uiQTTempAccessLayer].getCbAddr( absTUPartIdxC), m_pcQTTempTComYuv[uiQTTempAccessLayer].getCStride(), 5392 5352 pcResi->getCbAddr( absTUPartIdxC), pcResi->getCStride(), trWidthC, trHeightC 5393 #if WEIGHTED_CHROMA_DISTORTION5394 5353 , TEXT_CHROMA_U 5395 #endif5396 5354 ); 5397 5355 … … 5435 5393 uiNonzeroDistV = m_pcRdCost->getDistPart(g_bitDepthC, m_pcQTTempTComYuv[uiQTTempAccessLayer].getCrAddr( absTUPartIdxC ), m_pcQTTempTComYuv[uiQTTempAccessLayer].getCStride(), 5436 5394 pcResi->getCrAddr( absTUPartIdxC ), pcResi->getCStride(), trWidthC, trHeightC 5437 #if WEIGHTED_CHROMA_DISTORTION5438 5395 , TEXT_CHROMA_V 5439 #endif5440 5396 ); 5441 5397 … … 5474 5430 m_pcEntropyCoder->resetBits(); 5475 5431 5476 { 5477 if( uiLog2TrSize > pcCU->getQuadtreeTULog2MinSizeInCU(uiAbsPartIdx) ) 5478 { 5479 m_pcEntropyCoder->encodeTransformSubdivFlag( 0, 5 - uiLog2TrSize ); 5480 } 5481 } 5482 5483 { 5484 if( bCodeChroma ) 5485 { 5486 m_pcEntropyCoder->encodeQtCbf( pcCU, uiAbsPartIdx, TEXT_CHROMA_U, uiTrMode ); 5487 m_pcEntropyCoder->encodeQtCbf( pcCU, uiAbsPartIdx, TEXT_CHROMA_V, uiTrMode ); 5488 } 5489 5490 m_pcEntropyCoder->encodeQtCbf( pcCU, uiAbsPartIdx, TEXT_LUMA, uiTrMode ); 5491 } 5432 if( uiLog2TrSize > pcCU->getQuadtreeTULog2MinSizeInCU(uiAbsPartIdx) ) 5433 { 5434 m_pcEntropyCoder->encodeTransformSubdivFlag( 0, 5 - uiLog2TrSize ); 5435 } 5436 5437 if( bCodeChroma ) 5438 { 5439 m_pcEntropyCoder->encodeQtCbf( pcCU, uiAbsPartIdx, TEXT_CHROMA_U, uiTrMode ); 5440 m_pcEntropyCoder->encodeQtCbf( pcCU, uiAbsPartIdx, TEXT_CHROMA_V, uiTrMode ); 5441 } 5442 5443 m_pcEntropyCoder->encodeQtCbf( pcCU, uiAbsPartIdx, TEXT_LUMA, uiTrMode ); 5492 5444 5493 5445 m_pcEntropyCoder->encodeCoeffNxN( pcCU, pcCoeffCurrY, uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_LUMA ); … … 5546 5498 m_pcEntropyCoder->resetBits(); 5547 5499 5548 { 5549 xEncodeResidualQT( pcCU, uiAbsPartIdx, uiDepth, true, TEXT_LUMA ); 5550 xEncodeResidualQT( pcCU, uiAbsPartIdx, uiDepth, false, TEXT_LUMA ); 5551 xEncodeResidualQT( pcCU, uiAbsPartIdx, uiDepth, false, TEXT_CHROMA_U ); 5552 xEncodeResidualQT( pcCU, uiAbsPartIdx, uiDepth, false, TEXT_CHROMA_V ); 5553 } 5554 5500 xEncodeResidualQT( pcCU, uiAbsPartIdx, uiDepth, true, TEXT_LUMA ); 5501 xEncodeResidualQT( pcCU, uiAbsPartIdx, uiDepth, false, TEXT_LUMA ); 5502 xEncodeResidualQT( pcCU, uiAbsPartIdx, uiDepth, false, TEXT_CHROMA_U ); 5503 xEncodeResidualQT( pcCU, uiAbsPartIdx, uiDepth, false, TEXT_CHROMA_V ); 5504 5555 5505 uiSubdivBits = m_pcEntropyCoder->getNumberOfWrittenBits(); 5556 5506 dSubdivCost = m_pcRdCost->calcRdCost( uiSubdivBits, uiSubdivDist ); … … 5602 5552 const UInt uiLog2TrSize = g_aucConvertToBit[pcCU->getSlice()->getSPS()->getMaxCUWidth() >> uiDepth]+2; 5603 5553 5604 { 5605 if( bSubdivAndCbf && uiLog2TrSize <= pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() && uiLog2TrSize > pcCU->getQuadtreeTULog2MinSizeInCU(uiAbsPartIdx) ) 5606 { 5607 m_pcEntropyCoder->encodeTransformSubdivFlag( bSubdiv, 5 - uiLog2TrSize ); 5608 } 5609 } 5610 5611 { 5612 assert( pcCU->getPredictionMode(uiAbsPartIdx) != MODE_INTRA ); 5554 if( bSubdivAndCbf && uiLog2TrSize <= pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() && uiLog2TrSize > pcCU->getQuadtreeTULog2MinSizeInCU(uiAbsPartIdx) ) 5555 { 5556 m_pcEntropyCoder->encodeTransformSubdivFlag( bSubdiv, 5 - uiLog2TrSize ); 5557 } 5558 5559 assert( pcCU->getPredictionMode(uiAbsPartIdx) != MODE_INTRA ); 5613 5560 if( bSubdivAndCbf ) 5614 5561 { … … 5631 5578 } 5632 5579 } 5633 }5634 5580 5635 5581 if( !bSubdiv ) … … 5655 5601 if( bSubdivAndCbf ) 5656 5602 { 5657 { 5658 m_pcEntropyCoder->encodeQtCbf( pcCU, uiAbsPartIdx, TEXT_LUMA, uiTrMode ); 5659 } 5603 m_pcEntropyCoder->encodeQtCbf( pcCU, uiAbsPartIdx, TEXT_LUMA, uiTrMode ); 5660 5604 } 5661 5605 else … … 5725 5669 if( bCodeChroma ) 5726 5670 { 5727 { 5728 m_pcQTTempTComYuv[uiQTTempAccessLayer].copyPartToPartChroma( pcResi, uiAbsPartIdx, 1 << uiLog2TrSizeC, 1 << uiLog2TrSizeC ); 5729 } 5671 m_pcQTTempTComYuv[uiQTTempAccessLayer].copyPartToPartChroma( pcResi, uiAbsPartIdx, 1 << uiLog2TrSizeC, 1 << uiLog2TrSizeC ); 5730 5672 } 5731 5673 } … … 5847 5789 m_pcEntropyCoder->encodePartSize( pcCU, 0, pcCU->getDepth(0), true ); 5848 5790 m_pcEntropyCoder->encodePredInfo( pcCU, 0, true ); 5849 5850 5791 Bool bDummy = false; 5851 5792 m_pcEntropyCoder->encodeCoeff ( pcCU, 0, pcCU->getDepth(0), pcCU->getWidth(0), pcCU->getHeight(0), bDummy );
Note: See TracChangeset for help on using the changeset viewer.