Index: trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp
===================================================================
--- trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 77)
+++ trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 100)
@@ -1891,9 +1891,5 @@
       rpcSlice->setPOC( iPOCmsb+iPOClsb );
 
-#if HHI_FIX
       if( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDV && rpcSlice->getPOC() == 0 )
-#else
-      if( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDV ) 
-#endif
       {
         TComReferencePictureSet* rps = rpcSlice->getLocalRPS();
Index: trunk/source/Lib/TLibDecoder/TDecCu.cpp
===================================================================
--- trunk/source/Lib/TLibDecoder/TDecCu.cpp	(revision 77)
+++ trunk/source/Lib/TLibDecoder/TDecCu.cpp	(revision 100)
@@ -643,7 +643,7 @@
     AOF( bOK );
 #if LG_RESTRICTEDRESPRED_M24766
-	Int iPUResiPredShift[4];
-	pcCU->getPUResiPredShift(iPUResiPredShift, 0);
-	m_ppcYuvReco[uiDepth]->add(iPUResiPredShift, pcCU->getPartitionSize(0), m_ppcYuvResPred[uiDepth], pcCU->getWidth( 0 ), pcCU->getHeight( 0 ) );
+    Int iPUResiPredShift[4];
+    pcCU->getPUResiPredShift(iPUResiPredShift, 0);
+    m_ppcYuvReco[uiDepth]->add(iPUResiPredShift, pcCU->getPartitionSize(0), m_ppcYuvResPred[uiDepth], pcCU->getWidth( 0 ), pcCU->getHeight( 0 ) );
 #else
     m_ppcYuvReco[uiDepth]->add( m_ppcYuvResPred[uiDepth], pcCU->getWidth( 0 ), pcCU->getHeight( 0 ) );
@@ -705,4 +705,15 @@
                                      m_pcPrediction->getPredicBufHeight (),
                                      bAboveAvail, bLeftAvail );
+#if LGE_EDGE_INTRA
+  if( uiLumaPredMode >= EDGE_INTRA_IDX )
+  {
+    m_pcPrediction->predIntraLumaEdge( pcCU, pcCU->getPattern(), uiAbsPartIdx, uiWidth, uiHeight, piPred, uiStride
+#if LGE_EDGE_INTRA_DELTA_DC
+      , uiLumaPredMode == EDGE_INTRA_DELTA_IDX
+#endif
+      );
+  } 
+  else
+#endif
   
   //===== get prediction signal =====
