Index: /branches/HTM-13.1-dev0/source/App/TAppEncoder/TAppEncCfg.cpp
===================================================================
--- /branches/HTM-13.1-dev0/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 1171)
+++ /branches/HTM-13.1-dev0/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 1172)
@@ -1713,5 +1713,9 @@
   xConfirmPara( m_pchBaseViewCameraNumbers  == 0                ,   "BaseViewCameraNumbers must be given" );
 #if BUG_FIX_TK65
+#if HHI_CAM_PARA_K0052
+  xConfirmPara( m_iNumberOfViews != m_cCameraData.getBaseViewNumbers().size() ,   "Number of Views in BaseViewCameraNumbers must be equal to NumberOfViews" );
+#else
   xConfirmPara( ( ((UInt) m_numberOfLayers >> 1 ) != m_cCameraData.getBaseViewNumbers().size() ) && ( m_numberOfLayers != m_cCameraData.getBaseViewNumbers().size() ),   "Number of Views in BaseViewCameraNumbers must be equal to NumberOfViews" );
+#endif
 #else
   xConfirmPara( ((UInt) m_numberOfLayers >> 1 ) != m_cCameraData.getBaseViewNumbers().size(),   "Number of Views in BaseViewCameraNumbers must be equal to NumberOfViews" );
Index: /branches/HTM-13.1-dev0/source/App/TAppEncoder/TAppEncTop.cpp
===================================================================
--- /branches/HTM-13.1-dev0/source/App/TAppEncoder/TAppEncTop.cpp	(revision 1171)
+++ /branches/HTM-13.1-dev0/source/App/TAppEncoder/TAppEncTop.cpp	(revision 1172)
@@ -140,4 +140,9 @@
   xSetVPSVUI               ( vps ); 
 #if H_3D
+#if HHI_CAM_PARA_K0052
+  xSetCamPara              ( vps ); 
+#endif
+#endif
+#if H_3D
   m_ivPicLists.setVPS      ( &vps );
   xDeriveDltArray          ( vps, dlt );
@@ -224,8 +229,11 @@
     //====== Camera Parameters =========
     m_cTEncTop.setCameraParameters             ( &m_cCameraData );     
+#if !HHI_CAM_PARA_K0052
     m_cTEncTop.setCamParPrecision              ( m_cCameraData.getCamParsCodedPrecision  () );
     m_cTEncTop.setCamParInSliceHeader          ( m_cCameraData.getVaryingCameraParameters() );
+
     m_cTEncTop.setCodedScale                   ( m_cCameraData.getCodedScale             () );
     m_cTEncTop.setCodedOffset                  ( m_cCameraData.getCodedOffset            () );
+#endif
 #if H_3D_VSO
     //====== VSO =========
@@ -791,4 +799,5 @@
 {
 #if H_3D
+#if !HHI_CAM_PARA_K0052
   for ( Int viewIndex = 0; viewIndex < m_vps->getNumViews(); viewIndex++ )
   {
@@ -796,4 +805,5 @@
       m_cCameraData.getVaryingCameraParameters(), m_cCameraData.getCodedScale(), m_cCameraData.getCodedOffset() );
   }
+#endif
 #endif
 
@@ -2228,4 +2238,43 @@
   }
 }
+
+#if HHI_CAM_PARA_K0052
+#if H_3D
+Void TAppEncTop::xSetCamPara                ( TComVPS& vps )
+{
+  vps.setCpPrecision( m_cCameraData.getCamParsCodedPrecision()); 
+
+  for ( Int n = 1; n < vps.getNumViews(); n++ )
+  {  
+    Int i      = vps.getViewOIdxList( n ); 
+    Int iInVps = vps.getVoiInVps    ( i ); 
+    vps.setNumCp( iInVps,  n);   
+
+    if ( vps.getNumCp( iInVps ) > 0 )
+    {
+      vps.setCpInSliceSegmentHeaderFlag( iInVps, m_cCameraData.getVaryingCameraParameters() );
+
+      for( Int m = 0; m < vps.getNumCp( iInVps ); m++ )
+      {
+        vps.setCpRefVoi( iInVps, m, vps.getViewOIdxList( m ) ); 
+        if( !vps.getCpInSliceSegmentHeaderFlag( iInVps ) ) 
+        {
+          Int j = vps.getCpRefVoi( iInVps, m );
+          Int jInVps = vps.getVoiInVps( j );         
+
+          vps.setVpsCpScale   ( iInVps, jInVps, m_cCameraData.getCodedScale() [ jInVps ][ iInVps ] ) ;
+          vps.setVpsCpInvScale( iInVps, jInVps, m_cCameraData.getCodedScale() [ iInVps ][ jInVps ] ) ;
+          vps.setVpsCpOff     ( iInVps, jInVps, m_cCameraData.getCodedOffset()[ jInVps ][ iInVps ] ) ;
+          vps.setVpsCpInvOff  ( iInVps, jInVps, m_cCameraData.getCodedOffset()[ iInVps ][ jInVps ] ) ;
+        }
+      }
+    }
+  }
+  vps.deriveCpPresentFlag(); 
+}
+#endif
+#endif
+
+
 Bool TAppEncTop::xLayerIdInTargetEncLayerIdList(Int nuhLayerId)
 {
Index: /branches/HTM-13.1-dev0/source/App/TAppEncoder/TAppEncTop.h
===================================================================
--- /branches/HTM-13.1-dev0/source/App/TAppEncoder/TAppEncTop.h	(revision 1171)
+++ /branches/HTM-13.1-dev0/source/App/TAppEncoder/TAppEncTop.h	(revision 1172)
@@ -142,4 +142,9 @@
   Void xSetDpbSize                ( TComVPS& vps );
   Void xSetVPSVUI                 ( TComVPS& vps );
+#if HHI_CAM_PARA_K0052
+#if H_3D
+  Void xSetCamPara                ( TComVPS& vps );
+#endif
+#endif
   GOPEntry* xGetGopEntry( Int layerIdInVps, Int poc );
   Int  xGetMax( std::vector<Int>& vec);
Index: /branches/HTM-13.1-dev0/source/Lib/TAppCommon/TAppComCamPara.cpp
===================================================================
--- /branches/HTM-13.1-dev0/source/Lib/TAppCommon/TAppComCamPara.cpp	(revision 1171)
+++ /branches/HTM-13.1-dev0/source/Lib/TAppCommon/TAppComCamPara.cpp	(revision 1172)
@@ -399,4 +399,5 @@
 
 
+#if !HHI_CAM_PARA_K0052
 Void
 TAppComCamPara::xGetViewOrderIndices( const std::vector<Int>& raiId2SortedId, std::vector<Int>& raiVOIdx )
@@ -411,4 +412,5 @@
   }
 }
+#endif
 
 
@@ -447,25 +449,25 @@
     else
     {
-    Int     iBaseView  = m_aiBaseViews[ iBaseViewId ];
-    Double  dFL1, dFLX;
-    Double  dCP1, dCPX;
-    Double  dCS1, dCSX;
-    Double  dZN1, dZNX;
-    Double  dZF1, dZFX;
-    Bool    bInterpolated;
-    xGetGeometryData( iBaseView, m_uiFirstFrameId, dFL1, dCP1, dCS1, bInterpolated );  AOT( bInterpolated );
-    xGetZNearZFar   ( iBaseView, m_uiFirstFrameId, dZN1, dZF1 );
-
-    for( UInt uiFrameId = m_uiFirstFrameId + 1; !bChangeDetected && uiFrameId <= m_uiLastFrameId; uiFrameId++ )
-    {
-      xGetGeometryData( iBaseView, uiFrameId, dFLX, dCPX, dCSX, bInterpolated );  AOT( bInterpolated );
-      xGetZNearZFar   ( iBaseView, uiFrameId, dZNX, dZFX );
-
-      if( dFL1 != dFLX || dCP1 != dCPX || dCS1 != dCSX || dZN1 != dZNX || dZF1 != dZFX )
-      {
-        bChangeDetected = true;
-      }
-    }
-  }
+      Int     iBaseView  = m_aiBaseViews[ iBaseViewId ];
+      Double  dFL1, dFLX;
+      Double  dCP1, dCPX;
+      Double  dCS1, dCSX;
+      Double  dZN1, dZNX;
+      Double  dZF1, dZFX;
+      Bool    bInterpolated;
+      xGetGeometryData( iBaseView, m_uiFirstFrameId, dFL1, dCP1, dCS1, bInterpolated );  AOT( bInterpolated );
+      xGetZNearZFar   ( iBaseView, m_uiFirstFrameId, dZN1, dZF1 );
+
+      for( UInt uiFrameId = m_uiFirstFrameId + 1; !bChangeDetected && uiFrameId <= m_uiLastFrameId; uiFrameId++ )
+      {
+        xGetGeometryData( iBaseView, uiFrameId, dFLX, dCPX, dCSX, bInterpolated );  AOT( bInterpolated );
+        xGetZNearZFar   ( iBaseView, uiFrameId, dZNX, dZFX );
+
+        if( dFL1 != dFLX || dCP1 != dCPX || dCS1 != dCSX || dZN1 != dZNX || dZF1 != dZFX )
+        {
+          bChangeDetected = true;
+        }
+      }
+    }
   }
   return bChangeDetected;
