Skip to content
Snippets Groups Projects
EncCu.cpp 66.4 KiB
Newer Older
  • Learn to ignore specific revisions
  •     if( CU::isIntra( cu ) )
        {
          xReconIntraQT( cu );
        }
        else
        {
          xDeriveCUMV( cu );
          xReconInter( cu );
        }
    
        Distortion finalDistortion = 0;
        const int  numValidComponents = getNumberValidComponents( tempCS->area.chromaFormat );
    
        for( int comp = 0; comp < numValidComponents; comp++ )
        {
          const ComponentID compID = ComponentID( comp );
    
          if( CS::isDualITree( *tempCS ) && toChannelType( compID ) != partitioner.chType )
          {
            continue;
          }
    
          CPelBuf reco = tempCS->getRecoBuf( compID );
          CPelBuf org  = tempCS->getOrgBuf ( compID );
    
    #if WCG_EXT
          if( m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled() )
          {
    #if WCG_EXT_BUGFIX
            const CPelBuf orgLuma = tempCS->getOrgBuf(tempCS->area.blocks[COMPONENT_Y]);
    #else
            const CPelBuf orgLuma = tempCS->getOrgBuf(cs.area.blocks[COMPONENT_Y]);
    #endif
            finalDistortion += m_pcRdCost->getDistPart( org, reco, sps.getBitDepth( toChannelType( compID ) ), compID, DF_SSE_WTD, &orgLuma );
          }
          else
    #endif
          finalDistortion += m_pcRdCost->getDistPart( org, reco, sps.getBitDepth( toChannelType( compID ) ), compID, DF_SSE );
        }
    
        m_CABACEstimator->getCtx() = m_CurrCtx->start;
        m_CABACEstimator->resetBits();
    
        CUCtx cuCtx;
        cuCtx.isDQPCoded = true;
        cuCtx.isChromaQpAdjCoded = true;
        m_CABACEstimator->coding_unit( cu, partitioner, cuCtx );
    
        tempCS->dist     = finalDistortion;
        tempCS->fracBits = m_CABACEstimator->getEstFracBits();
        tempCS->cost     = m_pcRdCost->calcRdCost( tempCS->fracBits, tempCS->dist );
    
        xEncodeDontSplit( *tempCS,         partitioner );
        xCheckDQP       ( *tempCS,         partitioner );
        xCheckBestMode  (  tempCS, bestCS, partitioner, cachedMode );
      }
      else
      {
        THROW( "Should never happen!" );
      }
    }
    
    #endif
    
    //! \}