Index: trunk/source/Lib/TLibCommon/TComSlice.cpp
===================================================================
--- trunk/source/Lib/TLibCommon/TComSlice.cpp	(revision 100)
+++ trunk/source/Lib/TLibCommon/TComSlice.cpp	(revision 101)
@@ -1529,4 +1529,7 @@
 , m_cabacInitPresentFlag        (false)
 , m_encCABACTableIdx            (0)
+#if POZNAN_CABAC_INIT_FLAG_FIX
+, m_encPrevPOC            (0)
+#endif
 #endif
 {
Index: trunk/source/Lib/TLibCommon/TComSlice.h
===================================================================
--- trunk/source/Lib/TLibCommon/TComSlice.h	(revision 100)
+++ trunk/source/Lib/TLibCommon/TComSlice.h	(revision 101)
@@ -854,4 +854,7 @@
   Bool     m_cabacInitPresentFlag;
   UInt     m_encCABACTableIdx;           // Used to transmit table selection across slices
+#if POZNAN_CABAC_INIT_FLAG_FIX
+  UInt     m_encPrevPOC;
+#endif
 #endif
 #if DBL_CONTROL
@@ -986,4 +989,8 @@
   Bool     getCabacInitPresentFlag()                { return m_cabacInitPresentFlag;    }
   UInt     getEncCABACTableIdx()                    { return m_encCABACTableIdx;        }
+#if POZNAN_CABAC_INIT_FLAG_FIX
+  Void     setEncPrevPOC(UInt uiPOC)                { m_encPrevPOC = uiPOC;             }
+  UInt     getEncPrevPOC()                          { return m_encPrevPOC;              }
+#endif
 #endif
 #if DBL_CONTROL
Index: trunk/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- trunk/source/Lib/TLibCommon/TypeDef.h	(revision 100)
+++ trunk/source/Lib/TLibCommon/TypeDef.h	(revision 101)
@@ -42,30 +42,33 @@
 //! \{
 
-#define FIXES                           1
-#define LGE_EDGE_INTRA                  1       //JCT2-A0070
+#define FIXES                             1
+#define POZNAN_CABAC_INIT_FLAG_FIX        1
+
+
+#define LGE_EDGE_INTRA                    1   // JCT2-A0070
 #if LGE_EDGE_INTRA
-#define LGE_EDGE_INTRA_MIN_SIZE         4
-#define LGE_EDGE_INTRA_MAX_SIZE        32
-#define LGE_EDGE_INTRA_THRESHOLD       20
+#define LGE_EDGE_INTRA_MIN_SIZE           4
+#define LGE_EDGE_INTRA_MAX_SIZE           32
+#define LGE_EDGE_INTRA_THRESHOLD          20
 #define LGE_EDGE_INTRA_MAX_EDGE_NUM_PER_4x4 8
-#define LGE_EDGE_INTRA_DELTA_DC         1 
-#define LGE_EDGE_INTRA_PIXEL_DIFFERENCE 1
-#endif
-
-#define LG_ZEROINTRADEPTHRESI_M26039      1  //JCT2-A0087
-
+#define LGE_EDGE_INTRA_DELTA_DC           1 
+#define LGE_EDGE_INTRA_PIXEL_DIFFERENCE   1
+#endif
+
+#define LG_ZEROINTRADEPTHRESI_M26039      1   // JCT2-A0087
+                                        
 #define SONY_COLPIC_AVAILABILITY          1
-
+                                        
 #define HHI_INTER_VIEW_MOTION_PRED        1   // inter-view motion parameter prediction
 #define HHI_INTER_VIEW_RESIDUAL_PRED      1   // inter-view residual prediction
-#define QC_MULTI_DIS_CAN                  1         // JCT2-A0097
-#if QC_MULTI_DIS_CAN
+#define QC_MULTI_DIS_CAN                  1   // JCT2-A0097
+#if QC_MULTI_DIS_CAN                    
     #define DIS_CANS                      1
-#endif
-
-#define MTK_INTERVIEW_MERGE_A0049         1 //  JCT2-A0049 second part
-
-#define LGE_DVMCP                         1 //  JCT2-A0126     
-#if LGE_DVMCP
+#endif                                  
+                                        
+#define MTK_INTERVIEW_MERGE_A0049         1   //  JCT2-A0049 second part
+                                        
+#define LGE_DVMCP                         1   //  JCT2-A0126     
+#if LGE_DVMCP                           
 #define DVFROM_LEFTBELOW                  1
 #define DVFROM_LEFT                       2
@@ -82,5 +85,5 @@
 #define HHI_VSO_SYNTH_DIST_OUT            0
 #define HHI_VSO_COLOR_PLANES              1
-#define HHI_VSO_SPEEDUP_A033              1 // JCT2-A0033 modification 1 (changes classes directly related the renderer model 
+#define HHI_VSO_SPEEDUP_A0033             1 // JCT2-A0033 modification 1 (changes in classes directly related the renderer model 
                                             // to are not covered by this define, since nearly the entire class has been changed)
 #define HHI_VSO_RM_ASSERTIONS             0 // output VSO assertions
@@ -102,20 +105,20 @@
 #endif
 
-#define HHI_MPI                         1   // motion parameter inheritance from texture picture for depth map coding
-#define HHI_MPI_MERGE_POS               0
-#define HHI_FULL_PEL_DEPTH_MAP_MV_ACC   1   // full-pel mv accuracy for depth maps
-
-#if HHI_INTER_VIEW_MOTION_PRED
-#define SAIT_IMPROV_MOTION_PRED_M24829  1   // improved inter-view motion vector prediction
-#else
-#define SAIT_IMPROV_MOTION_PRED_M24829  0   
-#endif 
-
-#if HHI_INTER_VIEW_RESIDUAL_PRED
-#define LG_RESTRICTEDRESPRED_M24766     1   // restricted inter-view residual prediction
-#define QC_SIMPLIFIEDIVRP_M24938        1
-#else
-#define LG_RESTRICTEDRESPRED_M24766     0
-#define QC_SIMPLIFIEDIVRP_M24938        0
+#define HHI_MPI                           1   // motion parameter inheritance from texture picture for depth map coding
+#define HHI_MPI_MERGE_POS                 0
+#define HHI_FULL_PEL_DEPTH_MAP_MV_ACC     1   // full-pel mv accuracy for depth maps
+                                       
+#if HHI_INTER_VIEW_MOTION_PRED         
+#define SAIT_IMPROV_MOTION_PRED_M24829    1   // improved inter-view motion vector prediction
+#else                                  
+#define SAIT_IMPROV_MOTION_PRED_M24829    0   
+#endif                                 
+                                       
+#if HHI_INTER_VIEW_RESIDUAL_PRED       
+#define LG_RESTRICTEDRESPRED_M24766       1   // restricted inter-view residual prediction
+#define QC_SIMPLIFIEDIVRP_M24938          1
+#else                                  
+#define LG_RESTRICTEDRESPRED_M24766       0
+#define QC_SIMPLIFIEDIVRP_M24938          0
 #endif
 
@@ -125,17 +128,17 @@
 #define NO_COMBINED_PARALLEL              1 ///< Disallow any combined usage of parallel tools among Tile, EntropySlice and Wavefont
 
-#define LOSSLESS_CODING                   1  ///< H0530: lossless and lossy (mixed) coding
+#define LOSSLESS_CODING                   1 ///< H0530: lossless and lossy (mixed) coding
 #if LOSSLESS_CODING
-#define SEQUENCE_LEVEL_LOSSLESS           0  ///< H0530: used only for sequence or frame-level lossless coding
+#define SEQUENCE_LEVEL_LOSSLESS           0 ///< H0530: used only for sequence or frame-level lossless coding
 #endif
 
 #define PARALLEL_MERGE  1                   //< H0082 parallel merge/skip
-#define LOG2_PARALLEL_MERGE_LEVEL_MINUS2 0  //< H0082 parallel merge level 0-> 4x4, 1-> 8x8, 2->16x16, 3->32x32, 4->64x64
+#define LOG2_PARALLEL_MERGE_LEVEL_MINUS2  0 //< H0082 parallel merge level 0-> 4x4, 1-> 8x8, 2->16x16, 3->32x32, 4->64x64
 #if PARALLEL_MERGE && LOG2_PARALLEL_MERGE_LEVEL_MINUS2
-#define CU_BASED_MRG_CAND_LIST           1  //< H0240: single merge candidate list for all PUs inside a 8x8 CU conditioned on LOG2_PARALLEL_MERGE_LEVEL_MINUS2 > 0
-#endif
-#define MVP_AT_ENTROPYSLICE_BOUNDARY  1     //< H0362 enable motion prediction accross entropy slice boundary
-
-#define FAST_DECISION_FOR_MRG_RD_COST  1 ////< H0178: Fast Decision for Merge 2Nx2N RDCost
+#define CU_BASED_MRG_CAND_LIST            1  //< H0240: single merge candidate list for all PUs inside a 8x8 CU conditioned on LOG2_PARALLEL_MERGE_LEVEL_MINUS2 > 0
+#endif
+#define MVP_AT_ENTROPYSLICE_BOUNDARY      1  //< H0362 enable motion prediction accross entropy slice boundary
+
+#define FAST_DECISION_FOR_MRG_RD_COST     1  ////< H0178: Fast Decision for Merge 2Nx2N RDCost
 
 #define PIC_CROPPING              1 ///< Picture cropping and size constraints
@@ -700,5 +703,5 @@
 };
 