Index: trunk/source/Lib/TLibDecoder/TDecEntropy.cpp
===================================================================
--- trunk/source/Lib/TLibDecoder/TDecEntropy.cpp	(revision 77)
+++ trunk/source/Lib/TLibDecoder/TDecEntropy.cpp	(revision 100)
@@ -109,7 +109,7 @@
   {
 #if LG_RESTRICTEDRESPRED_M24766
-	  Int iPUResiPredShift[4];
-	  pcCU->getPUResiPredShift(iPUResiPredShift, uiAbsPartIdx);
-	  if(iPUResiPredShift[0] >= 0 || iPUResiPredShift[1] >= 0  || iPUResiPredShift[2] >= 0  || iPUResiPredShift[3] >= 0 )
+    Int iPUResiPredShift[4];
+    pcCU->getPUResiPredShift(iPUResiPredShift, uiAbsPartIdx);
+    if(iPUResiPredShift[0] >= 0 || iPUResiPredShift[1] >= 0  || iPUResiPredShift[2] >= 0  || iPUResiPredShift[3] >= 0 )
 #endif
     m_pcEntropyDecoderIf->parseResPredFlag( pcCU, bResPredFlag, uiAbsPartIdx, uiDepth );
Index: trunk/source/Lib/TLibDecoder/TDecGop.cpp
===================================================================
--- trunk/source/Lib/TLibDecoder/TDecGop.cpp	(revision 77)
+++ trunk/source/Lib/TLibDecoder/TDecGop.cpp	(revision 100)
@@ -303,5 +303,7 @@
     {
       m_pcDepthMapGenerator->initViewComponent( rpcPic );
+#if !QC_MULTI_DIS_CAN
       m_pcDepthMapGenerator->predictDepthMap  ( rpcPic );
+#endif
 #if HHI_INTER_VIEW_RESIDUAL_PRED
       m_pcResidualGenerator->initViewComponent( rpcPic );
@@ -339,6 +341,8 @@
 #endif
 #if DEPTH_MAP_GENERATION
+#if !QC_MULTI_DIS_CAN
     // update virtual depth map
     m_pcDepthMapGenerator->updateDepthMap( rpcPic );
+#endif
 #endif
     // deblocking filter
Index: trunk/source/Lib/TLibDecoder/TDecSbac.cpp
===================================================================
--- trunk/source/Lib/TLibDecoder/TDecSbac.cpp	(revision 77)
+++ trunk/source/Lib/TLibDecoder/TDecSbac.cpp	(revision 100)
@@ -98,4 +98,10 @@
 , m_cDmmDataSCModel           ( 1,             1,               NUM_DMM_DATA_CTX              , m_contextModels + m_numContextModels, m_numContextModels)
 #endif
+#if LGE_EDGE_INTRA
+, m_cEdgeIntraSCModel         ( 1,             1,               NUM_EDGE_INTRA_CTX            , m_contextModels + m_numContextModels, m_numContextModels)
+#if LGE_EDGE_INTRA_DELTA_DC
+, m_cEdgeIntraDeltaDCSCModel  ( 1,             1,               NUM_EDGE_INTRA_DELTA_DC_CTX   , m_contextModels + m_numContextModels, m_numContextModels)
+#endif
+#endif
 {
   assert( m_numContextModels <= MAX_NUM_CTX_MOD );
@@ -182,4 +188,10 @@
 
   m_cCUTransSubdivFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_TRANS_SUBDIV_FLAG );
+#if LGE_EDGE_INTRA
+  m_cEdgeIntraSCModel.initBuffer         ( sliceType, qp, (UChar*)INIT_EDGE_INTRA );
+#if LGE_EDGE_INTRA_DELTA_DC
+  m_cEdgeIntraDeltaDCSCModel.initBuffer  ( sliceType, qp, (UChar*)INIT_EDGE_INTRA_DELTA_DC );
+#endif
+#endif
   m_uiLastDQpNonZero  = 0;
 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
@@ -815,5 +827,5 @@
   {
     UInt uiDMMode;
-  
+
 #if HHI_DMM_WEDGE_INTRA && HHI_DMM_PRED_TEX
     m_pcTDecBinIf->decodeBin( uiSymbol, m_cDmmModeSCModel.get(0, 0, 0) ); uiDMMode  = uiSymbol;
@@ -847,69 +859,141 @@
 #endif
 #if !LOGI_INTRA_NAME_3MPM
-  Int iIntraIdx = pcCU->getIntraSizeIdx(uiAbsPartIdx);
-#endif
-  
+    Int iIntraIdx = pcCU->getIntraSizeIdx(uiAbsPartIdx);
+#endif
+
+#if LGE_EDGE_INTRA
+    Bool bCodeEdgeIntra = false;
+    if( pcCU->getSlice()->getSPS()->isDepth() )
+    {
+      UInt uiPUWidth = pcCU->getWidth( uiAbsPartIdx ) >> (pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_NxN ? 1 : 0);
+      if( uiPUWidth <= LGE_EDGE_INTRA_MAX_SIZE && uiPUWidth >= LGE_EDGE_INTRA_MIN_SIZE )
+        bCodeEdgeIntra = true;
+    }
+#endif
+
 #if LOGI_INTRA_NAME_3MPM
-  Int uiPreds[3] = {-1, -1, -1};
-#else
-  Int uiPreds[2] = {-1, -1};
-#endif
-  Int uiPredNum = pcCU->getIntraDirLumaPredictor(uiAbsPartIdx, uiPreds);  
- 
-  m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUIntraPredSCModel.get( 0, 0, 0) );
- 
-  if ( uiSymbol )
-  {
-    m_pcTDecBinIf->decodeBinEP( uiSymbol );
+    Int uiPreds[3] = {-1, -1, -1};
+#else
+    Int uiPreds[2] = {-1, -1};
+#endif
+    Int uiPredNum = pcCU->getIntraDirLumaPredictor(uiAbsPartIdx, uiPreds);  
+#if LGE_EDGE_INTRA
+    UInt uiCheckBit = 0;
+#endif
+
+    m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUIntraPredSCModel.get( 0, 0, 0) );
+
+    if ( uiSymbol )
+    {
+      m_pcTDecBinIf->decodeBinEP( uiSymbol );
 #if LOGI_INTRA_NAME_3MPM
-    if (uiSymbol)
-    {
-      m_pcTDecBinIf->decodeBinEP( uiSymbol );
-      uiSymbol++;
-    }
-#endif
-    intraPredMode = uiPreds[uiSymbol];
-  }
-  else
-  {
-    intraPredMode = 0;
-    
+      if (uiSymbol)
+      {
+        m_pcTDecBinIf->decodeBinEP( uiSymbol );
+        uiSymbol++;
+      }
+#endif
+      intraPredMode = uiPreds[uiSymbol];
+    }
+    else
+    {
+      intraPredMode = 0;
+
 #if LOGI_INTRA_NAME_3MPM
-   
-    m_pcTDecBinIf->decodeBinsEP( uiSymbol, 5 );
-    intraPredMode = uiSymbol;
-    
-   //postponed sorting of MPMs (only in remaining branch)
-    if (uiPreds[0] > uiPreds[1])
-    { 
-      std::swap(uiPreds[0], uiPreds[1]); 
-    }
-    if (uiPreds[0] > uiPreds[2])
-    {
-      std::swap(uiPreds[0], uiPreds[2]);
-    }
-    if (uiPreds[1] > uiPreds[2])
-    {
-      std::swap(uiPreds[1], uiPreds[2]);
-    }
-#else
-    m_pcTDecBinIf->decodeBinsEP( uiSymbol, g_aucIntraModeBitsAng[iIntraIdx] - 1 );
-    intraPredMode = uiSymbol;
-    
-    if ( intraPredMode == 31 )
-    {
-      m_pcTDecBinIf->decodeBinEP( uiSymbol );
-      intraPredMode += uiSymbol;      
-    }
-#endif
-    for ( Int i = 0; i < uiPredNum; i++ )
-    {
-      intraPredMode += ( intraPredMode >= uiPreds[i] );
-    }
-  }
+
+      m_pcTDecBinIf->decodeBinsEP( uiSymbol, 5 );
+#if LGE_EDGE_INTRA
+      if (bCodeEdgeIntra)
+      {
+        if (uiSymbol==31)
+        {
+          m_pcTDecBinIf->decodeBinsEP(uiCheckBit,1);
+          if (uiCheckBit)
+            uiSymbol = EDGE_INTRA_IDX;
+        }
+      }
+#endif
+      intraPredMode = uiSymbol;
+
+      //postponed sorting of MPMs (only in remaining branch)
+      if (uiPreds[0] > uiPreds[1])
+      { 
+        std::swap(uiPreds[0], uiPreds[1]); 
+      }
+      if (uiPreds[0] > uiPreds[2])
+      {
+        std::swap(uiPreds[0], uiPreds[2]);
+      }
+      if (uiPreds[1] > uiPreds[2])
+      {
+        std::swap(uiPreds[1], uiPreds[2]);
+      }
+#else
+      m_pcTDecBinIf->decodeBinsEP( uiSymbol, g_aucIntraModeBitsAng[iIntraIdx] - 1 );
+      intraPredMode = uiSymbol;
+
+      if ( intraPredMode == 31 )
+      {
+        m_pcTDecBinIf->decodeBinEP( uiSymbol );
+        intraPredMode += uiSymbol;      
+      }
+#endif
+#if LGE_EDGE_INTRA
+      if ( intraPredMode != EDGE_INTRA_IDX)
+      {
+#endif
+        for ( Int i = 0; i < uiPredNum; i++ )
+        {
+          intraPredMode += ( intraPredMode >= uiPreds[i] );
+        }
+#if LGE_EDGE_INTRA
+      }
+#endif
+    }
+
+#if LGE_EDGE_INTRA
+    if( intraPredMode == EDGE_INTRA_IDX )
+    {
+      xParseEdgeIntraInfo( pcCU, uiAbsPartIdx, uiDepth );
+#if LGE_EDGE_INTRA_DELTA_DC
+      m_pcTDecBinIf->decodeBin( uiSymbol, m_cEdgeIntraDeltaDCSCModel.get(0, 0, 0) );
+      if( uiSymbol )
+      {
+        intraPredMode = EDGE_INTRA_DELTA_IDX;
+        Int iDeltaDC0;
+        Int iDeltaDC1;
+
+        xReadExGolombLevel( (UInt &) iDeltaDC0, m_cEdgeIntraDeltaDCSCModel.get(0, 0, 1) );
+        if( iDeltaDC0 != 0 )
+        {
+          UInt uiSign;
+          m_pcTDecBinIf->decodeBinEP( uiSign );
+          if ( uiSign )
+          {
+            iDeltaDC0 = -iDeltaDC0;
+          }
+        }
+        xReadExGolombLevel( (UInt &) iDeltaDC1, m_cEdgeIntraDeltaDCSCModel.get(0, 0, 1) );
+        if( iDeltaDC1 != 0 )
+        {
+          UInt uiSign;
+          m_pcTDecBinIf->decodeBinEP( uiSign );
+          if ( uiSign )
+          {
+            iDeltaDC1 = -iDeltaDC1;
+          }
+        }
+
+        pcCU->setEdgeDeltaDC0( uiAbsPartIdx, iDeltaDC0 );
+        pcCU->setEdgeDeltaDC1( uiAbsPartIdx, iDeltaDC1 );
+      }
+#endif
+    }
+#endif
+
 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
   }
 #endif
