Index: branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncCfg.cpp
===================================================================
--- branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 474)
+++ branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 475)
@@ -224,4 +224,18 @@
 }
 
+#if AUXILIARY_PICTURES
+static inline ChromaFormat numberToChromaFormat(const Int val)
+{
+  switch (val)
+  {
+    case 400: return CHROMA_400; break;
+    case 420: return CHROMA_420; break;
+    case 422: return CHROMA_422; break;
+    case 444: return CHROMA_444; break;
+    default:  return NUM_CHROMA_FORMAT;
+  }
+}
+#endif
+
 #if SVC_EXTENSION
 void TAppEncCfg::getDirFilename(string& filename, string& dir, const string path)
@@ -363,4 +377,9 @@
   UInt*      cfg_uiQuadtreeTUMaxDepthIntra[MAX_LAYERS];
 #endif
+#if AUXILIARY_PICTURES
+  Int      cfg_tmpChromaFormatIDC  [MAX_LAYERS];
+  Int      cfg_tmpInputChromaFormat[MAX_LAYERS];
+  Int*     cfg_auxId               [MAX_LAYERS];
+#endif
 #if VPS_EXTN_DIRECT_REF_LAYERS
 #if M0457_PREDICTION_INDICATIONS
@@ -477,4 +496,7 @@
     cfg_maxTidIlRefPicsPlus1[layer] = &m_acLayerCfg[layer].m_maxTidIlRefPicsPlus1; 
 #endif 
+#if AUXILIARY_PICTURES
+    cfg_auxId[layer]                = &m_acLayerCfg[layer].m_auxId; 
+#endif
   }
 #if AVC_BASE
@@ -533,8 +555,16 @@
 #endif
   ("NumLayers",               m_numLayers, 1, "Number of layers to code")
+#if AUXILIARY_PICTURES
+  ("InputChromaFormat%d",     cfg_tmpInputChromaFormat,  420, MAX_LAYERS, "InputChromaFormatIDC for layer %d")
+  ("ChromaFormatIDC%d,-cf",   cfg_tmpChromaFormatIDC,    420, MAX_LAYERS, "ChromaFormatIDC (400|420|422|444 or set 0 (default) for same as InputChromaFormat) for layer %d")
+  ("AuxId%d",                 cfg_auxId,                 0,   MAX_LAYERS, "Auxilary picture ID for layer %d (0: Not aux pic, 1: Alpha plane, 2: Depth picture, 3: Cb enh, 4: Cr enh")
+#endif
   ("ConformanceMode%d",       cfg_conformanceMode,0, MAX_LAYERS, "Window conformance mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping")
 #if SCALABILITY_MASK_E0104
   ("ScalabilityMask1",        m_scalabilityMask[1], 0, "scalability_mask[1] (multiview)")
   ("ScalabilityMask2",        m_scalabilityMask[2], 1, "scalability_mask[2] (scalable)" )
+#if AUXILIARY_PICTURES
+  ("ScalabilityMask3",        m_scalabilityMask[3], 0, "scalability_mask[3] (auxiliary pictures)" )
+#endif
 #else
   ("ScalabilityMask0",        m_scalabilityMask[0], 0, "scalability_mask[0] (multiview)")
@@ -597,4 +627,8 @@
   ("OutputBitDepthC",       m_outputBitDepthC,   0, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)")
   ("InternalBitDepthC",     m_internalBitDepthC, 0, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth)")
+#if AUXILIARY_PICTURES
+  ("InputChromaFormat",     tmpInputChromaFormat,                       420, "InputChromaFormatIDC")
+  ("ChromaFormatIDC,-cf",   tmpChromaFormat,                             0, "ChromaFormatIDC (400|420|422|444 or set 0 (default) for same as InputChromaFormat)")
+#endif
   ("ConformanceMode",       m_conformanceMode,     0, "Window conformance mode (0: no window, 1:automatic padding, 2:padding, 3:conformance")
   ("HorizontalPadding,-pdx",m_aiPad[0],            0, "Horizontal source padding for conformance window mode 2")
@@ -1211,4 +1245,11 @@
       m_acLayerCfg[layer].m_refLayerIds = NULL;
     }
+  }
+#endif
+#if AUXILIARY_PICTURES
+  for(UInt layer = 0; layer < MAX_LAYERS; layer++)
+  {
+    m_acLayerCfg[layer].m_InputChromaFormat =  numberToChromaFormat(cfg_tmpChromaFormatIDC[layer]);
+    m_acLayerCfg[layer].m_chromaFormatIDC = ((cfg_tmpChromaFormatIDC[layer] == 0) ? (m_acLayerCfg[layer].m_InputChromaFormat ) : (numberToChromaFormat(cfg_tmpChromaFormatIDC[layer])));
   }
 #endif
@@ -2251,4 +2292,11 @@
   }
 #endif 
+#if AUXILIARY_PICTURES
+  for (UInt layer=0; layer < MAX_LAYERS-1; layer++)
+  {
+    xConfirmPara(m_acLayerCfg[layer].m_auxId < 0 || m_acLayerCfg[layer].m_auxId > 4, "AuxId must be in range 0 to 4");
+    xConfirmPara(m_acLayerCfg[layer].m_auxId > 0 && m_acLayerCfg[layer].m_chromaFormatIDC != CHROMA_400, "Auxiliary picture must be monochrome picture");
+  }
+#endif 
 #undef xConfirmPara
   if (check_failed)
@@ -2331,4 +2379,7 @@
   printf("Multiview                     : %d\n", m_scalabilityMask[1] );
   printf("Scalable                      : %d\n", m_scalabilityMask[2] );
+#if AUXILIARY_PICTURES
+  printf("Auxiliary pictures            : %d\n", m_scalabilityMask[3] );
+#endif
 #else
   printf("Multiview                     : %d\n", m_scalabilityMask[0] );
Index: branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncCfg.h
===================================================================
--- branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncCfg.h	(revision 474)
+++ branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncCfg.h	(revision 475)
@@ -101,5 +101,7 @@
   Int       m_aiPad[2];                                       ///< number of padded pixels for width and height
 #endif  
-
+#if AUXILIARY_PICTURES
+  ChromaFormat m_InputChromaFormatIDC;
+#endif
   Bool      m_isField;                                        ///< enable field coding
   Bool      m_isTopFieldFirst;
@@ -172,4 +174,7 @@
   Int       m_internalBitDepthY;                            ///< bit-depth codec operates at in luma (input/output files will be converted)
   Int       m_internalBitDepthC;                            ///< bit-depth codec operates at in chroma (input/output files will be converted)
+#endif
+#if AUXILIARY_PICTURES
+  ChromaFormat m_chromaFormatIDC;
 #endif
 
Index: branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncLayerCfg.cpp
===================================================================
--- branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncLayerCfg.cpp	(revision 474)
+++ branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncLayerCfg.cpp	(revision 475)
@@ -22,4 +22,18 @@
 //! \{
 
+
+#if AUXILIARY_PICTURES
+static inline ChromaFormat numberToChromaFormat(const Int val)
+{
+  switch (val)
+  {
+    case 400: return CHROMA_400; break;
+    case 420: return CHROMA_420; break;
+    case 422: return CHROMA_422; break;
+    case 444: return CHROMA_444; break;
+    default:  return NUM_CHROMA_FORMAT;
+  }
+}
+#endif
 
 // ====================================================================================================================
@@ -75,4 +89,9 @@
   string cfg_ReconFile;
   string cfg_dQPFile;
+#if AUXILIARY_PICTURES
+  Int tmpInputChromaFormat;
+  Int tmpChromaFormat;
+#endif
+
   po::Options opts;
   opts.addOptions()
@@ -85,4 +104,8 @@
     ("SourceHeight,-hgt",     m_iSourceHeight, 0, "Source picture height")
     ("CroppingMode",          m_conformanceMode,  0, "Cropping mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping")