@@ -721,14 +723,13 @@
   else
   {
-  Double  dScale, dOffset;
-  Bool    bInterpolated = xGetShiftParameterReal( uiSourceView, uiTargetView, uiFrame, false, bByIdx, dScale, dOffset );
-  AOT(    bInterpolated ); // must be base view
-
-  Double  dMultOffset   = (Double)( 1 << ( m_uiCamParsCodedPrecision + 1 ) );
-  Double  dMultScale    = (Double)( 1 << ( m_uiCamParsCodedPrecision + 1 + m_uiInputBitDepth ) );
-  riOffset              = (Int)floor( dMultOffset * dOffset + .5 );
-  riScale               = (Int)floor( dMultScale  * dScale  + .5 );
-}
-
+    Double  dScale, dOffset;
+    Bool    bInterpolated = xGetShiftParameterReal( uiSourceView, uiTargetView, uiFrame, false, bByIdx, dScale, dOffset );
+    AOT(    bInterpolated ); // must be base view
+
+    Double  dMultOffset   = (Double)( 1 << ( m_uiCamParsCodedPrecision + 1 ) );
+    Double  dMultScale    = (Double)( 1 << ( m_uiCamParsCodedPrecision + 1 + m_uiInputBitDepth ) );
+    riOffset              = (Int)floor( dMultOffset * dOffset + .5 );
+    riScale               = (Int)floor( dMultScale  * dScale  + .5 );
+  }
 }
 
@@ -958,4 +959,6 @@
 
 
+
+#if !HHI_CAM_PARA_K0052
 Void
 TAppComCamPara::xSetPdmConversionParams()
@@ -995,4 +998,5 @@
   }
 }
+#endif
 
 
@@ -1280,5 +1284,7 @@
 
   //===== set derived parameters =====
+#if !HHI_CAM_PARA_K0052
   xGetViewOrderIndices( m_aiBaseId2SortedId, m_aiViewOrderIndex );
+#endif
   m_bCamParsVaryOverTime = xGetCamParsChangeFlag();
 
Index: /branches/HTM-13.1-dev0/source/Lib/TAppCommon/TAppComCamPara.h
===================================================================
--- /branches/HTM-13.1-dev0/source/Lib/TAppCommon/TAppComCamPara.h	(revision 1171)
+++ /branches/HTM-13.1-dev0/source/Lib/TAppCommon/TAppComCamPara.h	(revision 1172)
@@ -85,5 +85,7 @@
 
   // SPS and slice header related variables
+#if !HHI_CAM_PARA_K0052
   std::vector<Int>    m_aiViewOrderIndex;                     ///< list of view order indices
+#endif
   UInt                m_uiCamParsCodedPrecision;              ///< precision for coding of camera parameters (x: max error in disparity is 2^(-x) luma samples)
   Bool                m_bCamParsVaryOverTime;                 ///< flag specifying whether camera parameters vary for given frame numbers
@@ -145,5 +147,7 @@
   // getting conversion parameters for disparity to virtual depth conversion
   Void  xGetCameraShifts          ( UInt uiSourceView, UInt uiTargetView, UInt uiFrame, Double& rdCamPosShift, Double& rdPicPosShift );
+#if !HHI_CAM_PARA_K0052
   Void  xSetPdmConversionParams   ();
+#endif
 
 public:
@@ -216,5 +220,7 @@
   Bool                getVaryingCameraParameters()  { return m_bCamParsVaryOverTime;    }
   UInt                getCamParsCodedPrecision  ()  { return m_uiCamParsCodedPrecision; }
+#if !HHI_CAM_PARA_K0052
   std::vector<Int>&   getViewOrderIndex         ()  { return m_aiViewOrderIndex;        }
+#endif
   Int**               getCodedScale             ()  { return m_aaiCodedScale;           }
   Int**               getCodedOffset            ()  { return m_aaiCodedOffset;          }
Index: /branches/HTM-13.1-dev0/source/Lib/TLibCommon/TComRom.cpp
===================================================================
--- /branches/HTM-13.1-dev0/source/Lib/TLibCommon/TComRom.cpp	(revision 1171)
+++ /branches/HTM-13.1-dev0/source/Lib/TLibCommon/TComRom.cpp	(revision 1172)
@@ -400,4 +400,5 @@
 Bool g_stopAtPos             = false; 
 Bool g_outputPos             = false; 
+Bool g_traceCameraParameters = true; 
 #endif
 #endif
@@ -601,10 +602,10 @@
 
   Bool stopFlag = false; 
-  if ( g_stopAtPos && poc == 0 && layerId == 1 )
+  if ( g_stopAtPos && poc == 0 && layerId == 2 )
   {
     Bool stopAtCU = true; 
     if ( stopAtCU )        // Stop at CU with specific size
     {    
-      stopFlag = ( cuPelX  == 888 ) && ( cuPelY  == 248 ) && ( cuWidth == 8 ) && ( cuHeight == 8); 
+      stopFlag = ( cuPelX  == 0 ) && ( cuPelY  == 0 ) && ( cuWidth == 16 ) && ( cuHeight == 16 ); 
     }
     else
Index: /branches/HTM-13.1-dev0/source/Lib/TLibCommon/TComRom.h
===================================================================
--- /branches/HTM-13.1-dev0/source/Lib/TLibCommon/TComRom.h	(revision 1171)
+++ /branches/HTM-13.1-dev0/source/Lib/TLibCommon/TComRom.h	(revision 1172)
@@ -230,5 +230,5 @@
 
 #ifndef ENC_DEC_TRACE
-#define ENC_DEC_TRACE   0
+#define ENC_DEC_TRACE   0 
 #endif
 
@@ -265,4 +265,5 @@
  extern Bool   g_stopAtPos;             // Stop at position
  extern Bool   g_outputPos;             // Output position
+ extern Bool   g_traceCameraParameters; // Trace camera parameters
 
 #define DTRACE_CU(x,y)             writeToTraceFile( x,y, g_traceCU );
Index: /branches/HTM-13.1-dev0/source/Lib/TLibCommon/TComSlice.cpp
===================================================================
--- /branches/HTM-13.1-dev0/source/Lib/TLibCommon/TComSlice.cpp	(revision 1171)
+++ /branches/HTM-13.1-dev0/source/Lib/TLibCommon/TComSlice.cpp	(revision 1172)
@@ -140,4 +140,7 @@
 , m_inCmpPredFlag                 ( false )
 #endif
+#if HHI_CAM_PARA_K0052
+, m_numViews                        ( 0    )
+#endif
 , m_depthToDisparityB             ( NULL )
 , m_depthToDisparityF             ( NULL )
@@ -211,5 +214,9 @@
   m_puiSubstreamSizes = NULL;
 #if H_3D
+#if HHI_CAM_PARA_K0052   
+  for( UInt i = 0; i < m_numViews; i++ )
+#else
   for( UInt i = 0; i < getViewIndex(); i++ )
+#endif
   {
     if ( m_depthToDisparityB && m_depthToDisparityB[ i ] )
@@ -221,5 +228,5 @@
     {
       delete[] m_depthToDisparityF [ i ];
-  }
+    }
   }
 
@@ -830,4 +837,23 @@
 Void TComSlice::setCamparaSlice( Int** aaiScale, Int** aaiOffset )
 {  
+#if HHI_CAM_PARA_K0052
+  Int voiInVps      = m_pcVPS->getVoiInVps(getViewIndex() ); 
+  if( m_pcVPS->getNumCp( voiInVps ) > 0 )
+  {    
+    if( m_pcVPS->getCpInSliceSegmentHeaderFlag( voiInVps ) )
+    {
+      for( Int m = 0; m < m_pcVPS->getNumCp( voiInVps ); m++ )
+      {      
+        Int j      = m_pcVPS->getCpRefVoi( voiInVps, m );
+        Int jInVps = m_pcVPS->getVoiInVps( j ); 
+
+        setCpScale   ( jInVps , aaiScale [ jInVps   ][ voiInVps ]);
+        setCpInvScale( jInVps , aaiScale [ voiInVps ][ jInVps   ]);
+        setCpOff     ( jInVps , aaiOffset[ jInVps   ][ voiInVps ]);
+        setCpInvOff  ( jInVps , aaiOffset[ voiInVps ][ jInVps   ]);
+      }
+    }
+  } 
+#else
   if( m_pcVPS->hasCamParInSliceHeader( m_viewIndex ) )
   {    
@@ -840,4 +866,5 @@
     }
   } 
