Index: branches/SHM-upgrade/source/App/TAppEncoder/TAppEncCfg.cpp
===================================================================
--- branches/SHM-upgrade/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 957)
+++ branches/SHM-upgrade/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 959)
@@ -65,4 +65,9 @@
   MAINREXT = 4,
   HIGHTHROUGHPUTREXT = 5, // Placeholder profile for development
+#if MULTIPLE_PTL_SUPPORT
+  MULTIVIEWMAIN = 6,
+  SCALABLEMAIN = 7,
+  SCALABLEMAIN10 = 7,
+#endif
   // The following are RExt profiles, which would map to the MAINREXT profile idc.
   // The enumeration indicates the bit-depth constraint in the bottom 2 digits
@@ -338,4 +343,9 @@
   {"main-RExt",            Profile::MAINREXT           },
   {"high-throughput-RExt", Profile::HIGHTHROUGHPUTREXT },
+#if MULTIPLE_PTL_SUPPORT
+  {"multiview-main",       Profile::MULTIVIEWMAIN      },       //This is not used in this software
+  {"scalable-main",        Profile::SCALABLEMAIN       },
+  {"scalable-main10",      Profile::SCALABLEMAIN10     },
+#endif
 };
 
@@ -372,4 +382,9 @@
     {"main_444_12_intra",  MAIN_444_12_INTRA},
     {"main_444_16_intra",  MAIN_444_16_INTRA},
+#if MULTIPLE_PTL_SUPPORT
+    {"multiview-main",     MULTIVIEWMAIN    },
+    {"scalable-main",      SCALABLEMAIN     },
+    {"scalable-main10",    SCALABLEMAIN10   },
+#endif
 };
 
@@ -515,4 +530,14 @@
   return readStrToEnum(strToScalingListMode, sizeof(strToScalingListMode)/sizeof(*strToScalingListMode), in, mode);
 }
+
+#if MULTIPLE_PTL_SUPPORT
+namespace Profile
+{
+  static inline istream& operator >> (istream &in, Name &profile)
+  {
+    return readStrToEnum(strToProfile, sizeof(strToProfile)/sizeof(*strToProfile), in, profile);
+  }
+}
+#endif
 
 template <class T>
@@ -1014,5 +1039,5 @@
   string inputColourSpaceConvert;
 #if MULTIPLE_PTL_SUPPORT
-  ExtendedProfileName extendedProfile[NUM_POSSIBLE_LEVEL];
+  ExtendedProfileName extendedProfile[MAX_NUM_LAYER_IDS + 1];
 #else
   ExtendedProfileName extendedProfile;
@@ -1266,20 +1291,21 @@
   // Profile and level
 #if MULTIPLE_PTL_SUPPORT
-  ("NumProfileTierLevel",                             m_numPTLInfo,                                         2, "Number of Profile, Tier and Level information")
-  ("Profile%d",                                       extendedProfile,               NONE, NUM_POSSIBLE_LEVEL,  "Profile name to use for encoding. Use main (for main), main10 (for main10), main-still-picture, main-RExt (for Range Extensions profile), any of the RExt specific profile names, or none")
-  ("Level%d",                                         m_levelList,            Level::NONE, NUM_POSSIBLE_LEVEL, "Level limit to be used, eg 5.1, or none")
-  ("Tier%d",                                          m_levelTierList,        Level::MAIN, NUM_POSSIBLE_LEVEL, "Tier to use for interpretation of --Level (main or high only)")
+  ("NumProfileTierLevel",                             m_numPTLInfo,                                         1, "Number of Profile, Tier and Level information")
+  ("Profile%d",                                       extendedProfile,          NONE, (MAX_NUM_LAYER_IDS + 1),  "Profile name to use for encoding. Use main (for main), main10 (for main10), main-still-picture, main-RExt (for Range Extensions profile), any of the RExt specific profile names, or none")
+  ("Level%d",                                         m_levelList,       Level::NONE, (MAX_NUM_LAYER_IDS + 1), "Level limit to be used, eg 5.1, or none")
+  ("Tier%d",                                          m_levelTierList,   Level::MAIN, (MAX_NUM_LAYER_IDS + 1), "Tier to use for interpretation of --Level (main or high only)")
   ("MaxBitDepthConstraint",                           tmpBitDepthConstraint,                               0u, "Bit depth to use for profile-constraint for RExt profiles. 0=automatically choose based upon other parameters")
   ("MaxChromaFormatConstraint",                       tmpConstraintChromaFormat,                            0, "Chroma-format to use for the profile-constraint for RExt profiles. 0=automatically choose based upon other parameters")
   ("IntraConstraintFlag",                             tmpIntraConstraintFlag,                           false, "Value of general_intra_constraint_flag to use for RExt profiles (not used if an explicit RExt sub-profile is specified)")
   ("LowerBitRateConstraintFlag",                      tmpLowerBitRateConstraintFlag,                     true, "Value of general_lower_bit_rate_constraint_flag to use for RExt profiles")