+#if AUXILIARY_PICTURES
+    ("InputChromaFormat",     tmpInputChromaFormat,  420, "InputChromaFormatIDC")
+    ("ChromaFormatIDC",       tmpChromaFormat,    420, "ChromaFormatIDC (400|420|422|444 or set 0 (default) for same as InputChromaFormat)")
+#endif
     ("CropLeft",              m_confLeft,      0, "Left cropping/padding for cropping mode 3")
     ("CropRight",             m_confRight,     0, "Right cropping/padding for cropping mode 3")
@@ -103,4 +126,8 @@
   m_cReconFile = cfg_ReconFile;
   m_pchdQPFile = cfg_dQPFile.empty() ? NULL : strdup(cfg_dQPFile.c_str());
+#if AUXILIARY_PICTURES
+  m_InputChromaFormat = numberToChromaFormat(tmpInputChromaFormat);
+  m_chromaFormatIDC   = ((tmpChromaFormat == 0) ? (m_InputChromaFormat) : (numberToChromaFormat(tmpChromaFormat)));
+#endif
 
   // reading external dQP description from file
Index: branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncLayerCfg.h
===================================================================
--- branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncLayerCfg.h	(revision 474)
+++ branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncLayerCfg.h	(revision 475)
@@ -44,4 +44,9 @@
   Double    m_fQP;                                            ///< QP value of key-picture (floating point)
 #if SVC_EXTENSION
+#if AUXILIARY_PICTURES
+  ChromaFormat m_chromaFormatIDC;
+  ChromaFormat m_InputChromaFormat;
+  Int          m_auxId;
+#endif
 #if VPS_EXTN_DIRECT_REF_LAYERS
 #if M0457_PREDICTION_INDICATIONS
@@ -141,4 +146,9 @@
   Int     getConfTop()                {return m_confTop;          }
   Int     getConfBottom()             {return m_confBottom;       }
+#if AUXILIARY_PICTURES
+  ChromaFormat getInputChromaFormat()   {return m_InputChromaFormat;}
+  ChromaFormat getChromaFormatIDC()     {return m_chromaFormatIDC;  }
+  Int          getAuxId()               {return m_auxId;            }
+#endif
 
   Int     getIntQP()                  {return m_iQP;              } 
Index: branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncTop.cpp
===================================================================
--- branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncTop.cpp	(revision 474)
+++ branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncTop.cpp	(revision 475)
@@ -103,5 +103,10 @@
       for( UInt idx = 0; idx < layer; idx++ )
       {
+#if AUXILIARY_PICTURES
+        if( m_acLayerCfg[layer].getSourceWidth() == m_acLayerCfg[idx].getSourceWidth() && m_acLayerCfg[layer].getSourceHeight() == m_acLayerCfg[idx].getSourceHeight() &&
+            m_acLayerCfg[layer].getChromaFormatIDC() == m_acLayerCfg[idx].getChromaFormatIDC() )
+#else
         if( m_acLayerCfg[layer].getSourceWidth() == m_acLayerCfg[idx].getSourceWidth() && m_acLayerCfg[layer].getSourceHeight() == m_acLayerCfg[idx].getSourceHeight() )
+#endif
         {
           found = true;
@@ -144,5 +149,9 @@
     repFormat->setPicWidthVpsInLumaSamples  ( m_acLayerCfg[mapIdxToLayer[idx]].getSourceWidth()   );
     repFormat->setPicHeightVpsInLumaSamples ( m_acLayerCfg[mapIdxToLayer[idx]].getSourceHeight()  );
+#if AUXILIARY_PICTURES
+    repFormat->setChromaFormatVpsIdc        ( m_acLayerCfg[mapIdxToLayer[idx]].getChromaFormatIDC() );
+#else
     repFormat->setChromaFormatVpsIdc        ( 1                                             );  // Need modification to change for each layer - corresponds to 420
+#endif
     repFormat->setSeparateColourPlaneVpsFlag( 0                                             );  // Need modification to change for each layer
 #if O0194_DIFFERENT_BITDEPTH_EL_BL
@@ -595,4 +604,7 @@
     m_acTEncTop[layer].setAdaptiveResolutionChange( m_adaptiveResolutionChange );
 #endif
+#if AUXILIARY_PICTURES
+    m_acTEncTop[layer].setChromaFormatIDC( m_acLayerCfg[layer].m_chromaFormatIDC );
+#endif
   }
 }
@@ -1025,5 +1037,9 @@
       scalabilityTypes += m_scalabilityMask[i];
     }
+#if AUXILIARY_PICTURES
+    assert( scalabilityTypes <= 2 );
+#else
     assert( scalabilityTypes == 1 );
+#endif
     vps->setNumScalabilityTypes(scalabilityTypes);
   }
@@ -1046,4 +1062,27 @@
     vps->setDimensionId(i, 0, i);
   }
+#if AUXILIARY_PICTURES
+  if (m_scalabilityMask[3])
+  {
+    UInt maxAuxId = 0;
+    UInt auxDimIdLen = 0;
+    for(i = 1; i < vps->getMaxLayers(); i++)
+    {
+      if (m_acLayerCfg[i].getAuxId() > maxAuxId)
+      {
+        maxAuxId = m_acLayerCfg[i].getAuxId();
+      }
+    }
+    while((1 << auxDimIdLen) < (maxAuxId + 1))
+    {
+      auxDimIdLen++;
+    }
+    vps->setDimensionIdLen(1, auxDimIdLen);
+    for(i = 1; i < vps->getMaxLayers(); i++)
+    {
+      vps->setDimensionId(i, 1, m_acLayerCfg[i].getAuxId());
+    }
+  }
+#endif
 #endif
 #if N0120_MAX_TID_REF_PRESENT_FLAG
@@ -1255,7 +1294,15 @@
 #if SVC_UPSAMPLING
 #if LAYER_CTB
+#if AUXILIARY_PICTURES
+      pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_acLayerCfg[layer].getChromaFormatIDC(), m_acLayerCfg[layer].m_uiMaxCUWidth, m_acLayerCfg[layer].m_uiMaxCUHeight, m_acLayerCfg[layer].m_uiMaxCUDepth, NULL );
+#else
       pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_acLayerCfg[layer].m_uiMaxCUWidth, m_acLayerCfg[layer].m_uiMaxCUHeight, m_acLayerCfg[layer].m_uiMaxCUDepth, NULL );
+#endif
+#else
+#if AUXILIARY_PICTURES
+      pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_acLayerCfg[layer].getChromaFormatIDC(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
 #else
       pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
+#endif
 #endif
 #else
@@ -1267,7 +1314,15 @@
 #if SVC_UPSAMPLING
 #if LAYER_CTB
+#if AUXILIARY_PICTURES
+      pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].getChromaFormatIDC(), m_acLayerCfg[layer].m_uiMaxCUWidth, m_acLayerCfg[layer].m_uiMaxCUHeight, m_acLayerCfg[layer].m_uiMaxCUDepth, NULL );
+#else
       pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].m_uiMaxCUWidth, m_acLayerCfg[layer].m_uiMaxCUHeight, m_acLayerCfg[layer].m_uiMaxCUDepth, NULL );
+#endif
+#else
+#if AUXILIARY_PICTURES
+      pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].getChromaFormatIDC(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
 #else
       pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
+#endif
 #endif
 #else
@@ -1325,4 +1380,11 @@
         // read input YUV file
         m_acTVideoIOYuvInputFile[layer].read( pcPicYuvOrg[layer], m_acLayerCfg[layer].getPad() );
+
+#if AUXILIARY_PICTURES
+        if (m_acLayerCfg[layer].getChromaFormatIDC() == CHROMA_400)
+        {
+          pcPicYuvOrg[layer]->convertToMonochrome();
+        }
+#endif
 
         if(layer == m_numLayers-1)
@@ -1680,7 +1742,15 @@
 #if SVC_UPSAMPLING
 #if LAYER_CTB
+#if AUXILIARY_PICTURES
+    rpcPicYuvRec->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].getChromaFormatIDC(), m_acLayerCfg[layer].m_uiMaxCUWidth, m_acLayerCfg[layer].m_uiMaxCUHeight, m_acLayerCfg[layer].m_uiMaxCUDepth, NULL );
+#else
     rpcPicYuvRec->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].m_uiMaxCUWidth, m_acLayerCfg[layer].m_uiMaxCUHeight, m_acLayerCfg[layer].m_uiMaxCUDepth, NULL );
