Index: branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/AnnexBread.cpp
===================================================================
--- branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/AnnexBread.cpp	(revision 836)
+++ branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/AnnexBread.cpp	(revision 837)
@@ -4,5 +4,5 @@
  * granted under this license.
  *
- * Copyright (c) 2010-2013, ITU/ISO/IEC
+* Copyright (c) 2010-2014, ITU/ISO/IEC
  * All rights reserved.
  *
Index: branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/AnnexBread.h
===================================================================
--- branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/AnnexBread.h	(revision 836)
+++ branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/AnnexBread.h	(revision 837)
@@ -4,5 +4,5 @@
  * granted under this license.
  *
- * Copyright (c) 2010-2013, ITU/ISO/IEC
+* Copyright (c) 2010-2014, ITU/ISO/IEC
  * All rights reserved.
  *
Index: branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/NALread.cpp
===================================================================
--- branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/NALread.cpp	(revision 836)
+++ branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/NALread.cpp	(revision 837)
@@ -4,5 +4,5 @@
  * granted under this license.
  *
- * Copyright (c) 2010-2013, ITU/ISO/IEC
+* Copyright (c) 2010-2014, ITU/ISO/IEC
  * All rights reserved.
  *
@@ -70,4 +70,5 @@
         break;
       }
+      assert(*it_read <= 0x03);
     }
     zeroCount = (*it_read == 0x00) ? zeroCount+1 : 0;
@@ -126,5 +127,5 @@
   else
   {
-    assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_TLA_R
+    assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_TSA_R
          && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_TSA_N
          && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_STSA_R
Index: branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/NALread.h
===================================================================
--- branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/NALread.h	(revision 836)
+++ branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/NALread.h	(revision 837)
@@ -4,5 +4,5 @@
  * granted under this license.
  *
- * Copyright (c) 2010-2013, ITU/ISO/IEC
+* Copyright (c) 2010-2014, ITU/ISO/IEC
  * All rights reserved.
  *
Index: branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/SEIread.cpp
===================================================================
--- branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/SEIread.cpp	(revision 836)
+++ branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/SEIread.cpp	(revision 837)
@@ -4,5 +4,5 @@
  * granted under this license.
  *
- * Copyright (c) 2010-2013, ITU/ISO/IEC
+* Copyright (c) 2010-2014, ITU/ISO/IEC
  * All rights reserved.
  *
@@ -443,5 +443,10 @@
   if( !pHRD->getSubPicCpbParamsPresentFlag() )
   {
-    READ_FLAG( code, "rap_cpb_params_present_flag" );                   sei.m_rapCpbParamsPresentFlag = code;
+    READ_FLAG( code, "irap_cpb_params_present_flag" );                   sei.m_rapCpbParamsPresentFlag = code;
+  }
+  if( sei.m_rapCpbParamsPresentFlag )
+  {
+    READ_CODE( pHRD->getCpbRemovalDelayLengthMinus1() + 1, code, "cpb_delay_offset" );      sei.m_cpbDelayOffset = code;
+    READ_CODE( pHRD->getDpbOutputDelayLengthMinus1()  + 1, code, "dpb_delay_offset" );      sei.m_dpbDelayOffset = code;
   }
   //read splicing flag and cpb_removal_delay_delta
@@ -450,9 +455,4 @@
   READ_CODE( ( pHRD->getCpbRemovalDelayLengthMinus1() + 1 ), code, "au_cpb_removal_delay_delta_minus1" );
   sei.m_auCpbRemovalDelayDelta = code + 1;
-  if( sei.m_rapCpbParamsPresentFlag )
-  {
-    READ_CODE( pHRD->getCpbRemovalDelayLengthMinus1() + 1, code, "cpb_delay_offset" );      sei.m_cpbDelayOffset = code;
-    READ_CODE( pHRD->getDpbOutputDelayLengthMinus1()  + 1, code, "dpb_delay_offset" );      sei.m_dpbDelayOffset = code;
-  }
   for( nalOrVcl = 0; nalOrVcl < 2; nalOrVcl ++ )
   {
Index: branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/SEIread.h
===================================================================
--- branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/SEIread.h	(revision 836)
+++ branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/SEIread.h	(revision 837)
@@ -4,5 +4,5 @@
  * granted under this license.
  *
- * Copyright (c) 2010-2013, ITU/ISO/IEC
+* Copyright (c) 2010-2014, ITU/ISO/IEC
  * All rights reserved.
  *
Index: branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/SyntaxElementParser.cpp
===================================================================
--- branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/SyntaxElementParser.cpp	(revision 836)
+++ branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/SyntaxElementParser.cpp	(revision 837)
@@ -4,5 +4,5 @@
 * granted under this license.  
 *
-* Copyright (c) 2010-2013, ITU/ISO/IEC
+* Copyright (c) 2010-2014, ITU/ISO/IEC
 * All rights reserved.
 *
Index: branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/SyntaxElementParser.h
===================================================================
--- branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/SyntaxElementParser.h	(revision 836)
+++ branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/SyntaxElementParser.h	(revision 837)
@@ -4,5 +4,5 @@
  * granted under this license.  
  *
- * Copyright (c) 2010-2013, ITU/ISO/IEC
+* Copyright (c) 2010-2014, ITU/ISO/IEC
  * All rights reserved.
  *
Index: branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecBinCoder.h
===================================================================
--- branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecBinCoder.h	(revision 836)
+++ branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecBinCoder.h	(revision 837)
@@ -4,5 +4,5 @@
  * granted under this license.  
  *
- * Copyright (c) 2010-2013, ITU/ISO/IEC
+* Copyright (c) 2010-2014, ITU/ISO/IEC
  * All rights reserved.
  *
Index: branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecBinCoderCABAC.cpp
===================================================================
--- branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecBinCoderCABAC.cpp	(revision 836)
+++ branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecBinCoderCABAC.cpp	(revision 837)
@@ -4,5 +4,5 @@
  * granted under this license.  
  *
- * Copyright (c) 2010-2013, ITU/ISO/IEC
+* Copyright (c) 2010-2014, ITU/ISO/IEC
  * All rights reserved.
  *
Index: branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecBinCoderCABAC.h
===================================================================
--- branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecBinCoderCABAC.h	(revision 836)
+++ branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecBinCoderCABAC.h	(revision 837)
@@ -4,5 +4,5 @@
  * granted under this license.  
  *
- * Copyright (c) 2010-2013, ITU/ISO/IEC
+* Copyright (c) 2010-2014, ITU/ISO/IEC
  * All rights reserved.
  *
Index: branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecCAVLC.cpp
===================================================================
--- branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 836)
+++ branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 837)
@@ -4,5 +4,5 @@
 * granted under this license.  
 *
-* Copyright (c) 2010-2013, ITU/ISO/IEC
+* Copyright (c) 2010-2014, ITU/ISO/IEC
 * All rights reserved.
 *
@@ -848,4 +848,10 @@
   READ_UVLC( uiCode, "log2_diff_max_min_coding_block_size" );
   pcSPS->setLog2DiffMaxMinCodingBlockSize(uiCode);
