Index: branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/CommonDef.h
===================================================================
--- branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/CommonDef.h	(revision 535)
+++ branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/CommonDef.h	(revision 537)
@@ -115,7 +115,4 @@
 #define MAX_NUM_REF_PICS            16          ///< max. number of pictures used for reference
 #define MAX_NUM_REF                 16          ///< max. number of entries in picture reference list
-#if !L0034_COMBINED_LIST_CLEANUP
-#define MAX_NUM_REF_LC              MAX_NUM_REF_PICS  // TODO: remove this macro definition (leftover from combined list concept)
-#endif
 
 #define MAX_UINT                    0xFFFFFFFFU ///< max. value of unsigned 32-bit integer
Index: branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/NAL.h
===================================================================
--- branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/NAL.h	(revision 535)
+++ branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/NAL.h	(revision 537)
@@ -94,5 +94,4 @@
         || m_nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R;
   }
-#if L0045_NON_NESTED_SEI_RESTRICTIONS
   Bool isSei()
   {
@@ -105,5 +104,4 @@
     return ( (UInt)m_nalUnitType < 32 );
   }
-#endif
 };
 
Index: branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/SEI.cpp
===================================================================
--- branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/SEI.cpp	(revision 535)
+++ branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/SEI.cpp	(revision 537)
@@ -39,8 +39,6 @@
 #include "SEI.h"
 
-#if J0149_TONE_MAPPING_SEI 
 //Table D-7 Meaning of camera iso sensitivity indicator and exposure index rating indicator
 Int  Table_exp_indicator[32] = {0, 10, 12, 16, 20, 25, 32, 40, 50, 64, 80, 100, 125, 160, 200, 250, 320, 400, 500, 640, 800, 1000, 1250, 1600, 2000, 2500, 3200, 4000, 5000, 6400, 8000, -1};
-#endif
 
 SEIMessages getSeisByType(SEIMessages &seiList, SEI::PayloadType seiType)
Index: branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/SEI.h
===================================================================
--- branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/SEI.h	(revision 535)
+++ branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/SEI.h	(revision 537)
@@ -124,20 +124,14 @@
 
   SEIActiveParameterSets() 
-#if !L0047_APS_FLAGS
-    :numSpsIdsMinus1(0)
-#else
     : activeVPSId            (0)
     , m_fullRandomAccessFlag (false)
     , m_noParamSetUpdateFlag (false)
     , numSpsIdsMinus1        (0)
-#endif
   {}
   virtual ~SEIActiveParameterSets() {}
 
   Int activeVPSId; 
-#if L0047_APS_FLAGS
   Bool m_fullRandomAccessFlag;
   Bool m_noParamSetUpdateFlag;
-#endif
   Int numSpsIdsMinus1;
   std::vector<Int> activeSeqParamSetId; 
@@ -150,5 +144,4 @@
 
   SEIBufferingPeriod()
-#if L0044_CPB_DPB_DELAY_OFFSET
   : m_bpSeqParameterSetId (0)
   , m_rapCpbParamsPresentFlag (false)
@@ -161,23 +154,16 @@
     ::memset(m_initialAltCpbRemovalDelayOffset, 0, sizeof(m_initialAltCpbRemovalDelayOffset));
   }
-#else
-  {}
-#endif
   virtual ~SEIBufferingPeriod() {}
 
   UInt m_bpSeqParameterSetId;
   Bool m_rapCpbParamsPresentFlag;
-#if L0044_CPB_DPB_DELAY_OFFSET
   Bool m_cpbDelayOffset;
   Bool m_dpbDelayOffset;
-#endif
   UInt m_initialCpbRemovalDelay         [MAX_CPB_CNT][2];
   UInt m_initialCpbRemovalDelayOffset   [MAX_CPB_CNT][2];
   UInt m_initialAltCpbRemovalDelay      [MAX_CPB_CNT][2];
   UInt m_initialAltCpbRemovalDelayOffset[MAX_CPB_CNT][2];
-#if L0328_SPLICING
   Bool m_concatenationFlag;
   UInt m_auCpbRemovalDelayDelta;
-#endif
 };
 class SEIPictureTiming : public SEI
@@ -188,13 +174,7 @@
   SEIPictureTiming()
   : m_picStruct               (0)
-#if L0046_RENAME_PROG_SRC_IDC
   , m_sourceScanType          (0)
-#else
-  , m_progressiveSourceIdc    (0)
-#endif
   , m_duplicateFlag           (false)
-#if L0044_DU_DPB_OUTPUT_DELAY_HRD
   , m_picDpbOutputDuDelay     (0)
-#endif
   , m_numNalusInDuMinus1      (NULL)
   , m_duCpbRemovalDelayMinus1 (NULL)
@@ -213,16 +193,10 @@
 
   UInt  m_picStruct;
-#if L0046_RENAME_PROG_SRC_IDC
   UInt  m_sourceScanType;
-#else
-  UInt  m_progressiveSourceIdc;
-#endif
   Bool  m_duplicateFlag;
 
   UInt  m_auCpbRemovalDelay;
   UInt  m_picDpbOutputDelay;
-#if L0044_DU_DPB_OUTPUT_DELAY_HRD
   UInt  m_picDpbOutputDuDelay;
-#endif
   UInt  m_numDecodingUnitsMinus1;
   Bool  m_duCommonCpbRemovalDelayFlag;
@@ -240,16 +214,12 @@
     : m_decodingUnitIdx(0)
     , m_duSptCpbRemovalDelay(0)
-#if L0044_DU_DPB_OUTPUT_DELAY_HRD
     , m_dpbOutputDuDelayPresentFlag(false)
     , m_picSptDpbOutputDuDelay(0)
-#endif
   {}
   virtual ~SEIDecodingUnitInfo() {}
   Int m_decodingUnitIdx;
   Int m_duSptCpbRemovalDelay;
-#if L0044_DU_DPB_OUTPUT_DELAY_HRD
   Bool m_dpbOutputDuDelayPresentFlag;
   Int m_picSptDpbOutputDuDelay;
-#endif
 };
 
@@ -290,9 +260,5 @@
   Int  m_frame1GridPositionY;
   Int  m_arrangementReservedByte;
-#if L0045_PERSISTENCE_FLAGS
   Bool m_arrangementPersistenceFlag;
-#else
-  Int  m_arrangementRepetetionPeriod;
-#endif
   Bool m_upsampledAspectRatio;
 };
@@ -305,9 +271,5 @@
   SEIDisplayOrientation()
     : cancelFlag(true)
-#if L0045_PERSISTENCE_FLAGS
     , persistenceFlag(0)
-#else
-    , repetitionPeriod(1)
-#endif
     , extensionFlag(false)
     {}
@@ -319,9 +281,5 @@
 
   UInt anticlockwiseRotation;
-#if L0045_PERSISTENCE_FLAGS
   Bool persistenceFlag;
-#else
-  UInt repetitionPeriod;
-#endif
   Bool extensionFlag;
 };
@@ -355,5 +313,4 @@
 };
 
-#if L0208_SOP_DESCRIPTION_SEI
 class SEISOPDescription : public SEI
 {
@@ -372,7 +329,5 @@
   Int m_sopDescPocDelta[MAX_NUM_PICS_IN_SOP];
 };
-#endif
-
-#if J0149_TONE_MAPPING_SEI 
+
 class SEIToneMappingInfo : public SEI
 {
@@ -407,5 +362,4 @@
   Int    m_extendedWhiteLevelLumaCodeValue;
 };
-#endif
 
 typedef std::list<SEI*> SEIMessages;
@@ -420,5 +374,4 @@
 Void deleteSEIs (SEIMessages &seiList);
 
-#if K0180_SCALABLE_NESTING_SEI
 class SEIScalableNesting : public SEI
 {
@@ -450,5 +403,4 @@
   SEIMessages m_nestedSEIs;
 };
-#endif
 
 //! \}
Index: branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComBitStream.h
===================================================================
--- branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComBitStream.h	(revision 535)
+++ branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComBitStream.h	(revision 537)
@@ -193,4 +193,10 @@
   }
 
+  Void        peekPreviousByte( UInt &byte )
+  {
+    assert(m_fifo_idx > 0);
+    byte = (*m_fifo)[m_fifo_idx - 1];
+  }
+  
   Void        readOutTrailingBits ();
   UChar getHeldBits  ()          { return m_held_bits;          }
Index: branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComDataCU.cpp
===================================================================
--- branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComDataCU.cpp	(revision 535)
+++ branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComDataCU.cpp	(revision 537)
@@ -136,5 +136,4 @@
 #endif
 #endif
-
   m_bDecSubCu          = false;
   m_sliceStartCU        = 0;
@@ -143,13 +142,10 @@
   m_pDvInfo              = NULL;
 #endif
-
 #if H_3D_VSP
   m_piVSPFlag            = NULL;
 #endif
-
 #if H_3D_ARP
   m_puhARPW              = NULL;
 #endif
-
 #if H_3D_IC
   m_pbICFlag             = NULL;
@@ -783,11 +779,9 @@
   }
 
-  UInt uiTmp = uhWidth*uhHeight;
-
   if(getPic()->getPicSym()->getInverseCUOrderMap(getAddr())*m_pcPic->getNumPartInCU()+m_uiAbsIdxInLCU >= getSlice()->getSliceSegmentCurStartCUAddr())
   {
     m_acCUMvField[0].clearMvField();
     m_acCUMvField[1].clearMvField();
-    uiTmp = uhWidth*uhHeight;
+    UInt uiTmp = uhWidth*uhHeight;
     
     memset( m_pcTrCoeffY,    0, uiTmp * sizeof( *m_pcTrCoeffY    ) );
@@ -1056,7 +1050,4 @@
   m_uiCUPelY           = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ];
   