+#endif
+#else
+#if AUXILIARY_PICTURES
+    rpcPicYuvRec->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].getChromaFormatIDC(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
 #else
     rpcPicYuvRec->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
+#endif
 #endif
 #else
Index: branches/SHM-4.0-dev/source/Lib/TLibCommon/TComPic.cpp
===================================================================
--- branches/SHM-4.0-dev/source/Lib/TLibCommon/TComPic.cpp	(revision 474)
+++ branches/SHM-4.0-dev/source/Lib/TLibCommon/TComPic.cpp	(revision 475)
@@ -79,14 +79,26 @@
 }
 #if SVC_UPSAMPLING
+#if AUXILIARY_PICTURES
+Void TComPic::create( Int iWidth, Int iHeight, ChromaFormat chromaFormatIDC, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, Window &conformanceWindow, Window &defaultDisplayWindow,
+                      Int *numReorderPics, TComSPS* pcSps, Bool bIsVirtual)
+#else
 Void TComPic::create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, Window &conformanceWindow, Window &defaultDisplayWindow,
                       Int *numReorderPics, TComSPS* pcSps, Bool bIsVirtual)
-
+#endif
 {
   m_apcPicSym     = new TComPicSym;  m_apcPicSym   ->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth );
   if (!bIsVirtual)
   {
+#if AUXILIARY_PICTURES
+    m_apcPicYuv[0]  = new TComPicYuv;  m_apcPicYuv[0]->create( iWidth, iHeight, chromaFormatIDC, uiMaxWidth, uiMaxHeight, uiMaxDepth, pcSps );
+#else
     m_apcPicYuv[0]  = new TComPicYuv;  m_apcPicYuv[0]->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth, pcSps );
-  }
+#endif
+  }
+#if AUXILIARY_PICTURES
+  m_apcPicYuv[1]  = new TComPicYuv;  m_apcPicYuv[1]->create( iWidth, iHeight, chromaFormatIDC, uiMaxWidth, uiMaxHeight, uiMaxDepth, pcSps );
+#else
   m_apcPicYuv[1]  = new TComPicYuv;  m_apcPicYuv[1]->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth, pcSps );
+#endif
 
   for( Int i = 0; i < MAX_LAYERS; i++ )
@@ -94,5 +106,9 @@
     if( m_bSpatialEnhLayer[i] )
     {
+#if AUXILIARY_PICTURES
+      m_pcFullPelBaseRec[i] = new TComPicYuv;  m_pcFullPelBaseRec[i]->create( iWidth, iHeight, chromaFormatIDC, uiMaxWidth, uiMaxHeight, uiMaxDepth, pcSps );
+#else
       m_pcFullPelBaseRec[i] = new TComPicYuv;  m_pcFullPelBaseRec[i]->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth, pcSps );
+#endif
     }
   }
@@ -407,5 +423,10 @@
   {
     m_pNDBFilterYuvTmp = new TComPicYuv();
+#if AUXILIARY_PICTURES
+    m_pNDBFilterYuvTmp->create(picWidth, picHeight, getChromaFormat(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth);
+#else
     m_pNDBFilterYuvTmp->create(picWidth, picHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth);
+#endif
+
   }
 
Index: branches/SHM-4.0-dev/source/Lib/TLibCommon/TComPic.h
===================================================================
--- branches/SHM-4.0-dev/source/Lib/TLibCommon/TComPic.h	(revision 474)
+++ branches/SHM-4.0-dev/source/Lib/TLibCommon/TComPic.h	(revision 475)
@@ -102,4 +102,13 @@
   virtual ~TComPic();
   
+#if AUXILIARY_PICTURES
+#if SVC_UPSAMPLING
+  Void          create( Int iWidth, Int iHeight, ChromaFormat chromaFormatIDC, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, Window &conformanceWindow, Window &defaultDisplayWindow, 
+                        Int *numReorderPics, TComSPS* pcSps = NULL, Bool bIsVirtual = false );
+#else
+  Void          create( Int iWidth, Int iHeight, ChromaFormat chromaFormatIDC, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, Window &conformanceWindow, Window &defaultDisplayWindow, 
+                        Int *numReorderPics, Bool bIsVirtual = false );                        
+#endif
+#else
 #if SVC_UPSAMPLING
   Void          create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, Window &conformanceWindow, Window &defaultDisplayWindow, 
@@ -108,4 +117,5 @@
   Void          create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, Window &conformanceWindow, Window &defaultDisplayWindow, 
                         Int *numReorderPics, Bool bIsVirtual = false );                        
+#endif
 #endif
   virtual Void  destroy();
@@ -166,4 +176,7 @@
   
   Int           getStride()           { return m_apcPicYuv[1]->getStride(); }
+#if AUXILIARY_PICTURES
+  ChromaFormat  getChromaFormat() const { return m_apcPicYuv[1]->getChromaFormat(); }
+#endif
   Int           getCStride()          { return m_apcPicYuv[1]->getCStride(); }
   
Index: branches/SHM-4.0-dev/source/Lib/TLibCommon/TComPicYuv.cpp
===================================================================
--- branches/SHM-4.0-dev/source/Lib/TLibCommon/TComPicYuv.cpp	(revision 474)
+++ branches/SHM-4.0-dev/source/Lib/TLibCommon/TComPicYuv.cpp	(revision 475)
@@ -67,8 +67,16 @@
 {
 }
+#if AUXILIARY_PICTURES
+#if SVC_UPSAMPLING
+Void TComPicYuv::create( Int iPicWidth, Int iPicHeight, ChromaFormat chromaFormatIDC, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth, TComSPS* pcSps )
+#else
+Void TComPicYuv::create( Int iPicWidth, Int iPicHeight, ChromaFormat chromaFormatIDC, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth )
+#endif
+#else
 #if SVC_UPSAMPLING
 Void TComPicYuv::create( Int iPicWidth, Int iPicHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth, TComSPS* pcSps )
 #else
 Void TComPicYuv::create( Int iPicWidth, Int iPicHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth )
+#endif
 #endif
 {
@@ -86,4 +94,7 @@
   m_iCuWidth        = uiMaxCUWidth;
   m_iCuHeight       = uiMaxCUHeight;
+#if AUXILIARY_PICTURES
+  m_chromaFormatIDC = chromaFormatIDC;
+#endif
 
   Int numCuInWidth  = m_iPicWidth  / m_iCuWidth  + (m_iPicWidth  % m_iCuWidth  != 0);
@@ -239,4 +250,18 @@
 }
 
