Changeset 296 in 3DVCSoftware for trunk/source/Lib/TLibEncoder/TEncEntropy.cpp


Ignore:
Timestamp:
20 Feb 2013, 22:07:43 (12 years ago)
Author:
tech
Message:

Reintegrated branch 5.1-dev0 rev. 295.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/Lib/TLibEncoder/TEncEntropy.cpp

    r210 r296  
    5252Void TEncEntropy::encodeSliceHeader ( TComSlice* pcSlice )
    5353{
    54 #if SAO_UNIT_INTERLEAVING
    5554  if (pcSlice->getSPS()->getUseSAO())
    5655  {
     
    6867    }
    6968  }
    70 #endif
    7169
    7270  m_pcEntropyCoderIf->codeSliceHeader( pcSlice );
     
    7472}
    7573
    76 #if TILES_WPP_ENTRY_POINT_SIGNALLING
    7774Void  TEncEntropy::encodeTilesWPPEntryPoint( TComSlice* pSlice )
    7875{
    7976  m_pcEntropyCoderIf->codeTilesWPPEntryPoint( pSlice );
    8077}
    81 #else
    82 Void TEncEntropy::encodeSliceHeaderSubstreamTable( TComSlice* pcSlice )
    83 {
    84   m_pcEntropyCoderIf->codeSliceHeaderSubstreamTable( pcSlice );
    85 }
    86 #endif
    8778
    8879Void TEncEntropy::encodeTerminatingBit      ( UInt uiIsLast )
     
    9889}
    9990
    100 #if OL_FLUSH
    10191Void TEncEntropy::encodeFlush()
    10292{
     
    10797  m_pcEntropyCoderIf->encodeStart();
    10898}
    109 #endif
    11099
    111100Void TEncEntropy::encodeSEI(const SEI& sei)
     
    133122#endif
    134123
    135 #if HHI_MPI
     124#if HHI_MPI || OL_QTLIMIT_PREDCODING_B0068
    136125Void TEncEntropy::encodeSPS( TComSPS* pcSPS, Bool bIsDepth )
    137126{
     
    157146    uiAbsPartIdx = 0;
    158147  }
    159 #if BURST_IPCM
    160148  if( !bRD )
    161149  {
     
    165153    }
    166154  }
    167 #endif
    168155  m_pcEntropyCoderIf->codeSkipFlag( pcCU, uiAbsPartIdx );
    169156}
    170157
    171158#if LGE_ILLUCOMP_B0045
    172 Void TEncEntropy::encodeICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD )
    173 {
    174   if (pcCU->isIntra(uiAbsPartIdx) || (pcCU->getSlice()->getViewId() == 0) || pcCU->getSlice()->getSPS()->isDepth())
     159Void TEncEntropy::encodeICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD
     160#if LGE_ILLUCOMP_DEPTH_C0046
     161    , UInt uiDepth
     162#endif
     163    )
     164{
     165  if (pcCU->isIntra(uiAbsPartIdx) || (pcCU->getSlice()->getViewId() == 0)
     166#if !LGE_ILLUCOMP_DEPTH_C0046
     167      || pcCU->getSlice()->getSPS()->isDepth()
     168#endif
     169      )
    175170  {
    176171    return;
     
    185180  }
    186181
    187   if(pcCU->isICFlagRequired(uiAbsPartIdx))
     182  if(pcCU->isICFlagRequired(uiAbsPartIdx
     183#if LGE_ILLUCOMP_DEPTH_C0046
     184      , uiDepth //This modification is not needed after integrating JCT3V-C0137
     185#endif
     186      ))
    188187    m_pcEntropyCoderIf->codeICFlag( pcCU, uiAbsPartIdx );
    189188}
     
    214213  //  m_pcEntropyCoderIf->codeAlfUvlc(pAlfParam->realfiltNo);
    215214
    216 #if !LCU_SYNTAX_ALF
    217   m_pcEntropyCoderIf->codeAlfFlag(pAlfParam->alf_pcr_region_flag);
    218 #endif
    219 #if !ALF_SINGLE_FILTER_SHAPE
    220   m_pcEntropyCoderIf->codeAlfUvlc(pAlfParam->filter_shape);
    221 #endif
    222215  Int noFilters = min(pAlfParam->filters_per_group-1, 2);
    223216  m_pcEntropyCoderIf->codeAlfUvlc(noFilters);
     
    229222  else if (noFilters == 2)
    230223  {
    231 #if LCU_SYNTAX_ALF
    232 #if ALF_16_BA_GROUPS
    233224    Int numMergeFlags = 16;
    234 #else
    235     Int numMergeFlags = 15;
    236 #endif
    237 #else
    238 #if ALF_16_BA_GROUPS
    239     Int numMergeFlags = 16;
    240 #else
    241     Int numMergeFlags = pAlfParam->alf_pcr_region_flag ? 16 : 15;
    242 #endif
    243 #endif
    244225    for (Int i=1; i<numMergeFlags; i++)
    245226    {
     
    273254  pDepthInt = pDepthIntTabShapes[ALFp->filter_shape];
    274255  maxScanVal = 0;
    275 #if ALF_SINGLE_FILTER_SHAPE
    276256  int minScanVal = MIN_SCAN_POS_CROSS;
    277 #else
    278   int minScanVal = ( ALFp->filter_shape==ALF_STAR5x5 ) ? 0 : MIN_SCAN_POS_CROSS;
    279 #endif
    280257
    281258  for(i = 0; i < sqrFiltLength; i++)
     
    343320  // Coding parameters
    344321  ALFp->minKStart = minKStart;
    345 #if !LCU_SYNTAX_ALF 
    346   ALFp->maxScanVal = maxScanVal;
    347 #endif
    348322  for(scanPos = minScanVal; scanPos < maxScanVal; scanPos++)
    349323  {
     
    351325  }
    352326
    353 #if LCU_SYNTAX_ALF
    354327  if (ALFp->filters_per_group == 1)
    355328  {
     
    358331  else
    359332  {
    360 #endif
    361333  len += writeFilterCodingParams(minKStart, minScanVal, maxScanVal, kMinTab);
    362334
    363335  // Filter coefficients
    364336  len += writeFilterCoeffs(sqrFiltLength, filters_per_group, pDepthInt, ALFp->coeffmulti, kMinTab);
    365 #if LCU_SYNTAX_ALF
    366   }
    367 #endif
     337  }
    368338 
    369339  return len;
     
    403373    {
    404374      scanPos = pDepthInt[i] - 1;
    405 #if LCU_SYNTAX_ALF
    406375      Int k = (filters_per_group == 1) ? kMinTab[i] : kMinTab[scanPos];
    407376      golombEncode(FilterCoeff[ind][i], k);
    408 #else
    409       golombEncode(FilterCoeff[ind][i], kMinTab[scanPos]);
    410 #endif
    411377    }
    412378  }
     
    489455}
    490456
    491 #if HHI_INTER_VIEW_RESIDUAL_PRED
     457#if H3D_IVRP && !MTK_MDIVRP_C0138
    492458Void
    493459TEncEntropy::encodeResPredFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiPUIdx, Bool bRD )
     
    514480#endif
    515481
    516 #if LCU_SYNTAX_ALF
    517482/** parse the fixed length code (smaller than one max value) in ALF
    518483 * \param run: coded value
     
    781746
    782747}
    783 #endif
    784748
    785749
    786750Void TEncEntropy::encodeAlfParam(ALFParam* pAlfParam)
    787751{
    788 #if LCU_SYNTAX_ALF
    789752  const Int numCoeff = (Int)ALF_MAX_NUM_COEF;
    790753
     
    814777    }
    815778  }
    816 #else
    817   if (!pAlfParam->alf_flag)
    818   {
    819     return;
    820   }
    821   Int pos;
    822   codeAux(pAlfParam);
    823   codeFilt(pAlfParam);
    824  
    825   // filter parameters for chroma
    826   m_pcEntropyCoderIf->codeAlfUvlc(pAlfParam->chroma_idc);
    827   if(pAlfParam->chroma_idc)
    828   {
    829 #if !ALF_SINGLE_FILTER_SHAPE
    830     m_pcEntropyCoderIf->codeAlfUvlc(pAlfParam->filter_shape_chroma);
    831 #endif
    832     // filter coefficients for chroma
    833     for(pos=0; pos<pAlfParam->num_coeff_chroma; pos++)
    834     {
    835       m_pcEntropyCoderIf->codeAlfSvlc(pAlfParam->coeff_chroma[pos]);
    836     }
    837   }
    838 #endif
    839779}
    840780
     
    895835    uiAbsPartIdx = 0;
    896836  }
    897 #if BURST_IPCM
    898837  if( !bRD )
    899838  {
     
    903842    }
    904843  }
    905 #endif
    906844
    907845#if !RWTH_SDC_DLT_B0036
     
    931869    uiAbsPartIdx = 0;
    932870  }
    933 #if BURST_IPCM
    934871  if( !bRD )
    935872  {
     
    939876    }
    940877  }
    941 #endif
    942878
    943879  m_pcEntropyCoderIf->codeSplitFlag( pcCU, uiAbsPartIdx, uiDepth );
     
    957893    uiAbsPartIdx = 0;
    958894  }
    959 #if BURST_IPCM
    960895  if( !bRD )
    961896  {
     
    965900    }
    966901  }
    967 #endif 
    968902#if RWTH_SDC_DLT_B0036
    969903  if( !pcCU->getSlice()->isInterB() && pcCU->isIntra(uiAbsPartIdx) && pcCU->getSDCFlag(uiAbsPartIdx)  )
     
    1019953  }
    1020954 
    1021 #if BURST_IPCM
    1022955  Int numIPCM = 0;
    1023956  Bool firstIPCMFlag = false;
     
    1035968  }
    1036969  m_pcEntropyCoderIf->codeIPCMInfo ( pcCU, uiAbsPartIdx, numIPCM, firstIPCMFlag);
    1037 #else
    1038   m_pcEntropyCoderIf->codeIPCMInfo ( pcCU, uiAbsPartIdx );
    1039 #endif
    1040 
    1041 }
    1042 
    1043 #if UNIFIED_TRANSFORM_TREE
     970
     971}
     972
    1044973Void TEncEntropy::xEncodeTransform( TComDataCU* pcCU,UInt offsetLuma, UInt offsetChroma, UInt uiAbsPartIdx, UInt absTUPartIdx, UInt uiDepth, UInt width, UInt height, UInt uiTrIdx, UInt uiInnerQuadIdx, UInt& uiYCbfFront3, UInt& uiUCbfFront3, UInt& uiVCbfFront3, Bool& bCodeDQP )
    1045 #else
    1046 Void TEncEntropy::xEncodeTransformSubdiv( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt absTUPartIdx, UInt uiDepth, UInt uiInnerQuadIdx, UInt& uiYCbfFront3, UInt& uiUCbfFront3, UInt& uiVCbfFront3 )
    1047 #endif
    1048974{
    1049975  const UInt uiSubdiv = pcCU->getTransformIdx( uiAbsPartIdx ) + pcCU->getDepth( uiAbsPartIdx ) > uiDepth;
    1050976  const UInt uiLog2TrafoSize = g_aucConvertToBit[pcCU->getSlice()->getSPS()->getMaxCUWidth()]+2 - uiDepth;
    1051 #if UNIFIED_TRANSFORM_TREE
    1052977  UInt cbfY = pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA    , uiTrIdx );
    1053978  UInt cbfU = pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrIdx );
     
    1072997    }
    1073998  }
    1074 #endif // UNIFIED_TRANSFORM_TREE
    1075999  {//CABAC
    10761000    if( pcCU->getPredictionMode(uiAbsPartIdx) == MODE_INTRA && pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_NxN && uiDepth == pcCU->getDepth(uiAbsPartIdx) )
     
    11521076    if( uiSubdiv )
    11531077    {
    1154 #if UNIFIED_TRANSFORM_TREE
    11551078      UInt size;
    11561079      width  >>= 1;
     
    11581081      size = width*height;
    11591082      uiTrIdx++;
    1160 #endif // UNIFIED_TRANSFORM_TREE
    11611083      ++uiDepth;
    1162 #if UNIFIED_TRANSFORM_TREE
    11631084      const UInt partNum = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1);
    1164 #else
    1165       const UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1);
    1166 #endif
    11671085     
    11681086      UInt uiCurrentCbfY = 0;
     
    11701088      UInt uiCurrentCbfV = 0;
    11711089     
    1172 #if UNIFIED_TRANSFORM_TREE
    11731090      UInt nsAddr = 0;
    11741091      nsAddr = pcCU->getNSAbsPartIdx( uiLog2TrafoSize-1, uiAbsPartIdx, absTUPartIdx, 0, uiDepth - pcCU->getDepth( uiAbsPartIdx ) );
     
    11861103      nsAddr = pcCU->getNSAbsPartIdx( uiLog2TrafoSize-1, uiAbsPartIdx, absTUPartIdx, 3, uiDepth - pcCU->getDepth( uiAbsPartIdx ) );
    11871104      xEncodeTransform( pcCU, offsetLuma, offsetChroma, uiAbsPartIdx, nsAddr, uiDepth, width, height, uiTrIdx, 3, uiCurrentCbfY, uiCurrentCbfU, uiCurrentCbfV, bCodeDQP );     
    1188 #else // UNIFIED_TRANSFORM_TREE
    1189       UInt nsAddr = 0;
    1190       nsAddr = pcCU->getNSAbsPartIdx( uiLog2TrafoSize-1, uiAbsPartIdx, absTUPartIdx, 0, uiDepth - pcCU->getDepth( uiAbsPartIdx ) );
    1191       xEncodeTransformSubdiv( pcCU, uiAbsPartIdx, nsAddr, uiDepth, 0, uiCurrentCbfY, uiCurrentCbfU, uiCurrentCbfV );
    1192 
    1193       uiAbsPartIdx += uiQPartNum;
    1194       nsAddr = pcCU->getNSAbsPartIdx( uiLog2TrafoSize-1, uiAbsPartIdx, absTUPartIdx, 1, uiDepth - pcCU->getDepth( uiAbsPartIdx ) );
    1195       xEncodeTransformSubdiv( pcCU, uiAbsPartIdx, nsAddr, uiDepth, 1, uiCurrentCbfY, uiCurrentCbfU, uiCurrentCbfV );
    1196 
    1197       uiAbsPartIdx += uiQPartNum;
    1198       nsAddr = pcCU->getNSAbsPartIdx( uiLog2TrafoSize-1, uiAbsPartIdx, absTUPartIdx, 2, uiDepth - pcCU->getDepth( uiAbsPartIdx ) );
    1199       xEncodeTransformSubdiv( pcCU, uiAbsPartIdx, nsAddr, uiDepth, 2, uiCurrentCbfY, uiCurrentCbfU, uiCurrentCbfV );
    1200 
    1201       uiAbsPartIdx += uiQPartNum;
    1202       nsAddr = pcCU->getNSAbsPartIdx( uiLog2TrafoSize-1, uiAbsPartIdx, absTUPartIdx, 3, uiDepth - pcCU->getDepth( uiAbsPartIdx ) );
    1203       xEncodeTransformSubdiv( pcCU, uiAbsPartIdx, nsAddr, uiDepth, 3, uiCurrentCbfY, uiCurrentCbfU, uiCurrentCbfV );
    1204 #endif // UNIFIED_TRANSFORM_TREE
    12051105     
    12061106      uiYCbfFront3 += uiCurrentCbfY;
     
    12461146      }
    12471147     
    1248 #if UNIFIED_TRANSFORM_TREE
    12491148      if ( cbfY || cbfU || cbfV )
    12501149      {
     
    12981197        }
    12991198      }
    1300 #endif // UNIFIED_TRANSFORM_TREE
    1301     }
    1302   }
    1303 }
    1304 
    1305 #if !UNIFIED_TRANSFORM_TREE
    1306 // transform index
    1307 Void TEncEntropy::encodeTransformIdx( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, Bool bRD )
    1308 {
    1309   assert( !bRD ); // parameter bRD can be removed
    1310   if( bRD )
    1311   {
    1312     uiAbsPartIdx = 0;
    1313   }
    1314  
    1315   DTRACE_CABAC_VL( g_nSymbolCounter++ )
    1316   DTRACE_CABAC_T( "\tdecodeTransformIdx()\tCUDepth=" )
    1317   DTRACE_CABAC_V( uiDepth )
    1318   DTRACE_CABAC_T( "\n" )
    1319   UInt temp = 0;
    1320   UInt temp1 = 0;
    1321   UInt temp2 = 0;
    1322   xEncodeTransformSubdiv( pcCU, uiAbsPartIdx, uiAbsPartIdx, uiDepth, 0, temp, temp1, temp2 );
    1323 }
    1324 #endif // !UNIFIED_TRANSFORM_TREE
     1199    }
     1200  }
     1201}
     1202
    13251203
    13261204// Intra direction for Luma
     
    13471225    uiAbsPartIdx = 0;
    13481226  }
    1349  
     1227
    13501228#if RWTH_SDC_DLT_B0036
    13511229  if( pcCU->getSDCFlag(uiAbsPartIdx) )
     
    13551233  }
    13561234#endif
    1357  
     1235
    13581236  PartSize eSize = pcCU->getPartitionSize( uiAbsPartIdx );
    13591237 
     
    14961374  if ( (pcCU->getInterDir( uiAbsPartIdx ) & ( 1 << eRefList )) && (pcCU->getAMVPMode(uiAbsPartIdx) == AM_EXPL) )
    14971375  {
    1498 #if HHI_INTER_VIEW_MOTION_PRED
     1376#if H3D_IVMP
    14991377    const Int iNumCands = AMVP_MAX_NUM_CANDS + ( pcCU->getSlice()->getSPS()->getMultiviewMvPredMode() ? 1 : 0 );
    15001378    m_pcEntropyCoderIf->codeMVPIdx( pcCU, uiAbsPartIdx, eRefList, iNumCands );
     
    15381416
    15391417// texture
    1540 #if !UNIFIED_TRANSFORM_TREE
    1541 Void TEncEntropy::xEncodeCoeff( TComDataCU* pcCU, UInt uiLumaOffset, UInt uiChromaOffset, UInt uiAbsPartIdx, UInt uiDepth, UInt uiWidth, UInt uiHeight, UInt uiTrIdx, UInt uiCurrTrIdx, Bool& bCodeDQP )
    1542 {
    1543   UInt uiLog2TrSize = g_aucConvertToBit[ pcCU->getSlice()->getSPS()->getMaxCUWidth() >> uiDepth ] + 2;
    1544   UInt uiCbfY = pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiTrIdx );
    1545   UInt uiCbfU = pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrIdx );
    1546   UInt uiCbfV = pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrIdx );
    1547 
    1548   if( uiLog2TrSize == 2 )
    1549   {
    1550     UInt uiQPDiv = pcCU->getPic()->getNumPartInCU() >> ( ( uiDepth - 1 ) << 1 );
    1551     if( ( uiAbsPartIdx % uiQPDiv ) == 0 )
    1552     {
    1553       m_uiBakAbsPartIdx   = uiAbsPartIdx;
    1554       m_uiBakChromaOffset = uiChromaOffset;
    1555     }
    1556     else if( ( uiAbsPartIdx % uiQPDiv ) == (uiQPDiv - 1) )
    1557     {
    1558       uiCbfU = pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_U, uiTrIdx );
    1559       uiCbfV = pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_V, uiTrIdx );
    1560     }
    1561   }
    1562 
    1563   if ( uiCbfY || uiCbfU || uiCbfV )
    1564   {
    1565     // dQP: only for LCU once
    1566     if ( pcCU->getSlice()->getPPS()->getUseDQP() )
    1567     {
    1568       if ( bCodeDQP )
    1569       {
    1570         encodeQP( pcCU, uiAbsPartIdx );
    1571         bCodeDQP = false;
    1572       }
    1573     }
    1574     UInt uiLumaTrMode, uiChromaTrMode;
    1575     pcCU->convertTransIdx( uiAbsPartIdx, pcCU->getTransformIdx( uiAbsPartIdx ), uiLumaTrMode, uiChromaTrMode );
    1576     const UInt uiStopTrMode = uiLumaTrMode;
    1577    
    1578     assert(1); // as long as quadtrees are not used for residual transform
    1579    
    1580     if( uiTrIdx == uiStopTrMode )
    1581     {
    1582       if( pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiTrIdx ) )
    1583       {
    1584         Int trWidth = uiWidth;
    1585         Int trHeight = uiHeight;
    1586         pcCU->getNSQTSize( uiTrIdx, uiAbsPartIdx, trWidth, trHeight );
    1587         m_pcEntropyCoderIf->codeCoeffNxN( pcCU, (pcCU->getCoeffY()+uiLumaOffset), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_LUMA );
    1588       }
    1589 
    1590       uiWidth  >>= 1;
    1591       uiHeight >>= 1;
    1592 
    1593       if( uiLog2TrSize == 2 )
    1594       {
    1595         UInt uiQPDiv = pcCU->getPic()->getNumPartInCU() >> ( ( uiDepth - 1 ) << 1 );
    1596         if( ( uiAbsPartIdx % uiQPDiv ) == (uiQPDiv - 1) )
    1597         {
    1598           uiWidth  <<= 1;
    1599           uiHeight <<= 1;
    1600           Int trWidth = uiWidth;
    1601           Int trHeight = uiHeight;
    1602           pcCU->getNSQTSize( uiTrIdx-1, uiAbsPartIdx, trWidth, trHeight );
    1603           if( pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_U, uiTrIdx ) )
    1604           {
    1605             m_pcEntropyCoderIf->codeCoeffNxN( pcCU, (pcCU->getCoeffCb()+m_uiBakChromaOffset), m_uiBakAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_U );
    1606           }
    1607           if( pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_V, uiTrIdx ) )
    1608           {
    1609             m_pcEntropyCoderIf->codeCoeffNxN( pcCU, (pcCU->getCoeffCr()+m_uiBakChromaOffset), m_uiBakAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_V );
    1610           }
    1611         }
    1612       }
    1613       else
    1614       {
    1615         Int trWidth = uiWidth;
    1616         Int trHeight = uiHeight;
    1617         pcCU->getNSQTSize( uiTrIdx, uiAbsPartIdx, trWidth, trHeight );
    1618         if( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrIdx ) )
    1619         {
    1620           m_pcEntropyCoderIf->codeCoeffNxN( pcCU, (pcCU->getCoeffCb()+uiChromaOffset), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_U );
    1621         }
    1622         if( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrIdx ) )
    1623         {
    1624           m_pcEntropyCoderIf->codeCoeffNxN( pcCU, (pcCU->getCoeffCr()+uiChromaOffset), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_V );
    1625         }
    1626       }
    1627     }
    1628     else
    1629     {
    1630       {
    1631         DTRACE_CABAC_VL( g_nSymbolCounter++ );
    1632         DTRACE_CABAC_T( "\tgoing down\tdepth=" );
    1633         DTRACE_CABAC_V( uiDepth );
    1634         DTRACE_CABAC_T( "\ttridx=" );
    1635         DTRACE_CABAC_V( uiTrIdx );
    1636         DTRACE_CABAC_T( "\n" );
    1637       }
    1638       if( uiCurrTrIdx <= uiTrIdx )
    1639         assert(1);
    1640      
    1641       UInt uiSize;
    1642       uiWidth  >>= 1;
    1643       uiHeight >>= 1;
    1644       uiSize = uiWidth*uiHeight;
    1645       uiDepth++;
    1646       uiTrIdx++;
    1647      
    1648       UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1);
    1649       UInt uiIdx      = uiAbsPartIdx;
    1650      
    1651       {
    1652         xEncodeCoeff( pcCU, uiLumaOffset, uiChromaOffset, uiIdx, uiDepth, uiWidth, uiHeight, uiTrIdx, uiCurrTrIdx, bCodeDQP );
    1653         uiLumaOffset += uiSize;  uiChromaOffset += (uiSize>>2);  uiIdx += uiQPartNum;
    1654 
    1655         xEncodeCoeff( pcCU, uiLumaOffset, uiChromaOffset, uiIdx, uiDepth, uiWidth, uiHeight, uiTrIdx, uiCurrTrIdx, bCodeDQP );
    1656         uiLumaOffset += uiSize;  uiChromaOffset += (uiSize>>2);  uiIdx += uiQPartNum;
    1657 
    1658         xEncodeCoeff( pcCU, uiLumaOffset, uiChromaOffset, uiIdx, uiDepth, uiWidth, uiHeight, uiTrIdx, uiCurrTrIdx, bCodeDQP );
    1659         uiLumaOffset += uiSize;  uiChromaOffset += (uiSize>>2);  uiIdx += uiQPartNum;
    1660 
    1661         xEncodeCoeff( pcCU, uiLumaOffset, uiChromaOffset, uiIdx, uiDepth, uiWidth, uiHeight, uiTrIdx, uiCurrTrIdx, bCodeDQP );
    1662       }
    1663       {
    1664         DTRACE_CABAC_VL( g_nSymbolCounter++ );
    1665         DTRACE_CABAC_T( "\tgoing up\n" );
    1666       }
    1667     }
    1668   }
    1669 }
    1670 #endif // !UNIFIED_TRANSFORM_TREE
    16711418
    16721419/** encode coefficients
     
    17061453    DTRACE_CABAC_V( uiDepth )
    17071454    DTRACE_CABAC_T( "\n" )
    1708 #if !UNIFIED_TRANSFORM_TREE
    1709     UInt temp = 0;
    1710     UInt temp1 = 0;
    1711     UInt temp2 = 0;
    1712     xEncodeTransformSubdiv( pcCU, uiAbsPartIdx, uiAbsPartIdx, uiDepth, 0, temp, temp1, temp2 );
    1713 #endif // !UNIFIED_TRANSFORM_TREE
    17141455  }
    17151456  else
     
    17351476      }
    17361477    }
    1737 #if !UNIFIED_TRANSFORM_TREE
    1738     encodeTransformIdx( pcCU, uiAbsPartIdx, pcCU->getDepth(uiAbsPartIdx) );
    1739 #endif
    17401478  }
    17411479 
     
    17561494#endif
    17571495
    1758 #if UNIFIED_TRANSFORM_TREE
    17591496  UInt temp = 0;
    17601497  UInt temp1 = 0;
    17611498  UInt temp2 = 0;
    17621499  xEncodeTransform( pcCU, uiLumaOffset, uiChromaOffset, uiAbsPartIdx, uiAbsPartIdx, uiDepth, uiWidth, uiHeight, 0, 0, temp, temp1, temp2, bCodeDQP );
    1763 #else // UNIFIED_TRANSFORM_TREE
    1764   xEncodeCoeff( pcCU, uiLumaOffset, uiChromaOffset, uiAbsPartIdx, uiDepth, uiWidth, uiHeight, 0, uiLumaTrMode, bCodeDQP );
    1765 #endif // UNIFIED_TRANSFORM_TREE
    17661500
    17671501#if FIX_MPI_B0065
     
    17851519}
    17861520
    1787 #if SAO_UNIT_INTERLEAVING
    17881521/** Encode SAO Offset
    17891522 * \param  saoLcuParam SAO LCU paramters
     
    19731706  }
    19741707}
    1975 #else
    1976 /** Encode SAO for one partition
    1977  * \param  pSaoParam, iPartIdx
    1978  */
    1979 Void TEncEntropy::encodeSaoOnePart(SAOParam* pSaoParam, Int iPartIdx, Int iYCbCr)
    1980 {
    1981   SAOQTPart*  pAlfPart = NULL;
    1982   pAlfPart = &(pSaoParam->psSaoPart[iYCbCr][iPartIdx]);
    1983 
    1984   UInt uiSymbol;
    1985 
    1986   if(!pAlfPart->bSplit)
    1987   {
    1988     if (pAlfPart->bEnableFlag)
    1989     {
    1990       uiSymbol = pAlfPart->iBestType + 1;
    1991     }
    1992     else
    1993     {
    1994       uiSymbol = 0;
    1995     }
    1996    
    1997     m_pcEntropyCoderIf->codeSaoUvlc(uiSymbol);
    1998 
    1999     if (pAlfPart->bEnableFlag)
    2000     {
    2001       for(Int i=0; i< pAlfPart->iLength; i++)
    2002       {
    2003         m_pcEntropyCoderIf->codeSaoSvlc(pAlfPart->iOffset[i]);
    2004       }   
    2005     }
    2006     return;
    2007   }
    2008 
    2009   //split
    2010   if (pAlfPart->PartLevel < pSaoParam->iMaxSplitLevel)
    2011   {
    2012     for (Int i=0;i<NUM_DOWN_PART;i++)
    2013     {
    2014       encodeSaoOnePart(pSaoParam, pAlfPart->DownPartsIdx[i], iYCbCr);
    2015     }
    2016   }
    2017 }
    2018 
    2019 /** Encode quadtree split flag
    2020  * \param  pSaoParam, iPartIdx
    2021  */
    2022 Void TEncEntropy::encodeQuadTreeSplitFlag(SAOParam* pSaoParam, Int iPartIdx, Int iYCbCr)
    2023 {
    2024   SAOQTPart*  pSaoPart = NULL;
    2025   pSaoPart = &(pSaoParam->psSaoPart[iYCbCr][iPartIdx]);
    2026 
    2027   if(pSaoPart->PartLevel < pSaoParam->iMaxSplitLevel)
    2028   {
    2029     //send one flag
    2030     m_pcEntropyCoderIf->codeSaoFlag( (pSaoPart->bSplit)?(1):(0)  );
    2031 
    2032     if(pSaoPart->bSplit)
    2033     {
    2034       for (Int i=0;i<NUM_DOWN_PART;i++)
    2035       {
    2036         encodeQuadTreeSplitFlag(pSaoParam, pSaoPart->DownPartsIdx[i], iYCbCr);
    2037       }
    2038     }
    2039   }
    2040 }
    2041 /** Encode SAO parameters
    2042  * \param  pSaoParam
    2043  */
    2044 Void TEncEntropy::encodeSaoParam(SAOParam* pSaoParam)
    2045 {
    2046   if (pSaoParam->bSaoFlag[0])
    2047   {
    2048     encodeQuadTreeSplitFlag(pSaoParam, 0, 0);
    2049     encodeSaoOnePart(pSaoParam, 0, 0);
    2050     m_pcEntropyCoderIf->codeSaoFlag(pSaoParam->bSaoFlag[1]);
    2051     if (pSaoParam->bSaoFlag[1])
    2052     {
    2053       encodeQuadTreeSplitFlag(pSaoParam, 0, 1);
    2054       encodeSaoOnePart(pSaoParam, 0, 1);
    2055     }
    2056     m_pcEntropyCoderIf->codeSaoFlag(pSaoParam->bSaoFlag[2]);
    2057     if (pSaoParam->bSaoFlag[2])
    2058     {
    2059       encodeQuadTreeSplitFlag(pSaoParam, 0, 2);
    2060       encodeSaoOnePart(pSaoParam, 0, 2);
    2061     }
    2062   }
    2063 }
    2064 #endif
    20651708
    20661709Int TEncEntropy::countNonZeroCoeffs( TCoeff* pcCoef, UInt uiSize )
Note: See TracChangeset for help on using the changeset viewer.