+  
+  if (pcSPS->getPTL()->getGeneralPTL()->getLevelIdc() >= Level::LEVEL5)
+  {
+    assert(log2MinCUSize + pcSPS->getLog2DiffMaxMinCodingBlockSize() >= 5);
+  }
+  
   Int maxCUDepthDelta = uiCode;
   pcSPS->setMaxCUWidth  ( 1<<(log2MinCUSize + maxCUDepthDelta) ); 
Index: branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecCAVLC.h
===================================================================
--- branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecCAVLC.h	(revision 836)
+++ branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecCAVLC.h	(revision 837)
@@ -4,5 +4,5 @@
  * granted under this license.  
  *
- * Copyright (c) 2010-2013, ITU/ISO/IEC
+* Copyright (c) 2010-2014, ITU/ISO/IEC
  * All rights reserved.
  *
Index: branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecCu.cpp
===================================================================
--- branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecCu.cpp	(revision 836)
+++ branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecCu.cpp	(revision 837)
@@ -4,5 +4,5 @@
  * granted under this license.  
  *
- * Copyright (c) 2010-2013, ITU/ISO/IEC
+* Copyright (c) 2010-2014, ITU/ISO/IEC
  * All rights reserved.
  *
@@ -918,9 +918,11 @@
 #endif
   
+  if ( pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiTrDepth ) )
+  {
   //===== inverse transform =====
   m_pcTrQuant->setQPforQuant  ( pcCU->getQP(0), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 );
 
   Int scalingListType = (pcCU->isIntra(uiAbsPartIdx) ? 0 : 3) + g_eTTable[(Int)TEXT_LUMA];
-  assert(scalingListType < 6);
+    assert(scalingListType < SCALING_LIST_NUM);
   m_pcTrQuant->invtransformNxN( pcCU->getCUTransquantBypass(uiAbsPartIdx), TEXT_LUMA, pcCU->getLumaIntraDir( uiAbsPartIdx ), piResi, uiStride, pcCoeff, uiWidth, uiHeight, scalingListType, useTransformSkip );
 
@@ -953,4 +955,23 @@
     pReco     += uiStride;
     pRecIPred += uiRecIPredStride;
+  }
+}
+  else
+  {
+    //===== reconstruction =====
+    Pel* pPred      = piPred;
+    Pel* pReco      = piReco;
+    Pel* pRecIPred  = piRecIPred;
+    for ( Int y = 0; y < uiHeight; y++ )
+    {
+      for ( Int x = 0; x < uiWidth; x++ )
+      {
+        pReco    [ x ] = pPred[ x ];
+        pRecIPred[ x ] = pReco[ x ];
+      }
+      pPred     += uiStride;
+      pReco     += uiStride;
+      pRecIPred += uiRecIPredStride;
+    }
   }
 }
@@ -1022,4 +1043,6 @@
   }
 
+  if ( pcCU->getCbf( uiAbsPartIdx, eText, uiTrDepth ) )
+  {
   //===== inverse transform =====
   Int curChromaQpOffset;
@@ -1035,5 +1058,5 @@
 
   Int scalingListType = (pcCU->isIntra(uiAbsPartIdx) ? 0 : 3) + g_eTTable[(Int)eText];
-  assert(scalingListType < 6);
+    assert(scalingListType < SCALING_LIST_NUM);
   m_pcTrQuant->invtransformNxN( pcCU->getCUTransquantBypass(uiAbsPartIdx), eText, REG_DCT, piResi, uiStride, pcCoeff, uiWidth, uiHeight, scalingListType, useTransformSkipChroma );
 
@@ -1054,4 +1077,23 @@
     pReco     += uiStride;
     pRecIPred += uiRecIPredStride;
+  }
+}
+  else
+  {
+    //===== reconstruction =====
+    Pel* pPred      = piPred;
+    Pel* pReco      = piReco;
+    Pel* pRecIPred  = piRecIPred;
+    for ( Int y = 0; y < uiHeight; y++ )
+    {
+      for ( Int x = 0; x < uiWidth; x++ )
+      {
+        pReco    [ x ] = pPred[ x ];
+        pRecIPred[ x ] = pReco[ x ];
+      }
+      pPred     += uiStride;
+      pReco     += uiStride;
+      pRecIPred += uiRecIPredStride;
+    }    
   }
 }
Index: branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecCu.h
===================================================================
--- branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecCu.h	(revision 836)
+++ branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecCu.h	(revision 837)
@@ -4,5 +4,5 @@
  * granted under this license.  
  *
- * Copyright (c) 2010-2013, ITU/ISO/IEC
+* Copyright (c) 2010-2014, ITU/ISO/IEC
  * All rights reserved.
  *
Index: branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecEntropy.cpp
===================================================================
--- branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecEntropy.cpp	(revision 836)
+++ branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecEntropy.cpp	(revision 837)
@@ -4,5 +4,5 @@
  * granted under this license.  
  *
- * Copyright (c) 2010-2013, ITU/ISO/IEC
+* Copyright (c) 2010-2014, ITU/ISO/IEC
  * All rights reserved.
  *
@@ -580,5 +580,5 @@
 }
 
-Void TDecEntropy::xDecodeTransform( TComDataCU* pcCU, UInt offsetLuma, UInt offsetChroma, UInt uiAbsPartIdx, UInt uiDepth, UInt width, UInt height, UInt uiTrIdx, Bool& bCodeDQP)
+Void TDecEntropy::xDecodeTransform( TComDataCU* pcCU, UInt offsetLuma, UInt offsetChroma, UInt uiAbsPartIdx, UInt uiDepth, UInt width, UInt height, UInt uiTrIdx, Bool& bCodeDQP, Int quadtreeTULog2MinSizeInCU)
 {
   UInt uiSubdiv;
@@ -604,5 +604,5 @@
   else if( (pcCU->getSlice()->getSPS()->getQuadtreeTUMaxDepthInter() == 1) && (pcCU->getPredictionMode(uiAbsPartIdx) == MODE_INTER) && ( pcCU->getPartitionSize(uiAbsPartIdx) != SIZE_2Nx2N ) && (uiDepth == pcCU->getDepth(uiAbsPartIdx)) )
   {
-    uiSubdiv = (uiLog2TrafoSize > pcCU->getQuadtreeTULog2MinSizeInCU(uiAbsPartIdx));
+    uiSubdiv = (uiLog2TrafoSize > quadtreeTULog2MinSizeInCU);
   }
   else if( uiLog2TrafoSize > pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() )
@@ -614,5 +614,5 @@
     uiSubdiv = 0;
   }
-  else if( uiLog2TrafoSize == pcCU->getQuadtreeTULog2MinSizeInCU(uiAbsPartIdx) )
+  else if( uiLog2TrafoSize == quadtreeTULog2MinSizeInCU )
   {
     uiSubdiv = 0;
@@ -620,5 +620,5 @@
   else
   {
-    assert( uiLog2TrafoSize > pcCU->getQuadtreeTULog2MinSizeInCU(uiAbsPartIdx) );
+    assert( uiLog2TrafoSize > quadtreeTULog2MinSizeInCU );
     m_pcEntropyDecoderIf->parseTransformSubdivFlag( uiSubdiv, 5 - uiLog2TrafoSize );
   }
@@ -666,5 +666,5 @@
     for( Int i = 0; i < 4; i++ )
     {
-      xDecodeTransform( pcCU, offsetLuma, offsetChroma, uiAbsPartIdx, uiDepth, width, height, uiTrIdx, bCodeDQP );
+      xDecodeTransform( pcCU, offsetLuma, offsetChroma, uiAbsPartIdx, uiDepth, width, height, uiTrIdx, bCodeDQP, quadtreeTULog2MinSizeInCU );
       uiYCbf |= pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiTrDepth+1 );
       uiUCbf |= pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth+1 );