+#if AUXILIARY_PICTURES
+Void TComPicYuv::convertToMonochrome()
+{
+  Int numPix = ((m_iPicWidth >> 1) + (m_iChromaMarginX << 1)) * ((m_iPicHeight >> 1) + (m_iChromaMarginY << 1));
+  Pel grayVal = (1 << (g_bitDepthC - 1));
+
+  for (UInt i = 0; i < numPix; i++)
+  {
+    m_apiPicBufU[i] = grayVal;
+    m_apiPicBufV[i] = grayVal;
+  }
+}
+#endif
+
 Void TComPicYuv::extendPicBorder ()
 {
Index: branches/SHM-4.0-dev/source/Lib/TLibCommon/TComPicYuv.h
===================================================================
--- branches/SHM-4.0-dev/source/Lib/TLibCommon/TComPicYuv.h	(revision 474)
+++ branches/SHM-4.0-dev/source/Lib/TLibCommon/TComPicYuv.h	(revision 475)
@@ -75,4 +75,7 @@
   Int   m_iPicWidth;            ///< Width of picture
   Int   m_iPicHeight;           ///< Height of picture
+#if AUXILIARY_PICTURES
+  ChromaFormat m_chromaFormatIDC; ////< Chroma Format
+#endif
   
   Int   m_iCuWidth;             ///< Width of Coding Unit (CU)
@@ -108,4 +111,11 @@
   //  Memory management
   // ------------------------------------------------------------------------------------------------
+#if AUXILIARY_PICTURES
+#if SVC_UPSAMPLING
+  Void  create      ( Int iPicWidth, Int iPicHeight, ChromaFormat chromaFormatIDC, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth, TComSPS* pcSps = NULL);
+#else
+  Void  create      ( Int iPicWidth, Int iPicHeight, ChromaFormat chromaFormatIDC, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth );
+#endif  
+#else
 #if SVC_UPSAMPLING
   Void  create      ( Int iPicWidth, Int iPicHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth, TComSPS* pcSps = NULL);
@@ -113,4 +123,5 @@
   Void  create      ( Int iPicWidth, Int iPicHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth );
 #endif  
+#endif
   
   Void  destroy     ();
@@ -125,4 +136,7 @@
   Int   getWidth    ()     { return  m_iPicWidth;    }
   Int   getHeight   ()     { return  m_iPicHeight;   }
+#if AUXILIARY_PICTURES
+  ChromaFormat  getChromaFormat   ()                     const { return m_chromaFormatIDC; }
+#endif
   
 #if SVC_EXTENSION
@@ -184,4 +198,8 @@
 #endif
 
+#if AUXILIARY_PICTURES
+  Void convertToMonochrome();
+#endif
+
   // Set border extension flag
   Void  setBorderExtension(Bool b) { m_bIsBorderExtended = b; }
Index: branches/SHM-4.0-dev/source/Lib/TLibCommon/TComSlice.cpp
===================================================================
--- branches/SHM-4.0-dev/source/Lib/TLibCommon/TComSlice.cpp	(revision 474)
+++ branches/SHM-4.0-dev/source/Lib/TLibCommon/TComSlice.cpp	(revision 475)
@@ -1840,5 +1840,29 @@
   return retVal;
 }
+#if AUXILIARY_PICTURES
+ChromaFormat TComSlice::getChromaFormatIdc()
+#else
 UInt TComSlice::getChromaFormatIdc()
+#endif
+{
+  TComSPS *sps = getSPS();
+  TComVPS *vps = getVPS();
+#if AUXILIARY_PICTURES
+  ChromaFormat retVal;
+  UInt layerId = getLayerId();
+#else
+  UInt retVal, layerId = getLayerId();
+#endif
+  if( ( layerId == 0 ) || sps->getUpdateRepFormatFlag() )
+  {
+    retVal = sps->getChromaFormatIdc();
+  }
+  else
+  {
+    retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerId) )->getChromaFormatVpsIdc();
+  }
+  return retVal;
+}
+UInt TComSlice::getBitDepthY()
 {
   TComSPS *sps = getSPS();
@@ -1847,13 +1871,13 @@
   if( ( layerId == 0 ) || sps->getUpdateRepFormatFlag() )
   {
-    retVal = sps->getChromaFormatIdc();
+    retVal = sps->getBitDepthY();
   }
   else
   {
-    retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerId) )->getChromaFormatVpsIdc();
+    retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerId) )->getBitDepthVpsLuma();
   }
   return retVal;
 }
-UInt TComSlice::getBitDepthY()
+UInt TComSlice::getBitDepthC()
 {
   TComSPS *sps = getSPS();
@@ -1862,27 +1886,12 @@
   if( ( layerId == 0 ) || sps->getUpdateRepFormatFlag() )
   {
-    retVal = sps->getBitDepthY();
+    retVal = sps->getBitDepthC();
   }
   else
   {
-    retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerId) )->getBitDepthVpsLuma();
+    retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerId) )->getBitDepthVpsChroma();
   }
   return retVal;
 }
-UInt TComSlice::getBitDepthC()
-{
-  TComSPS *sps = getSPS();
-  TComVPS *vps = getVPS();
-  UInt retVal, layerId = getLayerId();
-  if( ( layerId == 0 ) || sps->getUpdateRepFormatFlag() )
-  {
-    retVal = sps->getBitDepthC();
-  }
-  else
-  {
-    retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerId) )->getBitDepthVpsChroma();
-  }
-  return retVal;
-}
 Int TComSlice::getQpBDOffsetY()
 {
@@ -1895,5 +1904,9 @@
 
 RepFormat::RepFormat()
+#if AUXILIARY_PICTURES
+: m_chromaFormatVpsIdc          (CHROMA_420)
+#else
 : m_chromaFormatVpsIdc          (0)
+#endif
 , m_separateColourPlaneVpsFlag  (false)
 , m_picWidthVpsInLumaSamples    (0)
Index: branches/SHM-4.0-dev/source/Lib/TLibCommon/TComSlice.h
===================================================================
--- branches/SHM-4.0-dev/source/Lib/TLibCommon/TComSlice.h	(revision 474)
+++ branches/SHM-4.0-dev/source/Lib/TLibCommon/TComSlice.h	(revision 475)
@@ -436,5 +436,9 @@
 class RepFormat
 {
+#if AUXILIARY_PICTURES
+  ChromaFormat m_chromaFormatVpsIdc;
+#else
   Int  m_chromaFormatVpsIdc;
+#endif
   Bool m_separateColourPlaneVpsFlag;
   Int  m_picWidthVpsInLumaSamples;
@@ -446,6 +450,11 @@
   RepFormat();
 
+#if AUXILIARY_PICTURES
+  ChromaFormat getChromaFormatVpsIdc()        { return m_chromaFormatVpsIdc; }
+  Void setChromaFormatVpsIdc(ChromaFormat x)  { m_chromaFormatVpsIdc = x;    }
+#else
   Int  getChromaFormatVpsIdc()        { return m_chromaFormatVpsIdc; }
   Void setChromaFormatVpsIdc(Int x)   { m_chromaFormatVpsIdc = x;    }
+#endif
 
   Bool getSeparateColourPlaneVpsFlag()        { return m_separateColourPlaneVpsFlag; }
@@ -1072,5 +1081,9 @@
   Int         m_SPSId;
   Int         m_VPSId;
+#if AUXILIARY_PICTURES
+  ChromaFormat m_chromaFormatIdc;
+#else
   Int         m_chromaFormatIdc;
+#endif
 
   UInt        m_uiMaxTLayers;           // maximum number of temporal layers
@@ -1182,9 +1195,18 @@
   Int  getSPSId       ()         { return m_SPSId;          }
   Void setSPSId       (Int i)    { m_SPSId = i;             }
+#if AUXILIARY_PICTURES
+  ChromaFormat getChromaFormatIdc ()         { return m_chromaFormatIdc;       }
+#else
   Int  getChromaFormatIdc ()         { return m_chromaFormatIdc;       }
-  Void setChromaFormatIdc (Int i)    { m_chromaFormatIdc = i;          }
-
+#endif
+  Void setChromaFormatIdc (ChromaFormat i)    { m_chromaFormatIdc = i;          }
+
+#if AUXILIARY_PICTURES
+  static Int getWinUnitX (Int chromaFormatIdc) { assert (chromaFormatIdc >= 0 && chromaFormatIdc <= MAX_CHROMA_FORMAT_IDC); return m_winUnitX[chromaFormatIdc];      }
+  static Int getWinUnitY (Int chromaFormatIdc) { assert (chromaFormatIdc >= 0 && chromaFormatIdc <= MAX_CHROMA_FORMAT_IDC); return m_winUnitY[chromaFormatIdc];      }
+#else
   static Int getWinUnitX (Int chromaFormatIdc) { assert (chromaFormatIdc > 0 && chromaFormatIdc <= MAX_CHROMA_FORMAT_IDC); return m_winUnitX[chromaFormatIdc];      }
   static Int getWinUnitY (Int chromaFormatIdc) { assert (chromaFormatIdc > 0 && chromaFormatIdc <= MAX_CHROMA_FORMAT_IDC); return m_winUnitY[chromaFormatIdc];      }
+#endif
   
   // structure
@@ -2069,5 +2091,9 @@
   UInt getPicWidthInLumaSamples();
   UInt getPicHeightInLumaSamples();
+#if AUXILIARY_PICTURES
+  ChromaFormat getChromaFormatIdc();
+#else
   UInt getChromaFormatIdc();
+#endif
   UInt getBitDepthY();
   UInt getBitDepthC();
Index: branches/SHM-4.0-dev/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- branches/SHM-4.0-dev/source/Lib/TLibCommon/TypeDef.h	(revision 474)
+++ branches/SHM-4.0-dev/source/Lib/TLibCommon/TypeDef.h	(revision 475)
@@ -153,4 +153,5 @@
 
 #define O0215_PHASE_ALIGNMENT            1     // JCTVC_O0215: signal a flag to specify phase alignment case, 0: zero-position-aligned, 1: central-position-aligned,
+#define AUXILIARY_PICTURES               1
 
 #else
@@ -464,4 +465,7 @@
   CHROMA_422  = 2,
   CHROMA_444  = 3
+#if AUXILIARY_PICTURES
+  ,NUM_CHROMA_FORMAT = 4
+#endif
 };
 
Index: branches/SHM-4.0-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp
===================================================================
--- branches/SHM-4.0-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 474)
+++ branches/SHM-4.0-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 475)
@@ -602,5 +602,9 @@
   {
 #endif
+#if AUXILIARY_PICTURES
+    READ_UVLC(     uiCode, "chroma_format_idc" );                  pcSPS->setChromaFormatIdc( ChromaFormat(uiCode) );
+#else
     READ_UVLC(     uiCode, "chroma_format_idc" );                  pcSPS->setChromaFormatIdc( uiCode );
+#endif
     assert(uiCode <= 3);
     // in the first version we only support chroma_format_idc equal to 1 (4:2:0), so separate_colour_plane_flag cannot appear in the bitstream
@@ -1049,5 +1053,7 @@
     {
       READ_CODE( vps->getDimensionIdLen(j), uiCode, "dimension_id[i][j]" ); vps->setDimensionId(i, j, uiCode);
+#if !AUXILIARY_PICTURES
       assert( uiCode <= vps->getMaxLayerId() );
+#endif
     }
   }
