Changeset 310 in SHVCSoftware for trunk/source/Lib/TLibEncoder/TEncSlice.cpp
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/SHM-2.1-dev (added) merged: 193-196,202,204,210-212,214-216,224,226-228,233-251,258,282-309
- Property svn:mergeinfo changed
-
trunk/source
- Property svn:mergeinfo changed
-
trunk/source/Lib/TLibEncoder/TEncSlice.cpp
r191 r310 425 425 rpcSlice->setNumRefIdx(REF_PIC_LIST_1,m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive); 426 426 427 #if L0386_DB_METRIC428 427 if ( m_pcCfg->getDeblockingFilterMetric() ) 429 428 { … … 433 432 rpcSlice->setDeblockingFilterTcOffsetDiv2( 0 ); 434 433 } else 435 #endif436 434 if (rpcSlice->getPPS()->getDeblockingFilterControlPresentFlag()) 437 435 { … … 491 489 { 492 490 #if JCTVC_M0458_INTERLAYER_RPS_SIG 493 // currently only one reference layer is supported in software and no decision logic to select yet.494 // hence num of active inter layer references is set to one always495 491 if( rpcSlice->getNumILRRefIdx() > 0 ) 496 492 { 497 rpcSlice->setActiveNumILRRefIdx(1); 493 rpcSlice->setActiveNumILRRefIdx( m_ppcTEncTop[layerId]->getNumActiveRefLayers() ); 494 for( Int i = 0; i < rpcSlice->getActiveNumILRRefIdx(); i++ ) 495 { 496 rpcSlice->setInterLayerPredLayerIdc( m_ppcTEncTop[layerId]->getPredLayerId(i), i ); 497 } 498 498 rpcSlice->setInterLayerPredEnabledFlag(1); 499 499 } 500 500 #else 501 501 rpcSlice->setNumILRRefIdx( rpcSlice->getVPS()->getNumDirectRefLayers( layerId ) ); 502 #endif 502 #endif 503 #if M0457_COL_PICTURE_SIGNALING 504 rpcSlice->setMFMEnabledFlag(m_ppcTEncTop[layerId]->getMFMEnabledFlag()); 505 rpcSlice->setAltColIndicationFlag(rpcSlice->getMFMEnabledFlag()); 506 #endif 503 507 } 504 508 … … 513 517 // store lambda 514 518 slice->setSliceQp( sliceQP ); 515 #if L0033_RC_BUGFIX516 519 slice->setSliceQpBase ( sliceQP ); 517 #endif518 520 m_pcRdCost ->setLambda( lambda ); 519 521 #if WEIGHTED_CHROMA_DISTORTION … … 822 824 /** \param rpcPic picture class 823 825 */ 826 #if RATE_CONTROL_INTRA 827 Void TEncSlice::calCostSliceI(TComPic*& rpcPic) 828 { 829 UInt uiCUAddr; 830 UInt uiStartCUAddr; 831 UInt uiBoundingCUAddr; 832 Int iSumHad, shift = g_bitDepthY-8, offset = (shift>0)?(1<<(shift-1)):0;; 833 Double iSumHadSlice = 0; 834 835 rpcPic->getSlice(getSliceIdx())->setSliceSegmentBits(0); 836 TComSlice* pcSlice = rpcPic->getSlice(getSliceIdx()); 837 xDetermineStartAndBoundingCUAddr ( uiStartCUAddr, uiBoundingCUAddr, rpcPic, false ); 838 839 UInt uiEncCUOrder; 840 uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU()); 841 for( uiEncCUOrder = uiStartCUAddr/rpcPic->getNumPartInCU(); 842 uiEncCUOrder < (uiBoundingCUAddr+(rpcPic->getNumPartInCU()-1))/rpcPic->getNumPartInCU(); 843 uiCUAddr = rpcPic->getPicSym()->getCUOrderMap(++uiEncCUOrder) ) 844 { 845 // initialize CU encoder 846 TComDataCU*& pcCU = rpcPic->getCU( uiCUAddr ); 847 pcCU->initCU( rpcPic, uiCUAddr ); 848 849 Int height = min( pcSlice->getSPS()->getMaxCUHeight(),pcSlice->getSPS()->getPicHeightInLumaSamples() - uiCUAddr / rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUHeight() ); 850 Int width = min( pcSlice->getSPS()->getMaxCUWidth(),pcSlice->getSPS()->getPicWidthInLumaSamples() - uiCUAddr % rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUWidth() ); 851 852 iSumHad = m_pcCuEncoder->updateLCUDataISlice(pcCU, uiCUAddr, width, height); 853 854 (m_pcRateCtrl->getRCPic()->getLCU(uiCUAddr)).m_costIntra=(iSumHad+offset)>>shift; 855 iSumHadSlice += (m_pcRateCtrl->getRCPic()->getLCU(uiCUAddr)).m_costIntra; 856 857 } 858 m_pcRateCtrl->getRCPic()->setTotalIntraCost(iSumHadSlice); 859 } 860 #endif 861 824 862 Void TEncSlice::compressSlice( TComPic*& rpcPic ) 825 863 { … … 943 981 944 982 #if INTRA_BL 945 m_pcCuEncoder->setBaseRecPic( rpcPic->getLayerId() > 0 ? rpcPic->getFullPelBaseRec( ) : NULL);983 m_pcCuEncoder->setBaseRecPic( rpcPic->getLayerId() > 0 ? rpcPic->getFullPelBaseRec(rpcPic->getLayerId()-1) : NULL); 946 984 #endif 947 985 … … 993 1031 TComDataCU*& pcCU = rpcPic->getCU( uiCUAddr ); 994 1032 pcCU->initCU( rpcPic, uiCUAddr ); 995 #if SVC_EXTENSION996 pcCU->setLayerId(m_pcCfg->getLayerId());997 #endif998 1033 999 1034 #if !RATE_CONTROL_LAMBDA_DOMAIN … … 1088 1123 Double bpp = -1.0; 1089 1124 1125 #if M0036_RC_IMPROVEMENT 1126 if ( ( rpcPic->getSlice( 0 )->getSliceType() == I_SLICE && m_pcCfg->getForceIntraQP() ) || !m_pcCfg->getLCULevelRC() ) 1127 #else 1090 1128 if ( rpcPic->getSlice( 0 )->getSliceType() == I_SLICE || !m_pcCfg->getLCULevelRC() ) 1129 #endif 1091 1130 { 1092 1131 estQP = pcSlice->getSliceQp(); … … 1094 1133 else 1095 1134 { 1135 #if RATE_CONTROL_INTRA 1136 bpp = m_pcRateCtrl->getRCPic()->getLCUTargetBpp(pcSlice->getSliceType()); 1137 if ( rpcPic->getSlice( 0 )->getSliceType() == I_SLICE) 1138 { 1139 estLambda = m_pcRateCtrl->getRCPic()->getLCUEstLambdaAndQP(bpp, pcSlice->getSliceQp(), &estQP); 1140 } 1141 else 1142 { 1143 estLambda = m_pcRateCtrl->getRCPic()->getLCUEstLambda( bpp ); 1144 estQP = m_pcRateCtrl->getRCPic()->getLCUEstQP ( estLambda, pcSlice->getSliceQp() ); 1145 } 1146 #else 1096 1147 bpp = m_pcRateCtrl->getRCPic()->getLCUTargetBpp(); 1097 1148 estLambda = m_pcRateCtrl->getRCPic()->getLCUEstLambda( bpp ); 1098 1149 estQP = m_pcRateCtrl->getRCPic()->getLCUEstQP ( estLambda, pcSlice->getSliceQp() ); 1150 #endif 1151 1099 1152 estQP = Clip3( -pcSlice->getSPS()->getQpBDOffsetY(), MAX_QP, estQP ); 1100 1153 1101 1154 m_pcRdCost->setLambda(estLambda); 1155 #if M0036_RC_IMPROVEMENT 1156 #if RDOQ_CHROMA_LAMBDA 1157 // set lambda for RDOQ 1158 Double weight=m_pcRdCost->getChromaWeight(); 1159 m_pcTrQuant->setLambda( estLambda, estLambda / weight ); 1160 #else 1161 m_pcTrQuant->setLambda( estLambda ); 1162 #endif 1163 #endif 1102 1164 } 1103 1165 1104 1166 m_pcRateCtrl->setRCQP( estQP ); 1105 #if L0033_RC_BUGFIX1106 1167 pcCU->getSlice()->setSliceQpBase( estQP ); 1107 #endif1108 1168 } 1109 1169 #endif … … 1112 1172 m_pcCuEncoder->compressCU( pcCU ); 1113 1173 1174 #if !TICKET_1090_FIX 1114 1175 #if RATE_CONTROL_LAMBDA_DOMAIN 1115 1176 if ( m_pcCfg->getUseRateCtrl() ) 1116 1177 { 1178 #if !M0036_RC_IMPROVEMENT 1117 1179 UInt SAD = m_pcCuEncoder->getLCUPredictionSAD(); 1118 1180 Int height = min( pcSlice->getSPS()->getMaxCUHeight(),pcSlice->getSPS()->getPicHeightInLumaSamples() - uiCUAddr / rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUHeight() ); … … 1121 1183 MAD = MAD * MAD; 1122 1184 ( m_pcRateCtrl->getRCPic()->getLCU(uiCUAddr) ).m_MAD = MAD; 1185 #endif 1123 1186 1124 1187 Int actualQP = g_RCInvalidQPValue; … … 1144 1207 } 1145 1208 m_pcRdCost->setLambda(oldLambda); 1146 1209 #if RATE_CONTROL_INTRA 1210 m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda, 1211 pcCU->getSlice()->getSliceType() == I_SLICE ? 0 : m_pcCfg->getLCULevelRC() ); 1212 #else 1147 1213 m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda, m_pcCfg->getLCULevelRC() ); 1148 } 1214 #endif 1215 } 1216 #endif 1149 1217 #endif 1150 1218 … … 1180 1248 } 1181 1249 } 1250 1251 #if TICKET_1090_FIX 1252 #if RATE_CONTROL_LAMBDA_DOMAIN 1253 if ( m_pcCfg->getUseRateCtrl() ) 1254 { 1255 #if !M0036_RC_IMPROVEMENT 1256 UInt SAD = m_pcCuEncoder->getLCUPredictionSAD(); 1257 Int height = min( pcSlice->getSPS()->getMaxCUHeight(),pcSlice->getSPS()->getPicHeightInLumaSamples() - uiCUAddr / rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUHeight() ); 1258 Int width = min( pcSlice->getSPS()->getMaxCUWidth(),pcSlice->getSPS()->getPicWidthInLumaSamples() - uiCUAddr % rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUWidth() ); 1259 Double MAD = (Double)SAD / (Double)(height * width); 1260 MAD = MAD * MAD; 1261 ( m_pcRateCtrl->getRCPic()->getLCU(uiCUAddr) ).m_MAD = MAD; 1262 #endif 1263 1264 Int actualQP = g_RCInvalidQPValue; 1265 Double actualLambda = m_pcRdCost->getLambda(); 1266 Int actualBits = pcCU->getTotalBits(); 1267 Int numberOfEffectivePixels = 0; 1268 for ( Int idx = 0; idx < rpcPic->getNumPartInCU(); idx++ ) 1269 { 1270 if ( pcCU->getPredictionMode( idx ) != MODE_NONE && ( !pcCU->isSkipped( idx ) ) ) 1271 { 1272 numberOfEffectivePixels = numberOfEffectivePixels + 16; 1273 break; 1274 } 1275 } 1276 1277 if ( numberOfEffectivePixels == 0 ) 1278 { 1279 actualQP = g_RCInvalidQPValue; 1280 } 1281 else 1282 { 1283 actualQP = pcCU->getQP( 0 ); 1284 } 1285 m_pcRdCost->setLambda(oldLambda); 1286 1287 #if RATE_CONTROL_INTRA 1288 m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda, 1289 pcCU->getSlice()->getSliceType() == I_SLICE ? 0 : m_pcCfg->getLCULevelRC() ); 1290 #else 1291 m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda, m_pcCfg->getLCULevelRC() ); 1292 #endif 1293 } 1294 #endif 1295 #endif 1182 1296 } 1183 1297 // other case: encodeCU is not called
Note: See TracChangeset for help on using the changeset viewer.