Changeset 97 in 3DVCSoftware for branches/HTM-3.1-LG/source/Lib/TLibDecoder


Ignore:
Timestamp:
6 Aug 2012, 05:35:11 (13 years ago)
Author:
lg
Message:

Implemented the Region boundary chain coding (A0070) and R/D selection between Non-Zero Residual and All-Zero Residual Intra Coding (A0087) with macro: "LGE_EDGE_INTRA" and "LG_ZEROINTRADEPTHRESI_M26039"

Location:
branches/HTM-3.1-LG/source/Lib/TLibDecoder
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-3.1-LG/source/Lib/TLibDecoder/TDecCu.cpp

    r77 r97  
    705705                                     m_pcPrediction->getPredicBufHeight (),
    706706                                     bAboveAvail, bLeftAvail );
     707#if LGE_EDGE_INTRA
     708  if( uiLumaPredMode >= EDGE_INTRA_IDX )
     709  {
     710          m_pcPrediction->predIntraLumaEdge( pcCU, pcCU->getPattern(), uiAbsPartIdx, uiWidth, uiHeight, piPred, uiStride
     711#if LGE_EDGE_INTRA_DELTA_DC
     712                  , uiLumaPredMode == EDGE_INTRA_DELTA_IDX
     713#endif
     714                  );
     715  }
     716  else
     717#endif
    707718 
    708719  //===== get prediction signal =====
  • branches/HTM-3.1-LG/source/Lib/TLibDecoder/TDecSbac.cpp

    r56 r97  
    9898, m_cDmmDataSCModel           ( 1,             1,               NUM_DMM_DATA_CTX              , m_contextModels + m_numContextModels, m_numContextModels)
    9999#endif
     100#if LGE_EDGE_INTRA
     101, m_cEdgeIntraSCModel         ( 1,             1,               NUM_EDGE_INTRA_CTX            , m_contextModels + m_numContextModels, m_numContextModels)
     102#if LGE_EDGE_INTRA_DELTA_DC
     103, m_cEdgeIntraDeltaDCSCModel  ( 1,             1,               NUM_EDGE_INTRA_DELTA_DC_CTX   , m_contextModels + m_numContextModels, m_numContextModels)
     104#endif
     105#endif
    100106{
    101107  assert( m_numContextModels <= MAX_NUM_CTX_MOD );
     
    182188
    183189  m_cCUTransSubdivFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_TRANS_SUBDIV_FLAG );
     190#if LGE_EDGE_INTRA
     191  m_cEdgeIntraSCModel.initBuffer         ( sliceType, qp, (UChar*)INIT_EDGE_INTRA );
     192#if LGE_EDGE_INTRA_DELTA_DC
     193  m_cEdgeIntraDeltaDCSCModel.initBuffer  ( sliceType, qp, (UChar*)INIT_EDGE_INTRA_DELTA_DC );
     194#endif
     195#endif
    184196  m_uiLastDQpNonZero  = 0;
    185197#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
     
    850862#endif
    851863 
     864#if LGE_EDGE_INTRA
     865  Bool bCodeEdgeIntra = false;
     866  if( pcCU->getSlice()->getSPS()->isDepth() )
     867  {
     868          UInt uiPUWidth = pcCU->getWidth( uiAbsPartIdx ) >> (pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_NxN ? 1 : 0);
     869          if( uiPUWidth <= LGE_EDGE_INTRA_MAX_SIZE && uiPUWidth >= LGE_EDGE_INTRA_MIN_SIZE )
     870                  bCodeEdgeIntra = true;
     871  }
     872#endif
     873
    852874#if LOGI_INTRA_NAME_3MPM
    853875  Int uiPreds[3] = {-1, -1, -1};
     
    855877  Int uiPreds[2] = {-1, -1};
    856878#endif
    857   Int uiPredNum = pcCU->getIntraDirLumaPredictor(uiAbsPartIdx, uiPreds); 
     879  Int uiPredNum = pcCU->getIntraDirLumaPredictor(uiAbsPartIdx, uiPreds);
     880#if LGE_EDGE_INTRA
     881  UInt uiCheckBit = 0;
     882#endif
    858883 
    859884  m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUIntraPredSCModel.get( 0, 0, 0) );
     
    878903   
    879904    m_pcTDecBinIf->decodeBinsEP( uiSymbol, 5 );
     905#if LGE_EDGE_INTRA
     906        if (bCodeEdgeIntra)
     907        {
     908                if (uiSymbol==31)
     909                {
     910                        m_pcTDecBinIf->decodeBinsEP(uiCheckBit,1);
     911                        if (uiCheckBit)
     912                                uiSymbol = EDGE_INTRA_IDX;
     913                }
     914        }
     915#endif
    880916    intraPredMode = uiSymbol;
    881917   
     
    903939    }
    904940#endif
     941#if LGE_EDGE_INTRA
     942        if ( intraPredMode != EDGE_INTRA_IDX)
     943        {
     944#endif
    905945    for ( Int i = 0; i < uiPredNum; i++ )
    906946    {
    907947      intraPredMode += ( intraPredMode >= uiPreds[i] );
    908948    }
    909   }
     949#if LGE_EDGE_INTRA
     950        }
     951#endif
     952  }
     953
     954#if LGE_EDGE_INTRA
     955  if( intraPredMode == EDGE_INTRA_IDX )
     956  {
     957          xParseEdgeIntraInfo( pcCU, uiAbsPartIdx, uiDepth );
     958#if LGE_EDGE_INTRA_DELTA_DC
     959          m_pcTDecBinIf->decodeBin( uiSymbol, m_cEdgeIntraDeltaDCSCModel.get(0, 0, 0) );
     960          if( uiSymbol )
     961          {
     962                  intraPredMode = EDGE_INTRA_DELTA_IDX;
     963                  Int iDeltaDC0;
     964                  Int iDeltaDC1;
     965
     966                  xReadExGolombLevel( (UInt &) iDeltaDC0, m_cEdgeIntraDeltaDCSCModel.get(0, 0, 1) );
     967                  if( iDeltaDC0 != 0 )
     968                  {
     969                          UInt uiSign;
     970                          m_pcTDecBinIf->decodeBinEP( uiSign );
     971                          if ( uiSign )
     972                          {
     973                                  iDeltaDC0 = -iDeltaDC0;
     974                          }
     975                  }
     976                  xReadExGolombLevel( (UInt &) iDeltaDC1, m_cEdgeIntraDeltaDCSCModel.get(0, 0, 1) );
     977                  if( iDeltaDC1 != 0 )
     978                  {
     979                          UInt uiSign;
     980                          m_pcTDecBinIf->decodeBinEP( uiSign );
     981                          if ( uiSign )
     982                          {
     983                                  iDeltaDC1 = -iDeltaDC1;
     984                          }
     985                  }
     986
     987                  pcCU->setEdgeDeltaDC0( uiAbsPartIdx, iDeltaDC0 );
     988                  pcCU->setEdgeDeltaDC1( uiAbsPartIdx, iDeltaDC1 );
     989          }
     990#endif
     991  }
     992#endif
     993
    910994#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
    911995  }
     
    20122096#endif
    20132097
    2014 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
     2098#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX || (LGE_EDGE_INTRA && LGE_EDGE_INTRA_DELTA_DC)
    20152099Void TDecSbac::xReadExGolombLevel( UInt& ruiSymbol, ContextModel& rcSCModel  )
    20162100{
     
    22702354}
    22712355#endif
     2356
     2357#if LGE_EDGE_INTRA
     2358Void TDecSbac::xParseEdgeIntraInfo( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
     2359{
     2360        UInt uiSymbol = 0;
     2361
     2362        // 1. Top(0) or Left(1)
     2363        UChar ucLeft;
     2364        m_pcTDecBinIf->decodeBinEP( uiSymbol );
     2365        ucLeft = uiSymbol;
     2366
     2367        // 2. Start position (lowest bit first)
     2368        UChar ucStart = 0;
     2369        for( UInt ui = 0; ui < 6 - uiDepth; ui++ )
     2370        {
     2371                m_pcTDecBinIf->decodeBinEP( uiSymbol );
     2372                ucStart |= (uiSymbol << ui);
     2373        }
     2374
     2375        // 3. Number of edges
     2376        UChar ucMax = 0;
     2377        for( UInt ui = 0; ui < 7 - uiDepth; ui++ )
     2378        {
     2379                m_pcTDecBinIf->decodeBinEP( uiSymbol );
     2380                ucMax |= (uiSymbol << ui);
     2381        }
     2382        ucMax++; // +1
     2383
     2384        // 4. Edges
     2385        UChar* pucSymbolList = (UChar*) xMalloc( UChar, 256 * LGE_EDGE_INTRA_MAX_EDGE_NUM_PER_4x4 );
     2386        UInt uiCtxEdgeIntra = pcCU->getCtxEdgeIntra( uiAbsPartIdx );
     2387        for( Int iPtr = 0; iPtr < ucMax; iPtr++ )
     2388        {
     2389                UChar ucEdge = 0;
     2390                UInt  uiReorderEdge = 0;
     2391                // Left-friendly direction
     2392                // 0 (   0deg) => 0
     2393                // 1 (  45deg) => 10
     2394                // 2 ( -45deg) => 110
     2395                // 3 (  90deg) => 1110
     2396                // 4 ( -90deg) => 11110
     2397                // 5 ( 135deg) => 111110
     2398                // 6 (-135deg) => 111111
     2399                // Right-friendly direction
     2400                // 0 (   0deg) => 0
     2401                // 1 ( -45deg) => 10
     2402                // 2 (  45deg) => 110
     2403                // 3 ( -90deg) => 1110
     2404                // 4 (  90deg) => 11110
     2405                // 5 (-135deg) => 111110
     2406                // 6 ( 135deg) => 111111
     2407                // refer to a paper "An efficient chain code with Huffman coding"
     2408                for( UInt ui = 0; ui < 6; ui++ )
     2409                {
     2410                        m_pcTDecBinIf->decodeBin( uiSymbol, m_cEdgeIntraSCModel.get( 0, 0, uiCtxEdgeIntra ) );
     2411                        ucEdge <<= 1;
     2412                        ucEdge |= uiSymbol;
     2413                        if( uiSymbol == 0 )
     2414                                break;
     2415                }
     2416
     2417                switch( ucEdge )
     2418                {
     2419                case 0 :  // "0"
     2420                        uiReorderEdge = 0;
     2421                        break;
     2422                case 2 :  // "10"
     2423                        uiReorderEdge = 1;
     2424                        break;
     2425                case 6 :  // "110"
     2426                        uiReorderEdge = 2;
     2427                        break;
     2428                case 14 : // "1110"
     2429                        uiReorderEdge = 3;
     2430                        break;
     2431                case 30 : // "11110"
     2432                        uiReorderEdge = 4;
     2433                        break;
     2434                case 62 : // "111110"
     2435                        uiReorderEdge = 5;
     2436                        break;
     2437                case 63 : // "111111"
     2438                        uiReorderEdge = 6;
     2439                        break;
     2440                default :
     2441                        printf("parseIntraEdgeChain: error (unknown code %d)\n",ucEdge);
     2442                        assert(false);
     2443                        break;
     2444                }
     2445                pucSymbolList[iPtr] = uiReorderEdge;
     2446        }
     2447        /////////////////////
     2448        // Edge Reconstruction
     2449        Bool* pbRegion = pcCU->getEdgePartition( uiAbsPartIdx );
     2450        pcCU->reconPartition( uiAbsPartIdx, uiDepth, ucLeft == 1, ucStart, ucMax, pucSymbolList, pbRegion );
     2451        xFree( pucSymbolList );
     2452}
     2453#endif
     2454
    22722455//! \}
  • branches/HTM-3.1-LG/source/Lib/TLibDecoder/TDecSbac.h

    r77 r97  
    145145  Void xParseContourPredTexDeltaInfo( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    146146#endif
     147
     148#if LGE_EDGE_INTRA
     149  Void xParseEdgeIntraInfo ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
     150#endif
    147151 
    148152private:
     
    253257  ContextModel3DBuffer m_cDmmDataSCModel;
    254258#endif
     259#if LGE_EDGE_INTRA
     260  ContextModel3DBuffer m_cEdgeIntraSCModel;
     261#if LGE_EDGE_INTRA_DELTA_DC
     262  ContextModel3DBuffer m_cEdgeIntraDeltaDCSCModel;
     263#endif
     264#endif
    255265};
    256266
Note: See TracChangeset for help on using the changeset viewer.