-  UInt uiWidth         = g_uiMaxCUWidth  >> uiDepth;
-  UInt uiHeight        = g_uiMaxCUHeight >> uiDepth;
-  
   m_skipFlag=pcCU->getSkipFlag()          + uiPart;
 
@@ -1139,5 +1130,4 @@
   m_apcCUColocated[1] = pcCU->getCUColocated(REF_PIC_LIST_1);
   
-  UInt uiTmp = uiWidth*uiHeight;
   UInt uiMaxCuWidth=pcCU->getSlice()->getSPS()->getMaxCUWidth();
   UInt uiMaxCuHeight=pcCU->getSlice()->getSPS()->getMaxCUHeight();
@@ -1151,5 +1141,4 @@
   m_pcIPCMSampleY = pcCU->getPCMSampleY() + uiCoffOffset;
 
-  uiTmp >>= 2;
   uiCoffOffset >>=2;
   m_pcTrCoeffCb=pcCU->getCoeffCb() + uiCoffOffset;
@@ -1352,5 +1341,4 @@
   memcpy( m_sliceStartCU        + uiOffset, pcCU->m_sliceStartCU,        sizeof( UInt ) * uiNumPartition  );
   memcpy( m_sliceSegmentStartCU + uiOffset, pcCU->m_sliceSegmentStartCU, sizeof( UInt ) * uiNumPartition  );
-
 #if H_3D_ARP
   memcpy( m_puhARPW             + uiOffset, pcCU->getARPW(),              iSizeInUchar );
@@ -1430,5 +1418,4 @@
 #endif
 #endif
-
   memcpy( rpcCU->getDepth()  + m_uiAbsIdxInLCU, m_puhDepth,  iSizeInUchar );
   memcpy( rpcCU->getWidth()  + m_uiAbsIdxInLCU, m_puhWidth,  iSizeInUchar );
@@ -1465,5 +1452,4 @@
   memcpy( rpcCU->m_sliceStartCU        + m_uiAbsIdxInLCU, m_sliceStartCU,        sizeof( UInt ) * m_uiNumPartition  );
   memcpy( rpcCU->m_sliceSegmentStartCU + m_uiAbsIdxInLCU, m_sliceSegmentStartCU, sizeof( UInt ) * m_uiNumPartition  );
-
 #if H_3D_ARP
   memcpy( rpcCU->getARPW()             + m_uiAbsIdxInLCU, m_puhARPW,             iSizeInUchar );
@@ -1539,5 +1525,4 @@
 #endif
 #endif
-
   memcpy( rpcCU->getDepth()  + uiPartOffset, m_puhDepth,  iSizeInUchar );
   memcpy( rpcCU->getWidth()  + uiPartOffset, m_puhWidth,  iSizeInUchar );
@@ -1575,5 +1560,4 @@
   memcpy( rpcCU->m_sliceStartCU        + uiPartOffset, m_sliceStartCU,        sizeof( UInt ) * uiQNumPart  );
   memcpy( rpcCU->m_sliceSegmentStartCU + uiPartOffset, m_sliceSegmentStartCU, sizeof( UInt ) * uiQNumPart  );
-
 #if H_3D_ARP
   memcpy( rpcCU->getARPW()             + uiPartOffset, m_puhARPW,             iSizeInUchar );
@@ -2027,6 +2011,5 @@
     return getSlice()->getSliceQp();
   }
-  else
-  if ( iLastValidPartIdx >= 0 )
+  else if ( iLastValidPartIdx >= 0 )
   {
     return getQP( iLastValidPartIdx );
@@ -2255,5 +2238,4 @@
 }
 #endif
-
 UInt TComDataCU::getCtxInterDir( UInt uiAbsPartIdx )
 {
@@ -2492,5 +2474,4 @@
 }
 #endif
-
 Void TComDataCU::setMergeFlagSubParts ( Bool bMergeFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth )
 {
@@ -2509,5 +2490,4 @@
 }
 #endif
