Changeset 637 in 3DVCSoftware
- Timestamp:
- 17 Oct 2013, 20:17:10 (11 years ago)
- Location:
- branches/HTM-8.2-dev0-KWU
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-8.2-dev0-KWU/cfg/3D-HEVC/baseCfg_3view+depth.cfg
r636 r637 229 229 230 230 #============ Rate Control URQ ====================== 231 <<<<<<< .mine 232 #RateCtrl : 0 # 0: Disable rate control 1: Enable rate control with total target 233 #DepthMADPred : 0 # 0: Disable Depth based MAD prediction for extended view 1: Enable Depth based MAD prediction for extended view 234 #TargetBitAssign : 0 # Manual assignment of target bit-rate 235 #ViewWiseTargetBits : 952 315 360 # View-wise target bit-rate setting 236 #TargetBitrate : 1500 # input target bitrate when RateCtrl is enable 237 #NumLCUInUnit : 1 # Number of LCU in an Unit. Fraction is not allowed 238 ======= 231 239 #RateCtrl : 0 # 0: Disable rate control 1: Enable rate control with total target 232 240 #DepthMADPred : 0 # 0: Disable Depth based MAD prediction for extended view 1: Enable Depth based MAD prediction for extended view … … 235 243 #TargetBitrate : 1500 # input target bitrate when RateCtrl is enable 236 244 #NumLCUInUnit : 1 # Number of LCU in an Unit. Fraction is not allowed 245 >>>>>>> .r636 237 246 238 247 #========== multiview coding tools ========== -
branches/HTM-8.2-dev0-KWU/cfg/3D-HEVC/fullCfg.cfg
r636 r637 235 235 236 236 #============ Rate Control URQ ====================== 237 <<<<<<< .mine 238 #RateCtrl : 0 # 0: Disable rate control 1: Enable rate control with total target 239 #DepthMADPred : 0 # 0: Disable Depth based MAD prediction for extended view 1: Enable Depth based MAD prediction for extended view 240 #TargetBitAssign : 0 # Manual assignment of target bit-rate 241 #ViewWiseTargetBits : 952 315 360 # View-wise target bit-rate setting 242 #TargetBitrate : 1500 # input target bitrate when RateCtrl is enable 243 #NumLCUInUnit : 1 # Number of LCU in an Unit. Fraction is not allowed 244 ======= 237 245 #RateCtrl : 0 # 0: Disable rate control 1: Enable rate control with total target 238 246 #DepthMADPred : 0 # 0: Disable Depth based MAD prediction for extended view 1: Enable Depth based MAD prediction for extended view … … 241 249 #TargetBitrate : 1500 # input target bitrate when RateCtrl is enable 242 250 #NumLCUInUnit : 1 # Number of LCU in an Unit. Fraction is not allowed 251 >>>>>>> .r636 243 252 244 253 #========== multiview coding tools ========== -
branches/HTM-8.2-dev0-KWU/source/App/TAppEncoder/TAppEncCfg.cpp
r636 r637 2179 2179 xConfirmPara( (numLCUInPic % m_numLCUInUnit) != 0, "total number of LCUs in a frame should be completely divided by NumLCUInUnit" ); 2180 2180 2181 #if ! (KWU_RC_MADPRED_E0227 || KWU_RC_VIEWRC_E0227)2181 #if !KWU_FIX_URQ 2182 2182 m_iMaxDeltaQP = MAX_DELTA_QP; 2183 2183 #endif -
branches/HTM-8.2-dev0-KWU/source/App/TAppEncoder/TAppEncTop.cpp
r636 r637 512 512 m_cTEncTop.setSignHideFlag(m_signHideFlag); 513 513 #if RATE_CONTROL_LAMBDA_DOMAIN 514 #if KWU_RC_ MADPRED_E0227514 #if KWU_RC_VIEWRC_E0227 || KWU_RC_MADPRED_E0227 515 515 if(!m_cTEncTop.getIsDepth()) //only for texture 516 516 { … … 522 522 } 523 523 #else 524 m_cTEncTop.setUseRateCtrl ( m_RCEnableRateControl );524 m_cTEncTop.setUseRateCtrl ( m_RCEnableRateControl ); 525 525 #endif 526 526 #if !KWU_RC_VIEWRC_E0227 … … 603 603 #endif 604 604 #else 605 #if KWU_RC_ MADPRED_E0227605 #if KWU_RC_VIEWRC_E0227 || KWU_RC_MADPRED_E0227 606 606 if(!m_cTEncTop.getIsDepth()) //only for texture 607 607 { 608 608 m_cTEncTop.setUseRateCtrl ( m_enableRateCtrl ); 609 #if !KWU_RC_VIEWRC_E0227610 609 m_cTEncTop.setTargetBitrate ( m_targetBitrate ); 611 #endif612 610 m_cTEncTop.setNumLCUInUnit ( m_numLCUInUnit); 613 611 } … … 617 615 } 618 616 #else 619 m_cTEncTop.setUseRateCtrl ( m_enableRateCtrl); 620 m_cTEncTop.setTargetBitrate ( m_targetBitrate); 621 m_cTEncTop.setNumLCUInUnit ( m_numLCUInUnit); 622 #endif 617 m_cTEncTop.setUseRateCtrl ( m_enableRateCtrl ); 618 m_cTEncTop.setTargetBitrate ( m_targetBitrate ); 619 m_cTEncTop.setNumLCUInUnit ( m_numLCUInUnit); 620 #endif 621 623 622 624 623 #if KWU_RC_MADPRED_E0227 … … 962 961 } 963 962 964 #if !RATE_CONTROL_LAMBDA_DOMAIN 963 #if !RATE_CONTROL_LAMBDA_DOMAIN && KWU_FIX_URQ 965 964 for(Int layer=0; layer < m_numberOfLayers; layer++ ) 966 965 { -
branches/HTM-8.2-dev0-KWU/source/Lib/TAppCommon/TAppComCamPara.cpp
r636 r637 1526 1526 } 1527 1527 #endif 1528 1529 1530 #if KWU_RC_MADPRED_E02271531 Void1532 TAppComCamPara::getZNearZFar( Int iView, UInt uiFrame, Double& rdZNear, Double& rdZFar )1533 {1534 UInt uiFoundLine = -1;1535 if( !xGetCameraDataRow( m_aiBaseViews[iView], uiFrame, uiFoundLine ) || !( m_aadCameraParameters[ uiFoundLine ].size() < 8 ) )1536 {1537 rdZNear = m_aadCameraParameters[ uiFoundLine ][ 6 ];1538 rdZFar = m_aadCameraParameters[ uiFoundLine ][ 7 ];1539 }1540 else1541 {1542 std::cerr << "No ZNear or no ZFar for View " << (Double)iView / m_dViewNumPrec << " and Frame " << uiFrame << " given in CameraParameterFile" << std::endl;1543 exit( EXIT_FAILURE );1544 }1545 }1546 1547 1548 Void1549 TAppComCamPara::getGeometryData( Int iView, UInt uiFrame, Double& rdFocalLength, Double& rdPosition, Double& rdCameraShift, Bool& rbInterpolated )1550 {1551 UInt uiFoundLine = -1;1552 if ( !xGetCameraDataRow( m_aiBaseViews[iView], uiFrame, uiFoundLine ) )1553 {1554 AOT( m_aadCameraParameters[ uiFoundLine ].size() < 6 );1555 rbInterpolated = false;1556 rdFocalLength = m_aadCameraParameters[ uiFoundLine ][ 3 ];1557 rdPosition = m_aadCameraParameters[ uiFoundLine ][ 4 ];1558 rdCameraShift = m_aadCameraParameters[ uiFoundLine ][ 5 ];1559 }1560 else1561 {1562 UInt uiLeftViewLine;1563 UInt uiRightViewLine;1564 Int iLeftView;1565 Int iRightView;1566 Int iDummy;1567 1568 if( !xGetLeftRightView( iView, m_aiViewsInCfgFile, iLeftView, iRightView, iDummy, iDummy ) ||1569 xGetCameraDataRow( iLeftView, uiFrame, uiLeftViewLine ) ||1570 xGetCameraDataRow( iRightView, uiFrame, uiRightViewLine )1571 )1572 {1573 std::cerr << "No Left or no Right View next to View " << (Double)iView / m_dViewNumPrec << " for Frame " << uiFrame << " given in CameraParameterFile" << std::endl;1574 AOT(true);1575 exit( EXIT_FAILURE );1576 }1577 AOT( m_aadCameraParameters[ uiLeftViewLine ].size() < 6 );1578 AOT( m_aadCameraParameters[ uiRightViewLine ].size() < 6 );1579 1580 // Linear Interpolation1581 Double dFactor = ( (Double)( iView - iLeftView ) ) / ( (Double)( iRightView - iLeftView ) );1582 rdFocalLength = m_aadCameraParameters[ uiLeftViewLine ][ 3 ] + dFactor * ( m_aadCameraParameters[ uiRightViewLine ][ 3 ] - m_aadCameraParameters[ uiLeftViewLine ][ 3 ] );1583 rdPosition = m_aadCameraParameters[ uiLeftViewLine ][ 4 ] + dFactor * ( m_aadCameraParameters[ uiRightViewLine ][ 4 ] - m_aadCameraParameters[ uiLeftViewLine ][ 4 ] );1584 rdCameraShift = m_aadCameraParameters[ uiLeftViewLine ][ 5 ] + dFactor * ( m_aadCameraParameters[ uiRightViewLine ][ 5 ] - m_aadCameraParameters[ uiLeftViewLine ][ 5 ] );1585 rbInterpolated = true;1586 }1587 }1588 #endif -
branches/HTM-8.2-dev0-KWU/source/Lib/TAppCommon/TAppComCamPara.h
r636 r637 125 125 Bool xGetLeftRightView ( Int iView, std::vector<Int> aiSortedViews, Int& riLeftView, Int& riRightView, Int& riLeftSortedViewIdx, Int& riRightSortedViewIdx ); 126 126 Void xGetPrevAndNextBaseView ( Int iSourceViewNum, Int iTargetViewNum, Int& riPrevBaseViewNum, Int& riNextBaseViewNum ); 127 #if !KWU_RC_MADPRED_E0227 127 128 Void xGetZNearZFar ( Int iView, UInt uiFrame, Double& rdZNear, Double& rdZFar ); 128 129 Void xGetGeometryData ( Int dView, UInt uiFrame, Double& rdFocalLength, Double& rdPosition, Double& rdCameraShift, Bool& rbInterpolated ); 130 #endif 129 131 Void xSetupBaseViewsFromCoded (); 130 132 Void xSetupBaseViews ( Char* pchBaseViewNumbers, UInt uiNumBaseViews ); … … 222 224 223 225 #if KWU_RC_MADPRED_E0227 224 Void getZNearZFar ( Int iView, UInt uiFrame, Double& rdZNear, Double& rdZFar );225 Void getGeometryData ( Int dView, UInt uiFrame, Double& rdFocalLength, Double& rdPosition, Double& rdCameraShift, Bool& rbInterpolated );226 Void xGetZNearZFar ( Int iView, UInt uiFrame, Double& rdZNear, Double& rdZFar ); 227 Void xGetGeometryData ( Int dView, UInt uiFrame, Double& rdFocalLength, Double& rdPosition, Double& rdCameraShift, Bool& rbInterpolated ); 226 228 #endif 227 229 }; -
branches/HTM-8.2-dev0-KWU/source/Lib/TLibCommon/TypeDef.h
r636 r637 305 305 #define M0036_RC_IMPROVEMENT 1 ///< JCTVC-M0036, improvement for R-lambda model based rate control 306 306 #define TICKET_1090_FIX 1 307 308 #if RATE_CONTROL_LAMBDA_DOMAIN 307 #define KWU_FIX_URQ 1 308 309 #if KWU_FIX_URQ && RATE_CONTROL_LAMBDA_DOMAIN 309 310 #define RC_FIX 1 /// suggested fix for M0036 310 311 #define RATE_CONTROL_INTRA 1 ///< JCTVC-M0257, rate control for intra 311 312 #endif 313 312 314 #define KWU_RC_VIEWRC_E0227 1 ///< JCT3V-E0227, view-wise target bitrate allocation 313 315 #define KWU_RC_MADPRED_E0227 1 ///< JCT3V-E0227, inter-view MAD prediction -
branches/HTM-8.2-dev0-KWU/source/Lib/TLibEncoder/TEncCu.cpp
r636 r637 103 103 104 104 m_bEncodeDQP = false; 105 #if (RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT) || KWU_RC_MADPRED_E0227105 #if RATE_CONTROL_LAMBDA_DOMAIN && (!M0036_RC_IMPROVEMENT || KWU_RC_MADPRED_E0227) 106 106 m_LCUPredictionSAD = 0; 107 107 m_addSADDepth = 0; … … 242 242 243 243 m_bUseSBACRD = pcEncTop->getUseSBACRD(); 244 245 #if KWU_RC_MADPRED_E0227246 if(!pcEncTop->getIsDepth())247 {248 m_pcRateCtrl = pcEncTop->getRateCtrl();249 }250 else251 {252 m_pcRateCtrl = NULL;253 }254 #else255 244 m_pcRateCtrl = pcEncTop->getRateCtrl(); 256 #endif257 245 } 258 246 … … 478 466 479 467 #if RATE_CONTROL_LAMBDA_DOMAIN 480 if ( m_pcEncCfg->getUseRateCtrl() && !m_pcEncCfg->getIsDepth())468 if ( m_pcEncCfg->getUseRateCtrl() ) 481 469 { 482 470 iMinQP = m_pcRateCtrl->getRCQP(); … … 484 472 } 485 473 #else 486 if(m_pcEncCfg->getUseRateCtrl() && !m_pcEncCfg->getIsDepth())474 if(m_pcEncCfg->getUseRateCtrl()) 487 475 { 488 476 Int qp = m_pcRateCtrl->getUnitQP(); … … 692 680 } 693 681 #endif 694 #if !RATE_CONTROL_LAMBDA_DOMAIN 682 #if !RATE_CONTROL_LAMBDA_DOMAIN && KWU_FIX_URQ 695 683 if(m_pcEncCfg->getUseRateCtrl()) 696 684 { … … 1175 1163 } 1176 1164 #if RATE_CONTROL_LAMBDA_DOMAIN 1177 if ( m_pcEncCfg->getUseRateCtrl() && !m_pcEncCfg->getIsDepth())1165 if ( m_pcEncCfg->getUseRateCtrl() ) 1178 1166 { 1179 1167 iMinQP = m_pcRateCtrl->getRCQP(); … … 1181 1169 } 1182 1170 #else 1183 if(m_pcEncCfg->getUseRateCtrl() && !m_pcEncCfg->getIsDepth())1171 if(m_pcEncCfg->getUseRateCtrl()) 1184 1172 { 1185 1173 Int qp = m_pcRateCtrl->getUnitQP(); -
branches/HTM-8.2-dev0-KWU/source/Lib/TLibEncoder/TEncGOP.cpp
r636 r637 154 154 #endif 155 155 156 #if !RATE_CONTROL_LAMBDA_DOMAIN156 #if KWU_FIX_URQ 157 157 m_pcRateCtrl = pcTEncTop->getRateCtrl(); 158 158 #endif … … 2216 2216 delete[] pcSubstreamsOut; 2217 2217 } 2218 2218 #if !KWU_FIX_URQ && !RATE_CONTROL_LAMBDA_DOMAIN 2219 if(m_pcCfg->getUseRateCtrl()) 2220 { 2221 m_pcRateCtrl->updateRCGOPStatus(); 2222 } 2223 #endif 2219 2224 delete pcBitstreamRedirect; 2220 2225 -
branches/HTM-8.2-dev0-KWU/source/Lib/TLibEncoder/TEncRateCtrl.cpp
r636 r637 644 644 645 645 #if KWU_RC_MADPRED_E0227 646 Void TEncRCPic::create( TEncRCSeq* encRCSeq, TEncRCGOP* encRCGOP, Int frameLevel, list<TEncRCPic*>& listPreviousPictures, Int LayerID )646 Void TEncRCPic::create( TEncRCSeq* encRCSeq, TEncRCGOP* encRCGOP, Int frameLevel, list<TEncRCPic*>& listPreviousPictures, Int layerID ) 647 647 #else 648 648 Void TEncRCPic::create( TEncRCSeq* encRCSeq, TEncRCGOP* encRCGOP, Int frameLevel, list<TEncRCPic*>& listPreviousPictures ) … … 717 717 718 718 #if KWU_RC_MADPRED_E0227 719 m_LayerID = LayerID;719 m_LayerID = layerID; 720 720 m_lastIVPicture = NULL; 721 721 m_IVtotalMAD = 0.0; … … 1074 1074 1075 1075 #if KWU_RC_MADPRED_E0227 1076 Double TEncRCPic::getLCUTargetBppforInterView( list<TEncRCPic*>& listPreviousPictures, TComDataCU* pcCU, Double BasePos, Double CurPos, Double FocalLen, Double Znear, Double Zfar, Int Direction, Int* iDisparity )1076 Double TEncRCPic::getLCUTargetBppforInterView( list<TEncRCPic*>& listPreviousPictures, TComDataCU* pcCU, Double basePos, Double curPos, Double focalLen, Double znear, Double zfar, Int direction, Int* disparity ) 1077 1077 { 1078 1078 Int LCUIdx = getLCUCoded(); … … 1098 1098 Int iStride = pcCU->getSlice()->getIvPic(true, pcCU->getSlice()->getViewIndex())->getPicYuvOrg()->getStride(); 1099 1099 1100 Int iWidth = m_LCUs[ LCUIdx ].m_CUWidth;1101 Int iHeight = m_LCUs[ LCUIdx ].m_CUHeight;1100 Int width = m_LCUs[ LCUIdx ].m_CUWidth; 1101 Int height = m_LCUs[ LCUIdx ].m_CUHeight; 1102 1102 1103 1103 for( y = 0 ; y < pcCU->getSlice()->getSPS()->getMaxCUHeight() ; y+=8) … … 1112 1112 Double AvgDepth = (Double)Sum/((pcCU->getSlice()->getSPS()->getMaxCUHeight()/8)*(pcCU->getSlice()->getSPS()->getMaxCUWidth()/8)); 1113 1113 1114 //Int iDisparity = pDepthGen->RCGetDisparityFromVirtDepth(0, (Int)AvgDepth); 1115 1116 Double dFL = FocalLen * abs( BasePos - CurPos ); 1117 Double dZ = abs( 1.0 / Znear - 1.0 / Zfar ) * ((Double)(AvgDepth) / (( 1 << g_bitDepthY ) - 1) ) + abs(1.0 / Zfar); 1118 *iDisparity = (Int)(Direction*dFL * dZ); 1114 Double fL = focalLen * abs( basePos - curPos ); 1115 Double z = abs( 1.0 / znear - 1.0 / zfar ) * ((Double)(AvgDepth) / (( 1 << g_bitDepthY ) - 1) ) + abs(1.0 / zfar); 1116 *disparity = (Int)(direction*fL * z); 1119 1117 Int shift = DISTORTION_PRECISION_ADJUSTMENT(g_bitDepthY-8); 1120 1118 1121 Int Disp = *iDisparity;1122 Int PosX, PosY;1123 pcCU->getPosInPic(0, PosX, PosY);1124 if(( PosX + *iDisparity) < 0 || (PosX + *iDisparity + iWidth) >= pcCU->getSlice()->getSPS()->getMaxCUWidth())1125 { 1126 Disp = 0;1127 } 1128 1129 for( y = 0; y < iHeight; y++ )1130 { 1131 for( x = 0; x < iWidth; x++ )1132 { 1133 SAD += abs( pOrg[Clip3(0, (Int)(pcCU->getPic()->getPicYuvOrg()->getWidth() - pcCU->getSlice()->getSPS()->getMaxCUWidth()), x + Disp)]1134 - pRec[Clip3(0, (Int)(pcCU->getPic()->getPicYuvOrg()->getWidth() - pcCU->getSlice()->getSPS()->getMaxCUWidth()), x + Disp)] )>>shift;1119 Int disp = *disparity; 1120 Int posX, posY; 1121 pcCU->getPosInPic(0, posX, posY); 1122 if((posX + *disparity) < 0 || (posX + *disparity + width) >= pcCU->getSlice()->getSPS()->getMaxCUWidth()) 1123 { 1124 disp = 0; 1125 } 1126 1127 for( y = 0; y < height; y++ ) 1128 { 1129 for( x = 0; x < width; x++ ) 1130 { 1131 SAD += abs( pOrg[Clip3(0, (Int)(pcCU->getPic()->getPicYuvOrg()->getWidth() - pcCU->getSlice()->getSPS()->getMaxCUWidth()), x + disp)] 1132 - pRec[Clip3(0, (Int)(pcCU->getPic()->getPicYuvOrg()->getWidth() - pcCU->getSlice()->getSPS()->getMaxCUWidth()), x + disp)] )>>shift; 1135 1133 } 1136 1134 pOrg += iStride; 1137 1135 pRec += iStride; 1138 1136 } 1139 IVMAD = SAD / (Double)( iHeight * iWidth);1137 IVMAD = SAD / (Double)(height * width); 1140 1138 IVMAD = IVMAD * IVMAD; 1141 1139 … … 1440 1438 m_picLambda = averageLambda; 1441 1439 #if !M0036_RC_IMPROVEMENT || KWU_RC_MADPRED_E0227 1440 #if KWU_RC_MADPRED_E0227 1442 1441 m_totalMAD = 0; 1442 #endif 1443 1443 for ( Int i=0; i<m_numberOfLCU; i++ ) 1444 1444 { … … 1649 1649 #if M0036_RC_IMPROVEMENT 1650 1650 #if KWU_RC_MADPRED_E0227 1651 Void TEncRateCtrl::init( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Bool keepHierBits, Bool useLCUSeparateModel, GOPEntry GOPList[MAX_GOP], Int LayerID )1651 Void TEncRateCtrl::init( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Bool keepHierBits, Bool useLCUSeparateModel, GOPEntry GOPList[MAX_GOP], Int layerID ) 1652 1652 #else 1653 1653 Void TEncRateCtrl::init( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Int keepHierBits, Bool useLCUSeparateModel, GOPEntry GOPList[MAX_GOP] ) … … 1867 1867 1868 1868 #if KWU_RC_MADPRED_E0227 1869 setLayerID( LayerID);1869 setLayerID(layerID); 1870 1870 #endif 1871 1871 … … 2082 2082 m_sourceHeightInLCU = (sourceHeight / maxCUHeight) + (( sourceHeight % maxCUHeight) ? 1 : 0); 2083 2083 m_isLowdelay = (sizeIntraPeriod == -1) ? true : false; 2084 #if KWU_RC_MADPRED_E0227 2085 m_prevBitrate = ( targetKbps * 1000 ); // in units of 1,024 bps 2086 m_currBitrate = ( targetKbps * 1000 ); 2087 #else 2084 2088 2085 m_prevBitrate = ( targetKbps << 10 ); // in units of 1,024 bps 2089 2086 m_currBitrate = ( targetKbps << 10 ); 2090 #endif 2087 2091 2088 m_frameRate = frameRate; 2092 2089 m_refFrameNum = m_isLowdelay ? (sizeGOP) : (sizeGOP>>1); … … 2486 2483 2487 2484 #if KWU_RC_MADPRED_E0227 2488 Void TEncRateCtrl::updateLCUDataEnhancedView(TComDataCU* pcCU, UInt64 uiBits, Int iQP, Double BasePos, Double CurPos, Double FocalLen, Double Znear, Double Zfar, Int Direction)2485 Void TEncRateCtrl::updateLCUDataEnhancedView(TComDataCU* pcCU, UInt64 uiBits, Int qp, Double basePos, Double curPos, Double focalLen, Double znear, Double zfar, Int direction) 2489 2486 { 2490 2487 Int x, y; … … 2498 2495 Int iStride = pcCU->getSlice()->getIvPic(true, pcCU->getSlice()->getViewIndex())->getPicYuvOrg()->getStride(); 2499 2496 2500 Int iWidth = m_pcLCUData[m_indexLCU].m_widthInPixel;2501 Int iHeight = m_pcLCUData[m_indexLCU].m_heightInPixel;2497 Int width = m_pcLCUData[m_indexLCU].m_widthInPixel; 2498 Int height = m_pcLCUData[m_indexLCU].m_heightInPixel; 2502 2499 2503 2500 for( y = 0 ; y < pcCU->getSlice()->getSPS()->getMaxCUHeight() ; y+=8) … … 2511 2508 2512 2509 Double AvgDepth = (Double)Sum/((pcCU->getSlice()->getSPS()->getMaxCUHeight()/8)*(pcCU->getSlice()->getSPS()->getMaxCUWidth()/8)); 2513 2514 //Int iDisparity = pDepthGen->RCGetDisparityFromVirtDepth(0, (Int)AvgDepth); 2515 2516 Double dFL = FocalLen * abs( BasePos - CurPos ); 2517 Double dZ = abs( 1.0 / Znear - 1.0 / Zfar ) * ((Double)(AvgDepth) / (( 1 << g_bitDepthY ) - 1) ) + abs(1.0 / Zfar); 2518 Int iDisparity = (Int)(Direction*dFL * dZ); 2510 Double fL = focalLen * abs( basePos - curPos ); 2511 Double z = abs( 1.0 / znear - 1.0 / zfar ) * ((Double)(AvgDepth) / (( 1 << g_bitDepthY ) - 1) ) + abs(1.0 / zfar); 2512 Int disparity = (Int)(direction*fL * z); 2519 2513 Int shift = DISTORTION_PRECISION_ADJUSTMENT(g_bitDepthY-8); 2520 Int Disp = iDisparity;2521 2522 for( y = 0; y < iHeight; y++ )2523 { 2524 for( x = 0; x < iWidth; x++ )2525 { 2526 SAD += abs( pOrg[Clip3(0, (Int)(pcCU->getPic()->getPicYuvOrg()->getWidth() - pcCU->getSlice()->getSPS()->getMaxCUWidth()), x + Disp)]2527 - pRec[Clip3(0, (Int)(pcCU->getPic()->getPicYuvOrg()->getWidth() - pcCU->getSlice()->getSPS()->getMaxCUWidth()), x + Disp)] )>>shift;2514 Int disp = disparity; 2515 2516 for( y = 0; y < height; y++ ) 2517 { 2518 for( x = 0; x < width; x++ ) 2519 { 2520 SAD += abs( pOrg[Clip3(0, (Int)(pcCU->getPic()->getPicYuvOrg()->getWidth() - pcCU->getSlice()->getSPS()->getMaxCUWidth()), x + disp)] 2521 - pRec[Clip3(0, (Int)(pcCU->getPic()->getPicYuvOrg()->getWidth() - pcCU->getSlice()->getSPS()->getMaxCUWidth()), x + disp)] )>>shift; 2528 2522 } 2529 2523 pOrg += iStride; 2530 2524 pRec += iStride; 2531 2525 } 2532 m_pcLCUData[m_indexLCU].m_qp = iQP;2533 m_pcLCUData[m_indexLCU].m_costMAD = (SAD /(Double)( iWidth*iHeight));2526 m_pcLCUData[m_indexLCU].m_qp = qp; 2527 m_pcLCUData[m_indexLCU].m_costMAD = (SAD /(Double)(width*height)); 2534 2528 m_pcLCUData[m_indexLCU].m_bits = (Int)uiBits; 2535 2529 } -
branches/HTM-8.2-dev0-KWU/source/Lib/TLibEncoder/TEncRateCtrl.h
r635 r637 257 257 public: 258 258 #if KWU_RC_MADPRED_E0227 259 Void create( TEncRCSeq* encRCSeq, TEncRCGOP* encRCGOP, Int frameLevel, list<TEncRCPic*>& listPreviousPictures, Int LayerID );259 Void create( TEncRCSeq* encRCSeq, TEncRCGOP* encRCGOP, Int frameLevel, list<TEncRCPic*>& listPreviousPictures, Int layerID ); 260 260 #else 261 261 Void create( TEncRCSeq* encRCSeq, TEncRCGOP* encRCGOP, Int frameLevel, list<TEncRCPic*>& listPreviousPictures ); … … 264 264 265 265 #if KWU_RC_MADPRED_E0227 266 Double estimatePicLambdaIV( list<TEncRCPic*>& listPreviousPictures, Int CurPOC );266 Double estimatePicLambdaIV( list<TEncRCPic*>& listPreviousPictures, Int curPOC ); 267 267 #endif 268 268 #if !RATE_CONTROL_INTRA … … 284 284 285 285 #if KWU_RC_MADPRED_E0227 286 Double getLCUTargetBppforInterView( list<TEncRCPic*>& listPreviousPictures, TComDataCU* pcCU, Double BasePos, Double CurPos, Double FocalLen, Double Znear, Double Zfar, Int Direction, Int* iDisparity );286 Double getLCUTargetBppforInterView( list<TEncRCPic*>& listPreviousPictures, TComDataCU* pcCU, Double basePos, Double curPos, Double focalLen, Double znear, Double zfar, Int direction, Int* disparity ); 287 287 #endif 288 288 … … 305 305 #if KWU_RC_MADPRED_E0227 306 306 Void addToPictureLsitIV( list<TEncRCPic*>& listPreviousPictures ); 307 Void setIVPic( TEncRCPic* BaseRCPic );307 Void setIVPic( TEncRCPic* baseRCPic ); 308 308 #endif 309 309 … … 419 419 #if M0036_RC_IMPROVEMENT 420 420 #if KWU_RC_MADPRED_E0227 421 Void init( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Bool keepHierBits, Bool useLCUSeparateModel, GOPEntry GOPList[MAX_GOP], Int LayerID );421 Void init( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Bool keepHierBits, Bool useLCUSeparateModel, GOPEntry GOPList[MAX_GOP], Int layerID ); 422 422 #else 423 423 Void init( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Int keepHierBits, Bool useLCUSeparateModel, GOPEntry GOPList[MAX_GOP] ); … … 579 579 Void updateLCUData (TComDataCU* pcCU, UInt64 actualLCUBits, Int qp); 580 580 #if KWU_RC_MADPRED_E0227 581 Void updateLCUDataEnhancedView(TComDataCU* pcCU, UInt64 uiBits, Int iQP, Double BasePos, Double CurPos, Double FocalLen, Double Znear, Double Zfar, Int Direction);581 Void updateLCUDataEnhancedView(TComDataCU* pcCU, UInt64 uiBits, Int qp, Double basePos, Double curPos, Double focalLen, Double znear, Double zfar, Int direction); 582 582 #endif 583 583 Void updateFrameData (UInt64 actualFrameBits); -
branches/HTM-8.2-dev0-KWU/source/Lib/TLibEncoder/TEncSlice.cpp
r636 r637 332 332 } 333 333 #if !RATE_CONTROL_LAMBDA_DOMAIN 334 if ( m_pcCfg->getUseRateCtrl() && !m_pcCfg->getIsDepth())334 if ( m_pcCfg->getUseRateCtrl()) 335 335 { 336 336 dQP = m_pcRateCtrl->getFrameQP(rpcSlice->isReferenced(), rpcSlice->getPOC()); … … 1134 1134 #endif 1135 1135 #if !RATE_CONTROL_LAMBDA_DOMAIN 1136 if(m_pcCfg->getUseRateCtrl() && !m_pcCfg->getIsDepth())1136 if(m_pcCfg->getUseRateCtrl()) 1137 1137 { 1138 1138 #if KWU_RC_MADPRED_E0227 1139 1139 if(pcSlice->getLayerId() != 0 && m_pcCfg->getUseDepthMADPred() && !pcSlice->getIsDepth()) 1140 1140 { 1141 double Zn, Zf, FocalLength, Position, CamShift;1142 double BasePos;1141 double zn, zf, focallength, position, camshift; 1142 double basepos; 1143 1143 bool bInterpolated; 1144 Int Direction = pcSlice->getViewId() - pcCU->getSlice()->getIvPic(false, 0)->getViewId();1145 1146 pcEncTop->getCamParam()-> getZNearZFar(pcSlice->getViewId(), pcSlice->getPOC(), Zn, Zf);1147 pcEncTop->getCamParam()-> getGeometryData(0, pcSlice->getPOC(), FocalLength, BasePos, CamShift, bInterpolated);1148 pcEncTop->getCamParam()-> getGeometryData(pcSlice->getViewId(), pcSlice->getPOC(), FocalLength, Position, CamShift, bInterpolated);1149 1150 m_pcRateCtrl->updateLCUDataEnhancedView(pcCU, pcCU->getTotalBits(), pcCU->getQP(0), BasePos, Position, FocalLength, Zn, Zf, (Direction > 0 ? 1 : -1));1144 Int direction = pcSlice->getViewId() - pcCU->getSlice()->getIvPic(false, 0)->getViewId(); 1145 1146 pcEncTop->getCamParam()->xGetZNearZFar(pcEncTop->getCamParam()->getBaseViewNumbers()[pcSlice->getViewIndex()], pcSlice->getPOC(), zn, zf); 1147 pcEncTop->getCamParam()->xGetGeometryData(pcEncTop->getCamParam()->getBaseViewNumbers()[0], pcSlice->getPOC(), focallength, basepos, camshift, bInterpolated); 1148 pcEncTop->getCamParam()->xGetGeometryData(pcEncTop->getCamParam()->getBaseViewNumbers()[pcSlice->getViewIndex()], pcSlice->getPOC(), focallength, position, camshift, bInterpolated); 1149 1150 m_pcRateCtrl->updateLCUDataEnhancedView(pcCU, pcCU->getTotalBits(), pcCU->getQP(0), basepos, position, focallength, zn, zf, (direction > 0 ? 1 : -1)); 1151 1151 } 1152 1152 #endif … … 1252 1252 if(pcSlice->getLayerId() != 0 && m_pcCfg->getUseDepthMADPred() && !pcSlice->getIsDepth()) 1253 1253 { 1254 double Zn, Zf, FocalLength, Position, CamShift;1255 double BasePos;1254 double zn, zf, focallength, position, camShift; 1255 double basePos; 1256 1256 bool bInterpolated; 1257 Int Direction = pcSlice->getViewId() - pcCU->getSlice()->getIvPic(false, 0)->getViewId();1258 Int iDisparity;1259 1260 pcEncTop->getCamParam()-> getZNearZFar(pcSlice->getViewId(), pcSlice->getPOC(), Zn, Zf);1261 pcEncTop->getCamParam()-> getGeometryData(0, pcSlice->getPOC(), FocalLength, BasePos, CamShift, bInterpolated);1262 pcEncTop->getCamParam()-> getGeometryData(pcSlice->getViewId(), pcSlice->getPOC(), FocalLength, Position, CamShift, bInterpolated);1257 Int direction = pcSlice->getViewId() - pcCU->getSlice()->getIvPic(false, 0)->getViewId(); 1258 Int disparity; 1259 1260 pcEncTop->getCamParam()->xGetZNearZFar(pcEncTop->getCamParam()->getBaseViewNumbers()[pcSlice->getViewIndex()], pcSlice->getPOC(), zn, zf); 1261 pcEncTop->getCamParam()->xGetGeometryData(pcEncTop->getCamParam()->getBaseViewNumbers()[0], pcSlice->getPOC(), focallength, basePos, camShift, bInterpolated); 1262 pcEncTop->getCamParam()->xGetGeometryData(pcEncTop->getCamParam()->getBaseViewNumbers()[pcSlice->getViewIndex()], pcSlice->getPOC(), focallength, position, camShift, bInterpolated); 1263 1263 bpp = m_pcRateCtrl->getRCPic()->getLCUTargetBppforInterView( m_pcRateCtrl->getPicList(), pcCU, 1264 BasePos, Position, FocalLength, Zn, Zf, (Direction > 0 ? 1 : -1), &iDisparity );1264 basePos, position, focallength, zn, zf, (direction > 0 ? 1 : -1), &disparity ); 1265 1265 } 1266 1266 else … … 1391 1391 #if TICKET_1090_FIX 1392 1392 #if RATE_CONTROL_LAMBDA_DOMAIN 1393 if ( m_pcCfg->getUseRateCtrl() && !m_pcCfg->getIsDepth())1393 if ( m_pcCfg->getUseRateCtrl() ) 1394 1394 { 1395 1395 #if !M0036_RC_IMPROVEMENT || KWU_RC_MADPRED_E0227 … … 1456 1456 m_uiPicDist += pcCU->getTotalDistortion(); 1457 1457 #if !RATE_CONTROL_LAMBDA_DOMAIN 1458 if(m_pcCfg->getUseRateCtrl() && !m_pcCfg->getIsDepth())1458 if(m_pcCfg->getUseRateCtrl()) 1459 1459 { 1460 1460 m_pcRateCtrl->updateLCUData(pcCU, pcCU->getTotalBits(), pcCU->getQP(0)); … … 1477 1477 xRestoreWPparam( pcSlice ); 1478 1478 #if !RATE_CONTROL_LAMBDA_DOMAIN 1479 if(m_pcCfg->getUseRateCtrl() && !m_pcCfg->getIsDepth())1479 if(m_pcCfg->getUseRateCtrl()) 1480 1480 { 1481 1481 m_pcRateCtrl->updateFrameData(m_uiPicTotalBits); -
branches/HTM-8.2-dev0-KWU/source/Lib/TLibEncoder/TEncTop.cpp
r635 r637 132 132 } 133 133 #else 134 #if KWU_FIX_URQ 134 135 if(m_enableRateCtrl) 136 #endif 135 137 m_cRateCtrl.create(getIntraPeriod(), getGOPSize(), getFrameRate(), getTargetBitrate(), getQP(), getNumLCUInUnit(), getSourceWidth(), getSourceHeight(), g_uiMaxCUWidth, g_uiMaxCUHeight); 136 138 #endif … … 230 232 } 231 233 m_cLoopFilter. destroy(); 234 m_cRateCtrl. destroy(); 232 235 // SBAC RD 233 236 if( m_bUseSBACRD ) … … 750 753 m_cPPS.setMaxCuDQPDepth( 0 ); 751 754 m_cPPS.setMinCuDQPSize( m_cPPS.getSPS()->getMaxCUWidth() >> ( m_cPPS.getMaxCuDQPDepth()) ); 752 } 753 #else 755 } 756 #endif 757 #if !RATE_CONTROL_LAMBDA_DOMAIN && KWU_FIX_URQ 754 758 if ( m_enableRateCtrl ) 755 759 {
Note: See TracChangeset for help on using the changeset viewer.