+#endif
 }
 #endif
@@ -2254,6 +2281,15 @@
   Int i = 0, j = 0;
 
+#if HHI_CAM_PARA_K0052
+  m_numCp    = new Int [ iNumViews ];
+  m_cpRefVoi = new Int*[ iNumViews ];
+  m_cpInSliceSegmentHeaderFlag = new Bool[ iNumViews ];
+
+  m_cpPresentFlag  = new Bool*[ iNumViews ]; 
+#else
   m_bCamParPresent = new Bool[ iNumViews ];
   m_bCamParInSliceHeader = new Bool[ iNumViews ];
+#endif
+  
 
   m_aaaiCodedScale = new Int**[ iNumViews ];
@@ -2261,8 +2297,24 @@
   for ( i = 0; i < iNumViews ; i++ )
   {
+#if HHI_CAM_PARA_K0052
+    m_cpInSliceSegmentHeaderFlag[i] = false;     
+#else
     m_bCamParPresent[i] = false; 
     m_bCamParInSliceHeader[i] = false; 
+#endif
+    
     m_aaaiCodedScale[i] = new Int*[ 2 ];
     m_aaaiCodedOffset[i] = new Int*[ 2 ];
+
+#if HHI_CAM_PARA_K0052
+    m_numCp   [i] = 0; 
+    m_cpRefVoi[i] = new Int[ iNumViews ];
+    m_cpPresentFlag[i] = new Bool[ iNumViews ]; 
+    for ( j = 0; j < iNumViews; j++)
+    {
+      m_cpRefVoi[i][j] = 0; 
+      m_cpPresentFlag[i][j] = false; 
+    }
+#endif
     for ( j = 0; j < 2; j++ )
     {
@@ -2283,4 +2335,5 @@
   Int i = 0, j = 0;
 
+#if !HHI_CAM_PARA_K0052
   if ( m_bCamParPresent != NULL )
   {
@@ -2291,4 +2344,35 @@
     delete [] m_bCamParInSliceHeader;
   }
+#else
+  if ( m_numCp != NULL )
+  {
+    delete [] m_numCp;
+  }
+
+  if ( m_cpRefVoi != NULL )
+  {
+    for ( i = 0; i < iNumViews ; i++ )
+    {
+      delete [] m_cpRefVoi[i];
+    }
+    delete[] m_cpRefVoi; 
+  }
+
+  if ( m_cpPresentFlag != NULL )
+  {
+    for ( i = 0; i < iNumViews ; i++ )
+    {
+      delete [] m_cpPresentFlag[i];
+    }
+    delete[] m_cpPresentFlag; 
+  }
+
+
+  if ( m_cpInSliceSegmentHeaderFlag != NULL )
+  {
+    delete [] m_cpInSliceSegmentHeaderFlag;
+  }
+#endif
+
 
   if ( m_aaaiCodedScale != NULL )
@@ -2320,6 +2404,6 @@
 
 
-Void
-  TComVPS::initCamParaVPS( UInt uiViewIndex, Bool bCamParPresent, UInt uiCamParPrecision, Bool bCamParSlice, Int** aaiScale, Int** aaiOffset )
+#if !HHI_CAM_PARA_K0052
+Void TComVPS::initCamParaVPS( UInt uiViewIndex, Bool bCamParPresent, UInt uiCamParPrecision, Bool bCamParSlice, Int** aaiScale, Int** aaiOffset )
 {
   AOT( uiViewIndex != 0 && !bCamParSlice && ( aaiScale == 0 || aaiOffset == 0 ) );  
@@ -2340,4 +2424,5 @@
   }
 }
+#endif
 
 #endif // H_3D
@@ -2774,5 +2859,7 @@
 #endif
 #if H_3D
+#if !HHI_CAM_PARA_K0052
 , m_bCamParInSliceHeader      (false)
+#endif
 #endif
 {
@@ -3990,5 +4077,5 @@
 #if H_3D_NBDV_REF
   setupLUT = setupLUT || getDepthRefinementFlag( );
-#endif 
+#endif  
 
 #if H_3D_IV_MERGE
@@ -4000,9 +4087,17 @@
     return; 
 
+#if HHI_CAM_PARA_K0052
+  m_numViews = getVPS()->getNumViews(); 
+#endif
   /// GT: Allocation should be moved to a better place later; 
   if ( m_depthToDisparityB == NULL )
   {
+#if HHI_CAM_PARA_K0052    
+    m_depthToDisparityB = new Int*[ m_numViews ];
+    for ( Int i = 0; i < getVPS()->getNumViews(); i++ )
+#else
     m_depthToDisparityB = new Int*[ getViewIndex() ];
     for ( Int i = 0; i < getViewIndex(); i++ )
+#endif
     {
       m_depthToDisparityB[ i ] = new Int[ Int(1 << g_bitDepthY) ]; 
@@ -4010,8 +4105,14 @@
   }
 
+  
   if ( m_depthToDisparityF == NULL )
   {
+#if HHI_CAM_PARA_K0052    
+    m_depthToDisparityF = new Int*[ m_numViews ];
+    for ( Int i = 0; i < m_numViews; i++ )
+#else
     m_depthToDisparityF= new Int*[ getViewIndex() ];
     for ( Int i = 0; i < getViewIndex(); i++ )
+#endif
     {
       m_depthToDisparityF[ i ] = new Int[ Int(1 << g_bitDepthY) ]; 
@@ -4024,5 +4125,37 @@
   TComVPS* vps = getVPS(); 
 
+#if HHI_CAM_PARA_K0052
+  Int log2Div = g_bitDepthY - 1 + vps->getCpPrecision();
+  Int voiInVps = vps->getVoiInVps( getViewIndex() ); 
+  Bool camParaSH = vps->getCpInSliceSegmentHeaderFlag( voiInVps );  
+
+  Int* codScale     = camParaSH ? m_aaiCodedScale [ 0 ] : vps->getCodedScale    ( voiInVps ); 
+  Int* codOffset    = camParaSH ? m_aaiCodedOffset[ 0 ] : vps->getCodedOffset   ( voiInVps ); 
+  Int* invCodScale  = camParaSH ? m_aaiCodedScale [ 1 ] : vps->getInvCodedScale ( voiInVps ); 
+  Int* invCodOffset = camParaSH ? m_aaiCodedOffset[ 1 ] : vps->getInvCodedOffset( voiInVps ); 
+
+
+  for (Int i = 0; i < voiInVps; i++)
+  {
+    Int iInVoi = vps->getVoiInVps( i ); 
+#if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC
+    if ( g_traceCameraParameters )
+    {
+      std::cout << std::endl << "Cp: " << codScale   [ iInVoi ] << " " <<    codOffset[ iInVoi ] << " "
+                << invCodScale[ iInVoi ] << " " << invCodOffset[ iInVoi ] << " " << log2Div; 
+    }
+#endif
+    for ( Int d = 0; d <= ( ( 1 << g_bitDepthY ) - 1 ); d++ )
+    {      
+      Int offset =    ( codOffset  [ iInVoi ] << g_bitDepthY ) + ( ( 1 << log2Div ) >> 1 );         
+      m_depthToDisparityB[ iInVoi ][ d ] = ( codScale [ iInVoi ] * d + offset ) >> log2Div; 
+
+      Int invOffset = ( invCodOffset[ iInVoi ] << g_bitDepthY ) + ( ( 1 << log2Div ) >> 1 );         
+      m_depthToDisparityF[ iInVoi ][ d ] = ( invCodScale[ iInVoi ] * d + invOffset ) >> log2Div; 
+    }
+  }
+#else
   Int log2Div = g_bitDepthY - 1 + vps->getCamParPrecision();
+
   Int viewIndex = getViewIndex();
 
@@ -4045,4 +4178,5 @@
     }
   }
+#endif
 }
 #endif
@@ -4091,9 +4225,5 @@
   Bool depthOfRefViewsAvailFlag = false; 
   Bool textOfCurViewAvailFlag = false; 
-#endif
-
-  
-
-#if !HHI_INTER_COMP_PRED_K0052
+
   TComVPS* vps = getVPS(); 
 
@@ -4171,6 +4301,11 @@
   m_ivMvScalingFlag        = sps3dExt->getIvMvScalingFlag      ( depthFlag )                                 ;                             
   m_ivResPredFlag          = sps3dExt->getIvResPredFlag        ( depthFlag ) && nRLLG0                       ;                               
+#if HHI_CAM_PARA_K0052
+  m_depthRefinementFlag    = sps3dExt->getDepthRefinementFlag  ( depthFlag )           && getInCompPredFlag() && m_cpAvailableFlag;
+  m_viewSynthesisPredFlag  = sps3dExt->getViewSynthesisPredFlag( depthFlag ) && nRLLG0 && getInCompPredFlag() && m_cpAvailableFlag;
+#else
   m_depthRefinementFlag    = sps3dExt->getDepthRefinementFlag  ( depthFlag )           && getInCompPredFlag();                            
-  m_viewSynthesisPredFlag  = sps3dExt->getViewSynthesisPredFlag( depthFlag ) && nRLLG0 && getInCompPredFlag();                          
+  m_viewSynthesisPredFlag  = sps3dExt->getViewSynthesisPredFlag( depthFlag ) && nRLLG0 && getInCompPredFlag();                            
+#endif
   m_depthBasedBlkPartFlag  = sps3dExt->getDepthBasedBlkPartFlag( depthFlag )           && getInCompPredFlag();                          
   m_mpiFlag                = sps3dExt->getMpiFlag              ( depthFlag )           && getInCompPredFlag();
Index: /branches/HTM-13.1-dev0/source/Lib/TLibCommon/TComSlice.h
===================================================================
--- /branches/HTM-13.1-dev0/source/Lib/TLibCommon/TComSlice.h	(revision 1171)
+++ /branches/HTM-13.1-dev0/source/Lib/TLibCommon/TComSlice.h	(revision 1172)
@@ -914,7 +914,15 @@
   // VPS EXTENSION 2 SYNTAX ELEMENTS
 #if H_3D
+#if HHI_CAM_PARA_K0052  
+  Int*        m_numCp;  
+  Int**       m_cpRefVoi;
+  Bool**      m_cpPresentFlag; 
+  Int         m_cpPrecision;
+  Bool*       m_cpInSliceSegmentHeaderFlag;
+#else
   UInt        m_uiCamParPrecision;
   Bool*       m_bCamParInSliceHeader;
   Bool*       m_bCamParPresent;
+#endif
   Int         ***m_aaaiCodedScale ;
   Int         ***m_aaaiCodedOffset;
@@ -1188,7 +1196,14 @@
 #if HHI_VIEW_ID_LIST_I5_J0107 || HHI_INTER_COMP_PRED_K0052
   Int     getViewOIdxList( Int i )                                         { return m_viewOIdxList[i]; }
+#if HHI_CAM_PARA_K0052
+  std::vector<Int> getViewOIdxList( )                                               { return m_viewOIdxList; }
+#endif
 #endif
 #if HHI_INTER_COMP_PRED_K0052
+#if HHI_CAM_PARA_K0052
+  Int     getVoiInVps( Int viewOIdx )                                      
+#else
   Int     getInvViewOIdxList( Int viewOIdx )                                      
+#endif
   {    
     for ( Int i = 0; i < m_viewOIdxList.size(); i++ )
@@ -1202,6 +1217,12 @@
     return -1; 
   }; 
+
+#if HHI_CAM_PARA_K0052
+  Bool    getViewCompLayerPresentFlag (Int i, Bool d ) { return  m_viewCompLayerPresentFlag[ getVoiInVps(i) ][d]; }
+  Bool    getViewCompLayerId          (Int i, Bool d ) { return  m_viewCompLayerId         [ getVoiInVps(i) ][d]; }
+#else
   Bool    getViewCompLayerPresentFlag (Int i, Bool d ) { return  m_viewCompLayerPresentFlag[ getInvViewOIdxList(i) ][d]; }
   Bool    getViewCompLayerId          (Int i, Bool d ) { return  m_viewCompLayerId         [ getInvViewOIdxList(i) ][d]; }
+#endif
 #endif
   Bool    getDependencyFlag( Int i, Int j )                                { return m_dependencyFlag[i][j]; }
@@ -1325,5 +1346,61 @@
   Void createCamPars(Int iNumViews);
   Void deleteCamPars();
+#if HHI_CAM_PARA_K0052
+  Void initCamParaVPS( Int vOIdxInVps, Int numCp, Bool cpInSliceSegmentHeaderFlag, Int* cpRefVoi, Int** aaiScale, Int** aaiOffset ); 
+#else
   Void initCamParaVPS      (  UInt uiViewIndex, Bool bCamParPresent = false, UInt uiCamParPrecision = 0, Bool bCamParSlice = false, Int** aaiScale = 0, Int** aaiOffset = 0 );
+#endif
+  
+#if HHI_CAM_PARA_K0052
+
+  Void setCpPrecision( Int  val ) { m_cpPrecision = val; } 
+  Int  getCpPrecision(  ) { return m_cpPrecision; } 
+
+  Void setNumCp( Int i, Int  val ) { m_numCp[i] = val; } 
+  Int  getNumCp( Int i )           { return m_numCp[i]; } 
+
+  Void setCpRefVoi( Int i, Int m, Int  val ) { m_cpRefVoi[i][m] = val; } 
+  Int  getCpRefVoi( Int i, Int m )           { return m_cpRefVoi[i][m]; }   
+  
+  Void setCpInSliceSegmentHeaderFlag( Int i, Bool flag ) { m_cpInSliceSegmentHeaderFlag[i] = flag; } 
+  Bool getCpInSliceSegmentHeaderFlag( Int i )            { return m_cpInSliceSegmentHeaderFlag[i]; } 
+  
+  Void setVpsCpScale( Int i, Int j, Int  val ) { m_aaaiCodedScale [i][0][j] = val; } 
+  Int  getVpsCpScale( Int i, Int j ) { return m_aaaiCodedScale[i][0][j]; } 
+
+  Void setVpsCpOff( Int i, Int j, Int  val ) { m_aaaiCodedOffset[i][0][j] = val; } 
+  Int  getVpsCpOff( Int i, Int j ) { return m_aaaiCodedOffset[i][0][j]; } 
+
+  Void setVpsCpInvScale( Int i, Int j, Int  val ) { m_aaaiCodedScale[i][1][j] = val; } 
+  Int  getVpsCpInvScale( Int i, Int j ) { return m_aaaiCodedScale[i][1][j]; } 
+
+  Void setVpsCpInvOff( Int i, Int j, Int  val ) { m_aaaiCodedOffset[i][1][j] = val; } 
+  Int  getVpsCpInvOff( Int i, Int j ) { return m_aaaiCodedOffset[i][1][j]; } 
+
+// Derived
+  Void deriveCpPresentFlag( )
+  {
+    for( Int nInVps = 0; nInVps < getNumViews(); nInVps++  )
+    {
+      for( Int mInVps = 0; mInVps < getNumViews(); mInVps++ )
+      {
+        m_cpPresentFlag[nInVps][mInVps] = 0; 
+      }
+    }
+
+   for( Int n = 1; n < getNumViews(); n++ )
+   {
+      Int iInVps = getVoiInVps(  getViewOIdxList( n ) );      
+      for( Int m = 0; m < getNumCp( iInVps ); m++ )
+      {
+         m_cpPresentFlag[ iInVps ][ getVoiInVps( getCpRefVoi( iInVps, m ) ) ] = 1;
+      }
+    }
+  }
+
+  Void setCpPresentFlag( Int i, Int m, Bool flag ) { m_cpPresentFlag[i][m] = flag; } 
+  Bool getCpPresentFlag( Int i, Int m )           { return m_cpPresentFlag[i][m]; }   
+
+#else
   UInt getCamParPrecision    ()  { return m_uiCamParPrecision; }
   Bool getCamParPresent      ( Int viewIndex )  { return m_bCamParPresent[viewIndex]; }
@@ -1331,4 +1408,7 @@
   Bool hasCamParInSliceHeader( Int viewIndex )  { return m_bCamParInSliceHeader[viewIndex]; }
   Void setHasCamParInSliceHeader( Int viewIndex, Bool b )  { m_bCamParInSliceHeader[viewIndex] = b; }
+#endif
+
+
   Int* getCodedScale         ( Int viewIndex )  { return m_aaaiCodedScale [viewIndex][0]; }
   Int* getCodedOffset        ( Int viewIndex )  { return m_aaaiCodedOffset[viewIndex][0]; }
@@ -1802,6 +1882,8 @@
 #if H_3D
   TComSps3dExtension m_sps3dExtension; 
+#if !HHI_CAM_PARA_K0052
   UInt        m_uiCamParPrecision;
   Bool        m_bCamParInSliceHeader;
+#endif
   Int         m_aaiCodedScale [2][MAX_NUM_LAYERS];
   Int         m_aaiCodedOffset[2][MAX_NUM_LAYERS];
@@ -2447,4 +2529,8 @@
   Bool       m_inCmpPredFlag; 
 #endif
+#if HHI_CAM_PARA_K0052
+  Bool       m_cpAvailableFlag; 
+  Int        m_numViews; 
+#endif
   TComPic*   m_ivPicsCurrPoc [2][MAX_NUM_LAYERS];  
   Int**      m_depthToDisparityB; 
@@ -2551,4 +2637,7 @@
 #if HHI_INTER_COMP_PRED_K0052
   Bool      getInCmpPredAvailFlag( )                             { return m_inCmpPredAvailFlag;    } 
+#if HHI_CAM_PARA_K0052
+  Bool      getCpAvailableFlag( )                             { return m_cpAvailableFlag;    } 
+#endif
   Bool      getInCompPredFlag( )                                 { return m_inCmpPredFlag;         }    
   Void      setInCompPredFlag( Bool b )                          { m_inCmpPredFlag = b;            }    
@@ -2795,4 +2884,18 @@
   Int*      getInvCodedScale      ()  { return m_aaiCodedScale [1]; }
   Int*      getInvCodedOffset     ()  { return m_aaiCodedOffset[1]; }
+#if HHI_CAM_PARA_K0052
+  Void      setCpScale( Int j, Int  val ) { m_aaiCodedScale[0][j] = val; } 
+  Int       getCpScale( Int j ) { return m_aaiCodedScale[0][j]; } 
+            
+  Void      setCpOff( Int j, Int  val ) { m_aaiCodedOffset[0][j] = val; } 
+  Int       getCpOff( Int j ) { return m_aaiCodedOffset[0][j]; } 
+            
+  Void      setCpInvScale( Int j, Int  val ) { m_aaiCodedScale[1][j] = val; } 
+  Int       getCpInvScale( Int j ) { return m_aaiCodedScale[1][j]; } 
+            
+  Void      setCpInvOff( Int j, Int  val ) { m_aaiCodedOffset[1][j] = val; } 
+  Int       getCpInvOff( Int j ) { return m_aaiCodedOffset[1][j]; } 
+#endif
+
 #endif
 #endif
@@ -2801,6 +2904,11 @@
   Void    setDepthToDisparityLUTs();
 
+#if HHI_CAM_PARA_K0052
+  Int* getDepthToDisparityB( Int refViewIdx ) { return m_depthToDisparityB[ getVPS()->getVoiInVps( refViewIdx) ]; }; 
+  Int* getDepthToDisparityF( Int refViewIdx ) { return m_depthToDisparityF[ getVPS()->getVoiInVps( refViewIdx) ]; }; 
+#else
   Int* getDepthToDisparityB( Int refViewIdx ) { return m_depthToDisparityB[ refViewIdx ]; }; 
   Int* getDepthToDisparityF( Int refViewIdx ) { return m_depthToDisparityF[ refViewIdx ]; }; 
+#endif
 #endif
 #if H_3D_IC
@@ -2922,5 +3030,8 @@
     }
 
-    // m_cpAvailableFlag = true;
+#if HHI_CAM_PARA_K0052
+    m_cpAvailableFlag = true;
+    m_inCmpRefViewIdcs.clear();
+#endif
     Bool allRefCmpLayersAvailFlag = true;
 
@@ -2928,8 +3039,10 @@
     {
       m_inCmpRefViewIdcs.push_back( getVPS()->getViewOrderIdx( curCmpLIds[ i ] ));
-      //if( !getVPS()->getCpPresentFlag( getViewIdx(),  inCmpRefViewIdcs( i ) ) )
-      //{
-      //  m_cpAvailableFlag = false;
-      //}
+#if HHI_CAM_PARA_K0052
+      if( !getVPS()->getCpPresentFlag( getVPS()->getVoiInVps( getViewIndex() ),  getVPS()->getVoiInVps( m_inCmpRefViewIdcs[ i ] ) ) )
+      {
+        m_cpAvailableFlag = false;
+      }
+#endif
       Bool refCmpCurLIdAvailFlag = false;
       if( getVPS()->getViewCompLayerPresentFlag( m_inCmpRefViewIdcs[ i ], !getIsDepth() ) )
Index: /branches/HTM-13.1-dev0/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- /branches/HTM-13.1-dev0/source/Lib/TLibCommon/TypeDef.h	(revision 1171)
+++ /branches/HTM-13.1-dev0/source/Lib/TLibCommon/TypeDef.h	(revision 1172)
@@ -334,6 +334,6 @@
 #define HHI_INTER_COMP_PRED_K0052              1
 #define HHI_RES_PRED_K0052                     1
+#define HHI_CAM_PARA_K0052                     1
 #define H_3D_ANNEX_SELECTION_FIX               1
-
 #endif
 #define H_MV_FIX_REF_LAYER_PIC_FLAG            1
Index: /branches/HTM-13.1-dev0/source/Lib/TLibDecoder/TDecCAVLC.cpp
===================================================================
--- /branches/HTM-13.1-dev0/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 1171)
+++ /branches/HTM-13.1-dev0/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 1172)
@@ -93,4 +93,5 @@
 TDecCavlc::TDecCavlc()
 {
+#if !HHI_CAM_PARA_K0052
 #if H_3D
   m_aaiTempScale            = new Int* [ MAX_NUM_LAYERS ];
@@ -102,8 +103,10 @@
   }
 #endif