-
 Void TComDataCU::setChromIntraDirSubParts( UInt uiDir, UInt uiAbsPartIdx, UInt uiDepth )
 {
@@ -3030,5 +3010,4 @@
 
 #endif
-
 /** Constructs a list of merging candidates
  * \param uiAbsPartIdx
@@ -3139,5 +3118,4 @@
           pcTextureCU->getMvField( pcTextureCU, uiPartIdxCenter, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
           TComMv cMvPred = pcMvFieldNeighbours[(iCount<<1)+1].getMv();
-
 #if H_3D_IC
           const TComMv cAdd( 1 << ( 2 - 1 ), 1 << ( 2 - 1 ) );
@@ -3568,5 +3546,4 @@
     //>> MTK colocated-RightBottom
     UInt uiPartIdxRB;
-    Int uiLCUIdx = getAddr();
 
     deriveRightBottomIdx( uiPUIdx, uiPartIdxRB );  
@@ -3577,12 +3554,11 @@
     TComMv cColMv;
     Int iRefIdx;
+    Int uiLCUIdx = -1;
 
     if      ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() ) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples() )  // image boundary check
     {
-      uiLCUIdx = -1;
     }
     else if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples() )
     {
-      uiLCUIdx = -1;
     }
     else
@@ -3597,5 +3573,4 @@
       {
         uiAbsPartAddr = g_auiRasterToZscan[ (uiAbsPartIdxTmp + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ];
-        uiLCUIdx = -1 ; 
       }
       else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU
@@ -3607,5 +3582,4 @@
       {
         uiAbsPartAddr = 0;
-        uiLCUIdx = -1 ; 
       }
     }
@@ -3885,5 +3859,5 @@
     if (!bAdded) 
     {
-      bAdded = xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxLB, MD_LEFT );
+      xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxLB, MD_LEFT );
     }
   }
@@ -3898,5 +3872,5 @@
   if(!bAdded)
   {
-    bAdded = xAddMVPCand( pInfo, eRefPicList, iRefIdx, uiPartIdxLT, MD_ABOVE_LEFT);
+    xAddMVPCand( pInfo, eRefPicList, iRefIdx, uiPartIdxLT, MD_ABOVE_LEFT);
   }
   bAdded = bAddedSmvp;
@@ -3913,5 +3887,5 @@
     if(!bAdded)
     {
-      bAdded = xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxLT, MD_ABOVE_LEFT);
+      xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxLT, MD_ABOVE_LEFT);
     }
   }
@@ -3933,5 +3907,4 @@
     UInt uiAbsPartIdx;  
     UInt uiAbsPartAddr;
-    Int uiLCUIdx = getAddr();
 
     deriveRightBottomIdx( uiPartIdx, uiPartIdxRB );
@@ -3940,11 +3913,10 @@
     //----  co-located RightBottom Temporal Predictor (H) ---//
     uiAbsPartIdx = g_auiZscanToRaster[uiPartIdxRB];
+    Int uiLCUIdx = -1;
     if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdx] + m_pcPic->getMinCUWidth() ) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples() )  // image boundary check
     {
-      uiLCUIdx = -1;
     }
     else if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdx] + m_pcPic->getMinCUHeight() ) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples() )
     {
-      uiLCUIdx = -1;
     }
     else
@@ -3959,5 +3931,4 @@
       {
         uiAbsPartAddr = g_auiRasterToZscan[ (uiAbsPartIdx + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ];
-        uiLCUIdx      = -1 ; 
       }
       else if ( uiAbsPartIdx / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU
@@ -3969,5 +3940,4 @@
       {
         uiAbsPartAddr = 0;
-        uiLCUIdx      = -1 ; 
       }
     }
@@ -4043,6 +4013,5 @@
 UInt TComDataCU::getIntraSizeIdx(UInt uiAbsPartIdx)
 {
-  UInt uiShift = ( (m_puhTrIdx[uiAbsPartIdx]==0) && (m_pePartSize[uiAbsPartIdx]==SIZE_NxN) ) ? m_puhTrIdx[uiAbsPartIdx]+1 : m_puhTrIdx[uiAbsPartIdx];
-  uiShift = ( m_pePartSize[uiAbsPartIdx]==SIZE_NxN ? 1 : 0 );
+  UInt uiShift = ( m_pePartSize[uiAbsPartIdx]==SIZE_NxN ? 1 : 0 );
   
   UChar uiWidth = m_puhWidth[uiAbsPartIdx]>>uiShift;
@@ -4130,9 +4099,5 @@
   }
   
-#if L0363_MVP_POC
   if ( pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) >= 0 && m_pcSlice->getRefPic( eRefPicList, iRefIdx)->getPOC() == pcTmpCU->getSlice()->getRefPOC( eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ))
-#else
-  if ( m_pcSlice->isEqualRef(eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx), iRefIdx) )
-#endif
   {
     TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
@@ -4340,5 +4305,4 @@
   }
   iCurrPOC = m_pcSlice->getPOC();    
-  iCurrRefPOC = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getPOC();
   iColPOC = pColCU->getSlice()->getPOC();  
 
Index: branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComLoopFilter.cpp
===================================================================
--- branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComLoopFilter.cpp	(revision 535)
+++ branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComLoopFilter.cpp	(revision 537)
@@ -461,5 +461,4 @@
         if ( ((piRefP0==piRefQ0)&&(piRefP1==piRefQ1)) || ((piRefP0==piRefQ1)&&(piRefP1==piRefQ0)) )
         {
-          uiBs = 0;
           if ( piRefP0 != piRefP1 )   // Different L0 & L1
           {
@@ -694,6 +693,4 @@
   for ( UInt iIdx = 0; iIdx < uiNumParts; iIdx++ )
   {
-    ucBs = 0;
-    
     uiBsAbsIdx = xCalcBsIdx( pcCU, uiAbsZorderIdx, iDir, iEdge, iIdx);
     ucBs = m_aapucBS[iDir][uiBsAbsIdx];
Index: branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComPrediction.cpp
===================================================================
--- branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComPrediction.cpp	(revision 535)
+++ branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComPrediction.cpp	(revision 537)
@@ -76,5 +76,4 @@
   m_acYuvPredBase[1].destroy();
 #endif
-
   if( m_pLumaRecBuffer )
   {
@@ -146,4 +145,5 @@
 Pel TComPrediction::predIntraGetPredValDC( Int* pSrc, Int iSrcStride, UInt iWidth, UInt iHeight, Bool bAbove, Bool bLeft )
 {
+  assert(iWidth > 0 && iHeight > 0);
   Int iInd, iSum = 0;
   Pel pDcVal;
@@ -934,5 +934,4 @@
   }
 #endif
-
   if ( yFrac == 0 )
   {
@@ -1246,5 +1245,4 @@
   return;
 }
-
 #if H_3D_IC
 /** Function for deriving the position of first non-zero binary bit of a value
Index: branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComRdCost.cpp
===================================================================
--- branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComRdCost.cpp	(revision 535)
+++ branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComRdCost.cpp	(revision 537)
@@ -570,5 +570,5 @@
 #endif
 
-#if RATE_CONTROL_LAMBDA_DOMAIN
+#if RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT
 UInt TComRdCost::getSADPart ( Int bitDepth, Pel* pelCur, Int curStride,  Pel* pelOrg, Int orgStride, UInt width, UInt height )
 {
@@ -636,5 +636,4 @@
     return xGetSADw( pcDtParam );
   }
-
 #if H_3D_IC
   if( pcDtParam->bUseIC )
@@ -643,5 +642,4 @@
   }
 #endif
-
   Pel* piOrg   = pcDtParam->pOrg;
   Pel* piCur   = pcDtParam->pCur;
@@ -675,5 +673,4 @@
     return xGetSADw( pcDtParam );
   }
-
 #if H_3D_IC
   if( pcDtParam->bUseIC )
@@ -682,5 +679,4 @@
   }
 #endif
-
   Pel* piOrg      = pcDtParam->pOrg;
   Pel* piCur      = pcDtParam->pCur;
@@ -718,5 +714,4 @@
     return xGetSADw( pcDtParam );
   }
-
 #if H_3D_IC
   if( pcDtParam->bUseIC )
@@ -725,5 +720,4 @@
   }
 #endif
-
   Pel* piOrg   = pcDtParam->pOrg;
   Pel* piCur   = pcDtParam->pCur;
@@ -770,5 +764,4 @@
     return xGetSADw( pcDtParam );
   }
-
 #if H_3D_IC
   if( pcDtParam->bUseIC )
@@ -777,5 +770,4 @@
   }
 #endif
-
   Pel* piOrg   = pcDtParam->pOrg;
   Pel* piCur   = pcDtParam->pCur;
@@ -820,5 +812,4 @@
   }
 #endif
-
   Pel* piOrg   = pcDtParam->pOrg;
   Pel* piCur   = pcDtParam->pCur;
@@ -867,5 +858,4 @@
     return xGetSADw( pcDtParam );
   }
-
 #if H_3D_IC
   if( pcDtParam->bUseIC )
@@ -874,5 +864,4 @@
   }
 #endif
-
   Pel* piOrg   = pcDtParam->pOrg;
   Pel* piCur   = pcDtParam->pCur;
@@ -935,5 +924,4 @@
     return xGetSADw( pcDtParam );
   }
-
 #if H_3D_IC
   if( pcDtParam->bUseIC )
@@ -942,5 +930,4 @@
   }
 #endif
-
   Pel* piOrg   = pcDtParam->pOrg;
   Pel* piCur   = pcDtParam->pCur;
@@ -996,5 +983,4 @@
     return xGetSADw( pcDtParam );
   }
-
 #if H_3D_IC
   if( pcDtParam->bUseIC )
@@ -1003,5 +989,4 @@
   }
 #endif
-
   Pel* piOrg   = pcDtParam->pOrg;
   Pel* piCur   = pcDtParam->pCur;
@@ -1096,5 +1081,4 @@
     return xGetSADw( pcDtParam );
   }
-
 #if H_3D_IC
   if( pcDtParam->bUseIC )
@@ -1103,5 +1087,4 @@
   }
 #endif
-
   Pel* piOrg   = pcDtParam->pOrg;
   Pel* piCur   = pcDtParam->pCur;
@@ -3420,5 +3403,4 @@
     return xGetHADsw( pcDtParam );
   }
-
 #if H_3D_IC
   if( pcDtParam->bUseIC )
@@ -3427,5 +3409,4 @@
   }
 #endif
-
   Pel* piOrg   = pcDtParam->pOrg;
   Pel* piCur   = pcDtParam->pCur;
Index: branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComRdCost.h
===================================================================
--- branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComRdCost.h	(revision 535)
+++ branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComRdCost.h	(revision 537)
@@ -209,4 +209,7 @@
 #if RATE_CONTROL_LAMBDA_DOMAIN
   Double  getLambda() { return m_dLambda; }
+#if M0036_RC_IMPROVEMENT
+  Double  getChromaWeight () {return((m_cbDistortionWeight+m_crDistortionWeight)/2.0);}
+#endif
 #endif
   
@@ -331,5 +334,5 @@
 #endif
 
-#if RATE_CONTROL_LAMBDA_DOMAIN
+#if RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT
   UInt   getSADPart ( Int bitDepth, Pel* pelCur, Int curStride,  Pel* pelOrg, Int orgStride, UInt width, UInt height );
 #endif
Index: branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComSlice.cpp
===================================================================
--- branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComSlice.cpp	(revision 535)
+++ branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComSlice.cpp	(revision 537)
@@ -60,8 +60,4 @@
 , m_deblockingFilterBetaOffsetDiv2 ( 0 )
 , m_deblockingFilterTcOffsetDiv2   ( 0 )
-#if !L0034_COMBINED_LIST_CLEANUP
-, m_bRefPicListModificationFlagLC ( false )
-, m_bRefPicListCombinationFlag    ( false )
-#endif
 , m_bCheckLDC                     ( false )
 , m_iSliceQpDelta                 ( 0 )
@@ -80,7 +76,4 @@
 #else
 , m_dLambda                       ( 0.0 )
-#endif
-#if !L0034_COMBINED_LIST_CLEANUP
-, m_bNoBackPredFlag               ( false )
 #endif
 , m_uiTLayer                      ( 0 )
@@ -131,28 +124,12 @@
 #endif
 {
-#if L0034_COMBINED_LIST_CLEANUP
   m_aiNumRefIdx[0] = m_aiNumRefIdx[1] = 0;
-#else
-  m_aiNumRefIdx[0] = m_aiNumRefIdx[1] = m_aiNumRefIdx[2] = 0;
-#endif
   
   initEqualRef();
   
-#if L0034_COMBINED_LIST_CLEANUP
   for ( Int idx = 0; idx < MAX_NUM_REF; idx++ )
   {
     m_list1IdxToList0Idx[idx] = -1;
   }
-#else
-  for(Int iNumCount = 0; iNumCount < MAX_NUM_REF_LC; iNumCount++)
-  {
-    m_iRefIdxOfLC[REF_PIC_LIST_0][iNumCount]=-1;
-    m_iRefIdxOfLC[REF_PIC_LIST_1][iNumCount]=-1;
-    m_eListIdFromIdxOfLC[iNumCount]=0;
-    m_iRefIdxFromIdxOfLC[iNumCount]=0;
-    m_iRefIdxOfL0FromRefIdxOfL1[iNumCount] = -1;
-    m_iRefIdxOfL1FromRefIdxOfL0[iNumCount] = -1;
-  }    
-#endif
   for(Int iNumCount = 0; iNumCount < MAX_NUM_REF; iNumCount++)
   {
@@ -213,16 +190,7 @@
   m_colRefIdx = 0;
   initEqualRef();
-#if !L0034_COMBINED_LIST_CLEANUP
-  m_bNoBackPredFlag = false;
-  m_bRefPicListCombinationFlag = false;
-  m_bRefPicListModificationFlagLC = false;
-#endif
   m_bCheckLDC = false;
   m_iSliceQpDeltaCb = 0;
   m_iSliceQpDeltaCr = 0;
-
-#if !L0034_COMBINED_LIST_CLEANUP
-  m_aiNumRefIdx[REF_PIC_LIST_C]      = 0;
-#endif
 
 #if H_3D_IV_MERGE
@@ -378,5 +346,4 @@
 }
 
-#if L0034_COMBINED_LIST_CLEANUP
 Void TComSlice::setList1IdxToList0Idx()
 {
@@ -395,79 +362,4 @@
   }
 }
-#else
-Void TComSlice::generateCombinedList()
-{
-  if(m_aiNumRefIdx[REF_PIC_LIST_C] > 0)
-  {
-    m_aiNumRefIdx[REF_PIC_LIST_C]=0;
-    for(Int iNumCount = 0; iNumCount < MAX_NUM_REF_LC; iNumCount++)
-    {
-      m_iRefIdxOfLC[REF_PIC_LIST_0][iNumCount]=-1;
-      m_iRefIdxOfLC[REF_PIC_LIST_1][iNumCount]=-1;
-      m_eListIdFromIdxOfLC[iNumCount]=0;
-      m_iRefIdxFromIdxOfLC[iNumCount]=0;
-      m_iRefIdxOfL0FromRefIdxOfL1[iNumCount] = -1;
-      m_iRefIdxOfL1FromRefIdxOfL0[iNumCount] = -1;
-    }
-
-    for (Int iNumRefIdx = 0; iNumRefIdx < MAX_NUM_REF; iNumRefIdx++)
-    {
-      if(iNumRefIdx < m_aiNumRefIdx[REF_PIC_LIST_0])
-      {
-        Bool bTempRefIdxInL2 = true;
-        for ( Int iRefIdxLC = 0; iRefIdxLC < m_aiNumRefIdx[REF_PIC_LIST_C]; iRefIdxLC++ )
-        {
-#if H_MV
-          if ( m_apcRefPicList[REF_PIC_LIST_0][iNumRefIdx]->getPOC() == m_apcRefPicList[m_eListIdFromIdxOfLC[iRefIdxLC]][m_iRefIdxFromIdxOfLC[iRefIdxLC]]->getPOC() &&
-               m_apcRefPicList[REF_PIC_LIST_0][iNumRefIdx]->getLayerId() == m_apcRefPicList[m_eListIdFromIdxOfLC[iRefIdxLC]][m_iRefIdxFromIdxOfLC[iRefIdxLC]]->getLayerId() )
-#else
-          if ( m_apcRefPicList[REF_PIC_LIST_0][iNumRefIdx]->getPOC() == m_apcRefPicList[m_eListIdFromIdxOfLC[iRefIdxLC]][m_iRefIdxFromIdxOfLC[iRefIdxLC]]->getPOC() )
-#endif 
-          {
-            m_iRefIdxOfL1FromRefIdxOfL0[iNumRefIdx] = m_iRefIdxFromIdxOfLC[iRefIdxLC];
-            m_iRefIdxOfL0FromRefIdxOfL1[m_iRefIdxFromIdxOfLC[iRefIdxLC]] = iNumRefIdx;
-            bTempRefIdxInL2 = false;
-            break;
-          }
-        }
-
-        if(bTempRefIdxInL2 == true)
-        { 
-          m_eListIdFromIdxOfLC[m_aiNumRefIdx[REF_PIC_LIST_C]] = REF_PIC_LIST_0;
-          m_iRefIdxFromIdxOfLC[m_aiNumRefIdx[REF_PIC_LIST_C]] = iNumRefIdx;
-          m_iRefIdxOfLC[REF_PIC_LIST_0][iNumRefIdx] = m_aiNumRefIdx[REF_PIC_LIST_C]++;
-        }
-      }
-
-      if(iNumRefIdx < m_aiNumRefIdx[REF_PIC_LIST_1])
-      {
-        Bool bTempRefIdxInL2 = true;
-        for ( Int iRefIdxLC = 0; iRefIdxLC < m_aiNumRefIdx[REF_PIC_LIST_C]; iRefIdxLC++ )
-        {
-#if H_MV
-          if ( m_apcRefPicList[REF_PIC_LIST_1][iNumRefIdx]->getPOC() == m_apcRefPicList[m_eListIdFromIdxOfLC[iRefIdxLC]][m_iRefIdxFromIdxOfLC[iRefIdxLC]]->getPOC() &&
-               m_apcRefPicList[REF_PIC_LIST_1][iNumRefIdx]->getLayerId() == m_apcRefPicList[m_eListIdFromIdxOfLC[iRefIdxLC]][m_iRefIdxFromIdxOfLC[iRefIdxLC]]->getLayerId() )
-#else
-          if ( m_apcRefPicList[REF_PIC_LIST_1][iNumRefIdx]->getPOC() == m_apcRefPicList[m_eListIdFromIdxOfLC[iRefIdxLC]][m_iRefIdxFromIdxOfLC[iRefIdxLC]]->getPOC() )
-#endif 
-          {
-            m_iRefIdxOfL0FromRefIdxOfL1[iNumRefIdx] = m_iRefIdxFromIdxOfLC[iRefIdxLC];
-            m_iRefIdxOfL1FromRefIdxOfL0[m_iRefIdxFromIdxOfLC[iRefIdxLC]] = iNumRefIdx;
-            bTempRefIdxInL2 = false;
-            break;
-          }
-        }
-        if(bTempRefIdxInL2 == true)
-        {
-          m_eListIdFromIdxOfLC[m_aiNumRefIdx[REF_PIC_LIST_C]] = REF_PIC_LIST_1;
-          m_iRefIdxFromIdxOfLC[m_aiNumRefIdx[REF_PIC_LIST_C]] = iNumRefIdx;
-          m_iRefIdxOfLC[REF_PIC_LIST_1][iNumRefIdx] = m_aiNumRefIdx[REF_PIC_LIST_C]++;
-        }
-      }
-    }
-  }
-}
-#endif
-
 #if H_MV
 Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic, std::vector<TComPic*>& refPicSetInterLayer , Bool checkNumPocTotalCurr)
@@ -506,4 +398,5 @@
   UInt NumPocLtCurr = 0;
   Int i;
+
   for(i=0; i < m_pcRPS->getNumberOfNegativePictures(); i++)
   {
@@ -585,5 +478,5 @@
     }
     
-    assert(numPocTotalCurr != 0);
+    assert(numPocTotalCurr > 0);
     
     m_aiNumRefIdx[0] = getNumRefIdx(REF_PIC_LIST_0);
@@ -617,4 +510,5 @@
     }
 #endif
+  assert(cIdx == numPocTotalCurr);
 
   if (m_eSliceType==B_SLICE)
@@ -645,4 +539,5 @@
       }
 #endif
+    assert(cIdx == numPocTotalCurr);
   }
 
@@ -673,12 +568,12 @@
   }
 #else
-
-  for (Int rIdx = 0; rIdx <= (m_aiNumRefIdx[0]-1); rIdx ++)
-  {
-    m_apcRefPicList[0][rIdx] = m_RefPicListModification.getRefPicListModificationFlagL0() ? rpsCurrList0[ m_RefPicListModification.getRefPicSetIdxL0(rIdx) ] : rpsCurrList0[rIdx % numPocTotalCurr];
-    m_bIsUsedAsLongTerm[0][rIdx] = m_RefPicListModification.getRefPicListModificationFlagL0() ? (m_RefPicListModification.getRefPicSetIdxL0(rIdx) >= (NumPocStCurr0 + NumPocStCurr1))
-                                  : ((rIdx % numPocTotalCurr) >= (NumPocStCurr0 + NumPocStCurr1));
-  }
-  if ( m_eSliceType == P_SLICE )
+  for (Int rIdx = 0; rIdx < m_aiNumRefIdx[0]; rIdx ++)
+  {
+    cIdx = m_RefPicListModification.getRefPicListModificationFlagL0() ? m_RefPicListModification.getRefPicSetIdxL0(rIdx) : rIdx % numPocTotalCurr;
+    assert(cIdx >= 0 && cIdx < numPocTotalCurr);
+    m_apcRefPicList[0][rIdx] = rpsCurrList0[ cIdx ];
+    m_bIsUsedAsLongTerm[0][rIdx] = ( cIdx >= NumPocStCurr0 + NumPocStCurr1 );
+  }
+  if ( m_eSliceType != B_SLICE )
   {
     m_aiNumRefIdx[1] = 0;
@@ -687,20 +582,16 @@
   else
   {
-    for (Int rIdx = 0; rIdx <= (m_aiNumRefIdx[1]-1); rIdx ++)
-    {
-      m_apcRefPicList[1][rIdx] = m_RefPicListModification.getRefPicListModificationFlagL1() ? rpsCurrList1[ m_RefPicListModification.getRefPicSetIdxL1(rIdx) ] : rpsCurrList1[rIdx % numPocTotalCurr];
-      m_bIsUsedAsLongTerm[1][rIdx] = m_RefPicListModification.getRefPicListModificationFlagL1() ?
-                                  (m_RefPicListModification.getRefPicSetIdxL1(rIdx) >= (NumPocStCurr0 + NumPocStCurr1)): ((rIdx % numPocTotalCurr) >= (NumPocStCurr0 + NumPocStCurr1));
-    }
-  }
-#endif
-}
-
-#if H_MV && !H_MV_FIX1071
-// Temporary fix for FIX1071 should be removed later
-Int TComSlice::getNumRpsCurrTempList( TComReferencePictureSet* rps /* = 0 */)
-#else
+    for (Int rIdx = 0; rIdx < m_aiNumRefIdx[1]; rIdx ++)
+    {
+      cIdx = m_RefPicListModification.getRefPicListModificationFlagL1() ? m_RefPicListModification.getRefPicSetIdxL1(rIdx) : rIdx % numPocTotalCurr;
+      assert(cIdx >= 0 && cIdx < numPocTotalCurr);
+      m_apcRefPicList[1][rIdx] = rpsCurrList1[ cIdx ];
+      m_bIsUsedAsLongTerm[1][rIdx] = ( cIdx >= NumPocStCurr0 + NumPocStCurr1 );
+    }
+  }
+#endif
+}
+
 Int TComSlice::getNumRpsCurrTempList()