@@ -1306,6 +1312,10 @@
 {
   UInt uiCode;
+#if AUXILIARY_PICTURES
+  READ_CODE( 2, uiCode, "chroma_format_idc" );               repFormat->setChromaFormatVpsIdc( ChromaFormat(uiCode) );
+#else
   READ_CODE( 2, uiCode, "chroma_format_idc" );               repFormat->setChromaFormatVpsIdc( uiCode );
-
+#endif
+  
   if( repFormat->getChromaFormatVpsIdc() == 3 )
   {
@@ -1808,5 +1818,29 @@
     {
       READ_FLAG(uiCode, "slice_sao_luma_flag");  rpcSlice->setSaoEnabledFlag((Bool)uiCode);
+#if AUXILIARY_PICTURES
+      ChromaFormat format;
+#if REPN_FORMAT_IN_VPS
+      if( ( sps->getLayerId() == 0 ) || sps->getUpdateRepFormatFlag() )
+      {
+        format = sps->getChromaFormatIdc();
+      }
+      else
+      {
+        format = rpcSlice->getVPS()->getVpsRepFormat( rpcSlice->getVPS()->getVpsRepFormatIdx(sps->getLayerId()) )->getChromaFormatVpsIdc();
+      }
+#else
+      format = sps->getChromaFormatIdc();
+#endif
+      if (format != CHROMA_400)
+      {
+#endif
       READ_FLAG(uiCode, "slice_sao_chroma_flag");  rpcSlice->setSaoEnabledFlagChroma((Bool)uiCode);
+#if AUXILIARY_PICTURES
+      }
+      else
+      {
+        rpcSlice->setSaoEnabledFlagChroma(false);
+      }
+#endif
     }
 
@@ -2411,4 +2445,10 @@
 
   Int iDeltaDenom;
+#if AUXILIARY_PICTURES
+  if (pcSlice->getChromaFormatIdc() == CHROMA_400)
+  {
+    bChroma = false;
+  }
+#endif
   // decode delta_luma_log2_weight_denom :
   READ_UVLC( uiLog2WeightDenomLuma, "luma_log2_weight_denom" );     // ue(v): luma_log2_weight_denom
@@ -2430,6 +2470,18 @@
 
       wp[0].uiLog2WeightDenom = uiLog2WeightDenomLuma;
+#if AUXILIARY_PICTURES
+      if (!bChroma)
+      {
+        wp[1].uiLog2WeightDenom = 0;
+        wp[2].uiLog2WeightDenom = 0;
+      }
+      else
+      {
+#endif
       wp[1].uiLog2WeightDenom = uiLog2WeightDenomChroma;
       wp[2].uiLog2WeightDenom = uiLog2WeightDenomChroma;
+#if AUXILIARY_PICTURES
+      }
+#endif
 
       UInt  uiCode;
Index: branches/SHM-4.0-dev/source/Lib/TLibDecoder/TDecSbac.cpp
===================================================================
--- branches/SHM-4.0-dev/source/Lib/TLibDecoder/TDecSbac.cpp	(revision 474)
+++ branches/SHM-4.0-dev/source/Lib/TLibDecoder/TDecSbac.cpp	(revision 475)
@@ -356,4 +356,8 @@
     uiHeight = pcCU->getHeight(uiAbsPartIdx)/2;
     uiSampleBits = pcCU->getSlice()->getSPS()->getPCMBitDepthChroma();
+#if AUXILIARY_PICTURES
+    ChromaFormat format = pcCU->getSlice()->getChromaFormatIdc();
+    UInt uiGrayVal = 1 << (uiSampleBits - 1);
+#endif
 
     for(uiY = 0; uiY < uiHeight; uiY++)
@@ -362,4 +366,9 @@
       {
         UInt uiSample;
+#if AUXILIARY_PICTURES
+        if (format == CHROMA_400)
+          uiSample = uiGrayVal;
+        else
+#endif
         m_pcTDecBinIf->xReadPCMCode(uiSampleBits, uiSample);
         piPCMSample[uiX] = uiSample;
@@ -378,4 +387,9 @@
       {
         UInt uiSample;
+#if AUXILIARY_PICTURES
+        if (format == CHROMA_400)
+          uiSample = uiGrayVal;
+        else
+#endif
         m_pcTDecBinIf->xReadPCMCode(uiSampleBits, uiSample);
         piPCMSample[uiX] = uiSample;
@@ -665,4 +679,12 @@
   UInt uiSymbol;
 
+#if AUXILIARY_PICTURES
+  if ( pcCU->getSlice()->getChromaFormatIdc() == CHROMA_400 )
+  {
+    uiSymbol = DC_IDX;
+  }
+  else
+  {
+#endif
   m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUChromaPredSCModel.get( 0, 0, 0 ) );
 
@@ -681,4 +703,7 @@
     }
   }
+#if AUXILIARY_PICTURES
+  }
+#endif
   pcCU->setChromIntraDirSubParts( uiSymbol, uiAbsPartIdx, uiDepth );
   return;
@@ -885,5 +910,16 @@
   UInt uiSymbol;
   const UInt uiCtx = pcCU->getCtxQtCbf( eType, uiTrDepth );
+#if AUXILIARY_PICTURES
+  if (pcCU->getSlice()->getChromaFormatIdc() == CHROMA_400 && (eType == TEXT_CHROMA_U || eType == TEXT_CHROMA_V))
+  {
+    uiSymbol = 0;
+  }
+  else
+  {
+#endif
   m_pcTDecBinIf->decodeBin( uiSymbol , m_cCUQtCbfSCModel.get( 0, eType ? TEXT_CHROMA: eType, uiCtx ) );
+#if AUXILIARY_PICTURES
+  }
+#endif
   
   DTRACE_CABAC_VL( g_nSymbolCounter++ )
Index: branches/SHM-4.0-dev/source/Lib/TLibDecoder/TDecTop.cpp
===================================================================
--- branches/SHM-4.0-dev/source/Lib/TLibDecoder/TDecTop.cpp	(revision 474)
+++ branches/SHM-4.0-dev/source/Lib/TLibDecoder/TDecTop.cpp	(revision 475)
@@ -179,4 +179,19 @@
 
         m_cIlpPic[j] = new  TComPic;
+#if AUXILIARY_PICTURES
+#if REPN_FORMAT_IN_VPS
+#if SVC_UPSAMPLING
+        m_cIlpPic[j]->create(picWidth, picHeight, slice->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, pcSPS, true);
+#else
+        m_cIlpPic[j]->create(picWidth, picHeight, slice->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, true);
+#endif
+#else
+#if SVC_UPSAMPLING
+        m_cIlpPic[j]->create(pcSPS->getPicWidthInLumaSamples(), pcSPS->getPicHeightInLumaSamples(), pcSPS->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, pcSPS, true);
+#else
+        m_cIlpPic[j]->create(pcSPS->getPicWidthInLumaSamples(), pcSPS->getPicHeightInLumaSamples(), pcSPS->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, true);
+#endif
+#endif
+#else
 #if REPN_FORMAT_IN_VPS
 #if SVC_UPSAMPLING
@@ -190,4 +205,5 @@
 #else
         m_cIlpPic[j]->create(pcSPS->getPicWidthInLumaSamples(), pcSPS->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, true);
+#endif
 #endif
 #endif
@@ -291,4 +307,23 @@
 #endif
     
+#if AUXILIARY_PICTURES
+#if REPN_FORMAT_IN_VPS
+#if SVC_UPSAMPLING
+    rpcPic->create ( pcSlice->getPicWidthInLumaSamples(), pcSlice->getPicHeightInLumaSamples(), pcSlice->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, 
+                     conformanceWindow, defaultDisplayWindow, numReorderPics, pcSlice->getSPS(), true);
+#else
+    rpcPic->create ( pcSlice->getPicWidthInLumaSamples(), pcSlice->getPicHeightInLumaSamples(), pcSlice->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, 
+                     conformanceWindow, defaultDisplayWindow, numReorderPics, true);
+#endif
+#else
+#if SVC_UPSAMPLING
+    rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), pcSlice->getSPS()->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, 
+                     conformanceWindow, defaultDisplayWindow, numReorderPics, pcSlice->getSPS(), true);
+#else
+    rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), pcSlice->getSPS()->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, 
+                     conformanceWindow, defaultDisplayWindow, numReorderPics, true);
+#endif
+#endif
+#else
 #if REPN_FORMAT_IN_VPS
 #if SVC_UPSAMPLING