-  
-  ("ProgressiveSource%d",                             m_progressiveSourceFlagList,   false, NUM_POSSIBLE_LEVEL, "Indicate that source is progressive")
-  ("InterlacedSource%d",                              m_interlacedSourceFlagList,    false, NUM_POSSIBLE_LEVEL, "Indicate that source is interlaced")
-  ("NonPackedSource%d",                               m_nonPackedConstraintFlagList, false, NUM_POSSIBLE_LEVEL, "Indicate that source does not contain frame packing")
-  ("FrameOnly%d",                                     m_frameOnlyConstraintFlagList, false, NUM_POSSIBLE_LEVEL, "Indicate that the bitstream contains only frames")
+
+  ("ProfileCompatibility%d",                          m_profileCompatibility, Profile::NONE, (MAX_NUM_LAYER_IDS + 1), "Compatible profile to be used when encoding")
+  ("ProgressiveSource%d",                             m_progressiveSourceFlagList,   false, (MAX_NUM_LAYER_IDS + 1), "Indicate that source is progressive")
+  ("InterlacedSource%d",                              m_interlacedSourceFlagList,    false, (MAX_NUM_LAYER_IDS + 1), "Indicate that source is interlaced")
+  ("NonPackedSource%d",                               m_nonPackedConstraintFlagList, false, (MAX_NUM_LAYER_IDS + 1), "Indicate that source does not contain frame packing")
+  ("FrameOnly%d",                                     m_frameOnlyConstraintFlagList, false, (MAX_NUM_LAYER_IDS + 1), "Indicate that the bitstream contains only frames")
   
   ("LayerPTLIndex%d",                                 cfg_layerPTLIdx,               0, MAX_VPS_LAYER_ID_PLUS1, "Index of PTL for each layer")
-  ("ListOfProfileTierLevelOls%d",                     cfg_listOfLayerPTLOfOlss, string(""), MAX_VPS_LAYER_ID_PLUS1, "PTL Index for each layer in each OLS except the first OLS. The PTL index for layer in the first OLS is set to 1")
+  ("ListOfProfileTierLevelOls%d",                     cfg_listOfLayerPTLOfOlss, string(""), MAX_VPS_OUTPUT_LAYER_SETS_PLUS1, "PTL Index for each layer in each OLS except the first OLS. The PTL index for layer in the first OLS is set to 1")
 #else
   ("Profile",                                         extendedProfile,                                   NONE, "Profile name to use for encoding. Use main (for main), main10 (for main10), main-still-picture, main-RExt (for Range Extensions profile), any of the RExt specific profile names, or none")
@@ -2622,12 +2648,21 @@
     }
 #if MULTIPLE_PTL_SUPPORT