-#endif
 {
   Int numRpsCurrTempList = 0;
@@ -710,19 +601,7 @@
     return 0;
   }
-#if H_MV && !H_MV_FIX1071
-// Temporary fix for FIX1071 should be removed later
-  if (rps == NULL)
-  {
-    rps = m_pcRPS; 
-  }
-
-  for(UInt i=0; i < rps->getNumberOfNegativePictures()+ rps->getNumberOfPositivePictures() + rps->getNumberOfLongtermPictures(); i++)
-  {
-    if(rps->getUsed(i))
-#else
   for(UInt i=0; i < m_pcRPS->getNumberOfNegativePictures()+ m_pcRPS->getNumberOfPositivePictures() + m_pcRPS->getNumberOfLongtermPictures(); i++)
   {
     if(m_pcRPS->getUsed(i))
-#endif
     {
       numRpsCurrTempList++;
@@ -945,36 +824,13 @@
   m_deblockingFilterTcOffsetDiv2 = pSrc->m_deblockingFilterTcOffsetDiv2;
   
-#if L0034_COMBINED_LIST_CLEANUP
   for (i = 0; i < 2; i++)
-#else
-  for (i = 0; i < 3; i++)
-#endif
   {
     m_aiNumRefIdx[i]     = pSrc->m_aiNumRefIdx[i];
   }
 
-#if L0034_COMBINED_LIST_CLEANUP
   for (i = 0; i < MAX_NUM_REF; i++)
   {
     m_list1IdxToList0Idx[i] = pSrc->m_list1IdxToList0Idx[i];
   } 
-#else
-  for (i = 0; i < 2; i++)
-  {
-    for (j = 0; j < MAX_NUM_REF_LC; j++)
-    {
-       m_iRefIdxOfLC[i][j]  = pSrc->m_iRefIdxOfLC[i][j];
-    }
-  }
-  for (i = 0; i < MAX_NUM_REF_LC; i++)
-  {
-    m_eListIdFromIdxOfLC[i] = pSrc->m_eListIdFromIdxOfLC[i];
-    m_iRefIdxFromIdxOfLC[i] = pSrc->m_iRefIdxFromIdxOfLC[i];
-    m_iRefIdxOfL1FromRefIdxOfL0[i] = pSrc->m_iRefIdxOfL1FromRefIdxOfL0[i];
-    m_iRefIdxOfL0FromRefIdxOfL1[i] = pSrc->m_iRefIdxOfL0FromRefIdxOfL1[i];
-  }
-  m_bRefPicListModificationFlagLC = pSrc->m_bRefPicListModificationFlagLC;
-  m_bRefPicListCombinationFlag    = pSrc->m_bRefPicListCombinationFlag;
-#endif
   m_bCheckLDC             = pSrc->m_bCheckLDC;
   m_iSliceQpDelta        = pSrc->m_iSliceQpDelta;
@@ -1014,4 +870,5 @@
 
   m_pcPic                = pSrc->m_pcPic;
+
   m_colFromL0Flag        = pSrc->m_colFromL0Flag;
   m_colRefIdx            = pSrc->m_colRefIdx;
@@ -1033,7 +890,4 @@
   }
 
-#if !L0034_COMBINED_LIST_CLEANUP
-  m_bNoBackPredFlag      = pSrc->m_bNoBackPredFlag;
-#endif
   m_uiTLayer                      = pSrc->m_uiTLayer;
   m_bTLayerSwitchingFlag          = pSrc->m_bTLayerSwitchingFlag;
@@ -1366,5 +1220,5 @@
 /** Function for constructing an explicit Reference Picture Set out of the available pictures in a referenced Reference Picture Set
 */
-#if FIX1071 && H_MV_FIX1071
+#if FIX1071
 Void TComSlice::createExplicitReferencePictureSetFromReference( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool isRAP)
 #else
@@ -1395,5 +1249,5 @@
         // and should be added to the explicit Reference Picture Set
         pcRPS->setDeltaPOC(k, pReferencePictureSet->getDeltaPOC(i));
-#if FIX1071 && H_MV_FIX1071
+#if FIX1071
         pcRPS->setUsed(k, pReferencePictureSet->getUsed(i) && (!isRAP));
 #else
@@ -1566,9 +1420,5 @@
   {
     m_numReorderPics[i] = 0;
-#if L0323_DPB
     m_uiMaxDecPicBuffering[i] = 1; 
-#else
-    m_uiMaxDecPicBuffering[i] = 0; 
-#endif
     m_uiMaxLatencyIncrease[i] = 0;
   }
@@ -2005,7 +1855,4 @@
 , m_pcmLog2MaxSize            (  5)
 , m_uiPCMLog2MinSize          (  7)
-#if !L0034_COMBINED_LIST_CLEANUP
-, m_bUseLComb                 (false)
-#endif
 , m_bitDepthY                 (  8)
 , m_bitDepthC                 (  8)
@@ -2037,9 +1884,5 @@
   {
     m_uiMaxLatencyIncrease[i] = 0;
-#if L0323_DPB
     m_uiMaxDecPicBuffering[i] = 1;
-#else
-    m_uiMaxDecPicBuffering[i] = 0;
-#endif
     m_numReorderPics[i]       = 0;
   }
@@ -2079,5 +1922,4 @@
   TComHRD *hrd = vui->getHrdParameters();
 
-#if L0043_TIMING_INFO
   TimingInfo *timingInfo = vui->getTimingInfo();
   timingInfo->setTimingInfoPresentFlag( true );
@@ -2103,28 +1945,4 @@
     break;
   }
-#else
-  hrd->setTimingInfoPresentFlag( true );
-  switch( frameRate )
-  {
-  case 24:
-    hrd->setNumUnitsInTick( 1125000 );    hrd->setTimeScale    ( 27000000 );
-    break;
-  case 25:
-    hrd->setNumUnitsInTick( 1080000 );    hrd->setTimeScale    ( 27000000 );
-    break;
-  case 30:
-    hrd->setNumUnitsInTick( 900900 );     hrd->setTimeScale    ( 27000000 );
-    break;
-  case 50:
-    hrd->setNumUnitsInTick( 540000 );     hrd->setTimeScale    ( 27000000 );
-    break;
-  case 60:
-    hrd->setNumUnitsInTick( 450450 );     hrd->setTimeScale    ( 27000000 );
-    break;
-  default:
-    hrd->setNumUnitsInTick( 1001 );       hrd->setTimeScale    ( 60000 );
-    break;
-  }
-#endif
 
   Bool rateCnt = ( bitRate > 0 );
@@ -2139,7 +1957,5 @@
     hrd->setDuCpbRemovalDelayLengthMinus1( 7 );                    // 8-bit precision ( plus 1 for last DU in AU )
     hrd->setSubPicCpbParamsInPicTimingSEIFlag( true );
-#if L0044_DU_DPB_OUTPUT_DELAY_HRD
     hrd->setDpbOutputDelayDuLengthMinus1( 5 + 7 );                 // With sub-clock tick factor of 100, at least 7 bits to have the same value as AU dpb delay
-#endif
   }
   else