@@ -308,4 +343,5 @@
 #endif
 #endif
+#endif
 
     rpcPic->getPicSym()->allocSaoParam(&m_cSAO);
@@ -348,4 +384,25 @@
   rpcPic->destroy();
 
+#if AUXILIARY_PICTURES
+#if REPN_FORMAT_IN_VPS
+#if SVC_UPSAMPLING
+  rpcPic->create ( pcSlice->getPicWidthInLumaSamples(), pcSlice->getPicHeightInLumaSamples(), pcSlice->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
+                   conformanceWindow, defaultDisplayWindow, numReorderPics, pcSlice->getSPS(), true);
+
+#else
+  rpcPic->create ( pcSlice->getPicWidthInLumaSamples(), pcSlice->getPicHeightInLumaSamples(), pcSlice->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
+                   conformanceWindow, defaultDisplayWindow, numReorderPics, true);
+#endif
+#else
+#if SVC_UPSAMPLING
+  rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), pcSlice->getSPS()->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
+                   conformanceWindow, defaultDisplayWindow, numReorderPics, pcSlice->getSPS(), true);
+
+#else
+  rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), pcSlice->getSPS()->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
+                   conformanceWindow, defaultDisplayWindow, numReorderPics, true);
+#endif
+#endif
+#else
 #if REPN_FORMAT_IN_VPS
 #if SVC_UPSAMPLING
@@ -365,4 +422,5 @@
   rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
                    conformanceWindow, defaultDisplayWindow, numReorderPics, true);
+#endif
 #endif
 #endif
@@ -1526,7 +1584,17 @@
           Window &conformanceWindow = sps->getConformanceWindow();
           Window defaultDisplayWindow = sps->getVuiParametersPresentFlag() ? sps->getVuiParameters()->getDefaultDisplayWindow() : Window();
+#if AUXILIARY_PICTURES
 #if SVC_UPSAMPLING
 #if AVC_SYNTAX
-
+          pBLPic->create( m_ppcTDecTop[0]->getBLWidth(), m_ppcTDecTop[0]->getBLHeight(), sps->getChromaFormatIdc(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCUDepth(), conformanceWindow, defaultDisplayWindow, numReorderPics, sps, true);
+#else
+          pBLPic->create( m_ppcTDecTop[0]->getBLWidth(), m_ppcTDecTop[0]->getBLHeight(), sps->getChromaFormatIdc(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCUDepth(), conformanceWindow, defaultDisplayWindow, numReorderPics, NULL, true);
+#endif
+#else
+          pBLPic->create( m_ppcTDecTop[0]->getBLWidth(), m_ppcTDecTop[0]->getBLHeight(), sps->getChromaFormatIdc(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCUDepth(), onformanceWindow, defaultDisplayWindow, numReorderPics, true);
+#endif
+#else
+#if SVC_UPSAMPLING
+#if AVC_SYNTAX
           pBLPic->create( m_ppcTDecTop[0]->getBLWidth(), m_ppcTDecTop[0]->getBLHeight(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCUDepth(), conformanceWindow, defaultDisplayWindow, numReorderPics, sps, true);
 #else
@@ -1535,4 +1603,5 @@
 #else
           pBLPic->create( m_ppcTDecTop[0]->getBLWidth(), m_ppcTDecTop[0]->getBLHeight(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCUDepth(), onformanceWindow, defaultDisplayWindow, numReorderPics, true);
+#endif
 #endif
         }
Index: branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncCavlc.cpp
===================================================================
--- branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 474)
+++ branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 475)
@@ -1221,4 +1221,5 @@
     }
 
+#if !AUXILIARY_PICTURES
 #if REPN_FORMAT_IN_VPS
     // in the first version chroma_format_idc is equal to one, thus colour_plane_id will not be present
@@ -1227,4 +1228,5 @@
     // in the first version chroma_format_idc is equal to one, thus colour_plane_id will not be present
     assert (pcSlice->getSPS()->getChromaFormatIdc() == 1 );
+#endif
 #endif
     // if( separate_colour_plane_flag  ==  1 )
@@ -1428,6 +1430,13 @@
          WRITE_FLAG( pcSlice->getSaoEnabledFlag(), "slice_sao_luma_flag" );
          {
+#if AUXILIARY_PICTURES
+           if (pcSlice->getChromaFormatIdc() != CHROMA_400)
+           {
+#endif
            SAOParam *saoParam = pcSlice->getPic()->getPicSym()->getSaoParam();
           WRITE_FLAG( saoParam->bSaoFlag[1], "slice_sao_chroma_flag" );
+#if AUXILIARY_PICTURES
+           }
+#endif
          }
       }
@@ -1894,4 +1903,10 @@
   UInt            uiMode = 0;
   UInt            uiTotalSignalledWeightFlags = 0;