-    if( olsCtr > startOlsCtr ) // Non-default OLS
-    {
-      scanStringToArray( cfg_listOfLayerPTLOfOlss[olsCtr], m_numLayerInIdList[m_outputLayerSetIdx[olsCtr - startOlsCtr - 1]], "List of PTL for each layer in OLS", m_listOfLayerPTLofOlss[olsCtr] );
-    }
-    else
-    {
-      scanStringToArray( cfg_listOfLayerPTLOfOlss[olsCtr], m_numLayerInIdList[olsCtr], "List of PTL for each layer in OLS", m_listOfLayerPTLofOlss[olsCtr] );
-    }
+    Int olsToLsIndex = (olsCtr > startOlsCtr) ? m_outputLayerSetIdx[olsCtr - m_numLayerSets] : olsCtr;
+    scanStringToArray( cfg_listOfLayerPTLOfOlss[olsCtr], m_numLayerInIdList[olsToLsIndex], "List of PTL for each layers in OLS", m_listOfLayerPTLofOlss[olsCtr] );
+    //For conformance checking
+    //Conformance of a layer in an output operation point associated with an OLS in a bitstream to the Scalable Main profile is indicated as follows:
+    //If OpTid of the output operation point is equal to vps_max_sub_layer_minus1, the conformance is indicated by general_profile_idc being equal to 7 or general_profile_compatibility_flag[ 7 ] being equal to 1
+    //Conformance of a layer in an output operation point associated with an OLS in a bitstream to the Scalable Main 10 profile is indicated as follows:
+    //If OpTid of the output operation point is equal to vps_max_sub_layer_minus1, the conformance is indicated by general_profile_idc being equal to 7 or general_profile_compatibility_flag[ 7 ] being equal to 1
+    //The following assert may be updated / upgraded to take care of general_profile_compatibility_flag.
+    for ( Int ii = 1; ii < m_numLayerInIdList[olsToLsIndex]; ii++)
+    {
+      if (m_layerSetLayerIdList[olsToLsIndex][ii - 1] != 0 && m_layerSetLayerIdList[olsToLsIndex][ii] != 0)  //Profile / profile compatibility of enhancement layers must indicate the same profile.
+      {
+        assert( (m_profileList[m_listOfLayerPTLofOlss[olsCtr][ii]] == m_profileList[m_listOfLayerPTLofOlss[olsCtr][ii - 1]]) ||
+                (m_profileList[m_listOfLayerPTLofOlss[olsCtr][ii]] == m_profileCompatibility[m_listOfLayerPTLofOlss[olsCtr][ii - 1]]) ||   
+                (m_profileCompatibility[m_listOfLayerPTLofOlss[olsCtr][ii]] == m_profileList[m_listOfLayerPTLofOlss[olsCtr][ii - 1]]) );
+      }
+    }   
 #endif
   }
Index: branches/SHM-upgrade/source/App/TAppEncoder/TAppEncCfg.h
===================================================================
--- branches/SHM-upgrade/source/App/TAppEncoder/TAppEncCfg.h	(revision 957)
+++ branches/SHM-upgrade/source/App/TAppEncoder/TAppEncCfg.h	(revision 959)
@@ -131,11 +131,12 @@
 #if MULTIPLE_PTL_SUPPORT
   Int           m_numPTLInfo;
-  Profile::Name m_profileList[NUM_POSSIBLE_LEVEL];
-  Level::Tier   m_levelTierList[NUM_POSSIBLE_LEVEL];
-  Level::Name   m_levelList[NUM_POSSIBLE_LEVEL];
-  Bool          m_progressiveSourceFlagList[NUM_POSSIBLE_LEVEL];
-  Bool          m_interlacedSourceFlagList[NUM_POSSIBLE_LEVEL];
-  Bool          m_nonPackedConstraintFlagList[NUM_POSSIBLE_LEVEL];
-  Bool          m_frameOnlyConstraintFlagList[NUM_POSSIBLE_LEVEL];
+  Profile::Name m_profileList[MAX_NUM_LAYER_IDS + 1];
+  Level::Tier   m_levelTierList[MAX_NUM_LAYER_IDS + 1];
+  Level::Name   m_levelList[MAX_NUM_LAYER_IDS + 1];
+  Profile::Name m_profileCompatibility[MAX_NUM_LAYER_IDS + 1];
+  Bool          m_progressiveSourceFlagList[MAX_NUM_LAYER_IDS + 1];
+  Bool          m_interlacedSourceFlagList[MAX_NUM_LAYER_IDS + 1];
+  Bool          m_nonPackedConstraintFlagList[MAX_NUM_LAYER_IDS + 1];
+  Bool          m_frameOnlyConstraintFlagList[MAX_NUM_LAYER_IDS + 1];
 
   std::vector< std::vector<Int> > m_listOfLayerPTLofOlss;
Index: branches/SHM-upgrade/source/App/TAppEncoder/TAppEncTop.cpp
===================================================================
--- branches/SHM-upgrade/source/App/TAppEncoder/TAppEncTop.cpp	(revision 957)
+++ branches/SHM-upgrade/source/App/TAppEncoder/TAppEncTop.cpp	(revision 959)
@@ -213,5 +213,5 @@
     profileTierLevel.setTierFlag(m_levelTierList[ii]);
     profileTierLevel.setProfileIdc(m_profileList[ii]);
-    profileTierLevel.setProfileCompatibilityFlag(m_profileList[ii], 1);
+    profileTierLevel.setProfileCompatibilityFlag(m_profileCompatibility[ii], 1);
     profileTierLevel.setProgressiveSourceFlag(m_progressiveSourceFlagList[ii]);
     profileTierLevel.setInterlacedSourceFlag(m_interlacedSourceFlagList[ii]);