-#if HHI_VSO_SPEEDUP_A033
+#if HHI_VSO_SPEEDUP_A0033
 
 enum BlenMod
Index: trunk/source/Lib/TLibEncoder/TEncGOP.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 100)
+++ trunk/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 101)
@@ -448,5 +448,5 @@
 #endif
 
-#if HHI_VSO_SPEEDUP_A033
+#if HHI_VSO_SPEEDUP_A0033
 #else
     if ( iVSOMode == 4 )
Index: trunk/source/Lib/TLibEncoder/TEncGOP.h
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncGOP.h	(revision 100)
+++ trunk/source/Lib/TLibEncoder/TEncGOP.h	(revision 101)
@@ -137,5 +137,5 @@
   
   Void  preLoopFilterPicAll  ( TComPic* pcPic, UInt64& ruiDist, UInt64& ruiBits );
-#if HHI_VSO_SPEEDUP_A033
+#if HHI_VSO_SPEEDUP_A0033
   TEncTop* getEncTop() { return m_pcEncTop; }
 #endif
Index: trunk/source/Lib/TLibEncoder/TEncSbac.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncSbac.cpp	(revision 100)
+++ trunk/source/Lib/TLibEncoder/TEncSbac.cpp	(revision 101)
@@ -278,4 +278,8 @@
     m_pcSlice->getPPS()->setEncCABACTableIdx( I_SLICE );
   }  