+#endif
 }
 
 TDecCavlc::~TDecCavlc()
 {
+#if !HHI_CAM_PARA_K0052
 #if H_3D
   for( UInt uiVId = 0; uiVId < MAX_NUM_LAYERS; uiVId++ )
@@ -114,4 +117,5 @@
   delete [] m_aaiTempScale;
   delete [] m_aaiTempOffset;
+#endif
 #endif
 }
@@ -1925,6 +1929,36 @@
 Void TDecCavlc::parseVPS3dExtension( TComVPS* pcVPS )
 {
+#if HHI_CAM_PARA_K0052
+  UInt uiCode;   
+  READ_UVLC( uiCode, "cp_precision"); pcVPS->setCpPrecision( uiCode ) ;
+  
+  for (Int n = 1; n < pcVPS->getNumViews(); n++)
+  {
+    Int i      = pcVPS->getViewOIdxList( n );
+    Int iInVps = pcVPS->getVoiInVps( i ); 
+    READ_CODE( 6, uiCode, "num_cp" ); pcVPS->setNumCp( iInVps, uiCode );
+
+    if( pcVPS->getNumCp( iInVps ) > 0 )
+    {
+      READ_FLAG( uiCode, "cp_in_slice_segment_header_flag" ); pcVPS->setCpInSliceSegmentHeaderFlag( iInVps, uiCode == 1 );
+      for( Int m = 0; m < pcVPS->getNumCp( iInVps ); m++ )
+      {
+        READ_UVLC( uiCode, "cp_ref_voi" ); pcVPS->setCpRefVoi( iInVps, m, uiCode );
+        if( !pcVPS->getCpInSliceSegmentHeaderFlag( iInVps ) )
+        {
+          Int j      = pcVPS->getCpRefVoi( iInVps, m );
+          Int jInVps = pcVPS->getVoiInVps( j ); 
+          Int iCode;
+          READ_SVLC( iCode, "vps_cp_scale" );                pcVPS->setVpsCpScale   ( iInVps, jInVps, iCode );
+          READ_SVLC( iCode, "vps_cp_off" );                  pcVPS->setVpsCpOff     ( iInVps, jInVps, iCode );
+          READ_SVLC( iCode, "vps_cp_inv_scale_plus_scale" ); pcVPS->setVpsCpInvScale( iInVps, jInVps, iCode - pcVPS->getVpsCpScale( iInVps, jInVps ) );
+          READ_SVLC( iCode, "vps_cp_inv_off_plus_off" );     pcVPS->setVpsCpInvOff  ( iInVps, jInVps, iCode - pcVPS->getVpsCpOff  ( iInVps, jInVps ) );
+        }
+      }
+    }    
+  }
+  pcVPS->deriveCpPresentFlag(); 
+#else
   UInt uiCode; 
-
 
   UInt uiCamParPrecision = 0; 
@@ -1975,4 +2009,5 @@
     }
   }
