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/TEncSearch.cpp

    r1487 r1502  
    11291129  const ChromaFormat   chFmt            = pcOrgYuv->getChromaFormat();
    11301130  const ChannelType    chType           = toChannelType(compID);
    1131 #if SVC_EXTENSION
    1132   const Int            bitDepth         = pcCU->getSlice()->getBitDepth(chType);
    1133 #else
    11341131  const Int            bitDepth         = sps.getBitDepth(chType);
    1135 #endif
    1136 
    11371132  const UInt           uiWidth          = rect.width;
    11381133  const UInt           uiHeight         = rect.height;
     
    22942289      DistParam distParam;
    22952290      const Bool bUseHadamard=pcCU->getCUTransquantBypass(0) == 0;
    2296 #if SVC_EXTENSION
    2297       m_pcRdCost->setDistParam(distParam, pcCU->getSlice()->getBitDepth(CHANNEL_TYPE_LUMA), piOrg, uiStride, piPred, uiStride, puRect.width, puRect.height, bUseHadamard);
    2298 #else
    22992291      m_pcRdCost->setDistParam(distParam, sps.getBitDepth(CHANNEL_TYPE_LUMA), piOrg, uiStride, piPred, uiStride, puRect.width, puRect.height, bUseHadamard);
    2300 #endif
    23012292      distParam.bApplyWeight = false;
    23022293      for( Int modeIdx = 0; modeIdx < numModesAvailable; modeIdx++ )
     
    27742765  const UInt uiReconStride   = pcCU->getPic()->getPicYuvRec()->getStride(compID);
    27752766  const UInt uiPCMBitDepth   = pcCU->getSlice()->getSPS()->getPCMBitDepth(toChannelType(compID));
    2776 #if SVC_EXTENSION
    2777   const Int  channelBitDepth = pcCU->getSlice()->getBitDepth(toChannelType(compID));
    2778 #else
    27792767  const Int  channelBitDepth = pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID));
    2780 #endif
    27812768  Pel* pRecoPic = pcCU->getPic()->getPicYuvRec()->getAddr(compID, pcCU->getCtuRsAddr(), pcCU->getZorderIdxInCtu()+uiAbsPartIdx);
    27822769
     
    28662853
    28672854
    2868 #if SVC_EXTENSION
    2869   m_pcRdCost->setDistParam( cDistParam, pcCU->getSlice()->getBitDepth(CHANNEL_TYPE_LUMA),
    2870 #else
    28712855  m_pcRdCost->setDistParam( cDistParam, pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA),
    2872 #endif
    28732856                            pcYuvOrg->getAddr( COMPONENT_Y, uiAbsPartIdx ), pcYuvOrg->getStride(COMPONENT_Y),
    28742857                            m_tmpYuvPred .getAddr( COMPONENT_Y, uiAbsPartIdx ), m_tmpYuvPred.getStride(COMPONENT_Y),
     
    38133796#endif
    38143797  {
    3815 #if SVC_EXTENSION
    3816     xPredInterBlk( COMPONENT_Y, pcCU, pcPicYuvRef, uiPartAddr, &cMvCand, iSizeX, iSizeY, pcTemplateCand, true, pcCU->getSlice()->getBitDepth(CHANNEL_TYPE_LUMA) );
    3817 #else
    38183798    xPredInterBlk( COMPONENT_Y, pcCU, pcPicYuvRef, uiPartAddr, &cMvCand, iSizeX, iSizeY, pcTemplateCand, true, pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) );
    3819 #endif
    38203799  }
    38213800  else
    38223801  {
    3823 #if SVC_EXTENSION
    3824     xPredInterBlk( COMPONENT_Y, pcCU, pcPicYuvRef, uiPartAddr, &cMvCand, iSizeX, iSizeY, pcTemplateCand, false, pcCU->getSlice()->getBitDepth(CHANNEL_TYPE_LUMA) );
    3825 #else
    38263802    xPredInterBlk( COMPONENT_Y, pcCU, pcPicYuvRef, uiPartAddr, &cMvCand, iSizeX, iSizeY, pcTemplateCand, false, pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) );
    3827 #endif
    38283803  }
    38293804
     
    38403815  // calc distortion
    38413816
    3842 #if SVC_EXTENSION
    3843   uiCost = m_pcRdCost->getDistPart( pcCU->getSlice()->getBitDepth(CHANNEL_TYPE_LUMA), pcTemplateCand->getAddr(COMPONENT_Y, uiPartAddr), pcTemplateCand->getStride(COMPONENT_Y), pcOrgYuv->getAddr(COMPONENT_Y, uiPartAddr), pcOrgYuv->getStride(COMPONENT_Y), iSizeX, iSizeY, COMPONENT_Y, DF_SAD );
    3844 #else
    38453817  uiCost = m_pcRdCost->getDistPart( pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA), pcTemplateCand->getAddr(COMPONENT_Y, uiPartAddr), pcTemplateCand->getStride(COMPONENT_Y), pcOrgYuv->getAddr(COMPONENT_Y, uiPartAddr), pcOrgYuv->getStride(COMPONENT_Y), iSizeX, iSizeY, COMPONENT_Y, DF_SAD );
    3846 #endif
    38473818  uiCost = (UInt) m_pcRdCost->calcRdCost( m_auiMVPIdxCost[iMVPIdx][iMVPNum], uiCost, DF_SAD );
    38483819  return uiCost;
     
    38913862                             iRoiHeight,
    38923863                             pcYuv->getStride(COMPONENT_Y),
    3893 #if SVC_EXTENSION
    3894                              pcCU->getSlice()->getBitDepth(CHANNEL_TYPE_LUMA) );
    3895 #else
    38963864                             pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) );
    3897 #endif
    38983865
    38993866  Pel*        piRefY      = pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxPred )->getPicYuvRec()->getAddr( COMPONENT_Y, pcCU->getCtuRsAddr(), pcCU->getZorderIdxInCtu() + uiPartAddr );
     
    46334600  const UInt cuHeightPixels     = pcCU->getHeight( 0 );
    46344601  const Int  numValidComponents = pcCU->getPic()->getNumberValidComponents();
    4635 #if !SVC_EXTENSION
    46364602  const TComSPS &sps=*(pcCU->getSlice()->getSPS());
    4637 #endif
    46384603
    46394604  // The pcCU is not marked as skip-mode at this point, and its m_pcTrCoeff, m_pcArlCoeff, m_puhCbf, m_puhTrIdx will all be 0.
     
    46544619      const UInt csx=pcYuvOrg->getComponentScaleX(compID);
    46554620      const UInt csy=pcYuvOrg->getComponentScaleY(compID);
    4656 #if SVC_EXTENSION
    4657       distortion += m_pcRdCost->getDistPart( pcCU->getSlice()->getBitDepth(toChannelType(compID)), pcYuvRec->getAddr(compID), pcYuvRec->getStride(compID), pcYuvOrg->getAddr(compID),
    4658 #else
    46594621      distortion += m_pcRdCost->getDistPart( sps.getBitDepth(toChannelType(compID)), pcYuvRec->getAddr(compID), pcYuvRec->getStride(compID), pcYuvOrg->getAddr(compID),
    4660 #endif
    46614622                                               pcYuvOrg->getStride(compID), cuWidthPixels >> csx, cuHeightPixels >> csy, compID);
    46624623    }
     
    47584719  m_pcRDGoOnSbacCoder->store( m_pppcRDSbacCoder[ pcCU->getDepth( 0 ) ][ CI_TEMP_BEST ] );
    47594720
    4760 #if SVC_EXTENSION
    4761   pcYuvRec->addClip ( pcYuvPred, pcYuvResiBest, 0, cuWidthPixels, pcCU->getSlice()->getBitDepths() );
    4762 #else
    47634721  pcYuvRec->addClip ( pcYuvPred, pcYuvResiBest, 0, cuWidthPixels, sps.getBitDepths() );
    4764 #endif
    47654722
    47664723  // update with clipped distortion and cost (previously unclipped reconstruction values were used)
     
    47704727  {
    47714728    const ComponentID compID=ComponentID(comp);
    4772 #if SVC_EXTENSION
    4773     finalDistortion += m_pcRdCost->getDistPart( pcCU->getSlice()->getBitDepth(toChannelType(compID)), pcYuvRec->getAddr(compID ), pcYuvRec->getStride(compID ), pcYuvOrg->getAddr(compID ), pcYuvOrg->getStride(compID), cuWidthPixels >> pcYuvOrg->getComponentScaleX(compID), cuHeightPixels >> pcYuvOrg->getComponentScaleY(compID), compID);
    4774 #else
    47754729    finalDistortion += m_pcRdCost->getDistPart( sps.getBitDepth(toChannelType(compID)), pcYuvRec->getAddr(compID ), pcYuvRec->getStride(compID ), pcYuvOrg->getAddr(compID ), pcYuvOrg->getStride(compID), cuWidthPixels >> pcYuvOrg->getComponentScaleX(compID), cuHeightPixels >> pcYuvOrg->getComponentScaleY(compID), compID);
    4776 #endif
    47774730  }
    47784731
     
    48644817      checkTransformSkip[i]=false;
    48654818      const ComponentID compID=ComponentID(i);
    4866 #if SVC_EXTENSION
    4867       const Int channelBitDepth=pcCU->getSlice()->getBitDepth(toChannelType(compID));
    4868 #else
    48694819      const Int channelBitDepth=pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID));
    4870 #endif
    48714820      pcCoeffCurr[compID]    = m_ppcQTTempCoeff[compID][uiQTTempAccessLayer] + rTu.getCoefficientOffset(compID);
    48724821#if ADAPTIVE_QP_SELECTION
Note: See TracChangeset for help on using the changeset viewer.