Changeset 296 in 3DVCSoftware for trunk/source/Lib/TLibDecoder/TDecEntropy.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/TLibDecoder/TDecEntropy.cpp

    r189 r296  
    7272  pcCU->setICFlagSubParts( false , uiAbsPartIdx, 0, uiDepth );
    7373
    74   if (pcCU->isIntra(uiAbsPartIdx) || (pcCU->getSlice()->getViewId() == 0) || pcCU->getSlice()->getSPS()->isDepth())
     74  if (pcCU->isIntra(uiAbsPartIdx) || (pcCU->getSlice()->getViewId() == 0)
     75#if !LGE_ILLUCOMP_DEPTH_C0046
     76      || pcCU->getSlice()->getSPS()->isDepth()
     77#endif
     78      )
    7579  {
    7680    return;
     
    8084    return;
    8185
     86#if LGE_ILLUCOMP_DEPTH_C0046
     87  if(pcCU->isICFlagRequired(uiAbsPartIdx, uiDepth)) //This modification is not needed after integrating JCT3V-C0137
     88#else
    8289  if(pcCU->isICFlagRequired(uiAbsPartIdx))
     90#endif
    8391    m_pcEntropyDecoderIf->parseICFlag( pcCU, uiAbsPartIdx, uiDepth );
    8492}
     
    100108}
    101109
    102 #if HHI_INTER_VIEW_RESIDUAL_PRED
     110#if H3D_IVRP && !MTK_MDIVRP_C0138
    103111Void
    104112TDecEntropy::decodeResPredFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, TComDataCU* pcSubCU, UInt uiPUIdx )
     
    115123  if( bResPredAllowed )
    116124  {
    117     bResPredAvailable       = pcSubCU->getResidualSamples( uiPUIdx
    118 #if QC_SIMPLIFIEDIVRP_M24938
    119       , false
    120 #endif
    121       );
     125    bResPredAvailable       = pcSubCU->getResidualSamples( uiPUIdx , false  );
    122126  }
    123127
     
    272276
    273277#if CU_BASED_MRG_CAND_LIST
    274 #if HHI_INTER_VIEW_MOTION_PRED
     278#if H3D_IVMP
    275279  TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists
    276280  UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM];
     
    293297  {
    294298#if !CU_BASED_MRG_CAND_LIST
    295 #if HHI_INTER_VIEW_MOTION_PRED
     299#if H3D_IVMP
    296300    TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists
    297301    UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM];
     
    326330      else
    327331      {
    328 #if SIMP_MRG_PRUN
    329332        uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);
    330333        pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
    331 #else     
    332         pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
    333         uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);
    334 #endif
    335334      }
    336335#else
    337 #if SIMP_MRG_PRUN       
    338336      UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);
     337#if MERL_VSP_C0152
     338      Int iVSPIndexTrue[3] = {-1, -1, -1};
     339      pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, iVSPIndexTrue, uiMergeIndex );
     340
     341#if HHI_MPI
     342      if(pcCU->getTextureModeDepth( uiSubPartIdx ) == uiDepth)//MPI is used
     343      {
     344        TComDataCU *pcTextureCU = pcCU->getSlice()->getTexturePic()->getCU( pcCU->getAddr() );
     345        UInt uiCurrPartNumb = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1);
     346        for( UInt ui = 0; ui < uiCurrPartNumb; ui++ )
     347        {
     348          Int vspIdx = pcTextureCU->getVSPIndex( uiAbsPartIdx + ui);
     349          pcCU->setVSPIndex( uiAbsPartIdx + ui, vspIdx);
     350        }
     351      }
     352      else // MPI not used
     353#endif
     354      {
     355        Int iVSPIdx = 0;
     356        Int numVspIdx;
     357        numVspIdx = 3;
     358        for (Int i = 0; i < numVspIdx; i++)
     359        {
     360          if (iVSPIndexTrue[i] == uiMergeIndex)
     361            {
     362              iVSPIdx = i+1;
     363              break;
     364            }
     365        }
     366        pcCU->setVSPIndexSubParts( iVSPIdx, uiSubPartIdx, uiPartIdx, uiDepth );  //Initialize the VSP, may change later in get InterMergeCandidates()
     367      }
     368
     369#else
    339370      pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
    340 #else     
    341       pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
    342       UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);
    343371#endif
    344372#endif
     
    485513  if ( (pcSubCU->getInterDir(uiPartAddr) & ( 1 << eRefList )) && (pcSubCU->getAMVPMode(uiPartAddr) == AM_EXPL) )
    486514  {
    487 #if HHI_INTER_VIEW_MOTION_PRED
     515#if H3D_IVMP
    488516    const Int iNumAMVPCands = AMVP_MAX_NUM_CANDS + ( pcSubCU->getSlice()->getSPS()->getMultiviewMvPredMode() ? 1 : 0 );
    489517    m_pcEntropyDecoderIf->parseMVPIdx( iMVPIdx, iNumAMVPCands );
     
    492520#endif
    493521  }
    494 #if SHARP_INTERVIEW_DECOUPLE_B0111
     522#if H3D_IVMP
    495523  pcSubCU->fillMvpCand(uiPartIdx, uiPartAddr, eRefList, iRefIdx, pAMVPInfo, iMVPIdx);
    496524#else
     
    509537}
    510538
    511 #if UNIFIED_TRANSFORM_TREE
    512539Void TDecEntropy::xDecodeTransform( 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 )
    513 #else
    514 Void TDecEntropy::xDecodeTransformSubdiv( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt absTUPartIdx, UInt uiDepth, UInt uiInnerQuadIdx, UInt& uiYCbfFront3, UInt& uiUCbfFront3, UInt& uiVCbfFront3 )
    515 #endif
    516540{
    517541  UInt uiSubdiv;
    518542  const UInt uiLog2TrafoSize = g_aucConvertToBit[pcCU->getSlice()->getSPS()->getMaxCUWidth()]+2 - uiDepth;
    519543
    520 #if UNIFIED_TRANSFORM_TREE
    521544  if(uiTrIdx==0)
    522545  {
     
    532555    }
    533556  }
    534 #endif // UNIFIED_TRANSFORM_TREE
    535557  if( pcCU->getPredictionMode(uiAbsPartIdx) == MODE_INTRA && pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_NxN && uiDepth == pcCU->getDepth(uiAbsPartIdx) )
    536558  {
    537559    uiSubdiv = 1;
    538560  }
    539 #if G519_TU_AMP_NSQT_HARMONIZATION
    540561  else if( (pcCU->getSlice()->getSPS()->getQuadtreeTUMaxDepthInter() == 1) && (pcCU->getPredictionMode(uiAbsPartIdx) == MODE_INTER) && ( pcCU->getPartitionSize(uiAbsPartIdx) != SIZE_2Nx2N ) && (uiDepth == pcCU->getDepth(uiAbsPartIdx)) )
    541 #else
    542   else if( (pcCU->getSlice()->getSPS()->getQuadtreeTUMaxDepthInter() == 1) && (pcCU->getPredictionMode(uiAbsPartIdx) == MODE_INTER) && ( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2NxN || pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_Nx2N) && (uiDepth == pcCU->getDepth(uiAbsPartIdx)) )
    543 #endif
    544562  {
    545563    uiSubdiv = (uiLog2TrafoSize > pcCU->getQuadtreeTULog2MinSizeInCU(uiAbsPartIdx));
     
    618636  if( uiSubdiv )
    619637  {
    620 #if UNIFIED_TRANSFORM_TREE
    621638    UInt size;
    622639    width  >>= 1;
     
    624641    size = width*height;
    625642    uiTrIdx++;
    626 #endif
    627643    ++uiDepth;
    628644    const UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1);
     
    640656    for( Int i = 0; i < 4; i++ )
    641657    {
    642 #if UNIFIED_TRANSFORM_TREE
    643658      UInt nsAddr = 0;
    644659      nsAddr = pcCU->getNSAbsPartIdx( uiLog2TrafoSize-1, uiAbsPartIdx, absTUPartIdx, i, uiTrDepth+1 );
    645660      xDecodeTransform( pcCU, offsetLuma, offsetChroma, uiAbsPartIdx, nsAddr, uiDepth, width, height, uiTrIdx, i, uiCurrentCbfY, uiCurrentCbfU, uiCurrentCbfV, bCodeDQP );
    646 #else
    647       UInt nsAddr = 0;
    648       nsAddr = pcCU->getNSAbsPartIdx( uiLog2TrafoSize-1, uiAbsPartIdx, absTUPartIdx, i, uiTrDepth+1 );
    649       xDecodeTransformSubdiv( pcCU, uiAbsPartIdx, nsAddr, uiDepth, i, uiCurrentCbfY, uiCurrentCbfU, uiCurrentCbfV );
    650 #endif
    651661      uiYCbf |= pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiLumaTrMode );
    652662      uiUCbf |= pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiChromaTrMode );
    653663      uiVCbf |= pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiChromaTrMode );
    654664      uiAbsPartIdx += uiQPartNum;
    655 #if UNIFIED_TRANSFORM_TREE
    656665      offsetLuma += size;  offsetChroma += (size>>2);
    657 #endif
    658666    }
    659667   
     
    713721      }
    714722    }
    715 #if UNIFIED_TRANSFORM_TREE
    716723    // transform_unit begin
    717724    UInt cbfY = pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA    , uiTrIdx );
     
    779786    }
    780787    // transform_unit end
    781 #endif // UNIFIED_TRANSFORM_TREE
    782   }
    783 }
    784 
    785 #if !UNIFIED_TRANSFORM_TREE
    786 Void TDecEntropy::decodeTransformIdx( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    787 {
    788   DTRACE_CABAC_VL( g_nSymbolCounter++ )
    789   DTRACE_CABAC_T( "\tdecodeTransformIdx()\tCUDepth=" )
    790   DTRACE_CABAC_V( uiDepth )
    791   DTRACE_CABAC_T( "\n" )
    792   UInt temp = 0;
    793   UInt temp1 = 0;
    794   UInt temp2 = 0;
    795   xDecodeTransformSubdiv( pcCU, uiAbsPartIdx, uiAbsPartIdx, uiDepth, 0, temp, temp1, temp2 );
    796 }
    797 #endif // UNIFIED_TRANSFORM_TREE
    798 
    799 #if UNIFIED_TRANSFORM_TREE
     788  }
     789}
     790
     791
    800792Void TDecEntropy::decodeQP          ( TComDataCU* pcCU, UInt uiAbsPartIdx )
    801793{
     
    805797  }
    806798}
    807 #else
    808 Void TDecEntropy::decodeQP          ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    809 {
    810   if ( pcCU->getSlice()->getPPS()->getUseDQP() )
    811   {
    812     m_pcEntropyDecoderIf->parseDeltaQP( pcCU, uiAbsPartIdx, uiDepth );
    813   }
    814 }
    815 #endif
    816 
    817 #if !UNIFIED_TRANSFORM_TREE
    818 Void TDecEntropy::xDecodeCoeff( TComDataCU* pcCU, UInt uiLumaOffset, UInt uiChromaOffset, UInt uiAbsPartIdx, UInt uiDepth, UInt uiWidth, UInt uiHeight, UInt uiTrIdx, UInt uiCurrTrIdx, Bool& bCodeDQP )
    819 {
    820   UInt uiLog2TrSize = g_aucConvertToBit[ pcCU->getSlice()->getSPS()->getMaxCUWidth() >> uiDepth ] + 2;
    821   UInt uiCbfY = pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiTrIdx );
    822   UInt uiCbfU = pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrIdx );
    823   UInt uiCbfV = pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrIdx );
    824   if( uiLog2TrSize == 2 )
    825   {
    826     UInt uiQPDiv = pcCU->getPic()->getNumPartInCU() >> ( ( uiDepth - 1 ) << 1 );
    827     if( ( uiAbsPartIdx % uiQPDiv ) == 0 )
    828     {
    829       m_uiBakAbsPartIdx   = uiAbsPartIdx;
    830       m_uiBakChromaOffset = uiChromaOffset;
    831     }
    832     else if( ( uiAbsPartIdx % uiQPDiv ) == (uiQPDiv - 1) )
    833     {
    834       uiCbfU = pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_U, uiTrIdx );
    835       uiCbfV = pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_V, uiTrIdx );
    836     }
    837   }
    838 
    839   if ( uiCbfY || uiCbfU || uiCbfV )
    840   {
    841     // dQP: only for LCU
    842     if ( pcCU->getSlice()->getPPS()->getUseDQP() )
    843     {
    844       if ( bCodeDQP )
    845       {
    846         decodeQP( pcCU, uiAbsPartIdx, uiDepth);
    847         bCodeDQP = false;
    848       }
    849     }   
    850     UInt uiLumaTrMode, uiChromaTrMode;
    851     pcCU->convertTransIdx( uiAbsPartIdx, pcCU->getTransformIdx( uiAbsPartIdx ), uiLumaTrMode, uiChromaTrMode );
    852     const UInt uiStopTrMode = uiLumaTrMode;
    853    
    854     if( uiTrIdx == uiStopTrMode )
    855     {
    856       if( pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiTrIdx ) )
    857       {
    858         Int trWidth = uiWidth;
    859         Int trHeight = uiHeight;
    860         pcCU->getNSQTSize( uiTrIdx, uiAbsPartIdx, trWidth, trHeight );
    861         m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffY()+uiLumaOffset), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_LUMA );
    862       }
    863      
    864       uiWidth  >>= 1;
    865       uiHeight >>= 1;
    866 
    867       if( uiLog2TrSize == 2 )
    868       {
    869         UInt uiQPDiv = pcCU->getPic()->getNumPartInCU() >> ( ( uiDepth - 1 ) << 1 );
    870         if( ( uiAbsPartIdx % uiQPDiv ) == (uiQPDiv - 1) )
    871         {
    872           uiWidth  <<= 1;
    873           uiHeight <<= 1;
    874           Int trWidth = uiWidth;
    875           Int trHeight = uiHeight;
    876           pcCU->getNSQTSize( uiTrIdx-1, uiAbsPartIdx, trWidth, trHeight );
    877           if( pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_U, uiTrIdx ) )
    878           {
    879             m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCb()+m_uiBakChromaOffset), m_uiBakAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_U );
    880           }
    881           if( pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_V, uiTrIdx ) )
    882           {
    883             m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCr()+m_uiBakChromaOffset), m_uiBakAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_V );
    884           }
    885         }
    886       }
    887       else
    888       {
    889         Int trWidth = uiWidth;
    890         Int trHeight = uiHeight;
    891         pcCU->getNSQTSize( uiTrIdx, uiAbsPartIdx, trWidth, trHeight );
    892         if( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrIdx ) )
    893         {
    894           m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCb()+uiChromaOffset), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_U );
    895         }
    896         if( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrIdx ) )
    897         {
    898           m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCr()+uiChromaOffset), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_V );
    899         }
    900       }
    901     }
    902     else
    903     {
    904       {
    905         DTRACE_CABAC_VL( g_nSymbolCounter++ );
    906         DTRACE_CABAC_T( "\tgoing down\tdepth=" );
    907         DTRACE_CABAC_V( uiDepth );
    908         DTRACE_CABAC_T( "\ttridx=" );
    909         DTRACE_CABAC_V( uiTrIdx );
    910         DTRACE_CABAC_T( "\n" );
    911       }
    912       if( uiCurrTrIdx <= uiTrIdx )
    913       {
    914         assert(1);
    915       }
    916       UInt uiSize;
    917       uiWidth  >>= 1;
    918       uiHeight >>= 1;
    919       uiSize = uiWidth*uiHeight;
    920       uiDepth++;
    921       uiTrIdx++;
    922      
    923       UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1);
    924       UInt uiIdx      = uiAbsPartIdx;
    925      
    926       xDecodeCoeff( pcCU, uiLumaOffset, uiChromaOffset, uiIdx, uiDepth, uiWidth, uiHeight, uiTrIdx, uiCurrTrIdx, bCodeDQP );
    927       uiLumaOffset += uiSize;  uiChromaOffset += (uiSize>>2);  uiIdx += uiQPartNum;
    928      
    929       xDecodeCoeff( pcCU, uiLumaOffset, uiChromaOffset, uiIdx, uiDepth, uiWidth, uiHeight, uiTrIdx, uiCurrTrIdx, bCodeDQP );
    930       uiLumaOffset += uiSize;  uiChromaOffset += (uiSize>>2);  uiIdx += uiQPartNum;
    931      
    932       xDecodeCoeff( pcCU, uiLumaOffset, uiChromaOffset, uiIdx, uiDepth, uiWidth, uiHeight, uiTrIdx, uiCurrTrIdx, bCodeDQP );
    933       uiLumaOffset += uiSize;  uiChromaOffset += (uiSize>>2);  uiIdx += uiQPartNum;
    934      
    935       xDecodeCoeff( pcCU, uiLumaOffset, uiChromaOffset, uiIdx, uiDepth, uiWidth, uiHeight, uiTrIdx, uiCurrTrIdx, bCodeDQP );
    936       {
    937         DTRACE_CABAC_VL( g_nSymbolCounter++ );
    938         DTRACE_CABAC_T( "\tgoing up\n" );
    939       }
    940     }
    941   }
    942 }
    943 #endif // !UNIFIED_TRANSFORM_TREE
     799
    944800
    945801/** decode coefficients
     
    956812  UInt uiLumaOffset   = uiMinCoeffSize*uiAbsPartIdx;
    957813  UInt uiChromaOffset = uiLumaOffset>>2;
    958 #if UNIFIED_TRANSFORM_TREE
    959814  UInt temp  = 0;
    960815  UInt temp1 = 0;
    961816  UInt temp2 = 0;
    962 #else
    963   UInt uiLumaTrMode, uiChromaTrMode;
    964 #endif
    965817 
    966818#if RWTH_SDC_DLT_B0036
     
    980832  if( pcCU->isIntra(uiAbsPartIdx) )
    981833  {
    982 #if !UNIFIED_TRANSFORM_TREE
    983     decodeTransformIdx( pcCU, uiAbsPartIdx, pcCU->getDepth(uiAbsPartIdx) );
    984    
    985     pcCU->convertTransIdx( uiAbsPartIdx, pcCU->getTransformIdx(uiAbsPartIdx), uiLumaTrMode, uiChromaTrMode );
    986    
    987 #endif // !UNIFIED_TRANSFORM_TREE
    988834  }
    989835  else
     
    1007853    }
    1008854   
    1009 #if !UNIFIED_TRANSFORM_TREE
    1010     decodeTransformIdx( pcCU, uiAbsPartIdx, pcCU->getDepth(uiAbsPartIdx) );
    1011    
    1012     pcCU->convertTransIdx( uiAbsPartIdx, pcCU->getTransformIdx(uiAbsPartIdx), uiLumaTrMode, uiChromaTrMode );
    1013 #endif // !UNIFIED_TRANSFORM_TREE
    1014855  }
    1015856
     
    1030871#endif
    1031872
    1032 #if UNIFIED_TRANSFORM_TREE
    1033873  xDecodeTransform( pcCU, uiLumaOffset, uiChromaOffset, uiAbsPartIdx, uiAbsPartIdx, uiDepth, uiWidth, uiHeight, 0, 0, temp, temp1, temp2, bCodeDQP );
    1034 #else // UNIFIED_TRANSFORM_TREE
    1035   xDecodeCoeff( pcCU, uiLumaOffset, uiChromaOffset, uiAbsPartIdx, uiDepth, uiWidth, uiHeight, 0, uiLumaTrMode, bCodeDQP );
    1036 #endif // UNIFIED_TRANSFORM_TREE
    1037874
    1038875#if FIX_MPI_B0065
Note: See TracChangeset for help on using the changeset viewer.