Ignore:
Timestamp:
17 Jul 2015, 05:43:37 (9 years ago)
Author:
seregin
Message:

port rev 4322 (g_bitDepth)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified branches/SHM-dev/source/Lib/TLibEncoder/TEncSlice.cpp

    r1260 r1287  
    171171
    172172  // store lambda
    173   m_pcRdCost ->setLambda( dLambda );
     173#if SVC_EXTENSION
     174  m_pcRdCost ->setLambda( dLambda, slice->getBitDepths() );
     175#else
     176  m_pcRdCost ->setLambda( dLambda, slice->getSPS()->getBitDepths() );
     177#endif
    174178
    175179  // for RDO
     
    187191    {
    188192      dLambdas[0] = dLambda * 1.1;
    189       m_pcRdCost->setLambda( dLambdas[0] );
     193      m_pcRdCost->setLambda( dLambdas[0], slice->getBitDepths() );
    190194
    191195      m_pcRdCost->setDistortionWeight(compID, tmpWeight * 1.15);
     
    227231 \param iGOPid        POC offset for hierarchical structure
    228232 \param rpcSlice      slice header class
    229  \param pSPS          SPS associated with the slice
    230  \param pPPS          PPS associated with the slice
    231233 \param isField       true for field coding
    232234 */
    233 #if SVC_EXTENSION
     235
    234236Void TEncSlice::initEncSlice( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, Int iGOPid, TComSlice*& rpcSlice, Bool isField )
    235 #else
    236 Void TEncSlice::initEncSlice( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, Int iGOPid, TComSlice*& rpcSlice, const TComSPS* pSPS, const TComPPS *pPPS, Bool isField )
    237 #endif
    238237{
    239238  Double dQP;
     
    351350  {
    352351#if SVC_EXTENSION
    353     if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getQpBDOffsetY() ) && (rpcSlice->getPPS()->getTransquantBypassEnableFlag())))
     352    if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getQpBDOffset(CHANNEL_TYPE_LUMA) ) && (rpcSlice->getPPS()->getTransquantBypassEnableFlag())))
    354353#else
    355354    if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA) ) && (rpcSlice->getPPS()->getTransquantBypassEnableFlag())))
     
    393392
    394393#if FULL_NBIT
    395     Int    bitdepth_luma_qp_scale = 6 * (g_bitDepth[CHANNEL_TYPE_LUMA] - 8);
     394#if SVC_EXTENSION
     395    Int    bitdepth_luma_qp_scale = 6 * (rpcSlice->getBitDepth(CHANNEL_TYPE_LUMA) - 8);
     396#else
     397    Int    bitdepth_luma_qp_scale = 6 * (rpcSlice->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) - 8);
     398#endif
    396399#else
    397400    Int    bitdepth_luma_qp_scale = 0;
     
    425428
    426429#if SVC_EXTENSION
    427     iQP = max( -rpcSlice->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );
    428 #else
    429     iQP = max( -pSPS->getQpBDOffset(CHANNEL_TYPE_LUMA), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );
     430    iQP = max( -rpcSlice->getQpBDOffset(CHANNEL_TYPE_LUMA), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );
     431#else
     432    iQP = max( -rpcSlice->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );
    430433#endif
    431434
     
    486489    dQP = xGetQPValueAccordingToLambda( dLambda );
    487490#if SVC_EXTENSION
    488     iQP = max( -rpcSlice->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );
    489 #else
    490     iQP = max( -pSPS->getQpBDOffset(CHANNEL_TYPE_LUMA), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );
     491    iQP = max( -rpcSlice->getQpBDOffset(CHANNEL_TYPE_LUMA), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );
     492#else
     493    iQP = max( -rpcSlice->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );
    491494#endif
    492495  }
     
    499502  rpcSlice->setSliceChromaQpDelta( COMPONENT_Cb, 0 );
    500503  rpcSlice->setSliceChromaQpDelta( COMPONENT_Cr, 0 );
    501   rpcSlice->setUseChromaQpAdj( pPPS->getChromaQpAdjTableSize() > 0 );
     504  rpcSlice->setUseChromaQpAdj( rpcSlice->getPPS()->getChromaQpAdjTableSize() > 0 );
    502505  rpcSlice->setNumRefIdx(REF_PIC_LIST_0,m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive);
    503506  rpcSlice->setNumRefIdx(REF_PIC_LIST_1,m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive);
     
    644647  Double dFrameLambda;
    645648#if FULL_NBIT
    646   Int    SHIFT_QP = 12 + 6 * (g_bitDepth[CHANNEL_TYPE_LUMA] - 8);
     649#if SVC_EXTENSION
     650  Int    SHIFT_QP = 12 + 6 * (pcSlice->getBitDepth(CHANNEL_TYPE_LUMA) - 8);
     651#else
     652  Int    SHIFT_QP = 12 + 6 * (pcSlice->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) - 8);
     653#endif
    647654#else
    648655  Int    SHIFT_QP = 12;
     
    706713Void TEncSlice::calCostSliceI(TComPic* pcPic)
    707714{
    708   UInt    ctuRsAddr;
    709   UInt    startCtuTsAddr;
    710   UInt    boundingCtuTsAddr;
    711   Int     iSumHad, shift = g_bitDepth[CHANNEL_TYPE_LUMA]-8, offset = (shift>0)?(1<<(shift-1)):0;;
    712   Double  iSumHadSlice = 0;
    713 
    714   pcPic->getSlice(getSliceIdx())->setSliceSegmentBits(0);
    715   TComSlice* pcSlice            = pcPic->getSlice(getSliceIdx());
     715  Double            iSumHadSlice      = 0;
     716  TComSlice * const pcSlice           = pcPic->getSlice(getSliceIdx());
     717  const TComSPS    &sps               = *(pcSlice->getSPS());
     718#if SVC_EXTENSION
     719  const Int         shift             = pcSlice->getBitDepth(CHANNEL_TYPE_LUMA)-8;
     720#else
     721  const Int         shift             = sps.getBitDepth(CHANNEL_TYPE_LUMA)-8;
     722#endif
     723  const Int         offset            = (shift>0)?(1<<(shift-1)):0;
     724
     725  pcSlice->setSliceSegmentBits(0);
     726
     727  UInt startCtuTsAddr, boundingCtuTsAddr;
    716728  xDetermineStartAndBoundingCtuTsAddr ( startCtuTsAddr, boundingCtuTsAddr, pcPic, false );
    717729
    718   UInt ctuTsAddr;
    719   ctuRsAddr = pcPic->getPicSym()->getCtuTsToRsAddrMap( startCtuTsAddr);
    720   for( ctuTsAddr = startCtuTsAddr; ctuTsAddr < boundingCtuTsAddr; ctuRsAddr = pcPic->getPicSym()->getCtuTsToRsAddrMap(++ctuTsAddr) )
     730  for( UInt ctuTsAddr = startCtuTsAddr, ctuRsAddr = pcPic->getPicSym()->getCtuTsToRsAddrMap( startCtuTsAddr);
     731       ctuTsAddr < boundingCtuTsAddr;
     732      ctuRsAddr = pcPic->getPicSym()->getCtuTsToRsAddrMap(++ctuTsAddr) )
    721733  {
    722734    // initialize CU encoder
     
    725737
    726738#if SVC_EXTENSION
    727     Int height  = min( pcSlice->getSPS()->getMaxCUHeight(),pcSlice->getPicHeightInLumaSamples() - ctuRsAddr / pcPic->getFrameWidthInCtus() * pcSlice->getSPS()->getMaxCUHeight() );
    728     Int width   = min( pcSlice->getSPS()->getMaxCUWidth(),pcSlice->getPicWidthInLumaSamples() - ctuRsAddr % pcPic->getFrameWidthInCtus() * pcSlice->getSPS()->getMaxCUWidth() );
    729 #else
    730     Int height  = min( pcSlice->getSPS()->getMaxCUHeight(),pcSlice->getSPS()->getPicHeightInLumaSamples() - ctuRsAddr / pcPic->getFrameWidthInCtus() * pcSlice->getSPS()->getMaxCUHeight() );
    731     Int width   = min( pcSlice->getSPS()->getMaxCUWidth(),pcSlice->getSPS()->getPicWidthInLumaSamples() - ctuRsAddr % pcPic->getFrameWidthInCtus() * pcSlice->getSPS()->getMaxCUWidth() );
    732 #endif
    733 
    734     iSumHad = m_pcCuEncoder->updateCtuDataISlice(pCtu, width, height);
     739    Int height  = min( sps.getMaxCUHeight(),pcSlice->getPicHeightInLumaSamples() - ctuRsAddr / pcPic->getFrameWidthInCtus() * sps.getMaxCUHeight() );
     740    Int width   = min( sps.getMaxCUWidth(),pcSlice->getPicWidthInLumaSamples() - ctuRsAddr % pcPic->getFrameWidthInCtus() * sps.getMaxCUWidth() );
     741#else
     742    Int height  = min( sps.getMaxCUHeight(),sps.getPicHeightInLumaSamples() - ctuRsAddr / pcPic->getFrameWidthInCtus() * sps.getMaxCUHeight() );
     743    Int width   = min( sps.getMaxCUWidth(), sps.getPicWidthInLumaSamples()  - ctuRsAddr % pcPic->getFrameWidthInCtus() * sps.getMaxCUWidth() );
     744#endif
     745
     746    Int iSumHad = m_pcCuEncoder->updateCtuDataISlice(pCtu, width, height);
    735747
    736748    (m_pcRateCtrl->getRCPic()->getLCU(ctuRsAddr)).m_costIntra=(iSumHad+offset)>>shift;
     
    901913
    902914#if SVC_EXTENSION
    903         estQP     = Clip3( -pcSlice->getQpBDOffsetY(), MAX_QP, estQP );
     915        estQP     = Clip3( -pcSlice->getQpBDOffset(CHANNEL_TYPE_LUMA), MAX_QP, estQP );
     916
     917        m_pcRdCost->setLambda(estLambda, pcSlice->getBitDepths());
    904918#else
    905919        estQP     = Clip3( -pcSlice->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA), MAX_QP, estQP );
    906 #endif
    907 
    908         m_pcRdCost->setLambda(estLambda);
     920
     921        m_pcRdCost->setLambda(estLambda, pcSlice->getSPS()->getBitDepths());
     922#endif       
    909923
    910924#if RDOQ_CHROMA_LAMBDA
     
    10001014        actualQP = pCtu->getQP( 0 );
    10011015      }
    1002       m_pcRdCost->setLambda(oldLambda);
     1016#if SVC_EXTENSION
     1017      m_pcRdCost->setLambda(oldLambda, pcSlice->getBitDepths());
     1018#else
     1019      m_pcRdCost->setLambda(oldLambda, pcSlice->getSPS()->getBitDepths());
     1020#endif
    10031021      m_pcRateCtrl->getRCPic()->updateAfterCTU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda,
    10041022                                                pCtu->getSlice()->getSliceType() == I_SLICE ? 0 : m_pcCfg->getLCULevelRC() );
     
    11581176
    11591177#if SVC_EXTENSION
    1160         m_pcEntropyCoder->encodeSAOBlkParam(saoblkParam, m_ppcTEncTop[pcSlice->getLayerIdx()]->getSAO()->getSaoMaxOffsetQVal(), sliceEnabled, leftMergeAvail, aboveMergeAvail);
    1161 #else
    1162         m_pcEntropyCoder->encodeSAOBlkParam(saoblkParam, sliceEnabled, leftMergeAvail, aboveMergeAvail);
     1178        m_pcEntropyCoder->encodeSAOBlkParam(saoblkParam, pcPic->getPicSym()->getSlice(0)->getBitDepths(), sliceEnabled, leftMergeAvail, aboveMergeAvail);
     1179#else
     1180        m_pcEntropyCoder->encodeSAOBlkParam(saoblkParam, pcPic->getPicSym()->getSPS().getBitDepths(), sliceEnabled, leftMergeAvail, aboveMergeAvail);
    11631181#endif
    11641182      }
     
    13641382{
    13651383  xCalcACDCParamSlice(pcSlice);
    1366   WPACDCParam * temp_weightACDCParam;
    1367 
    1368   pcSlice->getWpAcDcParam(temp_weightACDCParam);
    1369   g_refWeightACDCParam = (void *) temp_weightACDCParam;
    13701384}
    13711385#endif //SVC_EXTENSION
Note: See TracChangeset for help on using the changeset viewer.