+#if AUXILIARY_PICTURES
+  if (pcSlice->getChromaFormatIdc() == CHROMA_400)
+  {
+    bChroma = false;
+  }
+#endif
   if ( (pcSlice->getSliceType()==P_SLICE && pcSlice->getPPS()->getUseWP()) || (pcSlice->getSliceType()==B_SLICE && pcSlice->getPPS()->getWPBiPred()) )
   {
Index: branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncCfg.h
===================================================================
--- branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncCfg.h	(revision 474)
+++ branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncCfg.h	(revision 475)
@@ -211,4 +211,7 @@
   Int       m_chromaCbQpOffset;                 //  Chroma Cb QP Offset (0:default)
   Int       m_chromaCrQpOffset;                 //  Chroma Cr Qp Offset (0:default)
+#if AUXILIARY_PICTURES
+  ChromaFormat m_chromaFormatIDC;
+#endif
 
 #if ADAPTIVE_QP_SELECTION
@@ -931,4 +934,8 @@
   Int       getAdaptiveResolutionChange()      { return m_adaptiveResolutionChange; }
 #endif
+#if AUXILIARY_PICTURES
+  Void         setChromaFormatIDC(ChromaFormat x) { m_chromaFormatIDC = x;    }
+  ChromaFormat getChromaFormatIDC()               { return m_chromaFormatIDC; }
+#endif
 #endif
 };
Index: branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncEntropy.cpp
===================================================================
--- branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncEntropy.cpp	(revision 474)
+++ branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncEntropy.cpp	(revision 475)
@@ -280,4 +280,8 @@
   const UInt uiTrDepthCurr = uiDepth - pcCU->getDepth( uiAbsPartIdx );
   const Bool bFirstCbfOfCU = uiTrDepthCurr == 0;
+#if AUXILIARY_PICTURES
+  if (pcCU->getSlice()->getChromaFormatIdc() != CHROMA_400)
+  {
+#endif
   if( bFirstCbfOfCU || uiLog2TrafoSize > 2 )
   {
@@ -296,4 +300,12 @@
     assert( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepthCurr ) == pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepthCurr - 1 ) );
   }
+#if AUXILIARY_PICTURES
+  }
+  else
+  {
+    assert( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepthCurr ) == 0 );
+    assert( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepthCurr ) == 0 );
+  }
+#endif
   
   if( uiSubdiv )
@@ -402,4 +414,10 @@
 Void TEncEntropy::encodeIntraDirModeChroma( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD )
 {
+#if AUXILIARY_PICTURES
+  if ( pcCU->getSlice()->getChromaFormatIdc() == CHROMA_400 )
+  {
+    return;
+  }
+#endif
   if( bRD )
   {
Index: branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncGOP.cpp
===================================================================
--- branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 474)
+++ branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 475)
@@ -3165,8 +3165,16 @@
   
   TComPicYuv* pcOrgInterlaced = new TComPicYuv;