@@ -886,5 +886,8 @@
     
   }
-  xDecodeTransform( pcCU, uiLumaOffset, uiChromaOffset, uiAbsPartIdx, uiDepth, uiWidth, uiHeight, 0, bCodeDQP );
+
+  Int getQuadtreeTULog2MinSizeInCU = pcCU->getQuadtreeTULog2MinSizeInCU(uiAbsPartIdx);
+
+  xDecodeTransform( pcCU, uiLumaOffset, uiChromaOffset, uiAbsPartIdx, uiDepth, uiWidth, uiHeight, 0, bCodeDQP, getQuadtreeTULog2MinSizeInCU );
 }
 
Index: branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecEntropy.h
===================================================================
--- branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecEntropy.h	(revision 836)
+++ branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecEntropy.h	(revision 837)
@@ -4,5 +4,5 @@
  * granted under this license.  
  *
- * Copyright (c) 2010-2013, ITU/ISO/IEC
+* Copyright (c) 2010-2014, ITU/ISO/IEC
  * All rights reserved.
  *
@@ -210,5 +210,5 @@
   
 private:
-  Void xDecodeTransform        ( TComDataCU* pcCU, UInt offsetLuma, UInt offsetChroma, UInt uiAbsPartIdx, UInt uiDepth, UInt width, UInt height, UInt uiTrIdx, Bool& bCodeDQP );
+  Void xDecodeTransform        ( TComDataCU* pcCU, UInt offsetLuma, UInt offsetChroma, UInt uiAbsPartIdx, UInt uiDepth, UInt width, UInt height, UInt uiTrIdx, Bool& bCodeDQP, Int getQuadtreeTULog2MinSizeInCU );
 
 public:
Index: branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecGop.cpp
===================================================================
--- branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecGop.cpp	(revision 836)
+++ branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecGop.cpp	(revision 837)
@@ -4,5 +4,5 @@
  * granted under this license.  
  *
- * Copyright (c) 2010-2013, ITU/ISO/IEC
+* Copyright (c) 2010-2014, ITU/ISO/IEC
  * All rights reserved.
  *
@@ -112,13 +112,4 @@
   //-- For time output for each slice
   long iBeforeTime = clock();
-  
-  UInt uiStartCUAddr   = pcSlice->getSliceSegmentCurStartCUAddr();
-
-  UInt uiSliceStartCuAddr = pcSlice->getSliceCurStartCUAddr();
-  if(uiSliceStartCuAddr == uiStartCUAddr)
-  {
-    m_sliceStartCUAddress.push_back(uiSliceStartCuAddr);
-  }
-
   m_pcSbacDecoder->init( (TDecBinIf*)m_pcBinCABAC );
   m_pcEntropyDecoder->setEntropyDecoder (m_pcSbacDecoder);
@@ -147,9 +138,4 @@
   m_pcEntropyDecoder->setBitstream      ( ppcSubstreams[0] );
   m_pcEntropyDecoder->resetEntropy      (pcSlice);
-
-  if(uiSliceStartCuAddr == uiStartCUAddr)
-  {
-    m_LFCrossSliceBoundaryFlag.push_back( pcSlice->getLFCrossSliceBoundaryFlag());
-  }
 #if H_3D_NBDV 
   if(pcSlice->getViewIndex() && !pcSlice->getIsDepth()) //Notes from QC: this condition shall be changed once the configuration is completed, e.g. in pcSlice->getSPS()->getMultiviewMvPredMode() || ARP in prev. HTM. Remove this comment once it is done.
@@ -199,28 +185,9 @@
   m_pcLoopFilter->setCfg(bLFCrossTileBoundary);
   m_pcLoopFilter->loopFilterPic( rpcPic );
-
-  if(pcSlice->getSPS()->getUseSAO())
-  {
-    m_sliceStartCUAddress.push_back(rpcPic->getNumCUsInFrame()* rpcPic->getNumPartInCU());
-    rpcPic->createNonDBFilterInfo(m_sliceStartCUAddress, 0, &m_LFCrossSliceBoundaryFlag, rpcPic->getPicSym()->getNumTiles(), bLFCrossTileBoundary);
-  }
-
   if( pcSlice->getSPS()->getUseSAO() )
   {
-    {
-      SAOParam *saoParam = rpcPic->getPicSym()->getSaoParam();
-      saoParam->bSaoFlag[0] = pcSlice->getSaoEnabledFlag();
-      saoParam->bSaoFlag[1] = pcSlice->getSaoEnabledFlagChroma();
-      m_pcSAO->setSaoLcuBasedOptimization(1);
-      m_pcSAO->createPicSaoInfo(rpcPic);
-      m_pcSAO->SAOProcess(saoParam);
-      m_pcSAO->PCMLFDisableProcess(rpcPic);
-      m_pcSAO->destroyPicSaoInfo();
-    }
-  }
-
-  if(pcSlice->getSPS()->getUseSAO())
-  {
-    rpcPic->destroyNonDBFilterInfo();
+    m_pcSAO->reconstructBlkSAOParams(rpcPic, rpcPic->getPicSym()->getSAOBlkParam());
+    m_pcSAO->SAOProcess(rpcPic);
+    m_pcSAO->PCMLFDisableProcess(rpcPic);
   }
 #if H_3D
@@ -284,6 +251,4 @@
   rpcPic->setOutputMark(true);
   rpcPic->setReconMark(true);
-  m_sliceStartCUAddress.clear();
-  m_LFCrossSliceBoundaryFlag.clear();
 }
 
Index: branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecGop.h
===================================================================
--- branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecGop.h	(revision 836)
+++ branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecGop.h	(revision 837)
@@ -4,5 +4,5 @@
  * granted under this license.  
  *
- * Copyright (c) 2010-2013, ITU/ISO/IEC
+* Copyright (c) 2010-2014, ITU/ISO/IEC
  * All rights reserved.
  *
@@ -83,8 +83,4 @@
   Int                   m_decodedPictureHashSEIEnabled;  ///< Checksum(3)/CRC(2)/MD5(1)/disable(0) acting on decoded picture hash SEI message
 
-  //! list that contains the CU address of each slice plus the end address 
-  std::vector<Int> m_sliceStartCUAddress;
-  std::vector<Bool> m_LFCrossSliceBoundaryFlag;
-
 public:
   TDecGop();
Index: branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecSbac.cpp
===================================================================
--- branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecSbac.cpp	(revision 836)
+++ branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecSbac.cpp	(revision 837)
@@ -4,5 +4,5 @@
  * granted under this license.  
  *
- * Copyright (c) 2010-2013, ITU/ISO/IEC
+* Copyright (c) 2010-2014, ITU/ISO/IEC
  * All rights reserved.
  *
@@ -78,5 +78,4 @@
 , m_cCUAbsSCModel             ( 1,             1,               NUM_ABS_FLAG_CTX              , m_contextModels + m_numContextModels, m_numContextModels)
 , m_cMVPIdxSCModel            ( 1,             1,               NUM_MVP_IDX_CTX               , m_contextModels + m_numContextModels, m_numContextModels)