@@ -2170,7 +1986,5 @@
   UInt birateValue, cpbSizeValue;
   UInt ducpbSizeValue;
-#if L0363_DU_BIT_RATE
   UInt duBitRateValue = 0;
-#endif
 
   for( i = 0; i < MAX_TLAYER; i ++ )
@@ -2184,7 +1998,5 @@
     cpbSizeValue = bitRate;                                     // 1 second
     ducpbSizeValue = bitRate/numDU;
-#if L0363_DU_BIT_RATE
     duBitRateValue = bitRate;
-#endif
     for( j = 0; j < ( hrd->getCpbCntMinus1( i ) + 1 ); j ++ )
     {
@@ -2197,7 +2009,5 @@
       hrd->setCpbSizeValueMinus1( i, j, 1, ( cpbSizeValue - 1 ) );
       hrd->setDuCpbSizeValueMinus1( i, j, 1, ( ducpbSizeValue - 1 ) );
-#if L0363_DU_BIT_RATE
       hrd->setDuBitRateValueMinus1( i, j, 1, ( duBitRateValue - 1 ) );
-#endif
       hrd->setCbrFlag( i, j, 1, ( j == 0 ) );
     }
@@ -2282,5 +2092,4 @@
 }
 #endif
-
 TComReferencePictureSet::TComReferencePictureSet()
 : m_numberOfPictures (0)
@@ -3167,10 +2976,8 @@
   , m_profileIdc      (0)
   , m_levelIdc        (0)
-#if L0046_CONSTRAINT_FLAGS
 , m_progressiveSourceFlag  (false)
 , m_interlacedSourceFlag   (false)
 , m_nonPackedConstraintFlag(false)
 , m_frameOnlyConstraintFlag(false)
-#endif
 {
   ::memset(m_profileCompatibilityFlag, 0, sizeof(m_profileCompatibilityFlag));
@@ -3205,4 +3012,3 @@
 }
 #endif
-
 //! \}
Index: branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComSlice.h
===================================================================
--- branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComSlice.h	(revision 535)
+++ branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComSlice.h	(revision 537)
@@ -190,10 +190,8 @@
   Int     m_levelIdc;
 
-#if L0046_CONSTRAINT_FLAGS
   Bool m_progressiveSourceFlag;
   Bool m_interlacedSourceFlag;
   Bool m_nonPackedConstraintFlag;
   Bool m_frameOnlyConstraintFlag;
-#endif
   
 public:
@@ -215,5 +213,4 @@
   Void  setLevelIdc(Int x)      { m_levelIdc = x; }
   
-#if L0046_CONSTRAINT_FLAGS
   Bool getProgressiveSourceFlag() const { return m_progressiveSourceFlag; }
   Void setProgressiveSourceFlag(Bool b) { m_progressiveSourceFlag = b; }
@@ -227,5 +224,4 @@
   Bool getFrameOnlyConstraintFlag() const { return m_frameOnlyConstraintFlag; }
   Void setFrameOnlyConstraintFlag(Bool b) { m_frameOnlyConstraintFlag = b; }