+
+  #if CABAC_INIT_FLAG && POZNAN_CABAC_INIT_FLAG_FIX
+    m_pcSlice->getPPS()->setEncPrevPOC( m_pcSlice->getPOC() );
+  #endif
 }
 #endif
Index: trunk/source/Lib/TLibEncoder/TEncSlice.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncSlice.cpp	(revision 100)
+++ trunk/source/Lib/TLibEncoder/TEncSlice.cpp	(revision 101)
@@ -38,5 +38,5 @@
 #include "TEncTop.h"
 #include "TEncSlice.h"
-#if HHI_VSO_SPEEDUP_A033
+#if HHI_VSO_SPEEDUP_A0033
 #include "../../App/TAppEncoder/TAppEncTop.h"
 #endif
@@ -642,4 +642,17 @@
   m_uiPicDist       = 0;
   
+#if CABAC_INIT_FLAG && POZNAN_CABAC_INIT_FLAG_FIX
+  Bool bReset =(pcSlice->getPOC() == 0) || 
+    (pcSlice->getPOC() % m_pcCfg->getIntraPeriod() == 0) ||
+    (pcSlice->getPPS()->getEncPrevPOC() % m_pcCfg->getIntraPeriod() == 0) ||
+    (pcSlice->getPOC()/m_pcCfg->getIntraPeriod() > pcSlice->getPPS()->getEncPrevPOC()/m_pcCfg->getIntraPeriod()) ||
+    (m_pcGOPEncoder->getGOPSize() == 0);
+
+  if ( bReset && pcSlice->getPPS()->getCabacInitPresentFlag())
+  {
+    pcSlice->getPPS()->setEncCABACTableIdx(pcSlice->getSliceType()); // reset cabac initialization table index
+  };
+#endif
+
   // set entropy coder
   if( m_pcCfg->getUseSBACRD() )