-, m_cCUAMPSCModel             ( 1,             1,               NUM_CU_AMP_CTX                , m_contextModels + m_numContextModels, m_numContextModels)
 , m_cSaoMergeSCModel      ( 1,             1,               NUM_SAO_MERGE_FLAG_CTX   , m_contextModels + m_numContextModels, m_numContextModels)
 , m_cSaoTypeIdxSCModel        ( 1,             1,               NUM_SAO_TYPE_IDX_CTX          , m_contextModels + m_numContextModels, m_numContextModels)
@@ -155,5 +154,4 @@
 #endif
   m_cCUPartSizeSCModel.initBuffer        ( sliceType, qp, (UChar*)INIT_PART_SIZE );
-  m_cCUAMPSCModel.initBuffer             ( sliceType, qp, (UChar*)INIT_CU_AMP_POS );
   m_cCUPredModeSCModel.initBuffer        ( sliceType, qp, (UChar*)INIT_PRED_MODE );
   m_cCUIntraPredSCModel.initBuffer       ( sliceType, qp, (UChar*)INIT_INTRA_PRED_MODE );
@@ -906,5 +904,5 @@
         if (eMode == SIZE_2NxN)
         {
-          m_pcTDecBinIf->decodeBin(uiSymbol, m_cCUAMPSCModel.get( 0, 0, 0 ));
+        m_pcTDecBinIf->decodeBin(uiSymbol, m_cCUPartSizeSCModel.get( 0, 0, 3 ));
           if (uiSymbol == 0)
           {
@@ -915,5 +913,5 @@
         else if (eMode == SIZE_Nx2N)
         {
-          m_pcTDecBinIf->decodeBin(uiSymbol, m_cCUAMPSCModel.get( 0, 0, 0 ));
+        m_pcTDecBinIf->decodeBin(uiSymbol, m_cCUPartSizeSCModel.get( 0, 0, 3 ));
           if (uiSymbol == 0)
           {
@@ -2009,181 +2007,138 @@
     if (uiCode == 0)
     {
-      ruiVal = 5;
+      ruiVal = 1;
     }
     else
     {
-      ruiVal = 1;
-    }
-  }
-}
-
-inline Void copySaoOneLcuParam(SaoLcuParam* psDst,  SaoLcuParam* psSrc)
-{
-  Int i;
-  psDst->partIdx = psSrc->partIdx;
-  psDst->typeIdx    = psSrc->typeIdx;
-  if (psDst->typeIdx != -1)
-  {
-    psDst->subTypeIdx = psSrc->subTypeIdx ;
-    psDst->length  = psSrc->length;
-    for (i=0;i<psDst->length;i++)
-    {
-      psDst->offset[i] = psSrc->offset[i];
-    }
-  }
-  else
-  {
-    psDst->length  = 0;
-    for (i=0;i<SAO_BO_LEN;i++)
-    {
-      psDst->offset[i] = 0;
-    }
-  }
-}
-
-Void TDecSbac::parseSaoOffset(SaoLcuParam* psSaoLcuParam, UInt compIdx)
+      ruiVal = 2;
+    }
+  }
+}
+
+{
+  m_pcTDecBinIf->decodeBinEP ( val ); 
+}
+
+Void TDecSbac::parseSAOBlkParam (SAOBlkParam& saoBlkParam
+                                , Bool* sliceEnabled
+                                , Bool leftMergeAvail
+                                , Bool aboveMergeAvail
+                                )
 {
   UInt uiSymbol;
-  static Int iTypeLength[MAX_NUM_SAO_TYPE] =
-  {
-    SAO_EO_LEN,
-    SAO_EO_LEN,
-    SAO_EO_LEN,
-    SAO_EO_LEN,
-    SAO_BO_LEN
-  }; 
-
-  if (compIdx==2)
-  {
-    uiSymbol = (UInt)( psSaoLcuParam->typeIdx + 1);
-  }
-  else
-  {
-    parseSaoTypeIdx(uiSymbol);
-  }
-  psSaoLcuParam->typeIdx = (Int)uiSymbol - 1;
-  if (uiSymbol)
-  {
-    psSaoLcuParam->length = iTypeLength[psSaoLcuParam->typeIdx];
-
-    Int bitDepth = compIdx ? g_bitDepthC : g_bitDepthY;
-    Int offsetTh = 1 << min(bitDepth - 5,5);
-
-    if( psSaoLcuParam->typeIdx == SAO_BO )
-    {
-      for(Int i=0; i< psSaoLcuParam->length; i++)
-      {
-        parseSaoMaxUvlc(uiSymbol, offsetTh -1 );
-        psSaoLcuParam->offset[i] = uiSymbol;
+
+  Bool isLeftMerge = false;
+  Bool isAboveMerge= false;
+
+  if(leftMergeAvail)
+  {
+    parseSaoMerge(uiSymbol); //sao_merge_left_flag
+    isLeftMerge = (uiSymbol?true:false);
+  }
+
+  if( aboveMergeAvail && !isLeftMerge)
+  {
+    parseSaoMerge(uiSymbol); //sao_merge_up_flag
+    isAboveMerge = (uiSymbol?true:false);
+  }
+
+  if(isLeftMerge || isAboveMerge) //merge mode
+      {
+    saoBlkParam[SAO_Y].modeIdc = saoBlkParam[SAO_Cb].modeIdc = saoBlkParam[SAO_Cr].modeIdc = SAO_MODE_MERGE;
+    saoBlkParam[SAO_Y].typeIdc = saoBlkParam[SAO_Cb].typeIdc = saoBlkParam[SAO_Cr].typeIdc = (isLeftMerge)?SAO_MERGE_LEFT:SAO_MERGE_ABOVE;
       }   
-      for(Int i=0; i< psSaoLcuParam->length; i++)
-      {
-        if (psSaoLcuParam->offset[i] != 0) 
-        {
-          m_pcTDecBinIf->decodeBinEP ( uiSymbol);
-          if (uiSymbol)
+  else //new or off mode
+      {
+    for(Int compIdx=0; compIdx < NUM_SAO_COMPONENTS; compIdx++)
+        {
+      SAOOffset& ctbParam = saoBlkParam[compIdx];
+
+      if(!sliceEnabled[compIdx])
           {
-            psSaoLcuParam->offset[i] = -psSaoLcuParam->offset[i] ;
-          }
-        }
-      }
-      parseSaoUflc(5, uiSymbol );
-      psSaoLcuParam->subTypeIdx = uiSymbol;
-    }
-    else if( psSaoLcuParam->typeIdx < 4 )
-    {
-      parseSaoMaxUvlc(uiSymbol, offsetTh -1 ); psSaoLcuParam->offset[0] = uiSymbol;
-      parseSaoMaxUvlc(uiSymbol, offsetTh -1 ); psSaoLcuParam->offset[1] = uiSymbol;
-      parseSaoMaxUvlc(uiSymbol, offsetTh -1 ); psSaoLcuParam->offset[2] = -(Int)uiSymbol;
-      parseSaoMaxUvlc(uiSymbol, offsetTh -1 ); psSaoLcuParam->offset[3] = -(Int)uiSymbol;
-     if (compIdx != 2)
+        //off
+        ctbParam.modeIdc = SAO_MODE_OFF;
+        continue;
+        }
+
+      //type
+      if(compIdx == SAO_Y || compIdx == SAO_Cb)
+    {
+        parseSaoTypeIdx(uiSymbol); //sao_type_idx_luma or sao_type_idx_chroma
+
+        assert(uiSymbol ==0 || uiSymbol ==1 || uiSymbol ==2);
+
+        if(uiSymbol ==0) //OFF
      {
-       parseSaoUflc(2, uiSymbol );
-       psSaoLcuParam->subTypeIdx = uiSymbol;
-       psSaoLcuParam->typeIdx += psSaoLcuParam->subTypeIdx;
-     }
+          ctbParam.modeIdc = SAO_MODE_OFF;
    }
-  }
-  else
-  {
-    psSaoLcuParam->length = 0;
-  }
-}
-
-Void TDecSbac::parseSaoOneLcuInterleaving(Int rx, Int ry, SAOParam* pSaoParam, TComDataCU* pcCU, Int iCUAddrInSlice, Int iCUAddrUpInSlice, Int allowMergeLeft, Int allowMergeUp)
-{
-  Int iAddr = pcCU->getAddr();
-  UInt uiSymbol;
-  for (Int iCompIdx=0; iCompIdx<3; iCompIdx++)
-  {
-    pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeUpFlag    = 0;
-    pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeLeftFlag  = 0;
-    pSaoParam->saoLcuParam[iCompIdx][iAddr].subTypeIdx     = 0;
-    pSaoParam->saoLcuParam[iCompIdx][iAddr].typeIdx        = -1;
-    pSaoParam->saoLcuParam[iCompIdx][iAddr].offset[0]     = 0;
-    pSaoParam->saoLcuParam[iCompIdx][iAddr].offset[1]     = 0;
-    pSaoParam->saoLcuParam[iCompIdx][iAddr].offset[2]     = 0;
-    pSaoParam->saoLcuParam[iCompIdx][iAddr].offset[3]     = 0;
-
-  }
- if (pSaoParam->bSaoFlag[0] || pSaoParam->bSaoFlag[1] )
-  {
-    if (rx>0 && iCUAddrInSlice!=0 && allowMergeLeft)
-    {
-      parseSaoMerge(uiSymbol); 
-      pSaoParam->saoLcuParam[0][iAddr].mergeLeftFlag = (Bool)uiSymbol;  
-    }
-    if (pSaoParam->saoLcuParam[0][iAddr].mergeLeftFlag==0)
-    {
-      if ((ry > 0) && (iCUAddrUpInSlice>=0) && allowMergeUp)
-      {
-        parseSaoMerge(uiSymbol);
-        pSaoParam->saoLcuParam[0][iAddr].mergeUpFlag = (Bool)uiSymbol;
-      }
-    }
-  }
-
-  for (Int iCompIdx=0; iCompIdx<3; iCompIdx++)
-  {
-    if ((iCompIdx == 0  && pSaoParam->bSaoFlag[0]) || (iCompIdx > 0  && pSaoParam->bSaoFlag[1]) )
-    {
-      if (rx>0 && iCUAddrInSlice!=0 && allowMergeLeft)
-      {
-        pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeLeftFlag = pSaoParam->saoLcuParam[0][iAddr].mergeLeftFlag;
-      }
-      else
-      {
-        pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeLeftFlag = 0;
-      }
-
-      if (pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeLeftFlag==0)
-      {
-        if ((ry > 0) && (iCUAddrUpInSlice>=0) && allowMergeUp)
-        {
-          pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeUpFlag = pSaoParam->saoLcuParam[0][iAddr].mergeUpFlag;
+        else if(uiSymbol == 1) //BO
+        {
+          ctbParam.modeIdc = SAO_MODE_NEW;
+          ctbParam.typeIdc = SAO_TYPE_START_BO;
+  }
+        else //2, EO
+  {
+          ctbParam.modeIdc = SAO_MODE_NEW;
+          ctbParam.typeIdc = SAO_TYPE_START_EO;
+        }
+
+  }
+      else //Cr, follow Cb SAO type
+      {
+        ctbParam.modeIdc = saoBlkParam[SAO_Cb].modeIdc;
+        ctbParam.typeIdc = saoBlkParam[SAO_Cb].typeIdc;
+}
+
+      if(ctbParam.modeIdc == SAO_MODE_NEW)
+{
+        Int offset[4];
+        for(Int i=0; i< 4; i++)
+  {
+          parseSaoMaxUvlc(uiSymbol,  g_saoMaxOffsetQVal[compIdx] ); //sao_offset_abs
+          offset[i] = (Int)uiSymbol;
+  }
+
+        if(ctbParam.typeIdc == SAO_TYPE_START_BO)
+  {
+          for(Int i=0; i< 4; i++)
+    {
+            if(offset[i] != 0)
+    {
+              parseSaoSign(uiSymbol); //sao_offset_sign
+              if(uiSymbol)
+      {
+                offset[i] = -offset[i];
+      }
+    }
+  }
+          parseSaoUflc(NUM_SAO_BO_CLASSES_LOG2, uiSymbol ); //sao_band_position
+          ctbParam.typeAuxInfo = uiSymbol;
+
+          for(Int i=0; i<4; i++)
+      {
+            ctbParam.offset[(ctbParam.typeAuxInfo+i)%MAX_NUM_SAO_CLASSES] = offset[i];
+      }
+
+        }
+        else //EO
+        {
+          ctbParam.typeAuxInfo = 0;
+
+          if(compIdx == SAO_Y || compIdx == SAO_Cb)
+        {
+            parseSaoUflc(NUM_SAO_EO_TYPES_LOG2, uiSymbol ); //sao_eo_class_luma or sao_eo_class_chroma
+            ctbParam.typeIdc += uiSymbol;
         }
         else
         {
-          pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeUpFlag = 0;
-        }
-        if (!pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeUpFlag)
-        {
-          pSaoParam->saoLcuParam[2][iAddr].typeIdx = pSaoParam->saoLcuParam[1][iAddr].typeIdx;
-          parseSaoOffset(&(pSaoParam->saoLcuParam[iCompIdx][iAddr]), iCompIdx);
-        }
-        else
-        {
-          copySaoOneLcuParam(&pSaoParam->saoLcuParam[iCompIdx][iAddr], &pSaoParam->saoLcuParam[iCompIdx][iAddr-pSaoParam->numCuInWidth]);
-        }
-      }
-      else
-      {
-        copySaoOneLcuParam(&pSaoParam->saoLcuParam[iCompIdx][iAddr],  &pSaoParam->saoLcuParam[iCompIdx][iAddr-1]);
-      }
-    }
-    else
-    {
-      pSaoParam->saoLcuParam[iCompIdx][iAddr].typeIdx = -1;
-      pSaoParam->saoLcuParam[iCompIdx][iAddr].subTypeIdx = 0;
+            ctbParam.typeIdc = saoBlkParam[SAO_Cb].typeIdc;
+        }
+          ctbParam.offset[SAO_CLASS_EO_FULL_VALLEY] = offset[0];
+          ctbParam.offset[SAO_CLASS_EO_HALF_VALLEY] = offset[1];
+          ctbParam.offset[SAO_CLASS_EO_PLAIN      ] = 0;
+          ctbParam.offset[SAO_CLASS_EO_HALF_PEAK  ] = -offset[2];
+          ctbParam.offset[SAO_CLASS_EO_FULL_PEAK  ] = -offset[3];
+      }
+      }
     }
   }
@@ -2218,209 +2173,3 @@
   xCopyContextsFrom(pScr);
 }
-
-#if H_3D_ARP
-Void TDecSbac::parseARPW( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
-{
-  UInt uiMaxW = pcCU->getSlice()->getARPStepNum() - 1;
-  UInt uiW = 0;
-  UInt uiOffset = pcCU->getCTXARPWFlag(uiAbsPartIdx);
-  UInt uiCode = 0;
-
-  assert ( uiMaxW > 0 );
-
-  m_pcTDecBinIf->decodeBin( uiCode , m_cCUPUARPWSCModel.get( 0, 0, 0 + uiOffset ) );
-
-  uiW = uiCode;
-  if( 1 == uiW )   
-  {
-#if MTK_ARP_FLAG_CABAC_SIMP_G0061
-    m_pcTDecBinIf->decodeBin( uiCode , m_cCUPUARPWSCModel.get( 0, 0, 2 ) );
-#else
-    m_pcTDecBinIf->decodeBin( uiCode , m_cCUPUARPWSCModel.get( 0, 0, 3 ) );
-#endif
-    uiW += ( 1 == uiCode ? 1 : 0 );
-  }
-#if H_MV_ENC_DEC_TRAC
-  DTRACE_CU("iv_res_pred_weight_idx", uiW )
-#endif
-  pcCU->setARPWSubParts( ( UChar )( uiW ) , uiAbsPartIdx, uiDepth );  
-}
-#endif
-
-#if H_3D_IC
-/** parse illumination compensation flag
- * \param pcCU
- * \param uiAbsPartIdx 
- * \param uiDepth
- * \returns Void
- */
-Void TDecSbac::parseICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
-{ 
-  UInt uiSymbol = 0;
-#if MTK_IC_FLAG_CABAC_SIMP_G0061
-  m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUICFlagSCModel.get( 0, 0, 0 ) );
-#else
-  UInt uiCtxIC = pcCU->getCtxICFlag( uiAbsPartIdx );
-  m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUICFlagSCModel.get( 0, 0, uiCtxIC ) );
-#endif
-#if !H_MV_ENC_DEC_TRAC 
-  DTRACE_CABAC_VL( g_nSymbolCounter++ );
-  DTRACE_CABAC_T( "\tICFlag" );
-  DTRACE_CABAC_T( "\tuiCtxIC: ");
-  DTRACE_CABAC_V( uiCtxIC );
-  DTRACE_CABAC_T( "\tuiSymbol: ");
-  DTRACE_CABAC_V( uiSymbol );
-  DTRACE_CABAC_T( "\n");
-#else
-  DTRACE_CU("ic_flag", uiSymbol)
-#endif
-  
-  pcCU->setICFlagSubParts( uiSymbol ? true : false , uiAbsPartIdx, 0, uiDepth );
-}
-#endif
-
-#if H_3D_INTER_SDC
-#if QC_SDC_UNIFY_G0130
-Void TDecSbac::parseDeltaDC( TComDataCU* pcCU, UInt absPartIdx, UInt depth )
-{
-  if( ! ( pcCU->getSDCFlag( absPartIdx ) || ( pcCU->isIntra( absPartIdx ) && getDimType( pcCU->getLumaIntraDir( absPartIdx ) ) < DIM_NUM_TYPE ) ) )
-  {
-    assert( 0 );
-  }
-
-  UInt symbol = 0;
-  UInt uiNumSegments = 0;
-
-  if( pcCU->isIntra( absPartIdx ) )
-  {
-    UInt dir     = pcCU->getLumaIntraDir( absPartIdx );
-    uiNumSegments = isDimMode( dir ) ? 2 : 1;
-
-    m_pcTDecBinIf->decodeBin( symbol, m_cDdcFlagSCModel.get( 0, 0, uiNumSegments-1 ) );
-
-    if( pcCU->getSDCFlag( absPartIdx ) )
-    {
-      assert( pcCU->getPartitionSize( absPartIdx ) == SIZE_2Nx2N );
-      pcCU->setTrIdxSubParts( 0, absPartIdx, depth );
-      pcCU->setCbfSubParts( 1, 1, 1, absPartIdx, depth );
-    }
-    else
-    {
-      pcCU->setLumaIntraDirSubParts( dir + symbol, absPartIdx, depth );
-    }
-  }
-  else
-  {
-#if SEC_INTER_SDC_G0101
-    uiNumSegments = 1;
-#else
-    PartSize cPartSize = pcCU->getPartitionSize( absPartIdx );
-    uiNumSegments = ( cPartSize == SIZE_2Nx2N ) ? 1 : ( cPartSize == SIZE_NxN ? 4 : 2 );
-#endif
-    symbol = 1;
-  }
-
-
-  for( UInt segment = 0; segment < uiNumSegments; segment++ )
-  {
-    Pel valDeltaDC = 0;
-    if( symbol )
-    {
-      xParseDimDeltaDC( valDeltaDC, uiNumSegments );
-    }
-
-    if( pcCU->isIntra( absPartIdx ) )
-    {
-      UInt dir     = pcCU->getLumaIntraDir( absPartIdx );
-
-      if( pcCU->getSDCFlag( absPartIdx ) )
-      {
-        pcCU->setSDCSegmentDCOffset( valDeltaDC, segment, absPartIdx );
-      }
-      else
-      {
-        pcCU->setDimDeltaDC( getDimType( dir ), segment, absPartIdx, valDeltaDC );
-      }
-    }
-    else
-    {
-      pcCU->setSDCSegmentDCOffset( valDeltaDC, segment, absPartIdx );
-    }
-  }
-}
-
-Void TDecSbac::parseSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
-{
-  UInt uiSymbol = 0;
-  UInt uiCtxSDCFlag = pcCU->getCtxSDCFlag( uiAbsPartIdx );
-
-  m_pcTDecBinIf->decodeBin( uiSymbol, m_cSDCFlagSCModel.get( 0, 0, uiCtxSDCFlag ) );
-
-  if( uiSymbol )
-  {
-    pcCU->setSDCFlagSubParts( true, uiAbsPartIdx, uiDepth );
-    pcCU->setTrIdxSubParts( 0, uiAbsPartIdx, uiDepth );
-    pcCU->setCbfSubParts( 1, 1, 1, uiAbsPartIdx, uiDepth );
-  }
-  else
-  {
-    pcCU->setSDCFlagSubParts( false, uiAbsPartIdx, uiDepth );
-  }
-}
-#else
-Void TDecSbac::parseInterSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
-{
-  UInt uiSymbol = 0;
-  UInt uiCtxInterSDCFlag = pcCU->getCtxInterSDCFlag( uiAbsPartIdx );
-
-  m_pcTDecBinIf->decodeBin( uiSymbol, m_cInterSDCFlagSCModel.get( 0, 0, uiCtxInterSDCFlag ) );
-
-  if( uiSymbol )
-  {
-    pcCU->setInterSDCFlagSubParts( true, uiAbsPartIdx, 0, uiDepth );
-    pcCU->setTrIdxSubParts( 0, uiAbsPartIdx, uiDepth );
-    pcCU->setCbfSubParts( 1, 1, 1, uiAbsPartIdx, uiDepth );
-  }
-  else
-  {
-    pcCU->setInterSDCFlagSubParts( false, uiAbsPartIdx, 0, uiDepth);
-  }
-}
-
-Void TDecSbac::parseInterSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiSegment )
-{
-  UInt uiAbsIdx   = 0;
-  UInt uiSign     = 0;
-  Int  iIdx       = 0;
-
-  xReadExGolombLevel( uiAbsIdx, m_cInterSDCResidualSCModel.get( 0, 0, 0 ) );
-
-  uiAbsIdx++;
-  m_pcTDecBinIf->decodeBin( uiSign, m_cInterSDCResidualSignFlagSCModel.get( 0, 0, 0 ) );
-  iIdx = (Int)( uiSign ? -1 : 1 ) * uiAbsIdx;
-
-  pcCU->setInterSDCSegmentDCOffset( iIdx, uiSegment, uiAbsPartIdx );
-}
-#endif
-#endif
-
-#if H_3D_DBBP
-Void TDecSbac::parseDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
-{
-  PartSize ePartSize = pcCU->getPartitionSize( uiAbsPartIdx );
-  AOF( pcCU->getSlice()->getVPS()->getUseDBBP(pcCU->getSlice()->getLayerIdInVps()) );
-  AOF( !pcCU->getSlice()->getIsDepth() );
-  AOF( ePartSize == RWTH_DBBP_PACK_MODE );
-  
-  UInt uiSymbol = 0;
-  
-  m_pcTDecBinIf->decodeBin( uiSymbol, m_cDBBPFlagSCModel.get( 0, 0, 0 ) );
-  
-  if( uiSymbol )
-  {
-    pcCU->setDBBPFlagSubParts(true, uiAbsPartIdx, 0, uiDepth);
-  }
-}
-#endif
-
 //! \}