-#endif
 };
 
@@ -253,35 +249,4 @@
 };
 /// VPS class
-
-#if SIGNAL_BITRATE_PICRATE_IN_VPS
-class TComBitRatePicRateInfo
-{
-  Bool        m_bitRateInfoPresentFlag[MAX_TLAYER];
-  Bool        m_picRateInfoPresentFlag[MAX_TLAYER];
-  Int         m_avgBitRate[MAX_TLAYER];
-  Int         m_maxBitRate[MAX_TLAYER];
-  Int         m_constantPicRateIdc[MAX_TLAYER];
-  Int         m_avgPicRate[MAX_TLAYER];
-public:
-  TComBitRatePicRateInfo();
-  Bool        getBitRateInfoPresentFlag(Int i) {return m_bitRateInfoPresentFlag[i];}
-  Void        setBitRateInfoPresentFlag(Int i, Bool x) {m_bitRateInfoPresentFlag[i] = x;}
-
-  Bool        getPicRateInfoPresentFlag(Int i) {return m_picRateInfoPresentFlag[i];}
-  Void        setPicRateInfoPresentFlag(Int i, Bool x) {m_picRateInfoPresentFlag[i] = x;}
-
-  Int         getAvgBitRate(Int i) {return m_avgBitRate[i];}
-  Void        setAvgBitRate(Int i, Int x) {m_avgBitRate[i] = x;}
-
-  Int         getMaxBitRate(Int i) {return m_maxBitRate[i];}
-  Void        setMaxBitRate(Int i, Int x) {m_maxBitRate[i] = x;}
-
-  Int         getConstantPicRateIdc(Int i) {return m_constantPicRateIdc[i];}
-  Void        setConstantPicRateIdc(Int i, Int x) {m_constantPicRateIdc[i] = x;}
-
-  Int         getAvgPicRate(Int i) {return m_avgPicRate[i];}
-  Void        setAvgPicRate(Int i, Int x) {m_avgPicRate[i] = x;}
-};
-#endif
 
 struct HrdSubLayerInfo
@@ -296,7 +261,5 @@
   UInt ducpbSizeValue    [MAX_CPB_CNT][2];
   UInt cbrFlag           [MAX_CPB_CNT][2];
-#if L0363_DU_BIT_RATE
   UInt duBitRateValue    [MAX_CPB_CNT][2];
-#endif
 };
 
@@ -304,9 +267,4 @@
 {
 private:
-#if !L0043_TIMING_INFO
-  Bool m_timingInfoPresentFlag;
-  UInt m_numUnitsInTick;
-  UInt m_timeScale;
-#endif
   Bool m_nalHrdParametersPresentFlag;
   Bool m_vclHrdParametersPresentFlag;
@@ -315,7 +273,5 @@
   UInt m_duCpbRemovalDelayLengthMinus1;
   Bool m_subPicCpbParamsInPicTimingSEIFlag;
-#if L0044_DU_DPB_OUTPUT_DELAY_HRD
   UInt m_dpbOutputDelayDuLengthMinus1;
-#endif
   UInt m_bitRateScale;
   UInt m_cpbSizeScale;
@@ -329,12 +285,5 @@
 public:
   TComHRD()
-#if !L0043_TIMING_INFO
-  :m_timingInfoPresentFlag(false)
-  ,m_numUnitsInTick(1001)
-  ,m_timeScale(60000)
-  ,m_nalHrdParametersPresentFlag(0)
-#else
   :m_nalHrdParametersPresentFlag(0)
-#endif
   ,m_vclHrdParametersPresentFlag(0)
   ,m_subPicCpbParamsPresentFlag(false)
@@ -342,7 +291,5 @@
   ,m_duCpbRemovalDelayLengthMinus1(0)
   ,m_subPicCpbParamsInPicTimingSEIFlag(false)
-#if L0044_DU_DPB_OUTPUT_DELAY_HRD
   ,m_dpbOutputDelayDuLengthMinus1(0)
-#endif
   ,m_bitRateScale(0)
   ,m_cpbSizeScale(0)
@@ -353,14 +300,4 @@
 
   virtual ~TComHRD() {}
-#if !L0043_TIMING_INFO
-  Void setTimingInfoPresentFlag             ( Bool flag )  { m_timingInfoPresentFlag = flag;               }
-  Bool getTimingInfoPresentFlag             ( )            { return m_timingInfoPresentFlag;               }
-
-  Void setNumUnitsInTick                    ( UInt value ) { m_numUnitsInTick = value;                     }
-  UInt getNumUnitsInTick                    ( )            { return m_numUnitsInTick;                      }
-
-  Void setTimeScale                         ( UInt value ) { m_timeScale = value;                          }
-  UInt getTimeScale                         ( )            { return m_timeScale;                           }
-#endif
 
   Void setNalHrdParametersPresentFlag       ( Bool flag )  { m_nalHrdParametersPresentFlag = flag;         }
@@ -382,8 +319,6 @@
   Bool getSubPicCpbParamsInPicTimingSEIFlag ()             { return m_subPicCpbParamsInPicTimingSEIFlag;   }
 
-#if L0044_DU_DPB_OUTPUT_DELAY_HRD
   Void setDpbOutputDelayDuLengthMinus1      (UInt value )  { m_dpbOutputDelayDuLengthMinus1 = value;       }
   UInt getDpbOutputDelayDuLengthMinus1      ()             { return m_dpbOutputDelayDuLengthMinus1;        }
-#endif
 
   Void setBitRateScale                      ( UInt value ) { m_bitRateScale = value;                       }
@@ -426,8 +361,6 @@
   Void setDuCpbSizeValueMinus1     ( Int layer, Int cpbcnt, Int nalOrVcl, UInt value ) { m_HRD[layer].ducpbSizeValue[cpbcnt][nalOrVcl] = value;       }
   UInt getDuCpbSizeValueMinus1     ( Int layer, Int cpbcnt, Int nalOrVcl            )  { return m_HRD[layer].ducpbSizeValue[cpbcnt][nalOrVcl];        }
-#if L0363_DU_BIT_RATE
   Void setDuBitRateValueMinus1     ( Int layer, Int cpbcnt, Int nalOrVcl, UInt value ) { m_HRD[layer].duBitRateValue[cpbcnt][nalOrVcl] = value;       }
   UInt getDuBitRateValueMinus1     (Int layer, Int cpbcnt, Int nalOrVcl )              { return m_HRD[layer].duBitRateValue[cpbcnt][nalOrVcl];        }
-#endif
   Void setCbrFlag                ( Int layer, Int cpbcnt, Int nalOrVcl, UInt value ) { m_HRD[layer].cbrFlag[cpbcnt][nalOrVcl] = value;            }
   Bool getCbrFlag                ( Int layer, Int cpbcnt, Int nalOrVcl             ) { return m_HRD[layer].cbrFlag[cpbcnt][nalOrVcl];             }
@@ -435,10 +368,7 @@
   Void setNumDU                              ( UInt value ) { m_numDU = value;                            }
   UInt getNumDU                              ( )            { return m_numDU;          }
-#if L0045_CONDITION_SIGNALLING
   Bool getCpbDpbDelaysPresentFlag() { return getNalHrdParametersPresentFlag() || getVclHrdParametersPresentFlag(); }
-#endif
 };
 
-#if L0043_TIMING_INFO
 class TimingInfo
 {
@@ -471,5 +401,4 @@
   Void setNumTicksPocDiffOneMinus1          (Int x       ) { m_numTicksPocDiffOneMinus1 = x;               }
 };
-#endif
 
 class TComVPS
@@ -483,5 +412,5 @@
   UInt        m_numReorderPics[MAX_TLAYER];
   UInt        m_uiMaxDecPicBuffering[MAX_TLAYER]; 
-  UInt        m_uiMaxLatencyIncrease[MAX_TLAYER];
+  UInt        m_uiMaxLatencyIncrease[MAX_TLAYER]; // Really max latency increase plus 1 (value 0 expresses no limit)
 
   UInt        m_numHrdParameters;
@@ -507,11 +436,5 @@
   TComPTL     m_pcPTL;
 #endif
-#if SIGNAL_BITRATE_PICRATE_IN_VPS
-  TComBitRatePicRateInfo    m_bitRatePicRateInfo;
-#endif
-#if L0043_TIMING_INFO
   TimingInfo  m_timingInfo;
-#endif
-
 #if H_MV
   /// VPS EXTENSION SYNTAX ELEMENTS
@@ -648,10 +571,5 @@
   TComPTL* getPTL() { return &m_pcPTL; }
 #endif
-#if SIGNAL_BITRATE_PICRATE_IN_VPS
-  TComBitRatePicRateInfo *getBitratePicrateInfo() { return &m_bitRatePicRateInfo; }
-#endif
-#if L0043_TIMING_INFO
   TimingInfo* getTimingInfo() { return &m_timingInfo; }
-#endif
 #if H_MV
   Void    setAvcBaseLayerFlag( Bool val )                                  { m_avcBaseLayerFlag = val;  }
@@ -878,13 +796,9 @@
   Int  m_log2MaxMvLengthVertical;
   TComHRD m_hrdParameters;
-#if L0043_TIMING_INFO
   TimingInfo m_timingInfo;
-#else
-  Bool m_pocProportionalToTimingFlag;
-  Int  m_numTicksPocDiffOneMinus1;
-#endif
 #if H_MV
   Bool m_tileBoundariesAlignedFlag;
 #endif
+
 public:
   TComVUI()
@@ -918,8 +832,4 @@
     ,m_log2MaxMvLengthHorizontal(15)
     ,m_log2MaxMvLengthVertical(15)
