Index: branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncCfg.cpp
===================================================================
--- branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 467)
+++ branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 468)
@@ -1269,5 +1269,6 @@
   /* rules for input, output and internal bitdepths as per help text */
 #if O0194_DIFFERENT_BITDEPTH_EL_BL
-  for(Int layer = 0; layer < MAX_LAYERS; layer++){
+  for(Int layer = 0; layer < MAX_LAYERS; layer++)
+  {
     if (!m_acLayerCfg[layer].m_internalBitDepthY) { m_acLayerCfg[layer].m_internalBitDepthY = m_acLayerCfg[layer].m_inputBitDepthY; }
     if (!m_acLayerCfg[layer].m_internalBitDepthC) { m_acLayerCfg[layer].m_internalBitDepthC = m_acLayerCfg[layer].m_internalBitDepthY; }
@@ -1541,5 +1542,6 @@
   // check range of parameters
 #if O0194_DIFFERENT_BITDEPTH_EL_BL
-  for(UInt layer=0; layer<m_numLayers; layer++){
+  for(UInt layer=0; layer<m_numLayers; layer++)
+  {
     xConfirmPara( m_acLayerCfg[layer].m_inputBitDepthY < 8,                                                     "InputBitDepth must be at least 8" );
     xConfirmPara( m_acLayerCfg[layer].m_inputBitDepthC < 8,                                                     "InputBitDepthC must be at least 8" );
@@ -2461,4 +2463,6 @@
   printf("GOP size                     : %d\n", m_iGOPSize );
 #if O0194_DIFFERENT_BITDEPTH_EL_BL
+  printf("Input bit depth Layer0       : (Y:%d, C:%d)\n", m_acLayerCfg[0].m_inputBitDepthY   , m_acLayerCfg[0].m_inputBitDepthC    );
+  printf("Input bit depth Layer1       : (Y:%d, C:%d)\n", m_acLayerCfg[1].m_internalBitDepthY, m_acLayerCfg[1].m_internalBitDepthC );
   printf("Internal bit depth Layer0    : (Y:%d, C:%d)\n", m_acLayerCfg[0].m_internalBitDepthY, m_acLayerCfg[0].m_internalBitDepthC );
   printf("Internal bit depth Layer1    : (Y:%d, C:%d)\n", m_acLayerCfg[1].m_internalBitDepthY, m_acLayerCfg[1].m_internalBitDepthC );
@@ -2568,5 +2572,4 @@
   printf("O0194_JOINT_US_BITSHIFT: %d ", O0194_JOINT_US_BITSHIFT);
   printf("O0194_WEIGHTED_PREDICTION_CGS: %d ",O0194_WEIGHTED_PREDICTION_CGS);
-  printf("O0194_REPN_FORMAT_IN_VPS_BUGFIX: %d ",O0194_REPN_FORMAT_IN_VPS_BUGFIX);
   printf("\n\n");
   
Index: branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncCfg.h
===================================================================
--- branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncCfg.h	(revision 467)
+++ branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncCfg.h	(revision 468)
@@ -173,4 +173,5 @@
   Int       m_internalBitDepthC;                            ///< bit-depth codec operates at in chroma (input/output files will be converted)
 #endif
+
   // coding tools (PCM bit-depth)
   Bool      m_bPCMInputBitDepthFlag;                          ///< 0: PCM bit-depth is internal bit-depth. 1: PCM bit-depth is input bit-depth.
Index: branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncLayerCfg.cpp
===================================================================
--- branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncLayerCfg.cpp	(revision 467)
+++ branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncLayerCfg.cpp	(revision 468)
@@ -273,5 +273,6 @@
 
 #if O0194_DIFFERENT_BITDEPTH_EL_BL
-  for(UInt layer = 0; layer < MAX_LAYERS; layer++){
+  for(UInt layer = 0; layer < MAX_LAYERS; layer++)
+  {
     xConfirmPara( m_iQP <  -6 * ((Int)m_cAppEncCfg->getInternalBitDepthY(layer) - 8) || m_iQP > 51,                "QP exceeds supported range (-QpBDOffsety to 51)" );
   }
Index: branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncTop.cpp
===================================================================
--- branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncTop.cpp	(revision 467)
+++ branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncTop.cpp	(revision 468)
@@ -146,5 +146,5 @@
     repFormat->setChromaFormatVpsIdc        ( 1                                             );  // Need modification to change for each layer - corresponds to 420
     repFormat->setSeparateColourPlaneVpsFlag( 0                                             );  // Need modification to change for each layer
-#if O0194_REPN_FORMAT_IN_VPS_BUGFIX
+#if O0194_DIFFERENT_BITDEPTH_EL_BL
     repFormat->setBitDepthVpsLuma           ( getInternalBitDepthY(mapIdxToLayer[idx])      );  // Need modification to change for each layer
     repFormat->setBitDepthVpsChroma         ( getInternalBitDepthC(mapIdxToLayer[idx])      );  // Need modification to change for each layer
@@ -408,5 +408,6 @@
     m_acTEncTop[layer].setWPBiPred                ( m_useWeightedBiPred   );
 #if O0194_WEIGHTED_PREDICTION_CGS
-    if (layer!=0){
+    if (layer!=0)
+    {
       // Enable weighted prediction for enhancement layer
       m_acTEncTop[layer].setUseWP                 ( true   );
@@ -884,4 +885,12 @@
   for(UInt layer=0; layer<m_numLayers; layer++)
   {
+#if O0194_DIFFERENT_BITDEPTH_EL_BL
+    //2
+    g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
+    g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
+
+    g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
+    g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
+#endif
 #if LAYER_CTB
     g_uiMaxCUWidth  = g_auiLayerMaxCUWidth[layer];
@@ -889,12 +898,4 @@
     g_uiMaxCUDepth  = g_auiLayerMaxCUDepth[layer];
     g_uiAddCUDepth  = g_auiLayerAddCUDepth[layer];
-#endif
-#if O0194_DIFFERENT_BITDEPTH_EL_BL
-    //2
-    g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
-    g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
-
-    g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
-    g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
 #endif
 #if O0194_DIFFERENT_BITDEPTH_EL_BL
@@ -963,4 +964,12 @@
   for(UInt layer=0; layer<m_numLayers; layer++)
   {
+#if O0194_DIFFERENT_BITDEPTH_EL_BL
+    //3
+    g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
+    g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
+
+    g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
+    g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
+#endif
 #if LAYER_CTB
     g_uiMaxCUWidth  = g_auiLayerMaxCUWidth[layer];
@@ -968,17 +977,9 @@
     g_uiMaxCUDepth  = g_auiLayerMaxCUDepth[layer];
     g_uiAddCUDepth  = g_auiLayerAddCUDepth[layer];
-        
+
     memcpy( g_auiZscanToRaster, g_auiLayerZscanToRaster[layer], sizeof( g_auiZscanToRaster ) );
     memcpy( g_auiRasterToZscan, g_auiLayerRasterToZscan[layer], sizeof( g_auiRasterToZscan ) );
     memcpy( g_auiRasterToPelX,  g_auiLayerRasterToPelX[layer],  sizeof( g_auiRasterToPelX ) );
     memcpy( g_auiRasterToPelY,  g_auiLayerRasterToPelY[layer],  sizeof( g_auiRasterToPelY ) );
-#endif
-#if O0194_DIFFERENT_BITDEPTH_EL_BL
-    //3
-    g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
-    g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
-
-    g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
-    g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
 #endif
     m_acTEncTop[layer].init(isFieldCoding);
@@ -1307,4 +1308,12 @@
       for(UInt layer=0; layer<m_numLayers; layer++)
       {
+#if O0194_DIFFERENT_BITDEPTH_EL_BL
+        //6
+        g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
+        g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
+
+        g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
+        g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
+#endif
 #if LAYER_CTB
         g_uiMaxCUWidth  = g_auiLayerMaxCUWidth[layer];
@@ -1313,12 +1322,5 @@
         g_uiAddCUDepth  = g_auiLayerAddCUDepth[layer];
 #endif
-#if O0194_DIFFERENT_BITDEPTH_EL_BL
-        //6
-        g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
-        g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
-
-        g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
-        g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
-#endif
+
         // get buffers
         xGetBuffer(pcPicYuvRec, layer);
@@ -1388,4 +1390,12 @@
       for(UInt layer=0; layer<m_numLayers; layer++)
       {
+#if O0194_DIFFERENT_BITDEPTH_EL_BL
+        //7
+        g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
+        g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
+
+        g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
+        g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
+#endif
 #if LAYER_CTB
         g_uiMaxCUWidth  = g_auiLayerMaxCUWidth[layer];
@@ -1398,12 +1408,4 @@
         memcpy( g_auiRasterToPelX,  g_auiLayerRasterToPelX[layer],  sizeof( g_auiRasterToPelX ) );
         memcpy( g_auiRasterToPelY,  g_auiLayerRasterToPelY[layer],  sizeof( g_auiRasterToPelY ) );
-#endif
-#if O0194_DIFFERENT_BITDEPTH_EL_BL
-        //7
-        g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
-        g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
-
-        g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
-        g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
 #endif
         // call encoding function for one frame