@@ -787,5 +800,5 @@
   UInt uiTileLCUX     = 0;
 
-#if HHI_VSO_SPEEDUP_A033
+#if HHI_VSO_SPEEDUP_A0033
   Int iLastPosY = -1;
 #endif
@@ -802,5 +815,5 @@
     pcCU->initCU( rpcPic, uiCUAddr );
 
-#if HHI_VSO_SPEEDUP_A033
+#if HHI_VSO_SPEEDUP_A0033
     if ( m_pcRdCost->getUseRenModel() )
     {
Index: trunk/source/Lib/TLibRenderer/TRenImage.cpp
===================================================================
--- trunk/source/Lib/TLibRenderer/TRenImage.cpp	(revision 100)
+++ trunk/source/Lib/TLibRenderer/TRenImage.cpp	(revision 101)
@@ -106,5 +106,5 @@
 }
 
-#if HHI_VSO_SPEEDUP_A033
+#if HHI_VSO_SPEEDUP_A0033
 template<typename T>
 Void TRenImage<T>::getDataAndStrides( T** pptData, Int* piStrides )
Index: trunk/source/Lib/TLibRenderer/TRenImage.h
===================================================================
--- trunk/source/Lib/TLibRenderer/TRenImage.h	(revision 100)
+++ trunk/source/Lib/TLibRenderer/TRenImage.h	(revision 101)
@@ -69,5 +69,5 @@
   TRenImagePlane<T>** getPlanes() const;
 
-#if HHI_VSO_SPEEDUP_A033
+#if HHI_VSO_SPEEDUP_A0033
   Void getDataAndStrides( T**    pptData, Int*  piStrides );
   Void getWidthAndHeight( Int*  piWidths, Int*  piHeights );
Index: trunk/source/Lib/TLibRenderer/TRenModel.cpp
===================================================================
--- trunk/source/Lib/TLibRenderer/TRenModel.cpp	(revision 100)
+++ trunk/source/Lib/TLibRenderer/TRenModel.cpp	(revision 101)
@@ -635,5 +635,5 @@
 TRenModel::getSynthDepth( Int iModelNum, Int iViewNum, TComPicYuv* pcPicYuv )
 {
-#if HHI_VSO_SPEEDUP_A033
+#if HHI_VSO_SPEEDUP_A0033
   m_apcRenModels[iModelNum]->getSynthDepth(iViewNum, pcPicYuv, m_uiHorOff );
 #else
Index: trunk/source/Lib/TLibRenderer/TRenModel.h
===================================================================
--- trunk/source/Lib/TLibRenderer/TRenModel.h	(revision 100)
+++ trunk/source/Lib/TLibRenderer/TRenModel.h	(revision 101)
@@ -103,5 +103,5 @@
   Int m_iNumOfBaseViews;
 
-#if HHI_VSO_SPEEDUP_A033                 
+#if HHI_VSO_SPEEDUP_A0033                 
   // Horizontal Offset in input data
   UInt m_uiHorOff;          