-#if !L0043_TIMING_INFO  
-    ,m_pocProportionalToTimingFlag(false)
-    ,m_numTicksPocDiffOneMinus1(0)
-#endif
 #if H_MV
     ,m_tileBoundariesAlignedFlag(true)
@@ -1019,14 +929,7 @@
 
   TComHRD* getHrdParameters                 ()             { return &m_hrdParameters; }
-#if L0043_TIMING_INFO
   TimingInfo* getTimingInfo() { return &m_timingInfo; }
-#else
-  Bool getPocProportionalToTimingFlag() {return m_pocProportionalToTimingFlag; }
-  Void setPocProportionalToTimingFlag(Bool x) {m_pocProportionalToTimingFlag = x;}
-  Int  getNumTicksPocDiffOneMinus1() {return m_numTicksPocDiffOneMinus1;}
-  Void setNumTicksPocDiffOneMinus1(Int x) { m_numTicksPocDiffOneMinus1 = x;}
-#endif
-#if H_MV
-  Bool getTileBoundariesAlignedFlag(  ) { return m_tileBoundariesAlignedFlag; } 
+#if H_MV
+Bool getTileBoundariesAlignedFlag(  ) { return m_tileBoundariesAlignedFlag; } 
   Void setTileBoundariesAlignedFlag( Bool flag ) { m_tileBoundariesAlignedFlag = flag; } 
 #endif
@@ -1070,8 +973,4 @@
   Bool        m_useAMP;
 
-#if !L0034_COMBINED_LIST_CLEANUP
-  Bool        m_bUseLComb;
-#endif
-  
   // Parameter
   Int         m_bitDepthY;
@@ -1102,5 +1001,5 @@
   TComScalingList*     m_scalingList;   //!< ScalingList class pointer
   UInt        m_uiMaxDecPicBuffering[MAX_TLAYER]; 
-  UInt        m_uiMaxLatencyIncrease[MAX_TLAYER];
+  UInt        m_uiMaxLatencyIncrease[MAX_TLAYER];  // Really max latency increase plus 1 (value 0 expresses no limit)
 
   Bool        m_useDF;
@@ -1203,9 +1102,4 @@
   
   // Tool list
-#if !L0034_COMBINED_LIST_CLEANUP
-  Void setUseLComb    (Bool b)   { m_bUseLComb = b;         }
-  Bool getUseLComb    ()         { return m_bUseLComb;      }
-#endif
-
   Bool getUseLossless ()         { return m_useLossless; }
   Void setUseLossless ( Bool b ) { m_useLossless  = b; }
@@ -1554,18 +1448,6 @@
   Int         m_deblockingFilterBetaOffsetDiv2;    //< beta offset for deblocking filter
   Int         m_deblockingFilterTcOffsetDiv2;      //< tc offset for deblocking filter
-#if L0034_COMBINED_LIST_CLEANUP
   Int         m_list1IdxToList0Idx[MAX_NUM_REF];
   Int         m_aiNumRefIdx   [2];    //  for multiple reference of current slice
-#else
-  Int         m_aiNumRefIdx   [3];    //  for multiple reference of current slice
-
-  Int         m_iRefIdxOfLC[2][MAX_NUM_REF_LC];
-  Int         m_eListIdFromIdxOfLC[MAX_NUM_REF_LC];
-  Int         m_iRefIdxFromIdxOfLC[MAX_NUM_REF_LC];
-  Int         m_iRefIdxOfL1FromRefIdxOfL0[MAX_NUM_REF_LC];
-  Int         m_iRefIdxOfL0FromRefIdxOfL1[MAX_NUM_REF_LC];
-  Bool        m_bRefPicListModificationFlagLC;
-  Bool        m_bRefPicListCombinationFlag;
-#endif
 
   Bool        m_bCheckLDC;
@@ -1608,7 +1490,4 @@
 
   Bool        m_abEqualRef  [2][MAX_NUM_REF][MAX_NUM_REF];
-#if !L0034_COMBINED_LIST_CLEANUP
-  Bool        m_bNoBackPredFlag;
-#endif
   UInt        m_uiTLayer;
   Bool        m_bTLayerSwitchingFlag;
@@ -1685,5 +1564,4 @@
 #endif
 #endif
-
 public:
   TComSlice();
@@ -1761,5 +1639,4 @@
   UInt      getARPStepNum( )                                                         { return m_nARPStepNum;                                         }  
 #endif
-
   Int       getDepth            ()                              { return  m_iDepth;                     }
   UInt      getColFromL0Flag    ()                              { return  m_colFromL0Flag;              }
@@ -1769,22 +1646,6 @@
   Bool      getCheckLDC     ()                                  { return m_bCheckLDC; }
   Bool      getMvdL1ZeroFlag ()                                  { return m_bLMvdL1Zero;    }
-#if H_MV && !H_MV_FIX1071  // This is a temporary fix of the temporary fix L0177 
-  Int       getNumRpsCurrTempList( TComReferencePictureSet* rps = NULL );
-#else
   Int       getNumRpsCurrTempList();
-#endif
-#if L0034_COMBINED_LIST_CLEANUP
   Int       getList1IdxToList0Idx ( Int list1Idx )               { return m_list1IdxToList0Idx[list1Idx]; }
-#else
-  Int       getRefIdxOfLC       (RefPicList e, Int iRefIdx)     { return m_iRefIdxOfLC[e][iRefIdx];           }
-  Int       getListIdFromIdxOfLC(Int iRefIdx)                   { return m_eListIdFromIdxOfLC[iRefIdx];       }
-  Int       getRefIdxFromIdxOfLC(Int iRefIdx)                   { return m_iRefIdxFromIdxOfLC[iRefIdx];       }
-  Int       getRefIdxOfL0FromRefIdxOfL1(Int iRefIdx)            { return m_iRefIdxOfL0FromRefIdxOfL1[iRefIdx];}
-  Int       getRefIdxOfL1FromRefIdxOfL0(Int iRefIdx)            { return m_iRefIdxOfL1FromRefIdxOfL0[iRefIdx];}
-  Bool      getRefPicListModificationFlagLC()                   {return m_bRefPicListModificationFlagLC;}
-  Void      setRefPicListModificationFlagLC(Bool bflag)         {m_bRefPicListModificationFlagLC=bflag;}     
-  Bool      getRefPicListCombinationFlag()                      {return m_bRefPicListCombinationFlag;}
-  Void      setRefPicListCombinationFlag(Bool bflag)            {m_bRefPicListCombinationFlag=bflag;}   
-#endif
   Void      setReferenced(Bool b)                               { m_bRefenced = b; }
   Bool      isReferenced()                                      { return m_bRefenced; }
@@ -1861,11 +1722,5 @@
   
   static Void      sortPicList         ( TComList<TComPic*>& rcListPic );
-#if L0034_COMBINED_LIST_CLEANUP
   Void setList1IdxToList0Idx();
-#else
-  Bool getNoBackPredFlag() { return m_bNoBackPredFlag; }
-  Void setNoBackPredFlag( Bool b ) { m_bNoBackPredFlag = b; }
-  Void generateCombinedList       ();
-#endif
 
   UInt getTLayer             ()                            { return m_uiTLayer;                      }
@@ -1880,12 +1735,10 @@
   static Void markCurrPic                 ( TComPic* currPic );; 
   static Void markIvRefPicsAsUnused       ( TComPicLists* ivPicLists, std::vector<Int> targetDecLayerIdSet, TComVPS* vps, Int curLayerId, Int curPoc  );
-
-
-  Void xPrintRefPicList();
+  Void        xPrintRefPicList();
 #endif
   Bool isTemporalLayerSwitchingPoint( TComList<TComPic*>& rcListPic );
   Bool isStepwiseTemporalLayerSwitchingPointCandidate( TComList<TComPic*>& rcListPic );
   Int       checkThatAllRefPicsAreAvailable( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool printErrors, Int pocRandomAccess = 0);
-#if FIX1071 && H_MV_FIX1071
+#if FIX1071
   Void      createExplicitReferencePictureSetFromReference( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool isRAP);
 #else
@@ -2036,5 +1889,4 @@
 
 #endif
-
 protected:
   TComPic*  xGetRefPic  (TComList<TComPic*>& rcListPic,
Index: branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComTrQuant.cpp
===================================================================
--- branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComTrQuant.cpp	(revision 535)
+++ branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComTrQuant.cpp	(revision 537)
@@ -1075,13 +1075,12 @@
     Int iTransformShift = MAX_TR_DYNAMIC_RANGE - uiBitDepth - uiLog2TrSize;  // Represents scaling through forward transform
 
-    Int iQBits = QUANT_SHIFT + m_cQP.m_iPer + iTransformShift;                // Right shift of non-RDOQ quantizer;  level = (coeff*uiQ + offset)>>q_bits
-
-    iAdd = (pcCU->getSlice()->getSliceType()==I_SLICE ? 171 : 85) << (iQBits-9);
-
 #if ADAPTIVE_QP_SELECTION
-    iQBits = QUANT_SHIFT + cQpBase.m_iPer + iTransformShift;
+    Int iQBits = QUANT_SHIFT + cQpBase.m_iPer + iTransformShift;
     iAdd = (pcCU->getSlice()->getSliceType()==I_SLICE ? 171 : 85) << (iQBits-9);
     Int iQBitsC = QUANT_SHIFT + cQpBase.m_iPer + iTransformShift - ARL_C_PRECISION;  
     Int iAddC   = 1 << (iQBitsC-1);
+#else
+    Int iQBits = QUANT_SHIFT + m_cQP.m_iPer + iTransformShift;                // Right shift of non-RDOQ quantizer;  level = (coeff*uiQ + offset)>>q_bits
+    iAdd = (pcCU->getSlice()->getSliceType()==I_SLICE ? 171 : 85) << (iQBits-9);
 #endif
 
@@ -1347,13 +1346,10 @@
 #else
   Int j;
-  {
-    Short block[ 64 * 64 ];
-    Short coeff[ 64 * 64 ];
-    {
+  Short block[ 32 * 32 ];
+  Short coeff[ 32 * 32 ];
       for (j = 0; j < iHeight; j++)
       {    
         memcpy( block + j * iWidth, piBlkResi + j * uiStride, iWidth * sizeof( Short ) );
       }
-    }
     xTrMxN(bitDepth, block, coeff, iWidth, iHeight, uiMode );
     for ( j = 0; j < iHeight * iWidth; j++ )
@@ -1361,6 +1357,4 @@
       psCoeff[ j ] = coeff[ j ];
     }
-    return ;
-  }
 #endif  
 }