Index: branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecSbac.h
===================================================================
--- branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecSbac.h	(revision 836)
+++ branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecSbac.h	(revision 837)
@@ -4,5 +4,5 @@
  * granted under this license.  
  *
- * Copyright (c) 2010-2013, ITU/ISO/IEC
+* Copyright (c) 2010-2014, ITU/ISO/IEC
  * All rights reserved.
  *
@@ -94,6 +94,4 @@
   Void  parseSaoTypeIdx           ( UInt&  ruiVal  );
   Void  parseSaoUflc              ( UInt uiLength, UInt& ruiVal     );
-  Void  parseSaoOneLcuInterleaving(Int rx, Int ry, SAOParam* pSaoParam, TComDataCU* pcCU, Int iCUAddrInSlice, Int iCUAddrUpInSlice, Int allowMergeLeft, Int allowMergeUp);
-  Void  parseSaoOffset            (SaoLcuParam* psSaoLcuParam, UInt compIdx);
 private:
   Void  xReadUnarySymbol    ( UInt& ruiSymbol, ContextModel* pcSCModel, Int iOffset );
@@ -209,5 +207,4 @@
   ContextModel3DBuffer m_cMVPIdxSCModel;
   
-  ContextModel3DBuffer m_cCUAMPSCModel;
   ContextModel3DBuffer m_cSaoMergeSCModel;
   ContextModel3DBuffer m_cSaoTypeIdxSCModel;