+#endif
 }
 #endif
@@ -2731,4 +2766,23 @@
     rpcSlice->setLFCrossSliceBoundaryFlag( (uiCode==1)?true:false);
 
+#if HHI_CAM_PARA_K0052
+#if H_3D
+    if ( getDecTop()->decProcAnnexI() )
+    {
+      Int voiInVps = vps->getVoiInVps( rpcSlice->getViewIndex() ); 
+      if( vps->getCpInSliceSegmentHeaderFlag( voiInVps ) && !rpcSlice->getIsDepth() )
+      {
+        for( Int m = 0; m < vps->getNumCp( voiInVps ); m++ )
+        {
+          Int jInVps = vps->getVoiInVps( vps->getCpRefVoi( voiInVps, m ));
+          READ_SVLC( iCode, "cp_scale" );                rpcSlice->setCpScale   ( jInVps, iCode );
+          READ_SVLC( iCode, "cp_off" );                  rpcSlice->setCpOff     ( jInVps, iCode );
+          READ_SVLC( iCode, "cp_inv_scale_plus_scale" ); rpcSlice->setCpInvScale( jInVps, iCode - rpcSlice->getCpScale   ( jInVps ));
+          READ_SVLC( iCode, "cp_inv_off_plus_off" );     rpcSlice->setCpInvOff  ( jInVps, iCode - rpcSlice->getCpOff     ( jInVps ));
+        }
+      }
+    }
+#endif
+#endif
   }
   