-  
+
   pcCU->setLumaIntraDirSubParts( (UChar)intraPredMode, uiAbsPartIdx, uiDepth );
 }
@@ -2012,5 +2096,5 @@
 #endif
 
-#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
+#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX || (LGE_EDGE_INTRA && LGE_EDGE_INTRA_DELTA_DC)
 Void TDecSbac::xReadExGolombLevel( UInt& ruiSymbol, ContextModel& rcSCModel  )
 {
@@ -2270,3 +2354,102 @@
 }
 #endif
+
+#if LGE_EDGE_INTRA
+Void TDecSbac::xParseEdgeIntraInfo( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
+{
+  UInt uiSymbol = 0;
+
+  // 1. Top(0) or Left(1)
+  UChar ucLeft;
+  m_pcTDecBinIf->decodeBinEP( uiSymbol );
+  ucLeft = uiSymbol;
+
+  // 2. Start position (lowest bit first)
+  UChar ucStart = 0;
+  for( UInt ui = 0; ui < 6 - uiDepth; ui++ )
+  {
+    m_pcTDecBinIf->decodeBinEP( uiSymbol );
+    ucStart |= (uiSymbol << ui);
+  }
+
+  // 3. Number of edges
+  UChar ucMax = 0;
+  for( UInt ui = 0; ui < 7 - uiDepth; ui++ )
+  {
+    m_pcTDecBinIf->decodeBinEP( uiSymbol );
+    ucMax |= (uiSymbol << ui);
+  }
+  ucMax++; // +1
+
+  // 4. Edges
+  UChar* pucSymbolList = (UChar*) xMalloc( UChar, 256 * LGE_EDGE_INTRA_MAX_EDGE_NUM_PER_4x4 );
+  UInt uiCtxEdgeIntra = pcCU->getCtxEdgeIntra( uiAbsPartIdx );
+  for( Int iPtr = 0; iPtr < ucMax; iPtr++ )
+  {
+    UChar ucEdge = 0;
+    UInt  uiReorderEdge = 0;
+    // Left-friendly direction
+    // 0 (   0deg) => 0
+    // 1 (  45deg) => 10
+    // 2 ( -45deg) => 110
+    // 3 (  90deg) => 1110
+    // 4 ( -90deg) => 11110
+    // 5 ( 135deg) => 111110
+    // 6 (-135deg) => 111111
+    // Right-friendly direction
+    // 0 (   0deg) => 0
+    // 1 ( -45deg) => 10
+    // 2 (  45deg) => 110
+    // 3 ( -90deg) => 1110
+    // 4 (  90deg) => 11110
+    // 5 (-135deg) => 111110
+    // 6 ( 135deg) => 111111
+    // refer to a paper "An efficient chain code with Huffman coding"
+    for( UInt ui = 0; ui < 6; ui++ )
+    {
+      m_pcTDecBinIf->decodeBin( uiSymbol, m_cEdgeIntraSCModel.get( 0, 0, uiCtxEdgeIntra ) );
+      ucEdge <<= 1;
+      ucEdge |= uiSymbol;
+      if( uiSymbol == 0 )
+        break;
+    }
+
+    switch( ucEdge )
+    {
+    case 0 :  // "0"
+      uiReorderEdge = 0;
+      break;
+    case 2 :  // "10"
+      uiReorderEdge = 1;
+      break;
+    case 6 :  // "110"
+      uiReorderEdge = 2;
+      break;
+    case 14 : // "1110"
+      uiReorderEdge = 3;
+      break;
+    case 30 : // "11110"
+      uiReorderEdge = 4;
+      break;
+    case 62 : // "111110"
+      uiReorderEdge = 5;
+      break;
+    case 63 : // "111111"
+      uiReorderEdge = 6;
+      break;
+    default :
+      printf("parseIntraEdgeChain: error (unknown code %d)\n",ucEdge);
+      assert(false);
+      break;
+    }
+    pucSymbolList[iPtr] = uiReorderEdge;
+  }
+  /////////////////////
+  // Edge Reconstruction
+  Bool* pbRegion = pcCU->getEdgePartition( uiAbsPartIdx );
+  pcCU->reconPartition( uiAbsPartIdx, uiDepth, ucLeft == 1, ucStart, ucMax, pucSymbolList, pbRegion );
+  xFree( pucSymbolList );
+}
+#endif
+
 //! \}
Index: trunk/source/Lib/TLibDecoder/TDecSbac.h
===================================================================
--- trunk/source/Lib/TLibDecoder/TDecSbac.h	(revision 77)
+++ trunk/source/Lib/TLibDecoder/TDecSbac.h	(revision 100)
@@ -146,4 +146,8 @@
 #endif
   
+#if LGE_EDGE_INTRA
+  Void xParseEdgeIntraInfo ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
+#endif
+  
 private:
   TComInputBitstream* m_pcBitstream;
@@ -253,4 +257,10 @@
   ContextModel3DBuffer m_cDmmDataSCModel;
 #endif
+#if LGE_EDGE_INTRA
+  ContextModel3DBuffer m_cEdgeIntraSCModel;
+#if LGE_EDGE_INTRA_DELTA_DC
+  ContextModel3DBuffer m_cEdgeIntraDeltaDCSCModel;
+#endif
+#endif
 };
 