@@ -1382,6 +1376,6 @@
   Int j;
   {
-    Short block[ 64 * 64 ];
-    Short coeff[ 64 * 64 ];
+    Short block[ 32 * 32 ];
+    Short coeff[ 32 * 32 ];
     for ( j = 0; j < iHeight * iWidth; j++ )
     {    
@@ -1505,8 +1499,5 @@
                                                       UInt                            uiAbsPartIdx )
 {
-  Int    iQBits      = m_cQP.m_iBits;
-  Double dTemp       = 0;
   UInt uiLog2TrSize = g_aucConvertToBit[ uiWidth ] + 2;
-  Int uiQ = g_quantScales[m_cQP.rem()];
   
   UInt uiBitDepth = eTType == TEXT_LUMA ? g_bitDepthY : g_bitDepthC;
@@ -1519,6 +1510,5 @@
   assert(scalingListType < 6);
   
-  iQBits = QUANT_SHIFT + m_cQP.m_iPer + iTransformShift;                   // Right shift of non-RDOQ quantizer;  level = (coeff*uiQ + offset)>>q_bits
-  Double dErrScale   = 0;
+  Int iQBits = QUANT_SHIFT + m_cQP.m_iPer + iTransformShift;                   // Right shift of non-RDOQ quantizer;  level = (coeff*uiQ + offset)>>q_bits
   Double *pdErrScaleOrg = getErrScaleCoeff(scalingListType,uiLog2TrSize-2,m_cQP.m_iRem);
   Int *piQCoefOrg = getQuantCoeff(scalingListType,m_cQP.m_iRem,uiLog2TrSize-2);
@@ -1572,5 +1562,4 @@
   Double  d64BaseCost         = 0;
   Int     iLastScanPos        = -1;
-  dTemp                       = dErrScale;
   
   UInt    c1Idx     = 0;
@@ -1601,6 +1590,6 @@
       UInt    uiBlkPos          = scan[iScanPos];
       // set coeff
-      uiQ  = piQCoef[uiBlkPos];
-      dTemp = pdErrScale[uiBlkPos];
+      Int uiQ  = piQCoef[uiBlkPos];
+      Double dTemp = pdErrScale[uiBlkPos];
       Int lLevelDouble          = plSrcCoeff[ uiBlkPos ];
       lLevelDouble              = (Int)min<Int64>((Int64)abs((Int)lLevelDouble) * uiQ , MAX_INT - (1 << (iQBits - 1)));
Index: branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComWeightPrediction.cpp
===================================================================
--- branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComWeightPrediction.cpp	(revision 535)
+++ branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComWeightPrediction.cpp	(revision 537)
@@ -271,4 +271,6 @@
 Void TComWeightPrediction::getWpScaling( TComDataCU* pcCU, Int iRefIdx0, Int iRefIdx1, wpScalingParam *&wp0, wpScalingParam *&wp1)
 {
+  assert(iRefIdx0 >= 0 || iRefIdx1 >= 0);
+  
   TComSlice*      pcSlice       = pcCU->getSlice();
   TComPPS*        pps           = pcCU->getSlice()->getPPS();
Index: branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TypeDef.h	(revision 535)
+++ branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TypeDef.h	(revision 537)
@@ -41,5 +41,4 @@
 //! \ingroup TLibCommon
 //! \{
-
 /////////////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////// EXTENSION SELECTION ///////////////////////////////////  
@@ -204,42 +203,10 @@
 /////////////////////////////////////////////////////////////////////////////////////////
 
-#define FIX1071 1 ///< Temporary fix for issue #1071
-
-#define L0208_SOP_DESCRIPTION_SEI     1 ///< L0208: add SOP descrioption SEI
+#define FIX1071 1 ///< fix for issue #1071
+
 #define MAX_NUM_PICS_IN_SOP           1024
 
-#define K0180_SCALABLE_NESTING_SEI  1   ///JCTVC-K0180 scalable nesting sei message
 #define MAX_NESTING_NUM_OPS         1024
 #define MAX_NESTING_NUM_LAYER       64
-
-#define J0149_TONE_MAPPING_SEI        1 ///< J0149: Tone mapping information SEI
-#define L0363_DU_BIT_RATE             1 ///< L0363: add bit_rate_du_value_minus1 to HRD parameters
-#define L0328_SPLICING                1 ///< L0328: splicing support in HRD
-#define L0044_DU_DPB_OUTPUT_DELAY_HRD 1 ///< L0044: Include dpb_output_delay_du_length_minus1 in hrd_parameters(), dpb_output_du_delay in
-                                        ///<        picture timing SEI and DU information SEI
-#define L0045_PERSISTENCE_FLAGS  1      ///< L0045: Replace "repetition_period" syntax elements in SEI with "persistence_flag"
-#define L0045_NON_NESTED_SEI_RESTRICTIONS 1 ///< L0045; Include restriction on the order of APS and non-nested BP, PT and DU info SEI messages
-#define L0044_CPB_DPB_DELAY_OFFSET 1  ///< L0044: Include syntax elements cpb_delay_offset and dpb_delay_offset in the BP SEI message
-#define L0047_APS_FLAGS            1  ///< L0047: Include full_random_access_flag and no_param_set_update_flag in the active parameter set SEI message
-#define L0043_TIMING_INFO          1  ///< L0043: Timing information is signalled in VUI outside hrd_parameters()
-#define L0046_RENAME_PROG_SRC_IDC  1  ///< L0046: Rename progressive_source_idc to source_scan_type
-#define L0045_CONDITION_SIGNALLING 1  ///< L0045: Condition the signaling of some syntax elements in picture timing SEI message
-#define L0043_MSS_IDC 1
-#define L0116_ENTRY_POINT 1
-#define L0363_MORE_BITS 1
-#define L0363_MVP_POC 1
-#define L0363_BYTE_ALIGN 1
-#define L0363_SEI_ALLOW_SUFFIX 1
-#define L0323_LIMIT_DEFAULT_LIST_SIZE 1
-#define L0046_CONSTRAINT_FLAGS 1
-#define L0255_MOVE_PPS_FLAGS       1  ///< move some flags to earlier positions in the PPS
-#define L0444_FPA_TYPE             1  ///< allow only FPA types 3, 4 and 5
-#define L0372 1
-#define SIGNAL_BITRATE_PICRATE_IN_VPS               0  ///< K0125: Signal bit_rate and pic_rate in VPS
-#define L0232_RD_PENALTY           1  ///< L0232: RD-penalty for 32x32 TU for intra in non-intra slices
-#define L0386_DB_METRIC            1  ///< L0386: non-normative blockiness metric (automatically configures deblocking parameters in bitstream)
-#define L0323_DPB                     1 ///< L0323: Specification of active reference indices and decoded picture buffer
-
-#define L0034_COMBINED_LIST_CLEANUP 1
 
 #define MAX_VPS_NUM_HRD_PARAMETERS                1
@@ -254,5 +221,9 @@
 
 #define RATE_CONTROL_LAMBDA_DOMAIN                  1  ///< JCTVC-K0103, rate control by R-lambda model
-#define L0033_RC_BUGFIX                             1  ///< JCTVC-L0033, bug fix for R-lambda model based rate control
+#define M0036_RC_IMPROVEMENT                        1  ///< JCTVC-M0036, improvement for R-lambda model based rate control
+#define TICKET_1090_FIX                             1
+
+#define RC_FIX                                      1  /// suggested fix for M0036
+#define RATE_CONTROL_INTRA                          1  ///< JCTVC-M0257, rate control for intra 
 
 #define MAX_CPB_CNT                     32  ///< Upper bound of (cpb_cnt_minus1 + 1)
@@ -281,6 +252,4 @@
 
 #define REMOVE_SAO_LCU_ENC_CONSTRAINTS_3 1  ///< disable the encoder constraint that conditionally disable SAO for chroma for entire slice in interleaved mode
-
-#define REMOVE_SINGLE_SEI_EXTENSION_FLAGS 1 ///< remove display orientation SEI extension flag (there is a generic SEI extension mechanism now) 
 
 #define SAO_ENCODING_CHOICE              1  ///< I0184: picture early termination
@@ -601,7 +570,4 @@
   REF_PIC_LIST_0 = 0,   ///< reference list 0
   REF_PIC_LIST_1 = 1,   ///< reference list 1
-#if !L0034_COMBINED_LIST_CLEANUP
-  REF_PIC_LIST_C = 2,   ///< combined reference list for uni-prediction in B-Slices
-#endif
   REF_PIC_LIST_X = 100  ///< special mark
 };