@@ -2754,4 +2808,5 @@
   }
 
+#if !HHI_CAM_PARA_K0052
 #if H_3D
 #if H_3D_FCO
@@ -2771,4 +2826,5 @@
     rpcSlice->setCamparaSlice( m_aaiTempScale, m_aaiTempOffset );
   }
+#endif
 #endif
 
Index: /branches/HTM-13.1-dev0/source/Lib/TLibDecoder/TDecCAVLC.h
===================================================================
--- /branches/HTM-13.1-dev0/source/Lib/TLibDecoder/TDecCAVLC.h	(revision 1171)
+++ /branches/HTM-13.1-dev0/source/Lib/TLibDecoder/TDecCAVLC.h	(revision 1172)
@@ -66,7 +66,10 @@
   void  parseShortTermRefPicSet            (TComSPS* pcSPS, TComReferencePictureSet* pcRPS, Int idx);
   
+
+#if !HHI_CAM_PARA_K0052
 #if H_3D
   Int**    m_aaiTempScale;
   Int**    m_aaiTempOffset;
+#endif
 #endif
 #if H_3D_ANNEX_SELECTION_FIX
Index: /branches/HTM-13.1-dev0/source/Lib/TLibDecoder/TDecCu.cpp
===================================================================
--- /branches/HTM-13.1-dev0/source/Lib/TLibDecoder/TDecCu.cpp	(revision 1171)
+++ /branches/HTM-13.1-dev0/source/Lib/TLibDecoder/TDecCu.cpp	(revision 1172)
@@ -290,4 +290,15 @@
 #if H_MV_ENC_DEC_TRAC
   DTRACE_CU_S("=========== coding_unit ===========\n")
+#if H_MV_ENC_DEC_TRAC
+#if ENC_DEC_TRACE
+    stopAtPos  ( pcCU->getSlice()->getPOC(), 
+    pcCU->getSlice()->getLayerId(), 
+    uiLPelX,
+    uiTPelY,
+    uiRPelX-uiLPelX+1, 
+    uiBPelY-uiTPelY+1);
+#endif
+#endif
+
 #endif
 
@@ -640,15 +651,4 @@
   
   m_ppcCU[uiDepth]->copySubCU( pcCU, uiAbsPartIdx, uiDepth );
-  
-#if H_MV_ENC_DEC_TRAC
-#if ENC_DEC_TRACE
-  stopAtPos  ( m_ppcCU[uiDepth]->getSlice()->getPOC(), 
-    m_ppcCU[uiDepth]->getSlice()->getLayerId(), 
-    m_ppcCU[uiDepth]->getCUPelX(),
-    m_ppcCU[uiDepth]->getCUPelY(),
-    m_ppcCU[uiDepth]->getWidth(0), 
-    m_ppcCU[uiDepth]->getHeight(0) );
-#endif
-#endif
 
   switch( m_ppcCU[uiDepth]->getPredictionMode(0) )
Index: /branches/HTM-13.1-dev0/source/Lib/TLibDecoder/TDecSbac.cpp
===================================================================
--- /branches/HTM-13.1-dev0/source/Lib/TLibDecoder/TDecSbac.cpp	(revision 1171)
+++ /branches/HTM-13.1-dev0/source/Lib/TLibDecoder/TDecSbac.cpp	(revision 1172)
@@ -2215,5 +2215,5 @@
   
   m_pcTDecBinIf->decodeBin( uiSymbol, m_cDBBPFlagSCModel.get( 0, 0, 0 ) );
-  
+  DTRACE_CU("dbbp_flag", uiSymbol)
   PartSize ePartSize = pcCU->getPartitionSize( uiAbsPartIdx );
   AOF( ePartSize == SIZE_2NxN || ePartSize == SIZE_Nx2N );
Index: /branches/HTM-13.1-dev0/source/Lib/TLibDecoder/TDecTop.cpp
===================================================================
--- /branches/HTM-13.1-dev0/source/Lib/TLibDecoder/TDecTop.cpp	(revision 1171)
+++ /branches/HTM-13.1-dev0/source/Lib/TLibDecoder/TDecTop.cpp	(revision 1172)
@@ -76,5 +76,9 @@
   xDeleteArray( m_adBaseViewShiftLUT, MAX_NUM_LAYERS, MAX_NUM_LAYERS, 2 );
   xDeleteArray( m_aiBaseViewShiftLUT, MAX_NUM_LAYERS, MAX_NUM_LAYERS, 2 );
+#if HHI_CAM_PARA_K0052
+  xDeleteArray( m_receivedIdc, m_vps->getNumViews() );
+#else
   xDeleteArray( m_receivedIdc, m_uiMaxViewIndex + 1 );
+#endif
 }
 
@@ -91,4 +95,44 @@
   m_firstReceivedPoc        = -2; 
 
+#if HHI_CAM_PARA_K0052  
+  for (Int i = 0; i <= vps->getMaxLayersMinus1(); i++)
+  {
+    Int curViewIdxInVps = m_vps->getVoiInVps( m_vps->getViewIndex( m_vps->getLayerIdInNuh( i ) ) ) ; 
+    m_bCamParsVaryOverTime = m_bCamParsVaryOverTime || vps->getCpInSliceSegmentHeaderFlag( curViewIdxInVps );    
+  }
+
+  assert( m_receivedIdc == NULL ); 
+  m_receivedIdc = new Int*[ m_vps->getNumViews() ]; 
+  for (Int i = 0; i < m_vps->getNumViews(); i++)
+  {
+    m_receivedIdc[i] = new Int[ m_vps->getNumViews() ]; 
+  }
+
+  xResetReceivedIdc( true ); 
+
+  for (Int voiInVps = 0; voiInVps < m_vps->getNumViews(); voiInVps++ )
+  {
+    if( !m_vps->getCpInSliceSegmentHeaderFlag( voiInVps ) ) 
+    {
+      for (Int baseVoiInVps = 0; baseVoiInVps < m_vps->getNumViews(); baseVoiInVps++ )
+      { 
+        if( m_vps->getCpPresentFlag( voiInVps, baseVoiInVps ) )
+        {
+          m_receivedIdc   [ baseVoiInVps ][ voiInVps ] = -1; 
+          m_aaiCodedScale [ baseVoiInVps ][ voiInVps ] = m_vps->getCodedScale    (voiInVps) [ baseVoiInVps ];
+          m_aaiCodedOffset[ baseVoiInVps ][ voiInVps ] = m_vps->getCodedOffset   (voiInVps) [ baseVoiInVps ];
+
+          m_receivedIdc   [ voiInVps ][ baseVoiInVps ] = -1; 
+          m_aaiCodedScale [ voiInVps ][ baseVoiInVps ] = m_vps->getInvCodedScale (voiInVps) [ baseVoiInVps ];
+          m_aaiCodedOffset[ voiInVps ][ baseVoiInVps ] = m_vps->getInvCodedOffset(voiInVps) [ baseVoiInVps ];
+          xInitLUTs( baseVoiInVps, voiInVps, m_aaiCodedScale[ baseVoiInVps ][ voiInVps ], m_aaiCodedOffset[ baseVoiInVps ][ voiInVps ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT );
+          xInitLUTs( voiInVps, baseVoiInVps, m_aaiCodedScale[ voiInVps ][ baseVoiInVps ], m_aaiCodedOffset[ voiInVps ][ baseVoiInVps ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT );
+        }
+      }
+    }
+  }
+}
+
+#else
   m_uiMaxViewIndex            = -1; 
   for (Int i = 0; i <= vps->getMaxLayersMinus1(); i++)
@@ -98,5 +142,4 @@
     m_uiMaxViewIndex = std::max( m_uiMaxViewIndex, curViewIdx  ) ; 
   }
-
   assert( m_receivedIdc == NULL ); 
   m_receivedIdc = new Int*[ m_uiMaxViewIndex + 1]; 
@@ -131,11 +174,22 @@
 }
 
