Changeset 637 in 3DVCSoftware


Ignore:
Timestamp:
17 Oct 2013, 20:17:10 (11 years ago)
Author:
kwu-htm
Message:

Clean up and revised according to the guideline.

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  
    229229
    230230#============ 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=======
    231239#RateCtrl                           : 0                # 0: Disable rate control 1: Enable rate control with total target
    232240#DepthMADPred                       : 0                # 0: Disable Depth based MAD prediction for extended view 1: Enable Depth based MAD prediction for extended view
     
    235243#TargetBitrate                      : 1500             # input target bitrate when RateCtrl is enable
    236244#NumLCUInUnit                       : 1                # Number of LCU in an Unit. Fraction is not allowed
     245>>>>>>> .r636
    237246
    238247#========== multiview coding tools ==========
  • branches/HTM-8.2-dev0-KWU/cfg/3D-HEVC/fullCfg.cfg

    r636 r637  
    235235
    236236#============ 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=======
    237245#RateCtrl                           : 0                # 0: Disable rate control 1: Enable rate control with total target
    238246#DepthMADPred                       : 0                # 0: Disable Depth based MAD prediction for extended view 1: Enable Depth based MAD prediction for extended view
     
    241249#TargetBitrate                      : 1500             # input target bitrate when RateCtrl is enable
    242250#NumLCUInUnit                       : 1                # Number of LCU in an Unit. Fraction is not allowed
     251>>>>>>> .r636
    243252
    244253#========== multiview coding tools ==========
  • branches/HTM-8.2-dev0-KWU/source/App/TAppEncoder/TAppEncCfg.cpp

    r636 r637  
    21792179    xConfirmPara( (numLCUInPic % m_numLCUInUnit) != 0, "total number of LCUs in a frame should be completely divided by NumLCUInUnit" );
    21802180
    2181 #if !(KWU_RC_MADPRED_E0227 || KWU_RC_VIEWRC_E0227)
     2181#if !KWU_FIX_URQ
    21822182    m_iMaxDeltaQP       = MAX_DELTA_QP;
    21832183#endif
  • branches/HTM-8.2-dev0-KWU/source/App/TAppEncoder/TAppEncTop.cpp

    r636 r637  
    512512  m_cTEncTop.setSignHideFlag(m_signHideFlag);
    513513#if RATE_CONTROL_LAMBDA_DOMAIN
    514 #if KWU_RC_MADPRED_E0227
     514#if KWU_RC_VIEWRC_E0227 || KWU_RC_MADPRED_E0227
    515515  if(!m_cTEncTop.getIsDepth())    //only for texture
    516516  {
     
    522522  }
    523523#else
    524   m_cTEncTop.setUseRateCtrl         ( m_RCEnableRateControl );
     524    m_cTEncTop.setUseRateCtrl         ( m_RCEnableRateControl );
    525525#endif
    526526#if !KWU_RC_VIEWRC_E0227
     
    603603#endif
    604604#else
    605 #if KWU_RC_MADPRED_E0227
     605#if KWU_RC_VIEWRC_E0227 || KWU_RC_MADPRED_E0227
    606606  if(!m_cTEncTop.getIsDepth())    //only for texture
    607607  {
    608608    m_cTEncTop.setUseRateCtrl         ( m_enableRateCtrl );
    609 #if !KWU_RC_VIEWRC_E0227
    610609    m_cTEncTop.setTargetBitrate       ( m_targetBitrate );
    611 #endif
    612610    m_cTEncTop.setNumLCUInUnit        ( m_numLCUInUnit);
    613611  }
     
    617615  }
    618616#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
    623622 
    624623#if KWU_RC_MADPRED_E0227
     
    962961    }
    963962
    964 #if !RATE_CONTROL_LAMBDA_DOMAIN
     963#if !RATE_CONTROL_LAMBDA_DOMAIN && KWU_FIX_URQ
    965964    for(Int layer=0; layer < m_numberOfLayers; layer++ )
    966965    {
  • branches/HTM-8.2-dev0-KWU/source/Lib/TAppCommon/TAppComCamPara.cpp

    r636 r637  
    15261526}
    15271527#endif
    1528 
    1529 
    1530 #if KWU_RC_MADPRED_E0227
    1531 Void
    1532   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   else
    1541   {
    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 Void
    1549   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   else
    1561   {
    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 Interpolation
    1581     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  
    125125  Bool  xGetLeftRightView         ( Int iView, std::vector<Int> aiSortedViews, Int& riLeftView, Int& riRightView, Int& riLeftSortedViewIdx, Int& riRightSortedViewIdx );
    126126  Void  xGetPrevAndNextBaseView   ( Int iSourceViewNum, Int iTargetViewNum, Int& riPrevBaseViewNum, Int& riNextBaseViewNum );
     127#if !KWU_RC_MADPRED_E0227
    127128  Void  xGetZNearZFar             ( Int iView, UInt uiFrame, Double& rdZNear, Double& rdZFar );
    128129  Void  xGetGeometryData          ( Int dView, UInt uiFrame, Double& rdFocalLength, Double& rdPosition, Double& rdCameraShift, Bool& rbInterpolated );
     130#endif
    129131  Void  xSetupBaseViewsFromCoded  ();
    130132  Void  xSetupBaseViews           ( Char* pchBaseViewNumbers, UInt uiNumBaseViews );
     
    222224
    223225#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 );
    226228#endif
    227229};
  • branches/HTM-8.2-dev0-KWU/source/Lib/TLibCommon/TypeDef.h

    r636 r637  
    305305#define M0036_RC_IMPROVEMENT                        1  ///< JCTVC-M0036, improvement for R-lambda model based rate control
    306306#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
    309310#define RC_FIX                                      1  /// suggested fix for M0036
    310311#define RATE_CONTROL_INTRA                          1  ///< JCTVC-M0257, rate control for intra
    311312#endif
     313
    312314#define KWU_RC_VIEWRC_E0227                         1  ///< JCT3V-E0227, view-wise target bitrate allocation
    313315#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  
    103103 
    104104  m_bEncodeDQP = false;
    105 #if (RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT) || KWU_RC_MADPRED_E0227
     105#if RATE_CONTROL_LAMBDA_DOMAIN && (!M0036_RC_IMPROVEMENT || KWU_RC_MADPRED_E0227)
    106106  m_LCUPredictionSAD = 0;
    107107  m_addSADDepth      = 0;
     
    242242 
    243243  m_bUseSBACRD        = pcEncTop->getUseSBACRD();
    244 
    245 #if KWU_RC_MADPRED_E0227
    246   if(!pcEncTop->getIsDepth())
    247   {
    248     m_pcRateCtrl        = pcEncTop->getRateCtrl();
    249   }
    250   else
    251   {
    252     m_pcRateCtrl = NULL;
    253   }
    254 #else
    255244  m_pcRateCtrl        = pcEncTop->getRateCtrl();
    256 #endif
    257245}
    258246
     
    478466
    479467#if RATE_CONTROL_LAMBDA_DOMAIN
    480   if ( m_pcEncCfg->getUseRateCtrl() && !m_pcEncCfg->getIsDepth() )
     468  if ( m_pcEncCfg->getUseRateCtrl() )
    481469  {
    482470    iMinQP = m_pcRateCtrl->getRCQP();
     
    484472  }
    485473#else
    486   if(m_pcEncCfg->getUseRateCtrl() && !m_pcEncCfg->getIsDepth())
     474  if(m_pcEncCfg->getUseRateCtrl())
    487475  {
    488476    Int qp = m_pcRateCtrl->getUnitQP();
     
    692680    }
    693681#endif
    694 #if !RATE_CONTROL_LAMBDA_DOMAIN
     682#if !RATE_CONTROL_LAMBDA_DOMAIN && KWU_FIX_URQ
    695683    if(m_pcEncCfg->getUseRateCtrl())
    696684    {
     
    11751163  }
    11761164#if RATE_CONTROL_LAMBDA_DOMAIN
    1177   if ( m_pcEncCfg->getUseRateCtrl() && !m_pcEncCfg->getIsDepth() )
     1165  if ( m_pcEncCfg->getUseRateCtrl() )
    11781166  {
    11791167    iMinQP = m_pcRateCtrl->getRCQP();
     
    11811169  }
    11821170#else
    1183   if(m_pcEncCfg->getUseRateCtrl() && !m_pcEncCfg->getIsDepth())
     1171  if(m_pcEncCfg->getUseRateCtrl())
    11841172  {
    11851173    Int qp = m_pcRateCtrl->getUnitQP();
  • branches/HTM-8.2-dev0-KWU/source/Lib/TLibEncoder/TEncGOP.cpp

    r636 r637  
    154154#endif
    155155
    156 #if !RATE_CONTROL_LAMBDA_DOMAIN
     156#if KWU_FIX_URQ
    157157  m_pcRateCtrl           = pcTEncTop->getRateCtrl();
    158158#endif
     
    22162216      delete[] pcSubstreamsOut;
    22172217  }
    2218 
     2218#if !KWU_FIX_URQ && !RATE_CONTROL_LAMBDA_DOMAIN
     2219  if(m_pcCfg->getUseRateCtrl())
     2220  {
     2221    m_pcRateCtrl->updateRCGOPStatus();
     2222  }
     2223#endif
    22192224  delete pcBitstreamRedirect;
    22202225
  • branches/HTM-8.2-dev0-KWU/source/Lib/TLibEncoder/TEncRateCtrl.cpp

    r636 r637  
    644644
    645645#if KWU_RC_MADPRED_E0227
    646 Void TEncRCPic::create( TEncRCSeq* encRCSeq, TEncRCGOP* encRCGOP, Int frameLevel, list<TEncRCPic*>& listPreviousPictures, Int LayerID )
     646Void TEncRCPic::create( TEncRCSeq* encRCSeq, TEncRCGOP* encRCGOP, Int frameLevel, list<TEncRCPic*>& listPreviousPictures, Int layerID )
    647647#else
    648648Void TEncRCPic::create( TEncRCSeq* encRCSeq, TEncRCGOP* encRCGOP, Int frameLevel, list<TEncRCPic*>& listPreviousPictures )
     
    717717
    718718#if KWU_RC_MADPRED_E0227
    719   m_LayerID = LayerID;
     719  m_LayerID = layerID;
    720720  m_lastIVPicture = NULL;
    721721  m_IVtotalMAD            = 0.0;
     
    10741074
    10751075#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 )
     1076Double TEncRCPic::getLCUTargetBppforInterView( list<TEncRCPic*>& listPreviousPictures, TComDataCU* pcCU, Double basePos, Double curPos, Double focalLen, Double znear, Double zfar, Int direction, Int* disparity )
    10771077{
    10781078  Int   LCUIdx    = getLCUCoded();
     
    10981098    Int   iStride = pcCU->getSlice()->getIvPic(true, pcCU->getSlice()->getViewIndex())->getPicYuvOrg()->getStride();
    10991099
    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;
    11021102
    11031103    for( y = 0 ; y < pcCU->getSlice()->getSPS()->getMaxCUHeight() ; y+=8)
     
    11121112    Double AvgDepth = (Double)Sum/((pcCU->getSlice()->getSPS()->getMaxCUHeight()/8)*(pcCU->getSlice()->getSPS()->getMaxCUWidth()/8));
    11131113
    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);
    11191117    Int shift = DISTORTION_PRECISION_ADJUSTMENT(g_bitDepthY-8);
    11201118
    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;
    11351133      }
    11361134      pOrg += iStride;
    11371135      pRec += iStride;
    11381136    }
    1139     IVMAD = SAD / (Double)(iHeight * iWidth);
     1137    IVMAD = SAD / (Double)(height * width);
    11401138    IVMAD = IVMAD * IVMAD;
    11411139
     
    14401438  m_picLambda           = averageLambda;
    14411439#if !M0036_RC_IMPROVEMENT || KWU_RC_MADPRED_E0227
     1440#if KWU_RC_MADPRED_E0227
    14421441  m_totalMAD = 0;
     1442#endif
    14431443  for ( Int i=0; i<m_numberOfLCU; i++ )
    14441444  {
     
    16491649#if M0036_RC_IMPROVEMENT
    16501650#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 )
     1651Void 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 )
    16521652#else
    16531653Void 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] )
     
    18671867
    18681868#if KWU_RC_MADPRED_E0227
    1869   setLayerID(LayerID);
     1869  setLayerID(layerID);
    18701870#endif
    18711871
     
    20822082  m_sourceHeightInLCU        = (sourceHeight / maxCUHeight) + (( sourceHeight %  maxCUHeight) ? 1 : 0); 
    20832083  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
    20882085  m_prevBitrate              = ( targetKbps << 10 );  // in units of 1,024 bps
    20892086  m_currBitrate              = ( targetKbps << 10 );
    2090 #endif
     2087
    20912088  m_frameRate                = frameRate;
    20922089  m_refFrameNum              = m_isLowdelay ? (sizeGOP) : (sizeGOP>>1);
     
    24862483
    24872484#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)
     2485Void  TEncRateCtrl::updateLCUDataEnhancedView(TComDataCU* pcCU, UInt64 uiBits, Int qp, Double basePos, Double curPos, Double focalLen, Double znear, Double zfar, Int direction)
    24892486{
    24902487  Int     x, y;
     
    24982495  Int   iStride = pcCU->getSlice()->getIvPic(true, pcCU->getSlice()->getViewIndex())->getPicYuvOrg()->getStride();
    24992496
    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;
    25022499
    25032500  for( y = 0 ; y < pcCU->getSlice()->getSPS()->getMaxCUHeight() ; y+=8)
     
    25112508
    25122509  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);
    25192513  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;
    25282522    }
    25292523    pOrg += iStride;
    25302524    pRec += iStride;
    25312525  }
    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));
    25342528  m_pcLCUData[m_indexLCU].m_bits = (Int)uiBits;
    25352529}
  • branches/HTM-8.2-dev0-KWU/source/Lib/TLibEncoder/TEncRateCtrl.h

    r635 r637  
    257257public:
    258258#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 );
    260260#else
    261261  Void create( TEncRCSeq* encRCSeq, TEncRCGOP* encRCGOP, Int frameLevel, list<TEncRCPic*>& listPreviousPictures );
     
    264264
    265265#if KWU_RC_MADPRED_E0227
    266   Double estimatePicLambdaIV( list<TEncRCPic*>& listPreviousPictures, Int CurPOC );
     266  Double estimatePicLambdaIV( list<TEncRCPic*>& listPreviousPictures, Int curPOC );
    267267#endif
    268268#if !RATE_CONTROL_INTRA
     
    284284
    285285#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 );
    287287#endif
    288288
     
    305305#if KWU_RC_MADPRED_E0227
    306306  Void addToPictureLsitIV( list<TEncRCPic*>& listPreviousPictures );
    307   Void setIVPic( TEncRCPic* BaseRCPic );
     307  Void setIVPic( TEncRCPic* baseRCPic );
    308308#endif
    309309
     
    419419#if M0036_RC_IMPROVEMENT
    420420#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 );
    422422#else
    423423  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] );
     
    579579  Void          updateLCUData         (TComDataCU* pcCU, UInt64 actualLCUBits, Int qp);
    580580#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);
    582582#endif
    583583  Void          updateFrameData       (UInt64 actualFrameBits);
  • branches/HTM-8.2-dev0-KWU/source/Lib/TLibEncoder/TEncSlice.cpp

    r636 r637  
    332332  }
    333333#if !RATE_CONTROL_LAMBDA_DOMAIN
    334   if ( m_pcCfg->getUseRateCtrl() && !m_pcCfg->getIsDepth())
     334  if ( m_pcCfg->getUseRateCtrl())
    335335  {
    336336    dQP = m_pcRateCtrl->getFrameQP(rpcSlice->isReferenced(), rpcSlice->getPOC());
     
    11341134#endif
    11351135#if !RATE_CONTROL_LAMBDA_DOMAIN
    1136     if(m_pcCfg->getUseRateCtrl() && !m_pcCfg->getIsDepth())
     1136    if(m_pcCfg->getUseRateCtrl())
    11371137    {
    11381138#if KWU_RC_MADPRED_E0227
    11391139      if(pcSlice->getLayerId() != 0 && m_pcCfg->getUseDepthMADPred() && !pcSlice->getIsDepth())
    11401140      {
    1141         double Zn, Zf, FocalLength, Position, CamShift;
    1142         double BasePos;
     1141        double zn, zf, focallength, position, camshift;
     1142        double basepos;
    11431143        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));
    11511151      }
    11521152#endif
     
    12521252          if(pcSlice->getLayerId() != 0 && m_pcCfg->getUseDepthMADPred() && !pcSlice->getIsDepth())
    12531253          {
    1254             double Zn, Zf, FocalLength, Position, CamShift;
    1255             double BasePos;
     1254            double zn, zf, focallength, position, camShift;
     1255            double basePos;
    12561256            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);
    12631263            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 );
    12651265          }
    12661266          else
     
    13911391#if TICKET_1090_FIX
    13921392#if RATE_CONTROL_LAMBDA_DOMAIN
    1393       if ( m_pcCfg->getUseRateCtrl() && !m_pcCfg->getIsDepth() )
     1393      if ( m_pcCfg->getUseRateCtrl() )
    13941394      {
    13951395#if !M0036_RC_IMPROVEMENT || KWU_RC_MADPRED_E0227
     
    14561456    m_uiPicDist      += pcCU->getTotalDistortion();
    14571457#if !RATE_CONTROL_LAMBDA_DOMAIN
    1458     if(m_pcCfg->getUseRateCtrl() && !m_pcCfg->getIsDepth())
     1458    if(m_pcCfg->getUseRateCtrl())
    14591459    {
    14601460      m_pcRateCtrl->updateLCUData(pcCU, pcCU->getTotalBits(), pcCU->getQP(0));
     
    14771477  xRestoreWPparam( pcSlice );
    14781478#if !RATE_CONTROL_LAMBDA_DOMAIN
    1479   if(m_pcCfg->getUseRateCtrl() && !m_pcCfg->getIsDepth())
     1479  if(m_pcCfg->getUseRateCtrl())
    14801480  {
    14811481    m_pcRateCtrl->updateFrameData(m_uiPicTotalBits);
  • branches/HTM-8.2-dev0-KWU/source/Lib/TLibEncoder/TEncTop.cpp

    r635 r637  
    132132  }
    133133#else
     134#if KWU_FIX_URQ
    134135  if(m_enableRateCtrl)
     136#endif
    135137    m_cRateCtrl.create(getIntraPeriod(), getGOPSize(), getFrameRate(), getTargetBitrate(), getQP(), getNumLCUInUnit(), getSourceWidth(), getSourceHeight(), g_uiMaxCUWidth, g_uiMaxCUHeight);
    136138#endif
     
    230232  }
    231233  m_cLoopFilter.        destroy();
     234  m_cRateCtrl.          destroy();
    232235  // SBAC RD
    233236  if( m_bUseSBACRD )
     
    750753    m_cPPS.setMaxCuDQPDepth( 0 );
    751754    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
    754758  if ( m_enableRateCtrl )
    755759  {
Note: See TracChangeset for help on using the changeset viewer.