Changeset 1243 in SHVCSoftware for branches/SHM-dev


Ignore:
Timestamp:
13 Jul 2015, 22:49:06 (9 years ago)
Author:
seregin
Message:

port rev 4235

Location:
branches/SHM-dev/source/Lib/TLibEncoder
Files:
3 edited

Legend:

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

    r1242 r1243  
    15041504  rpcTempCU->setChromaQpAdjSubParts( rpcTempCU->getCUTransquantBypass(0) ? 0 : m_ChromaQpAdjIdc, 0, uiDepth );
    15051505
    1506   Bool bSeparateLumaChroma = true; // choose estimation mode
    1507 
    1508   Distortion uiPreCalcDistC = 0;
    1509   if (rpcBestCU->getPic()->getChromaFormat()==CHROMA_400)
    1510   {
    1511     bSeparateLumaChroma=true;
    1512   }
    1513 
    15141506  Pel resiLuma[NUMBER_OF_STORED_RESIDUAL_TYPES][MAX_CU_SIZE * MAX_CU_SIZE];
    15151507
    1516   if( !bSeparateLumaChroma )
    1517   {
    1518     // after this function, the direction will be PLANAR, DC, HOR or VER
    1519     // however, if Luma ends up being one of those, the chroma dir must be later changed to DM_CHROMA.
    1520     m_pcPredSearch->preestChromaPredMode( rpcTempCU, m_ppcOrigYuv[uiDepth], m_ppcPredYuvTemp[uiDepth] );
    1521   }
    1522   m_pcPredSearch->estIntraPredQT( rpcTempCU, m_ppcOrigYuv[uiDepth], m_ppcPredYuvTemp[uiDepth], m_ppcResiYuvTemp[uiDepth], m_ppcRecoYuvTemp[uiDepth], resiLuma, uiPreCalcDistC, bSeparateLumaChroma DEBUG_STRING_PASS_INTO(sTest) );
     1508  m_pcPredSearch->estIntraPredLumaQT( rpcTempCU, m_ppcOrigYuv[uiDepth], m_ppcPredYuvTemp[uiDepth], m_ppcResiYuvTemp[uiDepth], m_ppcRecoYuvTemp[uiDepth], resiLuma DEBUG_STRING_PASS_INTO(sTest) );
    15231509
    15241510  m_ppcRecoYuvTemp[uiDepth]->copyToPicComponent(COMPONENT_Y, rpcTempCU->getPic()->getPicYuvRec(), rpcTempCU->getCtuRsAddr(), rpcTempCU->getZorderIdxInCtu() );
     
    15261512  if (rpcBestCU->getPic()->getChromaFormat()!=CHROMA_400)
    15271513  {
    1528     m_pcPredSearch->estIntraPredChromaQT( rpcTempCU, m_ppcOrigYuv[uiDepth], m_ppcPredYuvTemp[uiDepth], m_ppcResiYuvTemp[uiDepth], m_ppcRecoYuvTemp[uiDepth], resiLuma, uiPreCalcDistC DEBUG_STRING_PASS_INTO(sTest) );
     1514    m_pcPredSearch->estIntraPredChromaQT( rpcTempCU, m_ppcOrigYuv[uiDepth], m_ppcPredYuvTemp[uiDepth], m_ppcResiYuvTemp[uiDepth], m_ppcRecoYuvTemp[uiDepth], resiLuma DEBUG_STRING_PASS_INTO(sTest) );
    15291515  }
    15301516
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncSearch.cpp

    r1235 r1243  
    13621362
    13631363Void
    1364 TEncSearch::xRecurIntraCodingQT(Bool        bLumaOnly,
    1365                                 TComYuv*    pcOrgYuv,
    1366                                 TComYuv*    pcPredYuv,
    1367                                 TComYuv*    pcResiYuv,
    1368                                 Pel         resiLuma[NUMBER_OF_STORED_RESIDUAL_TYPES][MAX_CU_SIZE * MAX_CU_SIZE],
    1369                                 Distortion& ruiDistY,
    1370                                 Distortion& ruiDistC,
     1364TEncSearch::xRecurIntraCodingLumaQT(TComYuv*    pcOrgYuv,
     1365                                    TComYuv*    pcPredYuv,
     1366                                    TComYuv*    pcResiYuv,
     1367                                    Pel         resiLuma[NUMBER_OF_STORED_RESIDUAL_TYPES][MAX_CU_SIZE * MAX_CU_SIZE],
     1368                                    Distortion& ruiDistY,
    13711369#if HHI_RQT_INTRA_SPEEDUP
    1372                                 Bool        bCheckFirst,
    1373 #endif
    1374                                 Double&     dRDCost,
    1375                                 TComTU&     rTu
    1376                                 DEBUG_STRING_FN_DECLARE(sDebug))
     1370                                    Bool        bCheckFirst,
     1371#endif
     1372                                    Double&     dRDCost,
     1373                                    TComTU&     rTu
     1374                                    DEBUG_STRING_FN_DECLARE(sDebug))
    13771375{
    13781376  TComDataCU   *pcCU          = rTu.getCU();
     
    13831381        Bool    bCheckFull    = ( uiLog2TrSize  <= pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() );
    13841382        Bool    bCheckSplit   = ( uiLog2TrSize  >  pcCU->getQuadtreeTULog2MinSizeInCU(uiAbsPartIdx) );
    1385   const UInt    numValidComp  = (bLumaOnly) ? 1 : pcOrgYuv->getNumberValidComponents();
    13861383
    13871384        Pel     resiLumaSplit [NUMBER_OF_STORED_RESIDUAL_TYPES][MAX_CU_SIZE * MAX_CU_SIZE];
     
    14271424#endif
    14281425  Double     dSingleCost                        = MAX_DOUBLE;
     1426  Distortion uiSingleDistLuma                   = 0;
     1427  UInt       uiSingleCbfLuma                    = 0;
    14291428  Distortion uiSingleDist[MAX_NUM_CHANNEL_TYPE] = {0,0};
    14301429  UInt       uiSingleCbf[MAX_NUM_COMPONENT]     = {0,0,0};
     
    14461445      m_pcRDGoOnSbacCoder->store( m_pppcRDSbacCoder[ uiFullDepth ][ CI_QT_TRAFO_ROOT ] );
    14471446
    1448       Distortion singleDistTmp[MAX_NUM_CHANNEL_TYPE]  = { 0, 0 };
    1449       UInt       singleCbfTmp[MAX_NUM_COMPONENT]      = { 0, 0, 0 };
     1447      Distortion singleDistTmpLuma                    = 0;
     1448      UInt       singleCbfTmpLuma                     = 0;
    14501449      Double     singleCostTmp                        = 0;
    14511450      Int        firstCheckId                         = 0;
     
    14551454        DEBUG_STRING_NEW(sModeString)
    14561455        Int  default0Save1Load2 = 0;
    1457         singleDistTmp[0]=singleDistTmp[1]=0;
     1456        singleDistTmpLuma=0;
    14581457        if(modeId == firstCheckId)
    14591458        {
     
    14651464        }
    14661465
    1467         for(UInt ch=COMPONENT_Y; ch<numValidComp; ch++)
    1468         {
    1469           const ComponentID compID = ComponentID(ch);
    1470           if (rTu.ProcessComponentSection(compID))
    1471           {
    1472             const UInt totalAdjustedDepthChan = rTu.GetTransformDepthTotalAdj(compID);
    1473             pcCU->setTransformSkipSubParts ( modeId, compID, uiAbsPartIdx, totalAdjustedDepthChan );
    1474 
    1475             xIntraCodingTUBlock( pcOrgYuv, pcPredYuv, pcResiYuv, resiLumaSingle, false, singleDistTmp[toChannelType(compID)], compID, rTu DEBUG_STRING_PASS_INTO(sModeString), default0Save1Load2 );
    1476           }
    1477           singleCbfTmp[compID] = pcCU->getCbf( uiAbsPartIdx, compID, uiTrDepth );
    1478         }
     1466        if (rTu.ProcessComponentSection(COMPONENT_Y))
     1467        {
     1468          const UInt totalAdjustedDepthChan = rTu.GetTransformDepthTotalAdj(COMPONENT_Y);
     1469          pcCU->setTransformSkipSubParts ( modeId, COMPONENT_Y, uiAbsPartIdx, totalAdjustedDepthChan );
     1470
     1471          xIntraCodingTUBlock( pcOrgYuv, pcPredYuv, pcResiYuv, resiLumaSingle, false, singleDistTmpLuma, COMPONENT_Y, rTu DEBUG_STRING_PASS_INTO(sModeString), default0Save1Load2 );
     1472        }
     1473        singleCbfTmpLuma = pcCU->getCbf( uiAbsPartIdx, COMPONENT_Y, uiTrDepth );
     1474
    14791475        //----- determine rate and r-d cost -----
    1480         if(modeId == 1 && singleCbfTmp[COMPONENT_Y] == 0)
     1476        if(modeId == 1 && singleCbfTmpLuma == 0)
    14811477        {
    14821478          //In order not to code TS flag when cbf is zero, the case for TS with cbf being zero is forbidden.
     
    14851481        else
    14861482        {
    1487           UInt uiSingleBits = xGetIntraBitsQT( rTu, true, !bLumaOnly, false );
    1488           singleCostTmp     = m_pcRdCost->calcRdCost( uiSingleBits, singleDistTmp[CHANNEL_TYPE_LUMA] + singleDistTmp[CHANNEL_TYPE_CHROMA] );
     1483          UInt uiSingleBits = xGetIntraBitsQT( rTu, true, false, false );
     1484          singleCostTmp     = m_pcRdCost->calcRdCost( uiSingleBits, singleDistTmpLuma );
    14891485        }
    14901486        if(singleCostTmp < dSingleCost)
     
    14921488          DEBUG_STRING_SWAP(sDebug, sModeString)
    14931489          dSingleCost   = singleCostTmp;
    1494           uiSingleDist[CHANNEL_TYPE_LUMA] = singleDistTmp[CHANNEL_TYPE_LUMA];
    1495           uiSingleDist[CHANNEL_TYPE_CHROMA] = singleDistTmp[CHANNEL_TYPE_CHROMA];
    1496           for (UInt ch=0; ch<MAX_NUM_COMPONENT; ch++)
    1497             uiSingleCbf[ch] = singleCbfTmp[ch];
     1490          uiSingleDistLuma = singleDistTmpLuma;
     1491          uiSingleCbfLuma = singleCbfTmpLuma;
    14981492
    14991493          bestModeId[COMPONENT_Y] = modeId;
    15001494          if(bestModeId[COMPONENT_Y] == firstCheckId)
    15011495          {
    1502             xStoreIntraResultQT(COMPONENT_Y, bLumaOnly?COMPONENT_Y:COMPONENT_Cr, rTu );
     1496            xStoreIntraResultQT(COMPONENT_Y, rTu );
    15031497            m_pcRDGoOnSbacCoder->store( m_pppcRDSbacCoder[ uiFullDepth ][ CI_TEMP_BEST ] );
    15041498          }
     
    15231517      }
    15241518
    1525       for(UInt ch=COMPONENT_Y; ch<numValidComp; ch++)
    1526       {
    1527         const ComponentID compID=ComponentID(ch);
    1528         if (rTu.ProcessComponentSection(compID))
    1529         {
    1530           const UInt totalAdjustedDepthChan   = rTu.GetTransformDepthTotalAdj(compID);
    1531           pcCU ->setTransformSkipSubParts ( bestModeId[COMPONENT_Y], compID, uiAbsPartIdx, totalAdjustedDepthChan );
    1532         }
     1519      if (rTu.ProcessComponentSection(COMPONENT_Y))
     1520      {
     1521        const UInt totalAdjustedDepthChan   = rTu.GetTransformDepthTotalAdj(COMPONENT_Y);
     1522        pcCU ->setTransformSkipSubParts ( bestModeId[COMPONENT_Y], COMPONENT_Y, uiAbsPartIdx, totalAdjustedDepthChan );
    15331523      }
    15341524
    15351525      if(bestModeId[COMPONENT_Y] == firstCheckId)
    15361526      {
    1537         xLoadIntraResultQT(COMPONENT_Y, bLumaOnly?COMPONENT_Y:COMPONENT_Cr, rTu );
    1538         for(UInt ch=COMPONENT_Y; ch< numValidComp; ch++)
    1539         {
    1540           const ComponentID compID=ComponentID(ch);
    1541           if (rTu.ProcessComponentSection(compID))
    1542             pcCU->setCbfSubParts  ( uiSingleCbf[compID] << uiTrDepth, compID, uiAbsPartIdx, rTu.GetTransformDepthTotalAdj(compID) );
    1543         }
     1527        xLoadIntraResultQT(COMPONENT_Y, rTu );
     1528        if (rTu.ProcessComponentSection(COMPONENT_Y))
     1529          pcCU->setCbfSubParts  ( uiSingleCbfLuma << uiTrDepth, COMPONENT_Y, uiAbsPartIdx, rTu.GetTransformDepthTotalAdj(COMPONENT_Y) );
    15441530
    15451531        m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[ uiFullDepth ][ CI_TEMP_BEST ] );
    1546       }
    1547 
    1548       if( !bLumaOnly )
    1549       {
    1550         bestModeId[COMPONENT_Cb] = bestModeId[COMPONENT_Cr] = bestModeId[COMPONENT_Y];
    1551         if (rTu.ProcessComponentSection(COMPONENT_Cb) && bestModeId[COMPONENT_Y] == 1)
    1552         {
    1553           //In order not to code TS flag when cbf is zero, the case for TS with cbf being zero is forbidden.
    1554           for (UInt ch=COMPONENT_Cb; ch<numValidComp; ch++)
    1555           {
    1556             if (uiSingleCbf[ch] == 0)
    1557             {
    1558               const ComponentID compID=ComponentID(ch);
    1559               const UInt totalAdjustedDepthChan = rTu.GetTransformDepthTotalAdj(compID);
    1560               pcCU ->setTransformSkipSubParts ( 0, compID, uiAbsPartIdx, totalAdjustedDepthChan);
    1561               bestModeId[ch] = 0;
    1562             }
    1563           }
    1564         }
    15651532      }
    15661533    }
     
    15741541      //----- code luma/chroma block with given intra prediction mode and store Cbf-----
    15751542      dSingleCost   = 0.0;
    1576       for (UInt ch=COMPONENT_Y; ch<numValidComp; ch++)
    1577       {
    1578         const ComponentID compID = ComponentID(ch);
    1579 
    1580         if (rTu.ProcessComponentSection(compID))
    1581         {
    1582           const UInt totalAdjustedDepthChan   = rTu.GetTransformDepthTotalAdj(compID);
    1583           pcCU ->setTransformSkipSubParts ( 0, compID, uiAbsPartIdx, totalAdjustedDepthChan );
    1584         }
    1585 
    1586         xIntraCodingTUBlock( pcOrgYuv, pcPredYuv, pcResiYuv, resiLumaSingle, false, uiSingleDist[toChannelType(compID)], compID, rTu DEBUG_STRING_PASS_INTO(sDebug));
    1587 
    1588         if( bCheckSplit )
    1589         {
    1590           uiSingleCbf[compID] = pcCU->getCbf( uiAbsPartIdx, compID, uiTrDepth );
    1591         }
     1543      if (rTu.ProcessComponentSection(COMPONENT_Y))
     1544      {
     1545        const UInt totalAdjustedDepthChan   = rTu.GetTransformDepthTotalAdj(COMPONENT_Y);
     1546        pcCU ->setTransformSkipSubParts ( 0, COMPONENT_Y, uiAbsPartIdx, totalAdjustedDepthChan );
     1547      }
     1548
     1549      xIntraCodingTUBlock( pcOrgYuv, pcPredYuv, pcResiYuv, resiLumaSingle, false, uiSingleDistLuma, COMPONENT_Y, rTu DEBUG_STRING_PASS_INTO(sDebug));
     1550
     1551      if( bCheckSplit )
     1552      {
     1553        uiSingleCbfLuma = pcCU->getCbf( uiAbsPartIdx, COMPONENT_Y, uiTrDepth );
    15921554      }
    15931555      //----- determine rate and r-d cost -----
    1594       UInt uiSingleBits = xGetIntraBitsQT( rTu, true, !bLumaOnly, false );
     1556      UInt uiSingleBits = xGetIntraBitsQT( rTu, true, false, false );
    15951557
    15961558      if(m_pcEncCfg->getRDpenalty() && (uiLog2TrSize==5) && !isIntraSlice)
     
    15991561      }
    16001562
    1601       dSingleCost       = m_pcRdCost->calcRdCost( uiSingleBits, uiSingleDist[CHANNEL_TYPE_LUMA] + uiSingleDist[CHANNEL_TYPE_CHROMA] );
     1563      dSingleCost       = m_pcRdCost->calcRdCost( uiSingleBits, uiSingleDistLuma );
    16021564
    16031565      if (pcCU->getSlice()->getPPS()->getUseCrossComponentPrediction())
     
    16291591    }
    16301592    //----- code splitted block -----
    1631     Double     dSplitCost                         = 0.0;
    1632     Distortion uiSplitDist[MAX_NUM_CHANNEL_TYPE]  = {0,0};
    1633     UInt       uiSplitCbf[MAX_NUM_COMPONENT]      = {0,0,0};
     1593    Double     dSplitCost      = 0.0;
     1594    Distortion uiSplitDistLuma = 0;
     1595    UInt       uiSplitCbfLuma  = 0;
    16341596
    16351597    TComTURecurse tuRecurseChild(rTu, false);
     
    16391601      DEBUG_STRING_NEW(sChild)
    16401602#if HHI_RQT_INTRA_SPEEDUP
    1641       xRecurIntraCodingQT( bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, resiLumaSplit, uiSplitDist[0], uiSplitDist[1], bCheckFirst, dSplitCost, tuRecurseChild DEBUG_STRING_PASS_INTO(sChild) );
     1603      xRecurIntraCodingLumaQT( pcOrgYuv, pcPredYuv, pcResiYuv, resiLumaSplit, uiSplitDistLuma, bCheckFirst, dSplitCost, tuRecurseChild DEBUG_STRING_PASS_INTO(sChild) );
    16421604#else
    1643       xRecurIntraCodingQT( bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, resiLumaSplit, uiSplitDist[0], uiSplitDist[1], dSplitCost, tuRecurseChild DEBUG_STRING_PASS_INTO(sChild) );
     1605      xRecurIntraCodingLumaQT( pcOrgYuv, pcPredYuv, pcResiYuv, resiLumaSplit, uiSplitDistLuma, dSplitCost, tuRecurseChild DEBUG_STRING_PASS_INTO(sChild) );
    16441606#endif
    16451607      DEBUG_STRING_APPEND(sSplit, sChild)
    1646       for(UInt ch=0; ch<numValidComp; ch++)
    1647       {
    1648         uiSplitCbf[ch] |= pcCU->getCbf( tuRecurseChild.GetAbsPartIdxTU(), ComponentID(ch), tuRecurseChild.GetTransformDepthRel() );
    1649       }
     1608      uiSplitCbfLuma |= pcCU->getCbf( tuRecurseChild.GetAbsPartIdxTU(), COMPONENT_Y, tuRecurseChild.GetTransformDepthRel() );
    16501609    } while (tuRecurseChild.nextSection(rTu) );
    16511610
    16521611    UInt    uiPartsDiv     = rTu.GetAbsPartIdxNumParts();
    1653     for(UInt ch=COMPONENT_Y; ch<numValidComp; ch++)
    1654     {
    1655       if (uiSplitCbf[ch])
     1612    {
     1613      if (uiSplitCbfLuma)
    16561614      {
    16571615        const UInt flag=1<<uiTrDepth;
    1658         const ComponentID compID=ComponentID(ch);
    1659         UChar *pBase=pcCU->getCbf( compID );
     1616        UChar *pBase=pcCU->getCbf( COMPONENT_Y );
    16601617        for( UInt uiOffs = 0; uiOffs < uiPartsDiv; uiOffs++ )
    16611618        {
     
    16681625   
    16691626    //----- determine rate and r-d cost -----
    1670     UInt uiSplitBits = xGetIntraBitsQT( rTu, true, !bLumaOnly, false );
    1671     dSplitCost       = m_pcRdCost->calcRdCost( uiSplitBits, uiSplitDist[CHANNEL_TYPE_LUMA] + uiSplitDist[CHANNEL_TYPE_CHROMA] );
     1627    UInt uiSplitBits = xGetIntraBitsQT( rTu, true, false, false );
     1628    dSplitCost       = m_pcRdCost->calcRdCost( uiSplitBits, uiSplitDistLuma );
    16721629
    16731630    //===== compare and set best =====
     
    16761633      //--- update cost ---
    16771634      DEBUG_STRING_SWAP(sSplit, sDebug)
    1678       ruiDistY += uiSplitDist[CHANNEL_TYPE_LUMA];
    1679       ruiDistC += uiSplitDist[CHANNEL_TYPE_CHROMA];
     1635      ruiDistY += uiSplitDistLuma;
    16801636      dRDCost  += dSplitCost;
    16811637
     
    17011657    //--- set transform index and Cbf values ---
    17021658    pcCU->setTrIdxSubParts( uiTrDepth, uiAbsPartIdx, uiFullDepth );
    1703     for(UInt ch=0; ch<numValidComp; ch++)
    1704     {
    1705       const ComponentID compID=ComponentID(ch);
    1706       const TComRectangle &tuRect=rTu.getRect(compID);
    1707       const UInt totalAdjustedDepthChan   = rTu.GetTransformDepthTotalAdj(compID);
    1708       pcCU->setCbfSubParts  ( uiSingleCbf[compID] << uiTrDepth, compID, uiAbsPartIdx, totalAdjustedDepthChan );
    1709       pcCU ->setTransformSkipSubParts  ( bestModeId[compID], compID, uiAbsPartIdx, totalAdjustedDepthChan );
    1710 
    1711       //--- set reconstruction for next intra prediction blocks ---
    1712       const UInt  uiQTLayer   = pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() - uiLog2TrSize;
    1713       const UInt  uiZOrder    = pcCU->getZorderIdxInCtu() + uiAbsPartIdx;
    1714       const UInt  uiWidth     = tuRect.width;
    1715       const UInt  uiHeight    = tuRect.height;
    1716       Pel*  piSrc       = m_pcQTTempTComYuv[ uiQTLayer ].getAddr( compID, uiAbsPartIdx );
    1717       UInt  uiSrcStride = m_pcQTTempTComYuv[ uiQTLayer ].getStride  ( compID );
    1718       Pel*  piDes       = pcCU->getPic()->getPicYuvRec()->getAddr( compID, pcCU->getCtuRsAddr(), uiZOrder );
    1719       UInt  uiDesStride = pcCU->getPic()->getPicYuvRec()->getStride  ( compID );
    1720 
    1721       for( UInt uiY = 0; uiY < uiHeight; uiY++, piSrc += uiSrcStride, piDes += uiDesStride )
    1722       {
    1723         for( UInt uiX = 0; uiX < uiWidth; uiX++ )
    1724         {
    1725           piDes[ uiX ] = piSrc[ uiX ];
    1726         }
    1727       }
    1728     }
    1729   }
    1730   ruiDistY += uiSingleDist[CHANNEL_TYPE_LUMA];
    1731   ruiDistC += uiSingleDist[CHANNEL_TYPE_CHROMA];
     1659    const TComRectangle &tuRect=rTu.getRect(COMPONENT_Y);
     1660    const UInt totalAdjustedDepthChan   = rTu.GetTransformDepthTotalAdj(COMPONENT_Y);
     1661    pcCU->setCbfSubParts  ( uiSingleCbfLuma << uiTrDepth, COMPONENT_Y, uiAbsPartIdx, totalAdjustedDepthChan );
     1662    pcCU ->setTransformSkipSubParts  ( bestModeId[COMPONENT_Y], COMPONENT_Y, uiAbsPartIdx, totalAdjustedDepthChan );
     1663
     1664    //--- set reconstruction for next intra prediction blocks ---
     1665    const UInt  uiQTLayer   = pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() - uiLog2TrSize;
     1666    const UInt  uiZOrder    = pcCU->getZorderIdxInCtu() + uiAbsPartIdx;
     1667    const UInt  uiWidth     = tuRect.width;
     1668    const UInt  uiHeight    = tuRect.height;
     1669    Pel*  piSrc       = m_pcQTTempTComYuv[ uiQTLayer ].getAddr( COMPONENT_Y, uiAbsPartIdx );
     1670    UInt  uiSrcStride = m_pcQTTempTComYuv[ uiQTLayer ].getStride  ( COMPONENT_Y );
     1671    Pel*  piDes       = pcCU->getPic()->getPicYuvRec()->getAddr( COMPONENT_Y, pcCU->getCtuRsAddr(), uiZOrder );
     1672    UInt  uiDesStride = pcCU->getPic()->getPicYuvRec()->getStride  ( COMPONENT_Y );
     1673
     1674    for( UInt uiY = 0; uiY < uiHeight; uiY++, piSrc += uiSrcStride, piDes += uiDesStride )
     1675    {
     1676      for( UInt uiX = 0; uiX < uiWidth; uiX++ )
     1677      {
     1678        piDes[ uiX ] = piSrc[ uiX ];
     1679      }
     1680    }
     1681  }
     1682  ruiDistY += uiSingleDistLuma;
    17321683  dRDCost  += dSingleCost;
    17331684}
     
    17351686
    17361687Void
    1737 TEncSearch::xSetIntraResultQT(Bool        bLumaOnly,
    1738                               TComYuv*    pcRecoYuv,
    1739                               TComTU     &rTu)
     1688TEncSearch::xSetIntraResultLumaQT(TComYuv* pcRecoYuv, TComTU &rTu)
    17401689{
    17411690  TComDataCU *pcCU        = rTu.getCU();
     
    17481697    UInt uiQTLayer    = pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() - uiLog2TrSize;
    17491698
    1750     Bool bSkipChroma = !rTu.ProcessChannelSection(CHANNEL_TYPE_CHROMA);
    1751 
    17521699    //===== copy transform coefficients =====
    17531700
    1754     const UInt numChannelsToProcess = (bLumaOnly || bSkipChroma) ? 1 : ::getNumberValidComponents(pcCU->getPic()->getChromaFormat());
    1755     for (UInt ch=0; ch<numChannelsToProcess; ch++)
    1756     {
    1757       const ComponentID compID = ComponentID(ch);
    1758       const TComRectangle &tuRect=rTu.getRect(compID);
    1759       const UInt coeffOffset = rTu.getCoefficientOffset(compID);
    1760       const UInt numCoeffInBlock = tuRect.width * tuRect.height;
    1761 
    1762       if (numCoeffInBlock!=0)
    1763       {
    1764         const TCoeff* srcCoeff = m_ppcQTTempCoeff[compID][uiQTLayer] + coeffOffset;
    1765         TCoeff* destCoeff      = pcCU->getCoeff(compID) + coeffOffset;
    1766         ::memcpy( destCoeff, srcCoeff, sizeof(TCoeff)*numCoeffInBlock );
     1701    const TComRectangle &tuRect=rTu.getRect(COMPONENT_Y);
     1702    const UInt coeffOffset = rTu.getCoefficientOffset(COMPONENT_Y);
     1703    const UInt numCoeffInBlock = tuRect.width * tuRect.height;
     1704
     1705    if (numCoeffInBlock!=0)
     1706    {
     1707      const TCoeff* srcCoeff = m_ppcQTTempCoeff[COMPONENT_Y][uiQTLayer] + coeffOffset;
     1708      TCoeff* destCoeff      = pcCU->getCoeff(COMPONENT_Y) + coeffOffset;
     1709      ::memcpy( destCoeff, srcCoeff, sizeof(TCoeff)*numCoeffInBlock );
    17671710#if ADAPTIVE_QP_SELECTION
    1768         const TCoeff* srcArlCoeff = m_ppcQTTempArlCoeff[compID][ uiQTLayer ] + coeffOffset;
    1769         TCoeff* destArlCoeff      = pcCU->getArlCoeff (compID)               + coeffOffset;
    1770         ::memcpy( destArlCoeff, srcArlCoeff, sizeof( TCoeff ) * numCoeffInBlock );
    1771 #endif
    1772         m_pcQTTempTComYuv[ uiQTLayer ].copyPartToPartComponent( compID, pcRecoYuv, uiAbsPartIdx, tuRect.width, tuRect.height );
    1773       }
    1774     } // End of channel loop
     1711      const TCoeff* srcArlCoeff = m_ppcQTTempArlCoeff[COMPONENT_Y][ uiQTLayer ] + coeffOffset;
     1712      TCoeff* destArlCoeff      = pcCU->getArlCoeff (COMPONENT_Y)               + coeffOffset;
     1713      ::memcpy( destArlCoeff, srcArlCoeff, sizeof( TCoeff ) * numCoeffInBlock );
     1714#endif
     1715      m_pcQTTempTComYuv[ uiQTLayer ].copyPartToPartComponent( COMPONENT_Y, pcRecoYuv, uiAbsPartIdx, tuRect.width, tuRect.height );
     1716    }
    17751717
    17761718  }
     
    17801722    do
    17811723    {
    1782       xSetIntraResultQT( bLumaOnly, pcRecoYuv, tuRecurseChild );
     1724      xSetIntraResultLumaQT( pcRecoYuv, tuRecurseChild );
    17831725    } while (tuRecurseChild.nextSection(rTu));
    17841726  }
     
    17871729
    17881730Void
    1789 TEncSearch::xStoreIntraResultQT(const ComponentID first,
    1790                                 const ComponentID lastIncl,
    1791                                       TComTU &rTu )
     1731TEncSearch::xStoreIntraResultQT(const ComponentID compID, TComTU &rTu )
    17921732{
    17931733  TComDataCU *pcCU=rTu.getCU();
     
    17951735  const UInt uiAbsPartIdx = rTu.GetAbsPartIdxTU();
    17961736  const UInt uiTrMode     = pcCU->getTransformIdx( uiAbsPartIdx );
    1797   if (  first==COMPONENT_Y || uiTrMode == uiTrDepth )
     1737  if ( compID==COMPONENT_Y || uiTrMode == uiTrDepth )
    17981738  {
    17991739    assert(uiTrMode == uiTrDepth);
     
    18011741    const UInt uiQTLayer    = pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() - uiLog2TrSize;
    18021742
    1803 
    1804     for(UInt compID_=first; compID_<=lastIncl; compID_++)
    1805     {
    1806       ComponentID compID=ComponentID(compID_);
    1807       if (rTu.ProcessComponentSection(compID))
    1808       {
    1809         const TComRectangle &tuRect=rTu.getRect(compID);
    1810 
    1811         //===== copy transform coefficients =====
    1812         const UInt uiNumCoeff    = tuRect.width * tuRect.height;
    1813         TCoeff* pcCoeffSrc = m_ppcQTTempCoeff[compID] [ uiQTLayer ] + rTu.getCoefficientOffset(compID);
    1814         TCoeff* pcCoeffDst = m_pcQTTempTUCoeff[compID];
    1815 
    1816         ::memcpy( pcCoeffDst, pcCoeffSrc, sizeof( TCoeff ) * uiNumCoeff );
     1743    if (rTu.ProcessComponentSection(compID))
     1744    {
     1745      const TComRectangle &tuRect=rTu.getRect(compID);
     1746
     1747      //===== copy transform coefficients =====
     1748      const UInt uiNumCoeff    = tuRect.width * tuRect.height;
     1749      TCoeff* pcCoeffSrc = m_ppcQTTempCoeff[compID] [ uiQTLayer ] + rTu.getCoefficientOffset(compID);
     1750      TCoeff* pcCoeffDst = m_pcQTTempTUCoeff[compID];
     1751
     1752      ::memcpy( pcCoeffDst, pcCoeffSrc, sizeof( TCoeff ) * uiNumCoeff );
    18171753#if ADAPTIVE_QP_SELECTION
    1818         TCoeff* pcArlCoeffSrc = m_ppcQTTempArlCoeff[compID] [ uiQTLayer ] + rTu.getCoefficientOffset(compID);
    1819         TCoeff* pcArlCoeffDst = m_ppcQTTempTUArlCoeff[compID];
    1820         ::memcpy( pcArlCoeffDst, pcArlCoeffSrc, sizeof( TCoeff ) * uiNumCoeff );
    1821 #endif
    1822         //===== copy reconstruction =====
    1823         m_pcQTTempTComYuv[ uiQTLayer ].copyPartToPartComponent( compID, &m_pcQTTempTransformSkipTComYuv, uiAbsPartIdx, tuRect.width, tuRect.height );
    1824       }
     1754      TCoeff* pcArlCoeffSrc = m_ppcQTTempArlCoeff[compID] [ uiQTLayer ] + rTu.getCoefficientOffset(compID);
     1755      TCoeff* pcArlCoeffDst = m_ppcQTTempTUArlCoeff[compID];
     1756      ::memcpy( pcArlCoeffDst, pcArlCoeffSrc, sizeof( TCoeff ) * uiNumCoeff );
     1757#endif
     1758      //===== copy reconstruction =====
     1759      m_pcQTTempTComYuv[ uiQTLayer ].copyPartToPartComponent( compID, &m_pcQTTempTransformSkipTComYuv, uiAbsPartIdx, tuRect.width, tuRect.height );
    18251760    }
    18261761  }
     
    18291764
    18301765Void
    1831 TEncSearch::xLoadIntraResultQT(const ComponentID first,
    1832                                const ComponentID lastIncl,
    1833                                      TComTU &rTu)
     1766TEncSearch::xLoadIntraResultQT(const ComponentID compID, TComTU &rTu)
    18341767{
    18351768  TComDataCU *pcCU=rTu.getCU();
     
    18371770  const UInt uiAbsPartIdx = rTu.GetAbsPartIdxTU();
    18381771  const UInt uiTrMode     = pcCU->getTransformIdx( uiAbsPartIdx );
    1839   if (  first==COMPONENT_Y || uiTrMode == uiTrDepth )
     1772  if ( compID==COMPONENT_Y || uiTrMode == uiTrDepth )
    18401773  {
    18411774    assert(uiTrMode == uiTrDepth);
     
    18441777    const UInt uiZOrder     = pcCU->getZorderIdxInCtu() + uiAbsPartIdx;
    18451778
    1846     for(UInt compID_=first; compID_<=lastIncl; compID_++)
    1847     {
    1848       ComponentID compID=ComponentID(compID_);
    1849       if (rTu.ProcessComponentSection(compID))
    1850       {
    1851         const TComRectangle &tuRect=rTu.getRect(compID);
    1852 
    1853         //===== copy transform coefficients =====
    1854         const UInt uiNumCoeff = tuRect.width * tuRect.height;
    1855         TCoeff* pcCoeffDst = m_ppcQTTempCoeff[compID] [ uiQTLayer ] + rTu.getCoefficientOffset(compID);
    1856         TCoeff* pcCoeffSrc = m_pcQTTempTUCoeff[compID];
    1857 
    1858         ::memcpy( pcCoeffDst, pcCoeffSrc, sizeof( TCoeff ) * uiNumCoeff );
     1779    if (rTu.ProcessComponentSection(compID))
     1780    {
     1781      const TComRectangle &tuRect=rTu.getRect(compID);
     1782
     1783      //===== copy transform coefficients =====
     1784      const UInt uiNumCoeff = tuRect.width * tuRect.height;
     1785      TCoeff* pcCoeffDst = m_ppcQTTempCoeff[compID] [ uiQTLayer ] + rTu.getCoefficientOffset(compID);
     1786      TCoeff* pcCoeffSrc = m_pcQTTempTUCoeff[compID];
     1787
     1788      ::memcpy( pcCoeffDst, pcCoeffSrc, sizeof( TCoeff ) * uiNumCoeff );
    18591789#if ADAPTIVE_QP_SELECTION
    1860         TCoeff* pcArlCoeffDst = m_ppcQTTempArlCoeff[compID] [ uiQTLayer ] + rTu.getCoefficientOffset(compID);
    1861         TCoeff* pcArlCoeffSrc = m_ppcQTTempTUArlCoeff[compID];
    1862         ::memcpy( pcArlCoeffDst, pcArlCoeffSrc, sizeof( TCoeff ) * uiNumCoeff );
    1863 #endif
    1864         //===== copy reconstruction =====
    1865         m_pcQTTempTransformSkipTComYuv.copyPartToPartComponent( compID, &m_pcQTTempTComYuv[ uiQTLayer ], uiAbsPartIdx, tuRect.width, tuRect.height );
    1866 
    1867         Pel*    piRecIPred        = pcCU->getPic()->getPicYuvRec()->getAddr( compID, pcCU->getCtuRsAddr(), uiZOrder );
    1868         UInt    uiRecIPredStride  = pcCU->getPic()->getPicYuvRec()->getStride (compID);
    1869         Pel*    piRecQt           = m_pcQTTempTComYuv[ uiQTLayer ].getAddr( compID, uiAbsPartIdx );
    1870         UInt    uiRecQtStride     = m_pcQTTempTComYuv[ uiQTLayer ].getStride  (compID);
    1871         UInt    uiWidth           = tuRect.width;
    1872         UInt    uiHeight          = tuRect.height;
    1873         Pel* pRecQt               = piRecQt;
    1874         Pel* pRecIPred            = piRecIPred;
    1875         for( UInt uiY = 0; uiY < uiHeight; uiY++ )
    1876         {
    1877           for( UInt uiX = 0; uiX < uiWidth; uiX++ )
    1878           {
    1879             pRecIPred[ uiX ] = pRecQt   [ uiX ];
    1880           }
    1881           pRecQt    += uiRecQtStride;
    1882           pRecIPred += uiRecIPredStride;
    1883         }
     1790      TCoeff* pcArlCoeffDst = m_ppcQTTempArlCoeff[compID] [ uiQTLayer ] + rTu.getCoefficientOffset(compID);
     1791      TCoeff* pcArlCoeffSrc = m_ppcQTTempTUArlCoeff[compID];
     1792      ::memcpy( pcArlCoeffDst, pcArlCoeffSrc, sizeof( TCoeff ) * uiNumCoeff );
     1793#endif
     1794      //===== copy reconstruction =====
     1795      m_pcQTTempTransformSkipTComYuv.copyPartToPartComponent( compID, &m_pcQTTempTComYuv[ uiQTLayer ], uiAbsPartIdx, tuRect.width, tuRect.height );
     1796
     1797      Pel*    piRecIPred        = pcCU->getPic()->getPicYuvRec()->getAddr( compID, pcCU->getCtuRsAddr(), uiZOrder );
     1798      UInt    uiRecIPredStride  = pcCU->getPic()->getPicYuvRec()->getStride (compID);
     1799      Pel*    piRecQt           = m_pcQTTempTComYuv[ uiQTLayer ].getAddr( compID, uiAbsPartIdx );
     1800      UInt    uiRecQtStride     = m_pcQTTempTComYuv[ uiQTLayer ].getStride  (compID);
     1801      UInt    uiWidth           = tuRect.width;
     1802      UInt    uiHeight          = tuRect.height;
     1803      Pel* pRecQt               = piRecQt;
     1804      Pel* pRecIPred            = piRecIPred;
     1805      for( UInt uiY = 0; uiY < uiHeight; uiY++ )
     1806      {
     1807        for( UInt uiX = 0; uiX < uiWidth; uiX++ )
     1808        {
     1809          pRecIPred[ uiX ] = pRecQt   [ uiX ];
     1810        }
     1811        pRecQt    += uiRecQtStride;
     1812        pRecIPred += uiRecIPredStride;
    18841813      }
    18851814    }
     
    20882017              if (!isOneMode && !isLastMode)
    20892018              {
    2090                 xStoreIntraResultQT(compID, compID, TUIterator);
     2019                xStoreIntraResultQT(compID, TUIterator);
    20912020                m_pcRDGoOnSbacCoder->store( m_pppcRDSbacCoder[ uiFullDepth ][ CI_TEMP_BEST ] );
    20922021              }
     
    21022031        if(bestModeId < totalModesToTest)
    21032032        {
    2104           xLoadIntraResultQT(compID, compID, TUIterator);
     2033          xLoadIntraResultQT(compID, TUIterator);
    21052034          pcCU->setCbfPartRange( singleCbfC << uiTrDepth, compID, subTUAbsPartIdx, partIdxesPerSubTU );
    21062035
     
    22102139
    22112140Void
    2212 TEncSearch::preestChromaPredMode( TComDataCU* pcCU,
    2213                                  TComYuv*    pcOrgYuv,
    2214                                  TComYuv*    pcPredYuv )
    2215 {
    2216 
    2217   //===== loop over partitions =====
    2218   const UInt    uiInitTrDepth  = pcCU->getPartitionSize(0) != SIZE_2Nx2N && enable4ChromaPUsInIntraNxNCU(pcOrgYuv->getChromaFormat()) ? 1 : 0;
    2219   TComTURecurse tuRecurseCU(pcCU, 0);
    2220   TComTURecurse tuRecurseWithPU(tuRecurseCU, false, (uiInitTrDepth==0)?TComTU::DONT_SPLIT : TComTU::QUAD_SPLIT);
    2221   const ChromaFormat chFmt = tuRecurseWithPU.GetChromaFormat();
    2222   Bool bFilterEnabled=filterIntraReferenceSamples(CHANNEL_TYPE_CHROMA, chFmt, pcCU->getSlice()->getSPS()->getDisableIntraReferenceSmoothing());
    2223 
    2224   do
    2225   {
    2226     if (tuRecurseWithPU.ProcessChannelSection(CHANNEL_TYPE_CHROMA))
    2227     {
    2228       const TComRectangle &rect=tuRecurseWithPU.getRect(COMPONENT_Cb);
    2229       const UInt  uiWidth     = rect.width;
    2230       const UInt  uiHeight    = rect.height;
    2231       const UInt  partIdx     = tuRecurseWithPU.GetAbsPartIdxCU();
    2232       const UInt  uiStride    = pcOrgYuv ->getStride(COMPONENT_Cb);
    2233       Pel*  piOrgU      = pcOrgYuv ->getAddr ( COMPONENT_Cb, partIdx ); //TODO: Change this into an array and loop over chroma components below
    2234       Pel*  piOrgV      = pcOrgYuv ->getAddr ( COMPONENT_Cr, partIdx );
    2235       Pel*  piPredU     = pcPredYuv->getAddr ( COMPONENT_Cb, partIdx );
    2236       Pel*  piPredV     = pcPredYuv->getAddr ( COMPONENT_Cr, partIdx );
    2237 
    2238       //===== init pattern =====
    2239       Bool  bAboveAvail = false;
    2240       Bool  bLeftAvail  = false;
    2241       DEBUG_STRING_NEW(sTemp)
    2242       initAdiPatternChType( tuRecurseWithPU, bAboveAvail, bLeftAvail, COMPONENT_Cb, bFilterEnabled DEBUG_STRING_PASS_INTO(sTemp) );
    2243       initAdiPatternChType( tuRecurseWithPU, bAboveAvail, bLeftAvail, COMPONENT_Cr, bFilterEnabled DEBUG_STRING_PASS_INTO(sTemp) );
    2244 
    2245       //===== get best prediction modes (using SAD) =====
    2246             UInt        uiMinMode          = 0;
    2247             UInt        uiMaxMode          = 4;
    2248             UInt        uiBestMode         = MAX_UINT;
    2249             Distortion  uiMinSAD           = std::numeric_limits<Distortion>::max();
    2250       const UInt        mappedModeTable[4] = {PLANAR_IDX,DC_IDX,HOR_IDX,VER_IDX};
    2251 
    2252       DistParam distParamU, distParamV;
    2253       const Bool bUseHadamard=pcCU->getCUTransquantBypass(0) == 0;
    2254       m_pcRdCost->setDistParam(distParamU, g_bitDepth[CHANNEL_TYPE_CHROMA], piOrgU, uiStride, piPredU, uiStride, uiWidth, uiHeight, bUseHadamard);
    2255       m_pcRdCost->setDistParam(distParamV, g_bitDepth[CHANNEL_TYPE_CHROMA], piOrgV, uiStride, piPredV, uiStride, uiWidth, uiHeight, bUseHadamard);
    2256       distParamU.bApplyWeight = false;
    2257       distParamV.bApplyWeight = false;
    2258 
    2259       for( UInt uiMode_  = uiMinMode; uiMode_ < uiMaxMode; uiMode_++ )
    2260       {
    2261         UInt uiMode=mappedModeTable[uiMode_];
    2262         //--- get prediction ---
    2263         const Bool bUseFilter=TComPrediction::filteringIntraReferenceSamples(COMPONENT_Cb, uiMode, uiWidth, uiHeight, chFmt, pcCU->getSlice()->getSPS()->getDisableIntraReferenceSmoothing());
    2264 
    2265         predIntraAng( COMPONENT_Cb, uiMode, piOrgU, uiStride, piPredU, uiStride, tuRecurseCU, bAboveAvail, bLeftAvail, bUseFilter );
    2266         predIntraAng( COMPONENT_Cr, uiMode, piOrgV, uiStride, piPredV, uiStride, tuRecurseCU, bAboveAvail, bLeftAvail, bUseFilter );
    2267 
    2268         //--- get SAD ---
    2269         Distortion uiSAD  = distParamU.DistFunc(&distParamU);
    2270         uiSAD            += distParamV.DistFunc(&distParamV);
    2271         //--- check ---
    2272         if( uiSAD < uiMinSAD )
    2273         {
    2274           uiMinSAD   = uiSAD;
    2275           uiBestMode = uiMode;
    2276         }
    2277       }
    2278 
    2279       //===== set chroma pred mode =====
    2280       pcCU->setIntraDirSubParts( CHANNEL_TYPE_CHROMA, uiBestMode, partIdx, tuRecurseWithPU.getCUDepth() + uiInitTrDepth );
    2281     }
    2282   } while (tuRecurseWithPU.nextSection(tuRecurseCU));
    2283 }
    2284 
    2285 
    2286 
    2287 
    2288 Void
    2289 TEncSearch::estIntraPredQT(TComDataCU* pcCU,
    2290                            TComYuv*    pcOrgYuv,
    2291                            TComYuv*    pcPredYuv,
    2292                            TComYuv*    pcResiYuv,
    2293                            TComYuv*    pcRecoYuv,
    2294                            Pel         resiLuma[NUMBER_OF_STORED_RESIDUAL_TYPES][MAX_CU_SIZE * MAX_CU_SIZE],
    2295                            Distortion& ruiDistC,
    2296                            Bool        bLumaOnly
    2297                            DEBUG_STRING_FN_DECLARE(sDebug))
     2141TEncSearch::estIntraPredLumaQT(TComDataCU* pcCU,
     2142                               TComYuv*    pcOrgYuv,
     2143                               TComYuv*    pcPredYuv,
     2144                               TComYuv*    pcResiYuv,
     2145                               TComYuv*    pcRecoYuv,
     2146                               Pel         resiLuma[NUMBER_OF_STORED_RESIDUAL_TYPES][MAX_CU_SIZE * MAX_CU_SIZE]
     2147                               DEBUG_STRING_FN_DECLARE(sDebug))
    22982148{
    22992149  const UInt         uiDepth               = pcCU->getDepth(0);
    23002150  const UInt         uiInitTrDepth         = pcCU->getPartitionSize(0) == SIZE_2Nx2N ? 0 : 1;
    2301   const UInt         uiInitTrDepthC        = pcCU->getPartitionSize(0) != SIZE_2Nx2N && enable4ChromaPUsInIntraNxNCU(pcOrgYuv->getChromaFormat()) ? 1 : 0;
    23022151  const UInt         uiNumPU               = 1<<(2*uiInitTrDepth);
    23032152  const UInt         uiQNumParts           = pcCU->getTotalNumPart() >> 2;
     
    23062155  const UInt         numberValidComponents = getNumberValidComponents(chFmt);
    23072156        Distortion   uiOverallDistY        = 0;
    2308         Distortion   uiOverallDistC        = 0;
    23092157        UInt         CandNum;
    23102158        Double       CandCostList[ FAST_UDI_MAX_RDMODE_NUM ];
     
    24832331    UInt       uiBestPUMode  = 0;
    24842332    Distortion uiBestPUDistY = 0;
    2485     Distortion uiBestPUDistC = 0;
    24862333    Double     dBestPUCost   = MAX_DOUBLE;
    24872334
     
    25062353      // determine residual for partition
    25072354      Distortion uiPUDistY = 0;
    2508       Distortion uiPUDistC = 0;
    25092355      Double     dPUCost   = 0.0;
    25102356#if HHI_RQT_INTRA_SPEEDUP
    2511       xRecurIntraCodingQT( bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, resiLumaPU, uiPUDistY, uiPUDistC, true, dPUCost, tuRecurseWithPU DEBUG_STRING_PASS_INTO(sMode) );
     2357      xRecurIntraCodingLumaQT( pcOrgYuv, pcPredYuv, pcResiYuv, resiLumaPU, uiPUDistY, true, dPUCost, tuRecurseWithPU DEBUG_STRING_PASS_INTO(sMode) );
    25122358#else
    2513       xRecurIntraCodingQT( bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, resiLumaPU, uiPUDistY, uiPUDistC, dPUCost, tuRecurseWithPU DEBUG_STRING_PASS_INTO(sMode) );
     2359      xRecurIntraCodingLumaQT( pcOrgYuv, pcPredYuv, pcResiYuv, resiLumaPU, uiPUDistY, dPUCost, tuRecurseWithPU DEBUG_STRING_PASS_INTO(sMode) );
    25142360#endif
    25152361
     
    25282374        uiBestPUMode  = uiOrgMode;
    25292375        uiBestPUDistY = uiPUDistY;
    2530         uiBestPUDistC = uiPUDistC;
    25312376        dBestPUCost   = dPUCost;
    25322377
    2533         xSetIntraResultQT( bLumaOnly, pcRecoYuv, tuRecurseWithPU );
     2378        xSetIntraResultLumaQT( pcRecoYuv, tuRecurseWithPU );
    25342379
    25352380        if (pcCU->getSlice()->getPPS()->getUseCrossComponentPrediction())
     
    25932438      // determine residual for partition
    25942439      Distortion uiPUDistY = 0;
    2595       Distortion uiPUDistC = 0;
    25962440      Double     dPUCost   = 0.0;
    25972441
    2598       xRecurIntraCodingQT( bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, resiLumaPU, uiPUDistY, uiPUDistC, false, dPUCost, tuRecurseWithPU DEBUG_STRING_PASS_INTO(sModeTree));
     2442      xRecurIntraCodingLumaQT( pcOrgYuv, pcPredYuv, pcResiYuv, resiLumaPU, uiPUDistY, false, dPUCost, tuRecurseWithPU DEBUG_STRING_PASS_INTO(sModeTree));
    25992443
    26002444      // check r-d cost
     
    26042448        uiBestPUMode  = uiOrgMode;
    26052449        uiBestPUDistY = uiPUDistY;
    2606         uiBestPUDistC = uiPUDistC;
    26072450        dBestPUCost   = dPUCost;
    26082451
    2609         xSetIntraResultQT( bLumaOnly, pcRecoYuv, tuRecurseWithPU );
     2452        xSetIntraResultLumaQT( pcRecoYuv, tuRecurseWithPU );
    26102453
    26112454        if (pcCU->getSlice()->getPPS()->getUseCrossComponentPrediction())
     
    26392482    //--- update overall distortion ---
    26402483    uiOverallDistY += uiBestPUDistY;
    2641     uiOverallDistC += uiBestPUDistC;
    26422484
    26432485    //--- update transform index and cbf ---
     
    26542496    if( !tuRecurseWithPU.IsLastSection() )
    26552497    {
    2656       const Bool bSkipChroma  = tuRecurseWithPU.ProcessChannelSection(CHANNEL_TYPE_CHROMA);
    2657 
    2658       const UInt numChannelToProcess = (bLumaOnly || bSkipChroma) ? 1 : getNumberValidComponents(pcCU->getPic()->getChromaFormat());
    2659 
    2660       for (UInt ch=0; ch<numChannelToProcess; ch++)
    2661       {
    2662         const ComponentID compID = ComponentID(ch);
    2663         const TComRectangle &puRect=tuRecurseWithPU.getRect(compID);
    2664         const UInt  uiCompWidth   = puRect.width;
    2665         const UInt  uiCompHeight  = puRect.height;
    2666 
    2667         const UInt  uiZOrder      = pcCU->getZorderIdxInCtu() + uiPartOffset;
    2668               Pel*  piDes         = pcCU->getPic()->getPicYuvRec()->getAddr( compID, pcCU->getCtuRsAddr(), uiZOrder );
    2669         const UInt  uiDesStride   = pcCU->getPic()->getPicYuvRec()->getStride( compID);
    2670         const Pel*  piSrc         = pcRecoYuv->getAddr( compID, uiPartOffset );
    2671         const UInt  uiSrcStride   = pcRecoYuv->getStride( compID);
    2672 
    2673         for( UInt uiY = 0; uiY < uiCompHeight; uiY++, piSrc += uiSrcStride, piDes += uiDesStride )
    2674         {
    2675           for( UInt uiX = 0; uiX < uiCompWidth; uiX++ )
    2676           {
    2677             piDes[ uiX ] = piSrc[ uiX ];
    2678           }
     2498      const TComRectangle &puRect=tuRecurseWithPU.getRect(COMPONENT_Y);
     2499      const UInt  uiCompWidth   = puRect.width;
     2500      const UInt  uiCompHeight  = puRect.height;
     2501
     2502      const UInt  uiZOrder      = pcCU->getZorderIdxInCtu() + uiPartOffset;
     2503            Pel*  piDes         = pcCU->getPic()->getPicYuvRec()->getAddr( COMPONENT_Y, pcCU->getCtuRsAddr(), uiZOrder );
     2504      const UInt  uiDesStride   = pcCU->getPic()->getPicYuvRec()->getStride( COMPONENT_Y);
     2505      const Pel*  piSrc         = pcRecoYuv->getAddr( COMPONENT_Y, uiPartOffset );
     2506      const UInt  uiSrcStride   = pcRecoYuv->getStride( COMPONENT_Y);
     2507
     2508      for( UInt uiY = 0; uiY < uiCompHeight; uiY++, piSrc += uiSrcStride, piDes += uiDesStride )
     2509      {
     2510        for( UInt uiX = 0; uiX < uiCompWidth; uiX++ )
     2511        {
     2512          piDes[ uiX ] = piSrc[ uiX ];
    26792513        }
    26802514      }
     
    26822516
    26832517    //=== update PU data ====
    2684     pcCU->setIntraDirSubParts     ( CHANNEL_TYPE_LUMA, uiBestPUMode, uiPartOffset, uiDepth + uiInitTrDepth );
    2685     if (!bLumaOnly && getChromasCorrespondingPULumaIdx(uiPartOffset, chFmt)==uiPartOffset)
    2686     {
    2687       UInt chromaDir=pcCU->getIntraDir(CHANNEL_TYPE_CHROMA, getChromasCorrespondingPULumaIdx(uiPartOffset, chFmt));
    2688       if (chromaDir == uiBestPUMode && tuRecurseWithPU.ProcessChannelSection(CHANNEL_TYPE_CHROMA))
    2689       {
    2690         pcCU->setIntraDirSubParts     ( CHANNEL_TYPE_CHROMA, DM_CHROMA_IDX, getChromasCorrespondingPULumaIdx(uiPartOffset, chFmt), uiDepth + uiInitTrDepthC );
    2691       }
    2692     }
    2693     //pcCU->copyToPic                   ( uiDepth, uiPU, uiInitTrDepth ); // Unnecessary copy?
     2518    pcCU->setIntraDirSubParts     ( CHANNEL_TYPE_LUMA, uiBestPUMode, uiPartOffset, uiDepth + uiInitTrDepth );   
    26942519  } while (tuRecurseWithPU.nextSection(tuRecurseCU));
    26952520
     
    27192544
    27202545  //===== set distortion (rate and r-d costs are determined later) =====
    2721   ruiDistC                   = uiOverallDistC;
    2722   pcCU->getTotalDistortion() = uiOverallDistY + uiOverallDistC;
     2546  pcCU->getTotalDistortion() = uiOverallDistY;
    27232547}
    27242548
     
    27322556                                 TComYuv*    pcResiYuv,
    27332557                                 TComYuv*    pcRecoYuv,
    2734                                  Pel         resiLuma[NUMBER_OF_STORED_RESIDUAL_TYPES][MAX_CU_SIZE * MAX_CU_SIZE],
    2735                                  Distortion  uiPreCalcDistC
     2558                                 Pel         resiLuma[NUMBER_OF_STORED_RESIDUAL_TYPES][MAX_CU_SIZE * MAX_CU_SIZE]
    27362559                                 DEBUG_STRING_FN_DECLARE(sDebug))
    27372560{
    2738   pcCU->getTotalDistortion      () -= uiPreCalcDistC;
    2739 
    2740   //const UInt    uiDepthCU     = pcCU->getDepth(0);
    27412561  const UInt    uiInitTrDepth  = pcCU->getPartitionSize(0) != SIZE_2Nx2N && enable4ChromaPUsInIntraNxNCU(pcOrgYuv->getChromaFormat()) ? 1 : 0;
    2742 //  const UInt    uiNumPU        = 1<<(2*uiInitTrDepth);
    27432562
    27442563  TComTURecurse tuRecurseCU(pcCU, 0);
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncSearch.h

    r1029 r1243  
    174174
    175175public:
    176   Void  preestChromaPredMode    ( TComDataCU* pcCU,
    177                                   TComYuv*    pcOrgYuv,
    178                                   TComYuv*    pcPredYuv );
    179 
    180   Void  estIntraPredQT          ( TComDataCU* pcCU,
     176  Void  estIntraPredLumaQT      ( TComDataCU* pcCU,
    181177                                  TComYuv*    pcOrgYuv,
    182178                                  TComYuv*    pcPredYuv,
    183179                                  TComYuv*    pcResiYuv,
    184180                                  TComYuv*    pcRecoYuv,
    185                                   Pel         resiLuma[NUMBER_OF_STORED_RESIDUAL_TYPES][MAX_CU_SIZE * MAX_CU_SIZE],
    186                                   Distortion& ruiDistC,
    187                                   Bool        bLumaOnly
     181                                  Pel         resiLuma[NUMBER_OF_STORED_RESIDUAL_TYPES][MAX_CU_SIZE * MAX_CU_SIZE]
    188182                                  DEBUG_STRING_FN_DECLARE(sDebug));
    189183
     
    193187                                  TComYuv*    pcResiYuv,
    194188                                  TComYuv*    pcRecoYuv,
    195                                   Pel         resiLuma[NUMBER_OF_STORED_RESIDUAL_TYPES][MAX_CU_SIZE * MAX_CU_SIZE],
    196                                   Distortion  uiPreCalcDistC
     189                                  Pel         resiLuma[NUMBER_OF_STORED_RESIDUAL_TYPES][MAX_CU_SIZE * MAX_CU_SIZE]
    197190                                  DEBUG_STRING_FN_DECLARE(sDebug));
    198191
     
    278271                                   );
    279272
    280   Void  xRecurIntraCodingQT       ( Bool        bLumaOnly,
    281                                     TComYuv*    pcOrgYuv,
     273  Void  xRecurIntraCodingLumaQT   ( TComYuv*    pcOrgYuv,
    282274                                    TComYuv*    pcPredYuv,
    283275                                    TComYuv*    pcResiYuv,
    284276                                    Pel         resiLuma[NUMBER_OF_STORED_RESIDUAL_TYPES][MAX_CU_SIZE * MAX_CU_SIZE],
    285277                                    Distortion& ruiDistY,
    286                                     Distortion& ruiDistC,
    287278#if HHI_RQT_INTRA_SPEEDUP
    288                                    Bool         bCheckFirst,
    289 #endif
    290                                    Double&      dRDCost,
    291                                    TComTU      &rTu
    292                                    DEBUG_STRING_FN_DECLARE(sDebug));
    293 
    294   Void  xSetIntraResultQT         ( Bool         bLumaOnly,
    295                                     TComYuv*     pcRecoYuv,
     279                                    Bool         bCheckFirst,
     280#endif
     281                                    Double&      dRDCost,
     282                                    TComTU      &rTu
     283                                    DEBUG_STRING_FN_DECLARE(sDebug));
     284
     285  Void  xSetIntraResultLumaQT     ( TComYuv*     pcRecoYuv,
    296286                                    TComTU &rTu);
    297287
     
    323313  Void  xSetIntraResultChromaQT   ( TComYuv*    pcRecoYuv, TComTU &rTu);
    324314
    325   Void  xStoreIntraResultQT       ( const ComponentID first, const ComponentID lastIncl, TComTU &rTu);
    326   Void  xLoadIntraResultQT        ( const ComponentID first, const ComponentID lastIncl, TComTU &rTu);
     315  Void  xStoreIntraResultQT       ( const ComponentID compID, TComTU &rTu);
     316  Void  xLoadIntraResultQT        ( const ComponentID compID, TComTU &rTu);
    327317
    328318
Note: See TracChangeset for help on using the changeset viewer.