Ignore:
Timestamp:
11 Dec 2015, 00:05:48 (8 years ago)
Author:
seregin
Message:

infer parameters in SPS after activation, fixing chroma scaling for non 4:2:0

File:
1 edited

Legend:

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

    r1474 r1502  
    173173
    174174  // store lambda
    175 #if SVC_EXTENSION
    176   m_pcRdCost ->setLambda( dLambda, slice->getBitDepths() );
    177 #else
    178175  m_pcRdCost ->setLambda( dLambda, slice->getSPS()->getBitDepths() );
    179 #endif
    180176
    181177  // for RDO
     
    193189    {
    194190      dLambdas[0] = dLambda * 1.1;
    195       m_pcRdCost->setLambda( dLambdas[0], slice->getBitDepths() );
     191      m_pcRdCost->setLambda( dLambdas[0], slice->getSPS()->getBitDepths() );
    196192
    197193      m_pcRdCost->setDistortionWeight(compID, tmpWeight * 1.15);
     
    337333  if(eSliceType!=I_SLICE)
    338334  {
    339 #if SVC_EXTENSION
    340     if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getQpBDOffset(CHANNEL_TYPE_LUMA) ) && (rpcSlice->getPPS()->getTransquantBypassEnableFlag())))
    341 #else
    342335    if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA) ) && (rpcSlice->getPPS()->getTransquantBypassEnableFlag())))
    343 #endif
    344336    {
    345337      dQP += m_pcCfg->getGOPEntry(iGOPid).m_QPOffset;
     
    378370
    379371#if FULL_NBIT
    380 #if SVC_EXTENSION
    381     Int    bitdepth_luma_qp_scale = 6 * (rpcSlice->getBitDepth(CHANNEL_TYPE_LUMA) - 8);
    382 #else
    383372    Int    bitdepth_luma_qp_scale = 6 * (rpcSlice->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) - 8);
    384 #endif
    385373#else
    386374    Int    bitdepth_luma_qp_scale = 0;
     
    423411    }
    424412
    425 #if SVC_EXTENSION
    426     iQP = max( -rpcSlice->getQpBDOffset(CHANNEL_TYPE_LUMA), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );
    427 #else
    428413    iQP = max( -rpcSlice->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );
    429 #endif
    430414
    431415    m_pdRdPicLambda[iDQpIdx] = dLambda;
     
    489473  {
    490474    dQP = xGetQPValueAccordingToLambda( dLambda );
    491 #if SVC_EXTENSION
    492     iQP = max( -rpcSlice->getQpBDOffset(CHANNEL_TYPE_LUMA), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );
    493 #else
    494475    iQP = max( -rpcSlice->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );
    495 #endif
    496476  }
    497477
     
    669649  Double dFrameLambda;
    670650#if FULL_NBIT
    671 #if SVC_EXTENSION
    672   Int    SHIFT_QP = 12 + 6 * (pcSlice->getBitDepth(CHANNEL_TYPE_LUMA) - 8);
    673 #else
    674651  Int    SHIFT_QP = 12 + 6 * (pcSlice->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) - 8);
    675 #endif
    676652#else
    677653  Int    SHIFT_QP = 12;
     
    732708  TComSlice * const pcSlice           = pcPic->getSlice(getSliceIdx());
    733709  const TComSPS    &sps               = *(pcSlice->getSPS());
    734 #if SVC_EXTENSION
    735   const Int         shift             = pcSlice->getBitDepth(CHANNEL_TYPE_LUMA)-8;
    736 #else
    737710  const Int         shift             = sps.getBitDepth(CHANNEL_TYPE_LUMA)-8;
    738 #endif
    739711  const Int         offset            = (shift>0)?(1<<(shift-1)):0;
    740712
     
    752724    pCtu->initCtu( pcPic, ctuRsAddr );
    753725
    754 #if SVC_EXTENSION
    755     Int height  = min( sps.getMaxCUHeight(),pcSlice->getPicHeightInLumaSamples() - ctuRsAddr / pcPic->getFrameWidthInCtus() * sps.getMaxCUHeight() );
    756     Int width   = min( sps.getMaxCUWidth(),pcSlice->getPicWidthInLumaSamples() - ctuRsAddr % pcPic->getFrameWidthInCtus() * sps.getMaxCUWidth() );
    757 #else
    758726    Int height  = min( sps.getMaxCUHeight(),sps.getPicHeightInLumaSamples() - ctuRsAddr / pcPic->getFrameWidthInCtus() * sps.getMaxCUHeight() );
    759727    Int width   = min( sps.getMaxCUWidth(), sps.getPicWidthInLumaSamples()  - ctuRsAddr % pcPic->getFrameWidthInCtus() * sps.getMaxCUWidth() );
    760 #endif
    761728
    762729    Int iSumHad = m_pcCuEncoder->updateCtuDataISlice(pCtu, width, height);
     
    938905        }
    939906
    940 #if SVC_EXTENSION
    941         estQP     = Clip3( -pcSlice->getQpBDOffset(CHANNEL_TYPE_LUMA), MAX_QP, estQP );
    942 
    943         m_pcRdCost->setLambda(estLambda, pcSlice->getBitDepths());
    944 #else
    945907        estQP     = Clip3( -pcSlice->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA), MAX_QP, estQP );
    946908
    947909        m_pcRdCost->setLambda(estLambda, pcSlice->getSPS()->getBitDepths());
    948 #endif       
    949910
    950911#if RDOQ_CHROMA_LAMBDA
     
    10401001        actualQP = pCtu->getQP( 0 );
    10411002      }
    1042 #if SVC_EXTENSION
    1043       m_pcRdCost->setLambda(oldLambda, pcSlice->getBitDepths());
    1044 #else
    10451003      m_pcRdCost->setLambda(oldLambda, pcSlice->getSPS()->getBitDepths());
    1046 #endif
    10471004      m_pcRateCtrl->getRCPic()->updateAfterCTU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda,
    10481005                                                pCtu->getSlice()->getSliceType() == I_SLICE ? 0 : m_pcCfg->getLCULevelRC() );
     
    12011158        }
    12021159
    1203 #if SVC_EXTENSION
    1204         m_pcEntropyCoder->encodeSAOBlkParam(saoblkParam, pcPic->getPicSym()->getSlice(0)->getBitDepths(), sliceEnabled, leftMergeAvail, aboveMergeAvail);
    1205 #else
    12061160        m_pcEntropyCoder->encodeSAOBlkParam(saoblkParam, pcPic->getPicSym()->getSPS().getBitDepths(), sliceEnabled, leftMergeAvail, aboveMergeAvail);
    1207 #endif
    12081161      }
    12091162    }
Note: See TracChangeset for help on using the changeset viewer.