Index: branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecSlice.cpp
===================================================================
--- branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecSlice.cpp	(revision 836)
+++ branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecSlice.cpp	(revision 837)
@@ -4,5 +4,5 @@
  * granted under this license.  
  *
- * Copyright (c) 2010-2013, ITU/ISO/IEC
+* Copyright (c) 2010-2014, ITU/ISO/IEC
  * All rights reserved.
  *
@@ -313,53 +313,33 @@
     g_bJustDoIt = g_bEncDecTraceEnable;
 #endif
-    if ( pcSlice->getSPS()->getUseSAO() && (pcSlice->getSaoEnabledFlag()||pcSlice->getSaoEnabledFlagChroma()) )
-    {
-      SAOParam *saoParam = rpcPic->getPicSym()->getSaoParam();
-      saoParam->bSaoFlag[0] = pcSlice->getSaoEnabledFlag();
-      if (iCUAddr == iStartCUAddr)
-      {
-        saoParam->bSaoFlag[1] = pcSlice->getSaoEnabledFlagChroma();
-      }
-      Int numCuInWidth     = saoParam->numCuInWidth;
-      Int cuAddrInSlice = iCUAddr - rpcPic->getPicSym()->getCUOrderMap(pcSlice->getSliceCurStartCUAddr()/rpcPic->getNumPartInCU());
-      Int cuAddrUpInSlice  = cuAddrInSlice - numCuInWidth;
-      Int rx = iCUAddr % numCuInWidth;
-      Int ry = iCUAddr / numCuInWidth;
-      Int allowMergeLeft = 1;
-      Int allowMergeUp   = 1;
-      if (rx!=0)
-      {
-        if (rpcPic->getPicSym()->getTileIdxMap(iCUAddr-1) != rpcPic->getPicSym()->getTileIdxMap(iCUAddr))
-        {
-          allowMergeLeft = 0;
-        }
-      }
-      if (ry!=0)
-      {
-        if (rpcPic->getPicSym()->getTileIdxMap(iCUAddr-numCuInWidth) != rpcPic->getPicSym()->getTileIdxMap(iCUAddr))
-        {
-          allowMergeUp = 0;
-        }
-      }
-      pcSbacDecoder->parseSaoOneLcuInterleaving(rx, ry, saoParam,pcCU, cuAddrInSlice, cuAddrUpInSlice, allowMergeLeft, allowMergeUp);
-    }
-    else if ( pcSlice->getSPS()->getUseSAO() )
-    {
-      Int addr = pcCU->getAddr();
-      SAOParam *saoParam = rpcPic->getPicSym()->getSaoParam();
-      for (Int cIdx=0; cIdx<3; cIdx++)
-      {
-        SaoLcuParam *saoLcuParam = &(saoParam->saoLcuParam[cIdx][addr]);
-        if ( ((cIdx == 0) && !pcSlice->getSaoEnabledFlag()) || ((cIdx == 1 || cIdx == 2) && !pcSlice->getSaoEnabledFlagChroma()))
-        {
-          saoLcuParam->mergeUpFlag   = 0;
-          saoLcuParam->mergeLeftFlag = 0;
-          saoLcuParam->subTypeIdx    = 0;
-          saoLcuParam->typeIdx       = -1;
-          saoLcuParam->offset[0]     = 0;
-          saoLcuParam->offset[1]     = 0;
-          saoLcuParam->offset[2]     = 0;
-          saoLcuParam->offset[3]     = 0;
-        }
+
+    if ( pcSlice->getSPS()->getUseSAO() )
+      {
+      SAOBlkParam& saoblkParam = (rpcPic->getPicSym()->getSAOBlkParam())[iCUAddr];
+      if (pcSlice->getSaoEnabledFlag()||pcSlice->getSaoEnabledFlagChroma())
+      {
+        Bool sliceEnabled[NUM_SAO_COMPONENTS];
+        sliceEnabled[SAO_Y] = pcSlice->getSaoEnabledFlag();
+        sliceEnabled[SAO_Cb]= sliceEnabled[SAO_Cr]= pcSlice->getSaoEnabledFlagChroma();
+
+        Bool leftMergeAvail = false;
+        Bool aboveMergeAvail= false;
+
+        //merge left condition
+        Int rx = (iCUAddr % uiWidthInLCUs);
+        if(rx > 0)
+        {
+          leftMergeAvail = rpcPic->getSAOMergeAvailability(iCUAddr, iCUAddr-1);
+        }
+        //merge up condition
+        Int ry = (iCUAddr / uiWidthInLCUs);
+        if(ry > 0)
+        {
+      }
+
+        pcSbacDecoder->parseSAOBlkParam( saoblkParam, sliceEnabled, leftMergeAvail, aboveMergeAvail);
+    }
+      else 
+        {
       }
     }
Index: branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecSlice.h
===================================================================
--- branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecSlice.h	(revision 836)
+++ branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecSlice.h	(revision 837)
@@ -4,5 +4,5 @@
  * granted under this license.  
  *
- * Copyright (c) 2010-2013, ITU/ISO/IEC
+* Copyright (c) 2010-2014, ITU/ISO/IEC
  * All rights reserved.
  *
Index: branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecTop.cpp
===================================================================
--- branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecTop.cpp	(revision 836)
+++ branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecTop.cpp	(revision 837)
@@ -4,5 +4,5 @@
  * granted under this license.  
  *
- * Copyright (c) 2010-2013, ITU/ISO/IEC
+* Copyright (c) 2010-2014, ITU/ISO/IEC
  * All rights reserved.
  *
@@ -467,5 +467,4 @@
     rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, 
                      conformanceWindow, defaultDisplayWindow, numReorderPics, true);
-    rpcPic->getPicSym()->allocSaoParam(&m_cSAO);
     m_cListPic.pushBack( rpcPic );
     
@@ -505,5 +504,4 @@
   rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
                    conformanceWindow, defaultDisplayWindow, numReorderPics, true);
