Index: trunk/source/Lib/TLibEncoder/TEncGOP.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 33)
+++ trunk/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 55)
@@ -337,12 +337,16 @@
     pcSlice->setNalUnitType(getNalUnitType(uiPOCCurr));
 #if REF_IDX_FRAMEWORK
-    if (m_layerId > 0 && (uiPOCCurr % m_pcCfg->getIntraPeriod() == 0))
+    if( m_layerId > 0 && (uiPOCCurr % m_pcCfg->getIntraPeriod() == 0) )
+    {
       pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_CRA);
+    }
     if( m_layerId > 0 && !m_pcEncTop->getElRapSliceTypeB() )
     {
       if( (pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA) &&
           (pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA) &&
-           pcSlice->getSliceType() == B_SLICE ) 
+           pcSlice->getSliceType() == B_SLICE )
+      {
         pcSlice->setSliceType(P_SLICE);
+      }
     }
 #endif
@@ -466,6 +470,8 @@
 
 #if REF_IDX_FRAMEWORK
-    if (pcSlice->getSliceType() == B_SLICE) 
+    if( pcSlice->getSliceType() == B_SLICE )
+    {
       pcSlice->setColFromL0Flag(1-uiColDir);
+    }
 #endif
 
@@ -774,4 +780,7 @@
     {
       pcPic->getPicYuvOrg()->copyToPic( pcPic->getPicYuvRec() );
+#if AVC_SYNTAX
+      pcPic->readBLSyntax( m_ppcTEncTop[0]->getBLSyntaxFile(), SYNTAX_BYTES );
+#endif
       return;
     }
Index: trunk/source/Lib/TLibEncoder/TEncSearch.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 33)
+++ trunk/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 55)
@@ -1057,5 +1057,5 @@
     pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, uiTrDepth, m_piYuvExt, m_iYuvExtStride, m_iYuvExtHeight, bAboveAvail, bLeftAvail );
     //===== get prediction signal =====
-#if INTRA_BL
+#if INTRA_BL && !NO_RESIDUAL_FLAG_FOR_BLPRED
     if(pcCU->isIntraBL ( uiAbsPartIdx ) )
     {
@@ -1259,5 +1259,5 @@
 
     //===== get prediction signal =====
-#if INTRA_BL
+#if INTRA_BL && !NO_RESIDUAL_FLAG_FOR_BLPRED
   if(pcCU->isIntraBL ( uiAbsPartIdx ) )
   {
Index: trunk/source/Lib/TLibEncoder/TEncTop.h
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncTop.h	(revision 33)
+++ trunk/source/Lib/TLibEncoder/TEncTop.h	(revision 55)
@@ -77,4 +77,7 @@
   static Int              m_iSPSIdCnt;                    ///< next Id number for SPS    
   static Int              m_iPPSIdCnt;                    ///< next Id number for PPS    
+#if AVC_SYNTAX
+  fstream*                m_pBLSyntaxFile;
+#endif
 #endif
   
@@ -223,4 +226,8 @@
 
   Void encodePrep( bool bEos, TComPicYuv* pcPicYuvOrg );
+#if AVC_SYNTAX
+  Void      setBLSyntaxFile( fstream* pFile ) { m_pBLSyntaxFile = pFile; }
+  fstream*  getBLSyntaxFile() { return m_pBLSyntaxFile; }
+#endif
 #else
   Void encode( bool bEos, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut,