+#endif
+
+
+
 Void
 CamParsCollector::xResetReceivedIdc( Bool overWriteFlag )
 {
+#if HHI_CAM_PARA_K0052
+  for (Int i = 0; i < m_vps->getNumViews(); i++)
+  {  
+    for (Int j = 0; j < m_vps->getNumViews(); j++)
+    {
+#else
   for (Int i = 0; i <= m_uiMaxViewIndex; i++)
   {  
     for (Int j = 0; j <= m_uiMaxViewIndex; j++)
     {
+#endif
       if ( overWriteFlag ||  ( m_receivedIdc[i][j] != -1 ) )
       {
@@ -178,5 +232,9 @@
   CamParsCollector::xInitLUTs( UInt uiSourceView, UInt uiTargetView, Int iScale, Int iOffset, Double****& radLUT, Int****& raiLUT)
 {
+#if HHI_CAM_PARA_K0052
+  Int     iLog2DivLuma   = m_uiBitDepthForLUT + m_vps->getCpPrecision() + 1 - m_iLog2Precision;   AOF( iLog2DivLuma > 0 );
+#else
   Int     iLog2DivLuma   = m_uiBitDepthForLUT + m_vps->getCamParPrecision() + 1 - m_iLog2Precision;   AOF( iLog2DivLuma > 0 );
+#endif
   Int     iLog2DivChroma = iLog2DivLuma + 1;
 
@@ -255,4 +313,40 @@
   }
 
+#if HHI_CAM_PARA_K0052
+  UInt voiInVps          = m_vps->getVoiInVps(pcSlice->getViewIndex());  
+  if( m_vps->getCpInSliceSegmentHeaderFlag( voiInVps ) ) // check consistency of slice parameters here
+  {   
+    for( Int baseVoiInVps = 0; baseVoiInVps < m_vps->getNumViews(); baseVoiInVps++ )
+    {        
+      if ( m_vps->getCpPresentFlag( voiInVps, baseVoiInVps ) )
+      {
+        if ( m_receivedIdc[ voiInVps ][ baseVoiInVps ] != 0 )
+        {      
+          AOF( m_aaiCodedScale [ voiInVps ][ baseVoiInVps ] == pcSlice->getInvCodedScale () [ baseVoiInVps ] );
+          AOF( m_aaiCodedOffset[ voiInVps ][ baseVoiInVps ] == pcSlice->getInvCodedOffset() [ baseVoiInVps ] );
+        }
+        else
+        {          
+          m_receivedIdc   [ voiInVps ][ baseVoiInVps ]  = 1; 
+          m_aaiCodedScale [ voiInVps ][ baseVoiInVps ]  = pcSlice->getInvCodedScale () [ baseVoiInVps ];
+          m_aaiCodedOffset[ voiInVps ][ baseVoiInVps ]  = pcSlice->getInvCodedOffset() [ baseVoiInVps ];
+          xInitLUTs( voiInVps, baseVoiInVps, m_aaiCodedScale[ voiInVps ][ baseVoiInVps ], m_aaiCodedOffset[ voiInVps ][ baseVoiInVps ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT);
+        }
+        if ( m_receivedIdc[ baseVoiInVps ][ voiInVps ] != 0 )
+        {      
+          AOF( m_aaiCodedScale [ baseVoiInVps ][ voiInVps ] == pcSlice->getCodedScale    () [ baseVoiInVps ] );
+          AOF( m_aaiCodedOffset[ baseVoiInVps ][ voiInVps ] == pcSlice->getCodedOffset   () [ baseVoiInVps ] );
+        }
+        else
+        {        
+          m_receivedIdc   [ baseVoiInVps ][ voiInVps ]  = 1; 
+          m_aaiCodedScale [ baseVoiInVps ][ voiInVps ]  = pcSlice->getCodedScale    () [ baseVoiInVps ];
+          m_aaiCodedOffset[ baseVoiInVps ][ voiInVps ]  = pcSlice->getCodedOffset   () [ baseVoiInVps ];
+          xInitLUTs( baseVoiInVps, voiInVps, m_aaiCodedScale[ baseVoiInVps ][ voiInVps ], m_aaiCodedOffset[ baseVoiInVps ][ voiInVps ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT);
+        }
+      }
+    }
+  }  
+#else
   UInt uiViewIndex          = pcSlice->getViewIndex();  
   if( m_vps->getCamParPresent( uiViewIndex ) )
@@ -289,4 +383,7 @@
     }
   }
+#endif
+
+
 }
 
@@ -311,4 +408,33 @@
     if( iPOC == m_firstReceivedPoc )
     {
+#if HHI_CAM_PARA_K0052
+      fprintf( m_pCodedScaleOffsetFile, "#ViewOrderIdx     ViewIdVal\n" );
+      fprintf( m_pCodedScaleOffsetFile, "#------------ -------------\n" );
+      
+      for( UInt voiInVps = 0; voiInVps < m_vps->getNumViews(); voiInVps++ )
+      {
+        fprintf( m_pCodedScaleOffsetFile, "%13d %13d\n", m_vps->getViewOIdxList( voiInVps ), m_vps->getViewIdVal( m_vps->getViewOIdxList( voiInVps ) ) );
+      }
+      fprintf( m_pCodedScaleOffsetFile, "\n\n");
+      fprintf( m_pCodedScaleOffsetFile, "# StartFrame     EndFrame    TargetVOI      BaseVOI   CodedScale  CodedOffset    Precision\n" );
+      fprintf( m_pCodedScaleOffsetFile, "#----------- ------------ ------------ ------------ ------------ ------------ ------------\n" );
+    }
+    if( iPOC == m_firstReceivedPoc || m_bCamParsVaryOverTime  )
+    {
+      Int iS = iPOC;
+      Int iE = ( m_bCamParsVaryOverTime ? iPOC : ~( 1 << 31 ) );
+      for( UInt voiInVps = 0; voiInVps < m_vps->getNumViews(); voiInVps++ )
+      {
+        for( UInt baseVoiInVps = 0; baseVoiInVps < m_vps->getNumViews(); baseVoiInVps++ )
+        {
+          if( voiInVps != baseVoiInVps )
+          {
+            if ( m_receivedIdc[baseVoiInVps][voiInVps] != 0 )
+            {            
+              fprintf( m_pCodedScaleOffsetFile, "%12d %12d %12d %12d %12d %12d %12d\n",
+                iS, iE, m_vps->getViewOIdxList( voiInVps ), m_vps->getViewOIdxList( baseVoiInVps ), 
+                m_aaiCodedScale [ baseVoiInVps ][ voiInVps ], 
+                m_aaiCodedOffset[ baseVoiInVps ][ voiInVps ], m_vps->getCpPrecision() );
+#else
       fprintf( m_pCodedScaleOffsetFile, "#  ViewIndex       ViewId\n" );
       fprintf( m_pCodedScaleOffsetFile, "#----------- ------------\n" );
@@ -325,7 +451,13 @@
       Int iS = iPOC;
       Int iE = ( m_bCamParsVaryOverTime ? iPOC : ~( 1 << 31 ) );
+#if HHI_CAM_PARA_K0052
+      for( UInt uiViewIndex = 0; uiViewIndex < m_vps->getNumViews(); uiViewIndex++ )
+      {
+        for( UInt uiBaseIndex = 0; uiBaseIndex < m_vps->getNumViews(); uiBaseIndex++ )
+#else
       for( UInt uiViewIndex = 0; uiViewIndex <= m_uiMaxViewIndex; uiViewIndex++ )
       {
         for( UInt uiBaseIndex = 0; uiBaseIndex <= m_uiMaxViewIndex; uiBaseIndex++ )
+#endif
         {
           if( uiViewIndex != uiBaseIndex )
@@ -333,6 +465,12 @@
             if ( m_receivedIdc[uiBaseIndex][uiViewIndex] != 0 )
             {            
+#if HHI_CAM_PARA_K0052
+              fprintf( m_pCodedScaleOffsetFile, "%12d %12d %12d %12d %12d %12d %12d\n",
+                iS, iE, uiViewIndex, uiBaseIndex, m_aaiCodedScale[ uiBaseIndex ][ uiViewIndex ], m_aaiCodedOffset[ uiBaseIndex ][ uiViewIndex ], m_vps->getCpPrecision() );
+#else
               fprintf( m_pCodedScaleOffsetFile, "%12d %12d %12d %12d %12d %12d %12d\n",
                 iS, iE, uiViewIndex, uiBaseIndex, m_aaiCodedScale[ uiBaseIndex ][ uiViewIndex ], m_aaiCodedOffset[ uiBaseIndex ][ uiViewIndex ], m_vps->getCamParPrecision() );
+#endif
+#endif
             }            
           }
Index: /branches/HTM-13.1-dev0/source/Lib/TLibDecoder/TDecTop.h
===================================================================
--- /branches/HTM-13.1-dev0/source/Lib/TLibDecoder/TDecTop.h	(revision 1171)
+++ /branches/HTM-13.1-dev0/source/Lib/TLibDecoder/TDecTop.h	(revision 1172)
@@ -97,5 +97,7 @@
   TComVPS* m_vps; 
   Int**    m_receivedIdc; 
+#if!HHI_CAM_PARA_K0052
   Int      m_uiMaxViewIndex; 
+#endif
   Int      m_lastPoc; 
   Int      m_firstReceivedPoc; 
Index: /branches/HTM-13.1-dev0/source/Lib/TLibEncoder/TEncCavlc.cpp
===================================================================
--- /branches/HTM-13.1-dev0/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 1171)
+++ /branches/HTM-13.1-dev0/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 1172)
@@ -1614,4 +1614,31 @@
 Void TEncCavlc::codeVPS3dExtension( TComVPS* pcVPS )
 { 
+#if HHI_CAM_PARA_K0052
+  WRITE_UVLC( pcVPS->getCpPrecision( ), "cp_precision" );
+  for (Int n = 1; n < pcVPS->getNumViews(); n++)
+  {
+    Int i      = pcVPS->getViewOIdxList( n );
+    Int iInVps = pcVPS->getVoiInVps( i ); 
+    WRITE_CODE( pcVPS->getNumCp( iInVps ), 6, "num_cp" );
+
+    if( pcVPS->getNumCp( iInVps ) > 0 )
+    {
+      WRITE_FLAG( pcVPS->getCpInSliceSegmentHeaderFlag( iInVps ) ? 1 : 0 , "cp_in_slice_segment_header_flag" );
+      for( Int m = 0; m < pcVPS->getNumCp( iInVps ); m++ )
+      {
+        WRITE_UVLC( pcVPS->getCpRefVoi( iInVps, m ), "cp_ref_voi" );
+        if( !pcVPS->getCpInSliceSegmentHeaderFlag( iInVps ) )
+        {
+          Int j      = pcVPS->getCpRefVoi( iInVps, m );
+          Int jInVps = pcVPS->getVoiInVps( j ); 
+          WRITE_SVLC( pcVPS->getVpsCpScale   ( iInVps, jInVps ), "vps_cp_scale" );
+          WRITE_SVLC( pcVPS->getVpsCpOff     ( iInVps, jInVps ), "vps_cp_off" );
+          WRITE_SVLC( pcVPS->getVpsCpInvScale( iInVps, jInVps ) + pcVPS->getVpsCpScale( iInVps, jInVps ), "vps_cp_inv_scale_plus_scale" );
+          WRITE_SVLC( pcVPS->getVpsCpInvOff  ( iInVps, jInVps ) + pcVPS->getVpsCpOff  ( iInVps, jInVps ), "vps_cp_inv_off_plus_off" );
+        }
+      }
+    }
+  }  
+#else
   WRITE_UVLC( pcVPS->getCamParPrecision(), "cp_precision" );
   for (UInt viewIndex=1; viewIndex<pcVPS->getNumViews(); viewIndex++)
@@ -1633,4 +1660,5 @@
     }
   }
+#endif
 }
 #endif
@@ -2120,5 +2148,26 @@
       WRITE_FLAG(pcSlice->getLFCrossSliceBoundaryFlag()?1:0, "slice_loop_filter_across_slices_enabled_flag");
     }
-  }
+#if HHI_CAM_PARA_K0052
+#if H_3D
+    if (getEncTop()->decProcAnnexI() )
+    {
+      Int voiInVps = vps->getVoiInVps( pcSlice->getViewIndex() ); 
+      if( vps->getCpInSliceSegmentHeaderFlag( voiInVps ) && !pcSlice->getIsDepth() )
+      {
+        for( Int m = 0; m < vps->getNumCp( voiInVps ); m++ )
+        {
+          Int jInVps = vps->getVoiInVps( vps->getCpRefVoi( voiInVps, m ));
+          WRITE_SVLC( pcSlice->getCpScale   ( jInVps )   , "cp_scale" );
+          WRITE_SVLC( pcSlice->getCpOff     ( jInVps )   , "cp_off" );
+          WRITE_SVLC( pcSlice->getCpInvScale( jInVps ) + pcSlice->getCpScale( jInVps ) , "cp_inv_scale_plus_scale" );
+          WRITE_SVLC( pcSlice->getCpInvOff  ( jInVps ) + pcSlice->getCpOff  ( jInVps ) , "cp_inv_off_plus_off" );
+        }
+      }
+    }
+#endif
+#endif
+  }
+
+#if !HHI_CAM_PARA_K0052  
 #if H_3D
 #if H_3D_FCO
@@ -2136,4 +2185,5 @@
     }
   }
+#endif
 #endif
 
Index: /branches/HTM-13.1-dev0/source/Lib/TLibEncoder/TEncCfg.h
===================================================================
--- /branches/HTM-13.1-dev0/source/Lib/TLibEncoder/TEncCfg.h	(revision 1171)
+++ /branches/HTM-13.1-dev0/source/Lib/TLibEncoder/TEncCfg.h	(revision 1172)
@@ -380,8 +380,10 @@
 
   //====== Camera Parameters ======
+#if !HHI_CAM_PARA_K0052
   UInt      m_uiCamParPrecision;
   Bool      m_bCamParInSliceHeader;
   Int**     m_aaiCodedScale;
   Int**     m_aaiCodedOffset;
+#endif
   TAppComCamPara* m_cameraParameters; 
   
@@ -921,8 +923,10 @@
 
  //==== CAMERA PARAMETERS  ==========
+#if !HHI_CAM_PARA_K0052
   Void      setCamParPrecision              ( UInt  u )      { m_uiCamParPrecision      = u; }
   Void      setCamParInSliceHeader          ( Bool  b )      { m_bCamParInSliceHeader   = b; }
   Void      setCodedScale                   ( Int** p )      { m_aaiCodedScale          = p; }
   Void      setCodedOffset                  ( Int** p )      { m_aaiCodedOffset         = p; }
+#endif
   Void      setCameraParameters             ( TAppComCamPara* c) { m_cameraParameters   = c; }
 
Index: /branches/HTM-13.1-dev0/source/Lib/TLibEncoder/TEncCu.cpp
===================================================================
--- /branches/HTM-13.1-dev0/source/Lib/TLibEncoder/TEncCu.cpp	(revision 1171)
+++ /branches/HTM-13.1-dev0/source/Lib/TLibEncoder/TEncCu.cpp	(revision 1172)
@@ -2513,6 +2513,12 @@
   m_pcPredSearch  ->estIntraPredDIS      ( rpcTempCU, m_ppcOrigYuv[uiDepth], m_ppcPredYuvTemp[uiDepth], m_ppcResiYuvTemp[uiDepth], m_ppcRecoYuvTemp[uiDepth], uiPreCalcDistC, false );
 
-
+#if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC
+  Int oldTraceCopyBack = g_traceCopyBack; 
+  g_traceCopyBack = false;  
+#endif
   m_ppcRecoYuvTemp[uiDepth]->copyToPicLuma(rpcTempCU->getPic()->getPicYuvRec(), rpcTempCU->getAddr(), rpcTempCU->getZorderIdxInCU() );
+  #if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC  
+    g_traceCopyBack = oldTraceCopyBack; 
+  #endif
 
 
Index: /branches/HTM-13.1-dev0/source/Lib/TLibEncoder/TEncSbac.cpp
===================================================================
--- /branches/HTM-13.1-dev0/source/Lib/TLibEncoder/TEncSbac.cpp	(revision 1171)
+++ /branches/HTM-13.1-dev0/source/Lib/TLibEncoder/TEncSbac.cpp	(revision 1172)
@@ -2383,4 +2383,5 @@
   UInt uiSymbol = pcCU->getDBBPFlag( uiAbsPartIdx ) ? 1 : 0;
   m_pcBinIf->encodeBin( uiSymbol, m_cDBBPFlagSCModel.get( 0, 0, 0 ) );
+  DTRACE_CU("dbbp_flag", uiSymbol)
 }
 #endif
Index: /branches/HTM-13.1-dev0/source/Lib/TLibEncoder/TEncTop.cpp
===================================================================
--- /branches/HTM-13.1-dev0/source/Lib/TLibEncoder/TEncTop.cpp	(revision 1171)
+++ /branches/HTM-13.1-dev0/source/Lib/TLibEncoder/TEncTop.cpp	(revision 1172)
@@ -417,5 +417,9 @@
 #endif
 #if H_3D
+#if HHI_CAM_PARA_K0052
+  pcPicCurr->setScaleOffset( m_cameraParameters->getCodedScale(), m_cameraParameters->getCodedOffset() );
+#else
   pcPicCurr->setScaleOffset( m_aaiCodedScale, m_aaiCodedOffset );
+#endif
 #endif
 }