-  rpcPic->getPicSym()->allocSaoParam(&m_cSAO);
 }
 
@@ -662,5 +660,5 @@
 
   m_cSAO.destroy();
-  m_cSAO.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), sps->getMaxCUWidth(), sps->getMaxCUHeight() );
+  m_cSAO.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCUDepth() );
   m_cLoopFilter.create( sps->getMaxCUDepth() );
 }
@@ -670,5 +668,4 @@
 {
   assert( nalu.m_layerId == m_layerId ); 
-
 #else
 Bool TDecTop::xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay )
@@ -682,9 +679,8 @@
     m_uiSliceIdx     = 0;
   }
+  {
+    m_apcSlicePilot->copySliceInfo( pcPic->getPicSym()->getSlice(m_uiSliceIdx-1) );
+  }
   m_apcSlicePilot->setSliceIdx(m_uiSliceIdx);
-  if (!m_bFirstSliceInPicture)
-  {
-    m_apcSlicePilot->copySliceInfo( pcPic->getPicSym()->getSlice(m_uiSliceIdx-1) );
-  }
 
   m_apcSlicePilot->setNalUnitType(nalu.m_nalUnitType);
@@ -994,10 +990,5 @@
 #endif
 #else
-#if FIX1071
     pcSlice->setRefPicList( m_cListPic, true );