+#if AUXILIARY_PICTURES
+  pcOrgInterlaced->create( iWidth, iHeight << 1, pcPicOrgTop->getChromaFormat(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
+#else
   pcOrgInterlaced->create( iWidth, iHeight << 1, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
+#endif
   
   TComPicYuv* pcRecInterlaced = new TComPicYuv;
+#if AUXILIARY_PICTURES
+  pcRecInterlaced->create( iWidth, iHeight << 1, pcPicOrgTop->getChromaFormat(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
+#else
   pcRecInterlaced->create( iWidth, iHeight << 1, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
+#endif
   
   Pel* pOrgInterlaced = pcOrgInterlaced->getLumaAddr();
Index: branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncPic.cpp
===================================================================
--- branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncPic.cpp	(revision 474)
+++ branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncPic.cpp	(revision 475)
@@ -126,4 +126,32 @@
  * \return Void
  */
+#if AUXILIARY_PICTURES
+#if SVC_UPSAMPLING
+Void TEncPic::create( Int iWidth, Int iHeight, ChromaFormat chromaFormat, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, UInt uiMaxAQDepth,  
+                      Window &conformanceWindow, Window &defaultDisplayWindow, Int *numReorderPics, TComSPS* pcSps, Bool bIsVirtual )
+
+#else
+
+Void TEncPic::create( Int iWidth, Int iHeight, ChromaFormat chromaFormat, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, UInt uiMaxAQDepth,
+                      Window &conformanceWindow, Window &defaultDisplayWindow, Int *numReorderPics, Bool bIsVirtual )
+#endif
+{
+#if SVC_UPSAMPLING
+  TComPic::create( iWidth, iHeight, chromaFormat, uiMaxWidth, uiMaxHeight, uiMaxDepth,  
+                   conformanceWindow, defaultDisplayWindow, numReorderPics, pcSps, bIsVirtual );
+#else
+  TComPic::create( iWidth, iHeight, chromaFormat, uiMaxWidth, uiMaxHeight, uiMaxDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, bIsVirtual );
+#endif
+  m_uiMaxAQDepth = uiMaxAQDepth;
+  if ( uiMaxAQDepth > 0 )
+  {
+    m_acAQLayer = new TEncPicQPAdaptationLayer[ m_uiMaxAQDepth ];
+    for (UInt d = 0; d < m_uiMaxAQDepth; d++)
+    {
+      m_acAQLayer[d].create( iWidth, iHeight, uiMaxWidth>>d, uiMaxHeight>>d );
+    }
+  }
+}
+#else
 #if SVC_UPSAMPLING
 Void TEncPic::create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, UInt uiMaxAQDepth,  
@@ -152,4 +180,5 @@
   }
 }
+#endif
 
 /** Clean up
Index: branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncPic.h
===================================================================
--- branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncPic.h	(revision 474)
+++ branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncPic.h	(revision 475)
@@ -105,4 +105,14 @@
   virtual ~TEncPic();
 
+#if AUXILIARY_PICTURES
+#if SVC_UPSAMPLING
+  Void          create( Int iWidth, Int iHeight, ChromaFormat chromaFormat, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, UInt uiMaxAQDepth,  
+                      Window &conformanceWindow, Window &defaultDisplayWindow, Int *numReorderPics, TComSPS* pcSps, Bool bIsVirtual=false );
+#else
+  Void          create( Int iWidth, Int iHeight, ChromaFormat chromaFormat, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, UInt uiMaxAQDepth,
+                          Window &conformanceWindow, Window &defaultDisplayWindow, Int *numReorderPics, Bool bIsVirtual = false );
+
+#endif
+#else
 #if SVC_UPSAMPLING
   Void          create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, UInt uiMaxAQDepth,   
@@ -111,4 +121,5 @@
   Void          create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, UInt uiMaxAQDepth,   
                         Window &conformanceWindow, Window &defaultDisplayWindow, Int *numReorderPics, Bool bIsVirtual = false );
+#endif
 #endif
   virtual Void  destroy();
Index: branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp
===================================================================
--- branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp	(revision 474)
+++ branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp	(revision 475)
@@ -1871,5 +1871,9 @@
 
   saoParam->bSaoFlag[0] = true;
+#if AUXILIARY_PICTURES
+  saoParam->bSaoFlag[1] = m_pcPic->getChromaFormat() == CHROMA_400 ? false : true;
+#else
   saoParam->bSaoFlag[1] = true;
+#endif
   saoParam->oneUnitFlag[0] = false;
   saoParam->oneUnitFlag[1] = false;
Index: branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncSbac.cpp
===================================================================
--- branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncSbac.cpp	(revision 474)
+++ branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncSbac.cpp	(revision 475)
@@ -914,4 +914,8 @@
     }
 
+#if AUXILIARY_PICTURES
+    if (pcCU->getSlice()->getChromaFormatIdc() != CHROMA_400)
+    {
+#endif
     piPCMSample = pcCU->getPCMSampleCb() + uiChromaOffset;
     uiWidth = pcCU->getWidth(uiAbsPartIdx)/2;
@@ -945,4 +949,7 @@
       piPCMSample += uiWidth;
     }
+#if AUXILIARY_PICTURES
+    }
+#endif
     m_pcBinIf->resetBac();
   }
Index: branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncSlice.cpp
===================================================================
--- branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncSlice.cpp	(revision 474)
+++ branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncSlice.cpp	(revision 475)
@@ -79,4 +79,22 @@
 }
 
+#if AUXILIARY_PICTURES
+Void TEncSlice::create( Int iWidth, Int iHeight, ChromaFormat chromaFormat, UInt iMaxCUWidth, UInt iMaxCUHeight, UChar uhTotalDepth )
+{
+  // create prediction picture
+  if ( m_apcPicYuvPred == NULL )
+  {
+    m_apcPicYuvPred  = new TComPicYuv;
+    m_apcPicYuvPred->create( iWidth, iHeight, chromaFormat, iMaxCUWidth, iMaxCUHeight, uhTotalDepth );
+  }
+
+  // create residual picture
+  if( m_apcPicYuvResi == NULL )
+  {
+    m_apcPicYuvResi  = new TComPicYuv;
+    m_apcPicYuvResi->create( iWidth, iHeight, chromaFormat, iMaxCUWidth, iMaxCUHeight, uhTotalDepth );
+  }
+}
+#else
 Void TEncSlice::create( Int iWidth, Int iHeight, UInt iMaxCUWidth, UInt iMaxCUHeight, UChar uhTotalDepth )
 {
@@ -95,4 +113,5 @@
   }
 }
+#endif
 
 Void TEncSlice::destroy()
Index: branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncSlice.h
===================================================================
--- branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncSlice.h	(revision 474)
+++ branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncSlice.h	(revision 475)
@@ -111,5 +111,9 @@
   virtual ~TEncSlice();
   
+#if AUXILIARY_PICTURES
+  Void    create              ( Int iWidth, Int iHeight, ChromaFormat chromaFormat, UInt iMaxCUWidth, UInt iMaxCUHeight, UChar uhTotalDepth );
+#else
   Void    create              ( Int iWidth, Int iHeight, UInt iMaxCUWidth, UInt iMaxCUHeight, UChar uhTotalDepth );
+#endif
   Void    destroy             ();
   Void    init                ( TEncTop* pcEncTop );
Index: branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncTop.cpp
===================================================================
--- branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncTop.cpp	(revision 474)
+++ branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncTop.cpp	(revision 475)
@@ -115,5 +115,9 @@
   m_cGOPEncoder.        create();
 #endif
+#if AUXILIARY_PICTURES
+  m_cSliceEncoder.      create( getSourceWidth(), getSourceHeight(), m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
+#else
   m_cSliceEncoder.      create( getSourceWidth(), getSourceHeight(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
+#endif
   m_cCuEncoder.         create( g_uiMaxCUDepth, g_uiMaxCUWidth, g_uiMaxCUHeight );
   if (m_bUseSAO)
@@ -606,5 +610,9 @@
     else
     {
+#if AUXILIARY_PICTURES
+      rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
+#else
       rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
+#endif
     }
     rcListPicYuvRecOut.pushBack( rpcPicYuvRec );
@@ -806,4 +814,13 @@
 #endif
 
+#if AUXILIARY_PICTURES
+#if SVC_UPSAMPLING
+      pcEPic->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, m_cPPS.getMaxCuDQPDepth()+1 ,
+                      m_conformanceWindow, m_defaultDisplayWindow, m_numReorderPics, &m_cSPS);
+#else
+      pcEPic->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, m_cPPS.getMaxCuDQPDepth()+1 ,
+                      m_conformanceWindow, m_defaultDisplayWindow, m_numReorderPics);
+#endif
+#else
 #if SVC_UPSAMPLING
       pcEPic->create( m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, m_cPPS.getMaxCuDQPDepth()+1 ,
@@ -812,4 +829,5 @@
       pcEPic->create( m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, m_cPPS.getMaxCuDQPDepth()+1 ,
                       m_conformanceWindow, m_defaultDisplayWindow, m_numReorderPics);
+#endif
 #endif
       rpcPic = pcEPic;
@@ -847,4 +865,13 @@
 #endif
 
+#if AUXILIARY_PICTURES
+#if SVC_UPSAMPLING
+      rpcPic->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, 
+                      m_conformanceWindow, m_defaultDisplayWindow, m_numReorderPics, &m_cSPS);
+#else
+      rpcPic->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, 
+                      m_conformanceWindow, m_defaultDisplayWindow, m_numReorderPics);
+#endif
+#else
 #if SVC_UPSAMPLING
       rpcPic->create( m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, 
@@ -853,4 +880,5 @@
       rpcPic->create( m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, 
                       m_conformanceWindow, m_defaultDisplayWindow, m_numReorderPics);
+#endif
 #endif
     }
@@ -917,4 +945,7 @@
   m_cSPS.setMaxCUHeight   ( g_uiMaxCUHeight     );
   m_cSPS.setMaxCUDepth    ( g_uiMaxCUDepth      );
+#if AUXILIARY_PICTURES
+  m_cSPS.setChromaFormatIdc( m_chromaFormatIDC);
+#endif
 
   Int minCUSize = m_cSPS.getMaxCUWidth() >> ( m_cSPS.getMaxCUDepth()-g_uiAddCUDepth );
@@ -1557,5 +1588,9 @@
         m_cIlpPic[j] = new  TComPic;
 #if SVC_UPSAMPLING
+#if AUXILIARY_PICTURES
+        m_cIlpPic[j]->create(m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, &m_cSPS, true);
+#else
         m_cIlpPic[j]->create(m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, &m_cSPS, true);
+#endif
 #else
         m_cIlpPic[j]->create(m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, true);
@@ -1609,5 +1644,9 @@
         m_cIlpPic[j] = new  TComPic;
 #if SVC_UPSAMPLING
+#if AUXILIARY_PICTURES
+        m_cIlpPic[j]->create(picWidth, picHeight, m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, &m_cSPS, true);
+#else
         m_cIlpPic[j]->create(picWidth, picHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, &m_cSPS, true);
+#endif
 #else
         m_cIlpPic[j]->create(m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, true);
Index: branches/SHM-4.0-dev/source/Lib/TLibVideoIO/TVideoIOYuv.cpp
===================================================================
--- branches/SHM-4.0-dev/source/Lib/TLibVideoIO/TVideoIOYuv.cpp	(revision 474)
+++ branches/SHM-4.0-dev/source/Lib/TLibVideoIO/TVideoIOYuv.cpp	(revision 475)
@@ -473,5 +473,9 @@
   {
     dstPicYuv = new TComPicYuv;
+#if AUXILIARY_PICTURES
+    dstPicYuv->create( pPicYuv->getWidth(), pPicYuv->getHeight(), pPicYuv->getChromaFormat(), 1, 1, 0 );
+#else
     dstPicYuv->create( pPicYuv->getWidth(), pPicYuv->getHeight(), 1, 1, 0 );
+#endif
     pPicYuv->copyToPic(dstPicYuv);
 
@@ -567,9 +571,17 @@
   {
     dstPicTop = new TComPicYuv;
+#if AUXILIARY_PICTURES
+    dstPicTop->create( pPicTop->getWidth(), pPicTop->getHeight(), pPicTop->getChromaFormat(), 1, 1, 0 );
+#else
     dstPicTop->create( pPicTop->getWidth(), pPicTop->getHeight(), 1, 1, 0 );
+#endif
     pPicTop->copyToPic(dstPicTop);
     
     dstPicBottom = new TComPicYuv;
+#if AUXILIARY_PICTURES
+    dstPicBottom->create( pPicBottom->getWidth(), pPicBottom->getHeight(), pPicBottom->getChromaFormat(), 1, 1, 0 );
+#else
     dstPicBottom->create( pPicBottom->getWidth(), pPicBottom->getHeight(), 1, 1, 0 );
+#endif
     pPicBottom->copyToPic(dstPicBottom);
     