Index: trunk/source/Lib/TLibDecoder/TDecSlice.h
===================================================================
--- trunk/source/Lib/TLibDecoder/TDecSlice.h	(revision 77)
+++ trunk/source/Lib/TLibDecoder/TDecSlice.h	(revision 100)
@@ -107,5 +107,5 @@
   ParameterSetMap<TComAPS> m_apsBuffer; 
 #if VIDYO_VPS_INTEGRATION
-	ParameterSetMap<TComVPS> m_vpsBuffer;
+  ParameterSetMap<TComVPS> m_vpsBuffer;
 #endif
 };
Index: trunk/source/Lib/TLibDecoder/TDecTop.h
===================================================================
--- trunk/source/Lib/TLibDecoder/TDecTop.h	(revision 77)
+++ trunk/source/Lib/TLibDecoder/TDecTop.h	(revision 100)
@@ -176,11 +176,11 @@
   Void executeDeblockAndAlf(UInt& ruiPOC, TComList<TComPic*>*& rpcListPic, Int& iSkipFrame,  Int& iPOCLastDisplay);
 
-  Void setViewId(Int viewId)					{ m_viewId = viewId;}
-  Int  getViewId()								       { return m_viewId  ;}
+  Void setViewId(Int viewId)      { m_viewId = viewId;}
+  Int  getViewId()                { return m_viewId  ;}
   Void setIsDepth( Bool isDepth ) { m_isDepth = isDepth; }
 
 #if SONY_COLPIC_AVAILABILITY
-  Void setViewOrderIdx(Int i)					{ m_iViewOrderIdx = i ;}
-  Int  getViewOrderIdx()							{ return m_iViewOrderIdx ; }
+  Void setViewOrderIdx(Int i)     { m_iViewOrderIdx = i ;}
+  Int  getViewOrderIdx()          { return m_iViewOrderIdx ; }
 #endif
 
@@ -209,5 +209,5 @@
 #endif
 #if VIDYO_VPS_INTEGRATION
-	Void      xDecodeVPS();
+  Void      xDecodeVPS();
 #endif
   Void      xDecodeSPS();