-#else
-    pcSlice->setRefPicList( m_cListPic );
-#endif
-
 #endif
 
@@ -1215,5 +1206,5 @@
     case NAL_UNIT_CODED_SLICE_TRAIL_R:
     case NAL_UNIT_CODED_SLICE_TRAIL_N:
-    case NAL_UNIT_CODED_SLICE_TLA_R:
+    case NAL_UNIT_CODED_SLICE_TSA_R:
     case NAL_UNIT_CODED_SLICE_TSA_N:
     case NAL_UNIT_CODED_SLICE_STSA_R:
@@ -1235,6 +1226,68 @@
 #endif
       break;
+    case NAL_UNIT_EOS:
+      m_associatedIRAPType = NAL_UNIT_INVALID;
+      m_pocCRA = 0;
+      m_pocRandomAccess = MAX_INT;
+      m_prevPOC = MAX_INT;
+      m_bFirstSliceInPicture = true;
+      m_bFirstSliceInSequence = true;
+      m_prevSliceSkipped = false;
+      m_skippedPOC = 0;
+      return false;
+      
+    case NAL_UNIT_ACCESS_UNIT_DELIMITER:
+      // TODO: process AU delimiter
+      return false;
+      
+    case NAL_UNIT_EOB:
+      return false;
+      
+      
+    case NAL_UNIT_RESERVED_VCL_N10:
+    case NAL_UNIT_RESERVED_VCL_R11:
+    case NAL_UNIT_RESERVED_VCL_N12:
+    case NAL_UNIT_RESERVED_VCL_R13:
+    case NAL_UNIT_RESERVED_VCL_N14:
+    case NAL_UNIT_RESERVED_VCL_R15:
+      
+    case NAL_UNIT_RESERVED_IRAP_VCL22:
+    case NAL_UNIT_RESERVED_IRAP_VCL23:
+      
+    case NAL_UNIT_RESERVED_VCL24:
+    case NAL_UNIT_RESERVED_VCL25:
+    case NAL_UNIT_RESERVED_VCL26:
+    case NAL_UNIT_RESERVED_VCL27:
+    case NAL_UNIT_RESERVED_VCL28:
+    case NAL_UNIT_RESERVED_VCL29:
+    case NAL_UNIT_RESERVED_VCL30:
+    case NAL_UNIT_RESERVED_VCL31:
+      
+    case NAL_UNIT_FILLER_DATA:
+    case NAL_UNIT_RESERVED_NVCL41:
+    case NAL_UNIT_RESERVED_NVCL42:
+    case NAL_UNIT_RESERVED_NVCL43:
+    case NAL_UNIT_RESERVED_NVCL44:
+    case NAL_UNIT_RESERVED_NVCL45:
+    case NAL_UNIT_RESERVED_NVCL46:
+    case NAL_UNIT_RESERVED_NVCL47:
+    case NAL_UNIT_UNSPECIFIED_48:
+    case NAL_UNIT_UNSPECIFIED_49:
+    case NAL_UNIT_UNSPECIFIED_50:
+    case NAL_UNIT_UNSPECIFIED_51:
+    case NAL_UNIT_UNSPECIFIED_52:
+    case NAL_UNIT_UNSPECIFIED_53:
+    case NAL_UNIT_UNSPECIFIED_54:
+    case NAL_UNIT_UNSPECIFIED_55:
+    case NAL_UNIT_UNSPECIFIED_56:
+    case NAL_UNIT_UNSPECIFIED_57:
+    case NAL_UNIT_UNSPECIFIED_58:
+    case NAL_UNIT_UNSPECIFIED_59:
+    case NAL_UNIT_UNSPECIFIED_60:
+    case NAL_UNIT_UNSPECIFIED_61:
+    case NAL_UNIT_UNSPECIFIED_62:
+    case NAL_UNIT_UNSPECIFIED_63:
     default:
-      assert (1);
+      assert (0);
   }
 
Index: branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecTop.h
===================================================================
--- branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecTop.h	(revision 836)
+++ branches/HTM-10.0rc1-dev0/source/Lib/TLibDecoder/TDecTop.h	(revision 837)
@@ -4,5 +4,5 @@
  * granted under this license.  
  *
- * Copyright (c) 2010-2013, ITU/ISO/IEC
+* Copyright (c) 2010-2014, ITU/ISO/IEC
  * All rights reserved.
  *
