From 356a0cbd76aec5fbf98a033e21ef80a7c40d39f5 Mon Sep 17 00:00:00 2001
From: Frank Bossen <fbossen@gmail.com>
Date: Fri, 17 Jan 2020 15:28:41 +0100
Subject: [PATCH] remove macro JVET_O1159_SCALABILITY

---
 source/App/EncoderApp/EncApp.cpp              |  10 -
 source/App/EncoderApp/EncAppCfg.cpp           |   2 -
 source/App/EncoderApp/EncAppCfg.h             |   2 -
 source/App/StreamMergeApp/StreamMergeApp.cpp  |   4 -
 source/Lib/CommonLib/CommonDef.h              |   4 -
 source/Lib/CommonLib/InterPrediction.cpp      |   9 -
 source/Lib/CommonLib/Picture.cpp              |   6 -
 source/Lib/CommonLib/Picture.h                |   4 -
 source/Lib/CommonLib/Slice.cpp                | 262 ------------------
 source/Lib/CommonLib/Slice.h                  |  40 ---
 source/Lib/CommonLib/TypeDef.h                |   1 -
 source/Lib/CommonLib/UnitTools.cpp            |  30 --
 source/Lib/CommonLib/UnitTools.h              |   3 -
 source/Lib/DecoderLib/DecLib.cpp              |  30 --
 source/Lib/DecoderLib/VLCReader.cpp           |  50 ----
 .../Lib/EncoderLib/EncAdaptiveLoopFilter.cpp  |   4 -
 source/Lib/EncoderLib/EncCfg.h                |   4 -
 source/Lib/EncoderLib/EncGOP.cpp              |  50 ----
 source/Lib/EncoderLib/EncGOP.h                |   6 -
 source/Lib/EncoderLib/EncLib.cpp              |  46 ---
 source/Lib/EncoderLib/EncLib.h                |   4 -
 source/Lib/EncoderLib/VLCWriter.cpp           |  24 --
 22 files changed, 595 deletions(-)

diff --git a/source/App/EncoderApp/EncApp.cpp b/source/App/EncoderApp/EncApp.cpp
index 81d7c51b0..58535a43b 100644
--- a/source/App/EncoderApp/EncApp.cpp
+++ b/source/App/EncoderApp/EncApp.cpp
@@ -79,7 +79,6 @@ void EncApp::xInitLibCfg()
 
   vps.setMaxLayers( m_maxLayers );
 
-#if JVET_O1159_SCALABILITY
   if (vps.getMaxLayers() > 1)
   {
     vps.setVPSId(1);  //JVET_P0205 vps_video_parameter_set_id shall be greater than 0 for multi-layer coding
@@ -171,13 +170,6 @@ void EncApp::xInitLibCfg()
       }
     }
   }
-#endif
-#if !JVET_O1159_SCALABILITY
-  for(int i = 0; i < MAX_TLAYER; i++)
-  {
-    vps.setVPSIncludedLayerId                                    ( 0, i );
-  }
-#endif
   vps.setVPSExtensionFlag                                        ( false );
   m_cEncLib.setVPS(&vps);
   m_cEncLib.setProfile                                           ( m_profile);
@@ -973,9 +965,7 @@ void EncApp::xInitLibCfg()
 #if JVET_O0549_ENCODER_ONLY_FILTER
   m_cEncLib.setGopBasedTemporalFilterEnabled(m_gopBasedTemporalFilterEnabled);
 #endif
-#if JVET_O1159_SCALABILITY
   m_cEncLib.setNumRefLayers                                       ( m_numRefLayers );
-#endif
 }
 
 void EncApp::xCreateLib( std::list<PelUnitBuf*>& recBufList, const int layerId )
diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp
index d1f0bad7f..1ce9db3ca 100644
--- a/source/App/EncoderApp/EncAppCfg.cpp
+++ b/source/App/EncoderApp/EncAppCfg.cpp
@@ -1770,7 +1770,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
   ( "SwitchPocPeriod",                                m_switchPocPeriod,                            0, "Switch POC period for RPR" )
   ( "UpscaledOutput",                                 m_upscaledOutput,                             0, "Output upscaled (2), decoded but in full resolution buffer (1) or decoded cropped (0, default) picture for RPR" )
   ( "MaxLayers",                                      m_maxLayers,                                  1, "Max number of layers" )
-#if JVET_O1159_SCALABILITY
 
   ;
   opts.addOptions()
@@ -1784,7 +1783,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
   ( "OlsModeIdc",                                     m_olsModeIdc,                                 0, "Output layer set mode")
   ( "NumOutputLayerSets",                             m_numOutputLayerSets,                         1, "Number of output layer sets")
   ( "OlsOutputLayer%d",                               m_olsOutputLayerStr, string(""), MAX_VPS_LAYERS, "Output layer index of i-th OLS")
-#endif
     ;
 
 #if JVET_O0549_ENCODER_ONLY_FILTER
diff --git a/source/App/EncoderApp/EncAppCfg.h b/source/App/EncoderApp/EncAppCfg.h
index ce53a31e0..b7b71767c 100644
--- a/source/App/EncoderApp/EncAppCfg.h
+++ b/source/App/EncoderApp/EncAppCfg.h
@@ -834,7 +834,6 @@ protected:
 
   int         m_maxLayers;
 
-#if JVET_O1159_SCALABILITY
   int         m_layerId[MAX_VPS_LAYERS];
   int         m_layerIdx;
   int         m_maxSublayers;
@@ -846,7 +845,6 @@ protected:
   int         m_olsModeIdc;
   int         m_numOutputLayerSets;
   std::string m_olsOutputLayerStr[MAX_VPS_LAYERS];
-#endif
 
 #if EXTENSION_360_VIDEO
   TExt360AppEncCfg m_ext360;
diff --git a/source/App/StreamMergeApp/StreamMergeApp.cpp b/source/App/StreamMergeApp/StreamMergeApp.cpp
index a3c66b27b..b9943e8ec 100644
--- a/source/App/StreamMergeApp/StreamMergeApp.cpp
+++ b/source/App/StreamMergeApp/StreamMergeApp.cpp
@@ -279,10 +279,6 @@ uint32_t StreamMergeApp::mergeStreams()
 
   //set VPS which will be replicated for all layers but with differnt nul_layer_id
   vps.setMaxLayers(m_numInputStreams);
-#if !JVET_O1159_SCALABILITY
-  for (int i = 0; i < m_numInputStreams; i++)
-    vps.setVPSIncludedLayerId(i < 63 ? i : i + 1, i); //value 63 is reserved
-#endif
   vps.setVPSExtensionFlag(false);
 
   //Loop all input bitstreams to interleave their NALUs
diff --git a/source/Lib/CommonLib/CommonDef.h b/source/Lib/CommonLib/CommonDef.h
index ece696661..8538b5f3e 100644
--- a/source/Lib/CommonLib/CommonDef.h
+++ b/source/Lib/CommonLib/CommonDef.h
@@ -173,15 +173,11 @@ static const int MAX_NESTING_NUM_OPS =                           1024;
 static const int MAX_NESTING_NUM_LAYER =                           64;
 
 static const int MAX_VPS_NUM_HRD_PARAMETERS =                       1;
-#if JVET_O1159_SCALABILITY
 static const int MAX_VPS_LAYERS =                                  64;
 static const int MAX_VPS_SUBLAYERS =                                7;
 static const int MAX_NUM_REF_LAYERS =                               7;
 static const int MAX_NUM_OLSS =                                   256;
 static const int MAX_VPS_OLS_MODE_IDC =                             2;
-#else
-static const int MAX_VPS_LAYERS =                                 256;
-#endif
 static const int MAXIMUM_INTRA_FILTERED_WIDTH =                    16;
 static const int MAXIMUM_INTRA_FILTERED_HEIGHT =                   16;
 
diff --git a/source/Lib/CommonLib/InterPrediction.cpp b/source/Lib/CommonLib/InterPrediction.cpp
index e5ef5212c..7689b117f 100644
--- a/source/Lib/CommonLib/InterPrediction.cpp
+++ b/source/Lib/CommonLib/InterPrediction.cpp
@@ -315,12 +315,7 @@ void InterPrediction::xSubPuMC( PredictionUnit& pu, PelUnitBuf& predBuf, const R
   int  fstStep = (!verMC ? puHeight : puWidth);
   int  secStep = (!verMC ? puWidth : puHeight);
 
-#if JVET_P0590_SCALING_WINDOW || JVET_O1159_SCALABILITY
   bool scaled = pu.cu->slice->getScalingRatio( REF_PIC_LIST_0, 0 ) != SCALE_1X || ( pu.cs->slice->getSliceType() == B_SLICE ? pu.cu->slice->getScalingRatio( REF_PIC_LIST_1, 0 ) != SCALE_1X : false );
-#else
-  pu.refIdx[0] = 0; pu.refIdx[1] = pu.cs->slice->getSliceType() == B_SLICE ? 0 : -1;
-  bool scaled = !PU::isRefPicSameSize( pu );
-#endif
 
   m_subPuMC = true;
 
@@ -1942,11 +1937,7 @@ void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBu
       }
     }
 
-#if JVET_P0590_SCALING_WINDOW || JVET_O1159_SCALABILITY
     bioApplied = ( ( refIdx0 < 0 ? true : pu.cu->slice->getScalingRatio( REF_PIC_LIST_0, refIdx0 ) == SCALE_1X ) && ( refIdx1 < 0 ? true : pu.cu->slice->getScalingRatio( REF_PIC_LIST_1, refIdx1 ) == SCALE_1X ) ) ? bioApplied : false;
-#else
-    bioApplied = PU::isRefPicSameSize( pu ) ? bioApplied : false;
-#endif
     bool dmvrApplied = false;
     dmvrApplied = (pu.mvRefine) && PU::checkDMVRCondition(pu);
     if ((pu.lumaSize().width > MAX_BDOF_APPLICATION_REGION || pu.lumaSize().height > MAX_BDOF_APPLICATION_REGION) && pu.mergeType != MRG_TYPE_SUBPU_ATMVP && (bioApplied && !dmvrApplied))
diff --git a/source/Lib/CommonLib/Picture.cpp b/source/Lib/CommonLib/Picture.cpp
index e29c6d2c3..080ecda24 100644
--- a/source/Lib/CommonLib/Picture.cpp
+++ b/source/Lib/CommonLib/Picture.cpp
@@ -680,12 +680,8 @@ const CPelUnitBuf Picture::getRecoBuf(const UnitArea &unit, bool wrap)     const
 const CPelUnitBuf Picture::getRecoBuf(bool wrap)                           const { return M_BUFS(scheduler.getSplitPicId(), wrap ? PIC_RECON_WRAP : PIC_RECONSTRUCTION); }
 
 #if JVET_P1006_PICTURE_HEADER
-#if JVET_O1159_SCALABILITY
 void Picture::finalInit( const VPS* vps, const SPS& sps, const PPS& pps, PicHeader *picHeader, APS** alfApss, APS* lmcsAps, APS* scalingListAps )
 #else
-void Picture::finalInit( const SPS& sps, const PPS& pps, PicHeader* picHeader, APS** alfApss, APS* lmcsAps, APS* scalingListAps )
-#endif
-#else
 void Picture::finalInit( const SPS& sps, const PPS& pps, APS** alfApss, APS* lmcsAps, APS* scalingListAps )
 #endif
 {
@@ -720,9 +716,7 @@ void Picture::finalInit( const SPS& sps, const PPS& pps, APS** alfApss, APS* lmc
     cs->create(chromaFormatIDC, Area(0, 0, iWidth, iHeight), true, (bool)sps.getPLTMode());
   }
 
-#if JVET_O1159_SCALABILITY
   cs->vps = vps;
-#endif
   cs->picture = this;
   cs->slice   = nullptr;  // the slices for this picture have not been set at this point. update cs->slice after swapSliceObject()
   cs->pps     = &pps;
diff --git a/source/Lib/CommonLib/Picture.h b/source/Lib/CommonLib/Picture.h
index d557cdc8a..2edc724d8 100644
--- a/source/Lib/CommonLib/Picture.h
+++ b/source/Lib/CommonLib/Picture.h
@@ -215,11 +215,7 @@ struct Picture : public UnitArea
 
   void extendPicBorder();
 #if JVET_P1006_PICTURE_HEADER
-#if JVET_O1159_SCALABILITY
   void finalInit( const VPS* vps, const SPS& sps, const PPS& pps, PicHeader *picHeader, APS** alfApss, APS* lmcsAps, APS* scalingListAps );
-#else
-  void finalInit( const SPS& sps, const PPS& pps, PicHeader *picHeader, APS** alfApss, APS* lmcsAps, APS* scalingListAps );
-#endif
 #else
   void finalInit( const SPS& sps, const PPS& pps, APS** alfApss, APS* lmcsAps, APS* scalingListAps );
 #endif
diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp
index 1bd425ffa..b46d661fa 100644
--- a/source/Lib/CommonLib/Slice.cpp
+++ b/source/Lib/CommonLib/Slice.cpp
@@ -481,13 +481,10 @@ void Slice::constructRefPicList(PicList& rcListPic)
   uint32_t numOfActiveRef = 0;
   //construct L0
   numOfActiveRef = getNumRefIdx(REF_PIC_LIST_0);
-#if JVET_O1159_SCALABILITY
   int layerIdx = m_pcPic->cs->vps == nullptr ? 0 : m_pcPic->cs->vps->getGeneralLayerIdx( m_pcPic->layerId );
-#endif
 
   for (int ii = 0; ii < numOfActiveRef; ii++)
   {
-#if JVET_O1159_SCALABILITY
     if( m_pRPL0->isInterLayerRefPic( ii ) )
     {
       CHECK( m_pRPL0->getInterLayerRefPicIdx( ii ) == NOT_VALID, "Wrong ILRP index" );
@@ -498,7 +495,6 @@ void Slice::constructRefPicList(PicList& rcListPic)
       pcRefPic->longTerm = true;
     }
     else
-#endif
     if (!m_pRPL0->isRefPicLongterm(ii))
     {
       pcRefPic = xGetRefPic( rcListPic, getPOC() - m_pRPL0->getRefPicIdentifier( ii ), m_pcPic->layerId );
@@ -522,7 +518,6 @@ void Slice::constructRefPicList(PicList& rcListPic)
   numOfActiveRef = getNumRefIdx(REF_PIC_LIST_1);
   for (int ii = 0; ii < numOfActiveRef; ii++)
   {
-#if JVET_O1159_SCALABILITY
     if( m_pRPL1->isInterLayerRefPic( ii ) )
     {
       CHECK( m_pRPL1->getInterLayerRefPicIdx( ii ) == NOT_VALID, "Wrong ILRP index" );
@@ -533,7 +528,6 @@ void Slice::constructRefPicList(PicList& rcListPic)
       pcRefPic->longTerm = true;
     }
     else
-#endif
     if (!m_pRPL1->isRefPicLongterm(ii))
     {
       pcRefPic = xGetRefPic( rcListPic, getPOC() - m_pRPL1->getRefPicIdentifier( ii ), m_pcPic->layerId );
@@ -615,11 +609,7 @@ void Slice::checkCRA(const ReferencePictureList *pRPL0, const ReferencePictureLi
       {
         CHECK(getPOC() - pRPL1->getRefPicIdentifier(i) < pocCRA, "Invalid state");
       }
-#if JVET_O1159_SCALABILITY
       else if( !pRPL1->isInterLayerRefPic( i ) )
-#else
-      else
-#endif
       {
         CHECK( xGetLongTermRefPic( rcListPic, pRPL1->getRefPicIdentifier( i ), pRPL1->getDeltaPocMSBPresentFlag( i ), m_pcPic->layerId )->getPOC() < pocCRA, "Invalid state" );
       }
@@ -1140,11 +1130,7 @@ void Slice::checkLeadingPictureRestrictions(PicList& rcListPic) const
 
 
 //Function for applying picture marking based on the Reference Picture List
-#if JVET_O1159_SCALABILITY
 void Slice::applyReferencePictureListBasedMarking( PicList& rcListPic, const ReferencePictureList *pRPL0, const ReferencePictureList *pRPL1, const int layerId ) const
-#else
-void Slice::applyReferencePictureListBasedMarking(PicList& rcListPic, const ReferencePictureList *pRPL0, const ReferencePictureList *pRPL1) const
-#endif
 {
   int i, isReference;
   checkLeadingPictureRestrictions(rcListPic);
@@ -1163,7 +1149,6 @@ void Slice::applyReferencePictureListBasedMarking(PicList& rcListPic, const Refe
     isReference = 0;
     // loop through all pictures in the Reference Picture Set
     // to see if the picture should be kept as reference picture
-#if JVET_O1159_SCALABILITY
     for( i = 0; isNeedToCheck && !isReference && i < pRPL0->getNumberOfShorttermPictures() + pRPL0->getNumberOfLongtermPictures() + pRPL0->getNumberOfInterLayerPictures(); i++ )
     {
       if( pRPL0->isInterLayerRefPic( i ) )
@@ -1179,10 +1164,6 @@ void Slice::applyReferencePictureListBasedMarking(PicList& rcListPic, const Refe
       }
       else if (pcPic->layerId == layerId)
       {
-#else
-    for (i = 0; isNeedToCheck && !isReference && i < pRPL0->getNumberOfShorttermPictures() + pRPL0->getNumberOfLongtermPictures(); i++)
-    {
-#endif
       if (!(pRPL0->isRefPicLongterm(i)))
       {
         if (pcPic->poc == this->getPOC() - pRPL0->getRefPicIdentifier(i))
@@ -1201,12 +1182,9 @@ void Slice::applyReferencePictureListBasedMarking(PicList& rcListPic, const Refe
           pcPic->longTerm = true;
         }
       }
-#if JVET_O1159_SCALABILITY
       }
-#endif
     }
 
-#if JVET_O1159_SCALABILITY
     for( i = 0; isNeedToCheck && !isReference && i < pRPL1->getNumberOfShorttermPictures() + pRPL1->getNumberOfLongtermPictures() + pRPL1->getNumberOfInterLayerPictures(); i++ )
     {
       if( pRPL1->isInterLayerRefPic( i ) )
@@ -1222,10 +1200,6 @@ void Slice::applyReferencePictureListBasedMarking(PicList& rcListPic, const Refe
       }
       else if( pcPic->layerId == layerId )
       {
-#else
-    for (i = 0; isNeedToCheck && !isReference && i<pRPL1->getNumberOfShorttermPictures() + pRPL1->getNumberOfLongtermPictures(); i++)
-    {
-#endif
       if (!(pRPL1->isRefPicLongterm(i)))
       {
         if (pcPic->poc == this->getPOC() - pRPL1->getRefPicIdentifier(i))
@@ -1244,17 +1218,11 @@ void Slice::applyReferencePictureListBasedMarking(PicList& rcListPic, const Refe
           pcPic->longTerm = true;
         }
       }
-#if JVET_O1159_SCALABILITY
       }
-#endif
     }
     // mark the picture as "unused for reference" if it is not in
     // the Reference Picture List
-#if JVET_O1159_SCALABILITY
     if( pcPic->layerId == layerId && pcPic->poc != m_iPOC && isReference == 0 )
-#else
-    if (pcPic->poc != this->getPOC() && isReference == 0)
-#endif
     {
       pcPic->referenced = false;
       pcPic->longTerm = false;
@@ -1277,23 +1245,14 @@ int Slice::checkThatAllRefPicsAreAvailable(PicList& rcListPic, const ReferencePi
 
   if (this->isIDRorBLA()) return 0; //Assume that all pic in the DPB will be flushed anyway so no need to check.
 
-#if JVET_O1159_SCALABILITY
   int numberOfPictures = pRPL->getNumberOfLongtermPictures() + pRPL->getNumberOfShorttermPictures() + pRPL->getNumberOfInterLayerPictures();
-#else
-  int numberOfPictures = pRPL->getNumberOfLongtermPictures() + pRPL->getNumberOfShorttermPictures();
-#endif
   //Check long term ref pics
   for (int ii = 0; pRPL->getNumberOfLongtermPictures() > 0 && ii < numberOfPictures; ii++)
   {
-#if JVET_O1159_SCALABILITY
     if( !pRPL->isRefPicLongterm( ii ) || pRPL->isInterLayerRefPic( ii ) )
     {
       continue;
     }
-#else
-    if (!pRPL->isRefPicLongterm(ii))
-      continue;
-#endif
 
     notPresentPoc = pRPL->getRefPicIdentifier(ii);
     isAvailable = 0;
@@ -1380,23 +1339,14 @@ int Slice::checkThatAllRefPicsAreAvailable(PicList& rcListPic, const ReferencePi
 
   if (this->isIDRorBLA()) return 0; //Assume that all pic in the DPB will be flushed anyway so no need to check.
 
-#if JVET_O1159_SCALABILITY
   int numberOfPictures = pRPL->getNumberOfLongtermPictures() + pRPL->getNumberOfShorttermPictures() + pRPL->getNumberOfInterLayerPictures();
-#else
-  int numberOfPictures = pRPL->getNumberOfLongtermPictures() + pRPL->getNumberOfShorttermPictures();
-#endif
   //Check long term ref pics
   for (int ii = 0; pRPL->getNumberOfLongtermPictures() > 0 && ii < numberOfPictures; ii++)
   {
-#if JVET_O1159_SCALABILITY
     if( !pRPL->isRefPicLongterm( ii ) || pRPL->isInterLayerRefPic( ii ) )
     {
       continue;
     }
-#else
-    if (!pRPL->isRefPicLongterm(ii))
-      continue;
-#endif
 
     notPresentPoc = pRPL->getRefPicIdentifier(ii);
     isAvailable = 0;
@@ -1478,7 +1428,6 @@ int Slice::checkThatAllRefPicsAreAvailable(PicList& rcListPic, const ReferencePi
 
 bool Slice::isPOCInRefPicList(const ReferencePictureList *rpl, int poc )
 {
-#if JVET_O1159_SCALABILITY
   for( int i = 0; i < rpl->getNumberOfLongtermPictures() + rpl->getNumberOfShorttermPictures() + rpl->getNumberOfInterLayerPictures(); i++ )
   {
     if( rpl->isInterLayerRefPic( i ) )
@@ -1492,10 +1441,6 @@ bool Slice::isPOCInRefPicList(const ReferencePictureList *rpl, int poc )
       }
     }
     else
-#else
-  for (int i = 0; i < rpl->getNumberOfLongtermPictures() + rpl->getNumberOfShorttermPictures(); i++)
-  {
-#endif
     if (rpl->isRefPicLongterm(i))
     {
       if (poc == rpl->getRefPicIdentifier(i))
@@ -1585,182 +1530,6 @@ void Slice::checkConformanceForDRAP( uint32_t temporalId )
   }
 }
 
-#if !JVET_O1159_SCALABILITY
-void Slice::createExplicitReferencePictureSetFromReference(PicList& rcListPic, const ReferencePictureList *pRPL0, const ReferencePictureList *pRPL1)
-{
-  Picture* rpcPic;
-  int pocCycle = 0;
-
-
-  ReferencePictureList* pLocalRPL0 = this->getLocalRPL0();
-  (*pLocalRPL0) = ReferencePictureList();
-
-  uint32_t numOfSTRPL0 = 0;
-  uint32_t numOfLTRPL0 = 0;
-  uint32_t numOfRefPic = pRPL0->getNumberOfShorttermPictures() + pRPL0->getNumberOfLongtermPictures();
-  uint32_t refPicIdxL0 = 0;
-  for (int ii = 0; ii < numOfRefPic; ii++)
-  {
-    // loop through all pictures in the reference picture buffer
-    PicList::iterator iterPic = rcListPic.begin();
-    bool isAvailable = false;
-
-    pocCycle = 1 << (this->getSPS()->getBitsForPOC());
-    while (iterPic != rcListPic.end())
-    {
-      rpcPic = *(iterPic++);
-      if (!pRPL0->isRefPicLongterm(ii) && rpcPic->referenced && rpcPic->getPOC() == this->getPOC() - pRPL0->getRefPicIdentifier(ii) && !isPocRestrictedByDRAP(rpcPic->getPOC(), rpcPic->precedingDRAP))
-      {
-        isAvailable = true;
-        break;
-      }
-      else if (pRPL0->isRefPicLongterm(ii) && rpcPic->referenced && (rpcPic->getPOC() & (pocCycle - 1)) == pRPL0->getRefPicIdentifier(ii) && !isPocRestrictedByDRAP(rpcPic->getPOC(), rpcPic->precedingDRAP))
-      {
-        isAvailable = true;
-        break;
-      }
-    }
-    if (isAvailable)
-    {
-      pLocalRPL0->setRefPicIdentifier(refPicIdxL0, pRPL0->getRefPicIdentifier(ii), pRPL0->isRefPicLongterm(ii));
-      refPicIdxL0++;
-      numOfSTRPL0 = numOfSTRPL0 + ((pRPL0->isRefPicLongterm(ii)) ? 0 : 1);
-      numOfLTRPL0 = numOfLTRPL0 + ((pRPL0->isRefPicLongterm(ii)) ? 1 : 0);
-      isAvailable = false;
-    }
-  }
-
-  if (getEnableDRAPSEI())
-  {
-    pLocalRPL0->setNumberOfShorttermPictures(numOfSTRPL0);
-    pLocalRPL0->setNumberOfLongtermPictures(numOfLTRPL0);
-    if (!isIRAP() && !isPOCInRefPicList(pLocalRPL0, getAssociatedIRAPPOC()))
-    {
-      if (getUseLTforDRAP() && !isPOCInRefPicList(pRPL1, getAssociatedIRAPPOC()))
-      {
-        // Adding associated IRAP as longterm picture
-        pLocalRPL0->setRefPicIdentifier(refPicIdxL0, getAssociatedIRAPPOC(), true);
-        refPicIdxL0++;
-        numOfLTRPL0++;
-      }
-      else
-      {
-        // Adding associated IRAP as shortterm picture
-        pLocalRPL0->setRefPicIdentifier(refPicIdxL0, this->getPOC() - getAssociatedIRAPPOC(), false);
-        refPicIdxL0++;
-        numOfSTRPL0++;
-      }
-    }
-  }
-
-  ReferencePictureList* pLocalRPL1 = this->getLocalRPL1();
-  (*pLocalRPL1) = ReferencePictureList();
-
-  uint32_t numOfSTRPL1 = 0;
-  uint32_t numOfLTRPL1 = 0;
-  numOfRefPic = pRPL1->getNumberOfShorttermPictures() + pRPL1->getNumberOfLongtermPictures();
-  uint32_t refPicIdxL1 = 0;
-  for (int ii = 0; ii < numOfRefPic; ii++)
-  {
-    // loop through all pictures in the reference picture buffer
-    PicList::iterator iterPic = rcListPic.begin();
-    bool isAvailable = false;
-    pocCycle = 1 << (this->getSPS()->getBitsForPOC());
-    while (iterPic != rcListPic.end())
-    {
-      rpcPic = *(iterPic++);
-      if (!pRPL1->isRefPicLongterm(ii) && rpcPic->referenced && rpcPic->getPOC() == this->getPOC() - pRPL1->getRefPicIdentifier(ii) && !isPocRestrictedByDRAP(rpcPic->getPOC(), rpcPic->precedingDRAP))
-      {
-        isAvailable = true;
-        break;
-      }
-      else if (pRPL1->isRefPicLongterm(ii) && rpcPic->referenced && (rpcPic->getPOC() & (pocCycle - 1)) == pRPL1->getRefPicIdentifier(ii) && !isPocRestrictedByDRAP(rpcPic->getPOC(), rpcPic->precedingDRAP))
-      {
-        isAvailable = true;
-        break;
-      }
-    }
-    if (isAvailable)
-    {
-      pLocalRPL1->setRefPicIdentifier(refPicIdxL1, pRPL1->getRefPicIdentifier(ii), pRPL1->isRefPicLongterm(ii));
-      refPicIdxL1++;
-      numOfSTRPL1 = numOfSTRPL1 + ((pRPL1->isRefPicLongterm(ii)) ? 0 : 1);
-      numOfLTRPL1 = numOfLTRPL1 + ((pRPL1->isRefPicLongterm(ii)) ? 1 : 0);
-      isAvailable = false;
-    }
-  }
-
-  //Copy from L1 if we have less than active ref pic
-  int numOfNeedToFill = pRPL0->getNumberOfActivePictures() - (numOfLTRPL0 + numOfSTRPL0);
-  bool isDisallowMixedRefPic = (this->getSPS()->getAllActiveRplEntriesHasSameSignFlag()) ? true : false;
-  int originalL0StrpNum = numOfSTRPL0;
-  int originalL0LtrpNum = numOfLTRPL0;
-  for (int ii = 0; numOfNeedToFill > 0 && ii < (pLocalRPL1->getNumberOfLongtermPictures() + pLocalRPL1->getNumberOfShorttermPictures()); ii++)
-  {
-    if (ii <= (numOfLTRPL1 + numOfSTRPL1 - 1))
-    {
-      //Make sure this copy is not already in L0
-      bool canIncludeThis = true;
-      for (int jj = 0; jj < refPicIdxL0; jj++)
-      {
-        if ((pLocalRPL1->getRefPicIdentifier(ii) == pLocalRPL0->getRefPicIdentifier(jj)) && (pLocalRPL1->isRefPicLongterm(ii) == pLocalRPL0->isRefPicLongterm(jj)))
-          canIncludeThis = false;
-        bool sameSign = (pLocalRPL1->getRefPicIdentifier(ii) > 0) == (pLocalRPL0->getRefPicIdentifier(0) > 0);
-        if (isDisallowMixedRefPic && canIncludeThis && !pLocalRPL1->isRefPicLongterm(ii) && !sameSign)
-          canIncludeThis = false;
-      }
-      if (canIncludeThis)
-      {
-        pLocalRPL0->setRefPicIdentifier(refPicIdxL0, pLocalRPL1->getRefPicIdentifier(ii), pLocalRPL1->isRefPicLongterm(ii));
-        refPicIdxL0++;
-        numOfSTRPL0 = numOfSTRPL0 + ((pRPL1->isRefPicLongterm(ii)) ? 0 : 1);
-        numOfLTRPL0 = numOfLTRPL0 + ((pRPL1->isRefPicLongterm(ii)) ? 1 : 0);
-
-        numOfNeedToFill--;
-      }
-    }
-  }
-  pLocalRPL0->setNumberOfLongtermPictures(numOfLTRPL0);
-  pLocalRPL0->setNumberOfShorttermPictures(numOfSTRPL0);
-  pLocalRPL0->setNumberOfActivePictures((numOfLTRPL0 + numOfSTRPL0 < pRPL0->getNumberOfActivePictures()) ? numOfLTRPL0 + numOfSTRPL0 : pRPL0->getNumberOfActivePictures());
-  pLocalRPL0->setLtrpInSliceHeaderFlag(pRPL0->getLtrpInSliceHeaderFlag());
-  this->setRPL0idx(-1);
-  this->setRPL0(pLocalRPL0);
-
-  //Copy from L0 if we have less than active ref pic
-  numOfNeedToFill = pLocalRPL0->getNumberOfActivePictures() - (numOfLTRPL1 + numOfSTRPL1);
-  for (int ii = 0; numOfNeedToFill > 0 && ii < (pLocalRPL0->getNumberOfLongtermPictures() + pLocalRPL0->getNumberOfShorttermPictures()); ii++)
-  {
-    if (ii <= (originalL0StrpNum + originalL0LtrpNum - 1))
-    {
-      //Make sure this copy is not already in L0
-      bool canIncludeThis = true;
-      for (int jj = 0; jj < refPicIdxL1; jj++)
-      {
-        if ((pLocalRPL0->getRefPicIdentifier(ii) == pLocalRPL1->getRefPicIdentifier(jj)) && (pLocalRPL0->isRefPicLongterm(ii) == pLocalRPL1->isRefPicLongterm(jj)))
-          canIncludeThis = false;
-        bool sameSign = (pLocalRPL0->getRefPicIdentifier(ii) > 0) == (pLocalRPL1->getRefPicIdentifier(0) > 0);
-        if (isDisallowMixedRefPic && canIncludeThis && !pLocalRPL0->isRefPicLongterm(ii) && !sameSign)
-          canIncludeThis = false;
-      }
-      if (canIncludeThis)
-      {
-        pLocalRPL1->setRefPicIdentifier(refPicIdxL1, pLocalRPL0->getRefPicIdentifier(ii), pLocalRPL0->isRefPicLongterm(ii));
-        refPicIdxL1++;
-        numOfSTRPL1 = numOfSTRPL1 + ((pLocalRPL0->isRefPicLongterm(ii)) ? 0 : 1);
-        numOfLTRPL1 = numOfLTRPL1 + ((pLocalRPL0->isRefPicLongterm(ii)) ? 1 : 0);
-        numOfNeedToFill--;
-      }
-    }
-  }
-  pLocalRPL1->setNumberOfLongtermPictures(numOfLTRPL1);
-  pLocalRPL1->setNumberOfShorttermPictures(numOfSTRPL1);
-  pLocalRPL1->setNumberOfActivePictures((isDisallowMixedRefPic) ? (numOfLTRPL1 + numOfSTRPL1) : (((numOfLTRPL1 + numOfSTRPL1) < pRPL1->getNumberOfActivePictures()) ? (numOfLTRPL1 + numOfSTRPL1) : pRPL1->getNumberOfActivePictures()));
-  pLocalRPL1->setLtrpInSliceHeaderFlag(pRPL1->getLtrpInSliceHeaderFlag());
-  this->setRPL1idx(-1);
-  this->setRPL1(pLocalRPL1);
-}
-#endif
 
 //! get AC and DC values for weighted pred
 void  Slice::getWpAcDcParam(const WPACDCParam *&wp) const
@@ -1881,16 +1650,13 @@ VPS::VPS()
 #if JVET_P0185
   , m_vpsMaxSubLayers(1)
 #endif
-#if JVET_O1159_SCALABILITY
   , m_vpsAllLayersSameNumSubLayersFlag (true)
   , m_vpsAllIndependentLayersFlag(true)
   , m_vpsEachLayerIsAnOlsFlag (1)
   , m_vpsOlsModeIdc (0)
   , m_vpsNumOutputLayerSets (1)
-#endif
 , m_vpsExtensionFlag()
 {
-#if JVET_O1159_SCALABILITY
   for (int i = 0; i < MAX_VPS_LAYERS; i++)
   {
     m_vpsLayerId[i] = 0;
@@ -1909,12 +1675,6 @@ VPS::VPS()
       m_vpsOlsOutputLayerFlag[i][j] = 0;
     }
   }
-#else
-  for (int i = 0; i < MAX_VPS_LAYERS; i++)
-  {
-    m_vpsIncludedLayerId[i] = 0;
-  }
-#endif
 }
 
 VPS::~VPS()
@@ -2000,17 +1760,13 @@ PicHeader::PicHeader()
   m_localRPL0.setNumberOfShorttermPictures(0);
   m_localRPL0.setNumberOfLongtermPictures(0);
   m_localRPL0.setLtrpInSliceHeaderFlag(0);
-#if JVET_O1159_SCALABILITY
   m_localRPL0.setNumberOfInterLayerPictures( 0 );
-#endif
 
   m_localRPL1.setNumberOfActivePictures(0);
   m_localRPL1.setNumberOfShorttermPictures(0);
   m_localRPL1.setNumberOfLongtermPictures(0);
   m_localRPL1.setLtrpInSliceHeaderFlag(0);
-#if JVET_O1159_SCALABILITY
   m_localRPL1.setNumberOfInterLayerPictures( 0 );
-#endif
 
   m_alfApsId.resize(0);
 }
@@ -2842,38 +2598,26 @@ APS::~APS()
 {
 }
 
-#if JVET_O1159_SCALABILITY
 ReferencePictureList::ReferencePictureList( const bool interLayerPicPresentFlag )
-#else
-ReferencePictureList::ReferencePictureList()
-#endif
   : m_numberOfShorttermPictures(0)
   , m_numberOfLongtermPictures(0)
   , m_numberOfActivePictures(MAX_INT)
   , m_ltrp_in_slice_header_flag(0)
-#if JVET_O1159_SCALABILITY
   , m_interLayerPresentFlag( interLayerPicPresentFlag )
   , m_numberOfInterLayerPictures( 0 )
-#endif
 {
   ::memset(m_isLongtermRefPic, 0, sizeof(m_isLongtermRefPic));
   ::memset(m_refPicIdentifier, 0, sizeof(m_refPicIdentifier));
   ::memset(m_POC, 0, sizeof(m_POC));
-#if JVET_O1159_SCALABILITY
   ::memset( m_isInterLayerRefPic, 0, sizeof( m_isInterLayerRefPic ) );
   ::memset( m_interLayerRefPicIdx, 0, sizeof( m_interLayerRefPicIdx ) );
-#endif
 }
 
 ReferencePictureList::~ReferencePictureList()
 {
 }
 
-#if JVET_O1159_SCALABILITY
 void ReferencePictureList::setRefPicIdentifier( int idx, int identifier, bool isLongterm, bool isInterLayerRefPic, int interLayerIdx )
-#else
-void ReferencePictureList::setRefPicIdentifier(int idx, int identifier, bool isLongterm)
-#endif
 {
   m_refPicIdentifier[idx] = identifier;
   m_isLongtermRefPic[idx] = isLongterm;
@@ -2881,10 +2625,8 @@ void ReferencePictureList::setRefPicIdentifier(int idx, int identifier, bool isL
   m_deltaPocMSBPresentFlag[idx] = false;
   m_deltaPOCMSBCycleLT[idx] = 0;
 
-#if JVET_O1159_SCALABILITY
   m_isInterLayerRefPic[idx] = isInterLayerRefPic;
   m_interLayerRefPicIdx[idx] = interLayerIdx;
-#endif
 }
 
 int ReferencePictureList::getRefPicIdentifier(int idx) const
@@ -3948,11 +3690,7 @@ void Slice::scaleRefPicList( Picture *scaledRefPic[ ], APS** apss, APS* lmcsAps,
             scaledRefPic[j]->referenced = true;
 
 #if JVET_P1006_PICTURE_HEADER
-#if JVET_O1159_SCALABILITY
             scaledRefPic[j]->finalInit( m_pcPic->cs->vps, *sps, *pps, picHeader, apss, lmcsAps, scalingListAps );
-#else
-            scaledRefPic[j]->finalInit( *sps, *pps, picHeader, apss, lmcsAps, scalingListAps );
-#endif
 #else
             scaledRefPic[ j ]->finalInit( *sps, *pps, apss, lmcsAps, scalingListAps );
 #endif
diff --git a/source/Lib/CommonLib/Slice.h b/source/Lib/CommonLib/Slice.h
index 28d23d831..30bb3b167 100644
--- a/source/Lib/CommonLib/Slice.h
+++ b/source/Lib/CommonLib/Slice.h
@@ -84,26 +84,16 @@ private:
   bool  m_deltaPocMSBPresentFlag[MAX_NUM_REF_PICS];
   int   m_deltaPOCMSBCycleLT[MAX_NUM_REF_PICS];
   bool  m_ltrp_in_slice_header_flag;
-#if JVET_O1159_SCALABILITY
   bool  m_interLayerPresentFlag;
   bool  m_isInterLayerRefPic[MAX_NUM_REF_PICS];
   int   m_interLayerRefPicIdx[MAX_NUM_REF_PICS];
   int   m_numberOfInterLayerPictures;
-#endif
 
 public:
-#if JVET_O1159_SCALABILITY
   ReferencePictureList( const bool interLayerPicPresentFlag = false );
-#else
-  ReferencePictureList();
-#endif
   virtual ~ReferencePictureList();
 
-#if JVET_O1159_SCALABILITY
   void    setRefPicIdentifier( int idx, int identifier, bool isLongterm, bool isInterLayerRefPic, int interLayerIdx );
-#else
-  void    setRefPicIdentifier(int idx, int identifier, bool isLongterm);
-#endif
   int     getRefPicIdentifier(int idx) const;
   bool    isRefPicLongterm(int idx) const;
 
@@ -116,14 +106,10 @@ public:
   void    setLtrpInSliceHeaderFlag(bool flag) { m_ltrp_in_slice_header_flag = flag; }
   bool    getLtrpInSliceHeaderFlag() const { return m_ltrp_in_slice_header_flag; }
 
-#if JVET_O1159_SCALABILITY
   void    setNumberOfInterLayerPictures( const int numberOfIlrp ) { m_numberOfInterLayerPictures = numberOfIlrp; }
   int     getNumberOfInterLayerPictures() const { return m_numberOfInterLayerPictures; }
 
   int     getNumRefEntries() const { return m_numberOfShorttermPictures + m_numberOfLongtermPictures + m_numberOfInterLayerPictures; }
-#else
-  int     getNumRefEntries() const { return m_numberOfShorttermPictures + m_numberOfLongtermPictures; }
-#endif
 
   void    setPOC(int idx, int POC);
   int     getPOC(int idx) const;
@@ -138,13 +124,11 @@ public:
 
   void    printRefPicInfo() const;
 
-#if JVET_O1159_SCALABILITY
   bool      getInterLayerPresentFlag()                   const { return m_interLayerPresentFlag; }
   void      setInterLayerPresentFlag( bool b )                 { m_interLayerPresentFlag = b; }
   bool      isInterLayerRefPic( int idx )                const { return m_isInterLayerRefPic[idx]; }
   int       getInterLayerRefPicIdx( int idx )            const { return m_interLayerRefPicIdx[idx]; }
   void      setInterLayerRefPicIdx( int idx, int layerIdc )    { m_interLayerRefPicIdx[idx] = layerIdc; }
-#endif
 };
 
 /// Reference Picture List set class
@@ -786,7 +770,6 @@ private:
 #if JVET_P0185
   uint32_t              m_vpsMaxSubLayers;
 #endif
-#if JVET_O1159_SCALABILITY
   uint32_t              m_vpsLayerId[MAX_VPS_LAYERS];
   bool                  m_vpsAllLayersSameNumSubLayersFlag;
   bool                  m_vpsAllIndependentLayersFlag;
@@ -801,9 +784,6 @@ private:
 
   // stores index ( ilrp_idx within 0 .. NumDirectRefLayers ) of the dependent reference layers 
   uint32_t              m_interLayerRefIdx[MAX_VPS_LAYERS][MAX_VPS_LAYERS];
-#else
-  uint32_t              m_vpsIncludedLayerId[MAX_VPS_LAYERS];
-#endif
   bool                  m_vpsExtensionFlag;
 
 public:
@@ -821,7 +801,6 @@ public:
   uint32_t          getMaxSubLayers() const                              { return m_vpsMaxSubLayers;                                        }
   void              setMaxSubLayers(uint32_t value)                      { m_vpsMaxSubLayers = value;                                       }
 #endif
-#if JVET_O1159_SCALABILITY
   bool              getAllLayersSameNumSublayersFlag() const { return m_vpsAllLayersSameNumSubLayersFlag; }
   void              setAllLayersSameNumSublayersFlag(bool t) { m_vpsAllLayersSameNumSubLayersFlag = t; }
 
@@ -857,11 +836,6 @@ public:
 
   bool              getOlsOutputLayerFlag(uint32_t ols, uint32_t layer) const { return m_vpsOlsOutputLayerFlag[ols][layer]; }
   void              setOlsOutputLayerFlag(uint32_t ols, uint32_t layer, bool t) { m_vpsOlsOutputLayerFlag[ols][layer] = t; }
-#else
-  void              setVPSIncludedLayerId(uint32_t v, uint32_t layer) { m_vpsIncludedLayerId[layer] = v; }
-  uint32_t          getVPSIncludedLayerId(uint32_t layer) const { return m_vpsIncludedLayerId[layer]; }
->>>>>>> BD/VVCSoftware_VTM-JVET-O1159_JVET-P1019
-#endif
 
   bool              getVPSExtensionFlag() const                          { return m_vpsExtensionFlag;                                 }
   void              setVPSExtensionFlag(bool t)                          { m_vpsExtensionFlag = t;                                    }
@@ -1238,9 +1212,7 @@ private:
 #if JVET_P0590_SCALING_WINDOW
   bool              m_rprEnabledFlag;
 #endif
-#if JVET_O1159_SCALABILITY
   bool              m_interLayerPresentFlag;
-#endif
 
 public:
 
@@ -1584,10 +1556,8 @@ public:
   bool      getRprEnabledFlag()                                           const     { return m_rprEnabledFlag; }
   void      setRprEnabledFlag( bool flag )                                          { m_rprEnabledFlag = flag; }
 #endif
-#if JVET_O1159_SCALABILITY
   bool      getInterLayerPresentFlag()                                        const { return m_interLayerPresentFlag; }
   void      setInterLayerPresentFlag( bool b )                                      { m_interLayerPresentFlag = b; }
-#endif
 
 };
 
@@ -2826,18 +2796,10 @@ public:
 
   void                        checkLeadingPictureRestrictions( PicList& rcListPic )                                         const;
   int                         checkThatAllRefPicsAreAvailable(PicList& rcListPic, const ReferencePictureList* pRPL, int rplIdx, bool printErrors, int* refPicIndex) const;
-#if JVET_O1159_SCALABILITY
   void                        applyReferencePictureListBasedMarking( PicList& rcListPic, const ReferencePictureList *pRPL0, const ReferencePictureList *pRPL1, const int layerId )  const;
-#else
-  void                        applyReferencePictureListBasedMarking( PicList& rcListPic, const ReferencePictureList *pRPL0, const ReferencePictureList *pRPL1 )  const;
-#endif
   bool                        isTemporalLayerSwitchingPoint( PicList& rcListPic )                                           const;
   bool                        isStepwiseTemporalLayerSwitchingPointCandidate( PicList& rcListPic )                          const;
   int                         checkThatAllRefPicsAreAvailable(PicList& rcListPic, const ReferencePictureList *pRPL, int rplIdx, bool printErrors)                const;
-#if !JVET_O1159_SCALABILITY
-  // this is encoder only function
-  void                        createExplicitReferencePictureSetFromReference(PicList& rcListPic, const ReferencePictureList *pRPL0, const ReferencePictureList *pRPL1);
-#endif
 #if !JVET_P1006_PICTURE_HEADER
   void                        setMaxNumMergeCand(uint32_t val )                          { m_maxNumMergeCand = val;                                      }
   uint32_t                    getMaxNumMergeCand() const                             { return m_maxNumMergeCand;                                     }
@@ -3184,10 +3146,8 @@ public:
                  ParameterSetManager();
   virtual        ~ParameterSetManager();
 
-#if JVET_O1159_SCALABILITY
   void           storeVPS(VPS *vps, const std::vector<uint8_t> &naluData)    { m_vpsMap.storePS(vps->getVPSId(), vps, &naluData); }
   VPS*           getVPS( int vpsId )                                         { return m_vpsMap.getPS( vpsId ); };
-#endif
 
   void           storeDPS(DPS *dps, const std::vector<uint8_t> &naluData)    { m_dpsMap.storePS( dps->getDecodingParameterSetId(), dps, &naluData); };
   //! get pointer to existing video parameter set
diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h
index dd0cf3b7b..b7959b0b7 100644
--- a/source/Lib/CommonLib/TypeDef.h
+++ b/source/Lib/CommonLib/TypeDef.h
@@ -154,7 +154,6 @@
 #define JVET_P0347_MAX_MTT_DEPTH_CONSTRAINT               1 // JVET-P0347: Max MTT Depth constraint
 
 
-#define JVET_O1159_SCALABILITY                            1 // JVET-O1159: Scalability
 
 #define JVET_P0325_CHANGE_MERGE_CANDIDATE_ORDER           1 // JVET-P0325: reorder the spatial merge candidates
 
diff --git a/source/Lib/CommonLib/UnitTools.cpp b/source/Lib/CommonLib/UnitTools.cpp
index 0581de096..a5907cb70 100644
--- a/source/Lib/CommonLib/UnitTools.cpp
+++ b/source/Lib/CommonLib/UnitTools.cpp
@@ -1404,11 +1404,7 @@ bool PU::checkDMVRCondition(const PredictionUnit& pu)
       && ((pu.lheight() * pu.lwidth()) >= 128)
       && (pu.cu->BcwIdx == BCW_DEFAULT)
       && ((!wp0[COMPONENT_Y].bPresentFlag) && (!wp1[COMPONENT_Y].bPresentFlag))
-#if JVET_P0590_SCALING_WINDOW || JVET_O1159_SCALABILITY
       && ( refIdx0 < 0 ? true : pu.cu->slice->getScalingRatio( REF_PIC_LIST_0, refIdx0 ) == SCALE_1X ) && ( refIdx1 < 0 ? true : pu.cu->slice->getScalingRatio( REF_PIC_LIST_1, refIdx1 ) == SCALE_1X )
-#else
-      && PU::isRefPicSameSize( pu )
-#endif
       ;
   }
   else
@@ -4080,31 +4076,5 @@ bool allowLfnstWithMip(const Size& block)
   return false;
 }
 
-#if !JVET_P0590_SCALING_WINDOW && !JVET_O1159_SCALABILITY
-bool PU::isRefPicSameSize( const PredictionUnit& pu )
-{
-  bool samePicSize = true;
-  int curPicWidth = pu.cs->pps->getPicWidthInLumaSamples();
-  int curPicHeight = pu.cs->pps->getPicHeightInLumaSamples();
-
-  if( pu.refIdx[0] >= 0 )
-  {
-    int refPicWidth = pu.cu->slice->getRefPic( REF_PIC_LIST_0, pu.refIdx[0] )->getPicWidthInLumaSamples();
-    int refPicHeight = pu.cu->slice->getRefPic( REF_PIC_LIST_0, pu.refIdx[0] )->getPicHeightInLumaSamples();
-
-    samePicSize = refPicWidth == curPicWidth && refPicHeight == curPicHeight;
-  }
-
-  if( pu.refIdx[1] >= 0 )
-  {
-    int refPicWidth = pu.cu->slice->getRefPic( REF_PIC_LIST_1, pu.refIdx[1] )->getPicWidthInLumaSamples();
-    int refPicHeight = pu.cu->slice->getRefPic( REF_PIC_LIST_1, pu.refIdx[1] )->getPicHeightInLumaSamples();
-
-    samePicSize = samePicSize && ( refPicWidth == curPicWidth && refPicHeight == curPicHeight );
-  }
-
-  return samePicSize;
-}
-#endif
 
 
diff --git a/source/Lib/CommonLib/UnitTools.h b/source/Lib/CommonLib/UnitTools.h
index 3fbb6fb3e..62a2c05cc 100644
--- a/source/Lib/CommonLib/UnitTools.h
+++ b/source/Lib/CommonLib/UnitTools.h
@@ -196,9 +196,6 @@ namespace PU
   bool getDerivedBV(PredictionUnit &pu, const Mv& currentMv, Mv& derivedMv);
   bool checkDMVRCondition(const PredictionUnit& pu);
 
-#if !JVET_P0590_SCALING_WINDOW && !JVET_O1159_SCALABILITY
-  bool isRefPicSameSize( const PredictionUnit& pu );
-#endif
 }
 
 // TU tools
diff --git a/source/Lib/DecoderLib/DecLib.cpp b/source/Lib/DecoderLib/DecLib.cpp
index d6aa79517..424715f3c 100644
--- a/source/Lib/DecoderLib/DecLib.cpp
+++ b/source/Lib/DecoderLib/DecLib.cpp
@@ -441,13 +441,6 @@ DecLib::~DecLib()
     m_prefixSEINALUs.pop_front();
   }
 
-#if !JVET_O1159_SCALABILITY
-  if( m_vps != nullptr )
-  {
-    delete m_vps;
-    m_vps = nullptr;
-  }
-#endif
 }
 
 void DecLib::create()
@@ -678,12 +671,10 @@ void DecLib::finishPicture(int& poc, PicList*& rpcListPic, MsgLevel msgl )
           msg( msgl, "%d ", pcSlice->getRefPOC( RefPicList( iRefList ), iRefIndex ) );
       }
 
-#if JVET_O1159_SCALABILITY
       if( pcSlice->getRefPOC( RefPicList( iRefList ), iRefIndex ) == pcSlice->getPOC() )
       {
         msg( msgl, ".%d", pcSlice->getRefPic( RefPicList( iRefList ), iRefIndex )->layerId );
       }   
-#endif
 
       msg( msgl, " " );
     }
@@ -1029,9 +1020,7 @@ void DecLib::xActivateParameterSets( const int layerId )
     const SPS *sps = m_parameterSetManager.getSPS(pps->getSPSId());             // this is a temporary SPS object. Do not store this value
     CHECK(sps == 0, "No SPS present");
 
-#if JVET_O1159_SCALABILITY
     const VPS *vps = sps->getVPSId() ? m_parameterSetManager.getVPS( sps->getVPSId() ) : nullptr;
-#endif
 
     if (NULL == pps->pcv)
     {
@@ -1081,17 +1070,9 @@ void DecLib::xActivateParameterSets( const int layerId )
     //  Get a new picture buffer. This will also set up m_pcPic, and therefore give us a SPS and PPS pointer that we can use.
     m_pcPic = xGetNewPicBuffer( *sps, *pps, m_apcSlicePilot->getTLayer(), layerId );
 
-#if JVET_O1159_SCALABILITY
     m_apcSlicePilot->applyReferencePictureListBasedMarking( m_cListPic, m_apcSlicePilot->getRPL0(), m_apcSlicePilot->getRPL1(), layerId );
-#else
-    m_apcSlicePilot->applyReferencePictureListBasedMarking(m_cListPic, m_apcSlicePilot->getRPL0(), m_apcSlicePilot->getRPL1());
-#endif
 #if JVET_P1006_PICTURE_HEADER
-#if JVET_O1159_SCALABILITY
     m_pcPic->finalInit( vps, *sps, *pps, &m_picHeader, apss, lmcsAPS, scalinglistAPS );
-#else
-    m_pcPic->finalInit( *sps, *pps, &m_picHeader, apss, lmcsAPS, scalinglistAPS );
-#endif
 #else
     m_pcPic->finalInit( *sps, *pps, apss, lmcsAPS, scalinglistAPS );
 #endif
@@ -1121,9 +1102,7 @@ void DecLib::xActivateParameterSets( const int layerId )
     m_pcPic->cs->slice = pSlice;
     m_pcPic->cs->sps   = sps;
     m_pcPic->cs->pps   = pps;
-#if JVET_O1159_SCALABILITY
     m_pcPic->cs->vps = vps;
-#endif
 
     memcpy(m_pcPic->cs->alfApss, apss, sizeof(m_pcPic->cs->alfApss));
     m_pcPic->cs->lmcsAps = lmcsAPS;
@@ -1936,22 +1915,13 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl
 
 void DecLib::xDecodeVPS( InputNALUnit& nalu )
 {
-#if JVET_O1159_SCALABILITY
   m_vps = new VPS();
-#else
-  if( m_vps == nullptr )
-  {
-    m_vps = new VPS();
-  }
-#endif
   m_HLSReader.setBitstream( &nalu.getBitstream() );
 
   CHECK( nalu.m_temporalId, "The value of TemporalId of VPS NAL units shall be equal to 0" );
 
   m_HLSReader.parseVPS( m_vps );
-#if JVET_O1159_SCALABILITY
   m_parameterSetManager.storeVPS( m_vps, nalu.getBitstream().getFifo());
-#endif
 }
 
 void DecLib::xDecodeDPS( InputNALUnit& nalu )
diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp
index 42e94c891..f20ebc94f 100644
--- a/source/Lib/DecoderLib/VLCReader.cpp
+++ b/source/Lib/DecoderLib/VLCReader.cpp
@@ -300,9 +300,7 @@ void HLSyntaxReader::copyRefPicList(SPS* sps, ReferencePictureList* source_rpl,
 {
   dest_rp->setNumberOfShorttermPictures(source_rpl->getNumberOfShorttermPictures());
 
-#if JVET_O1159_SCALABILITY
   dest_rp->setNumberOfInterLayerPictures( sps->getInterLayerPresentFlag() ? dest_rp->getNumberOfInterLayerPictures() : 0 );
-#endif
 
   if( sps->getLongTermRefsPresent() )
   {
@@ -315,11 +313,7 @@ void HLSyntaxReader::copyRefPicList(SPS* sps, ReferencePictureList* source_rpl,
 
   for( int ii = 0; ii < numRefPic; ii++ )
   {
-#if JVET_O1159_SCALABILITY
     dest_rp->setRefPicIdentifier( ii, source_rpl->getRefPicIdentifier( ii ), source_rpl->isRefPicLongterm( ii ), source_rpl->isInterLayerRefPic( ii ), source_rpl->getInterLayerRefPicIdx( ii ) );
-#else
-    dest_rp->setRefPicIdentifier( ii, source_rpl->getRefPicIdentifier( ii ), source_rpl->isRefPicLongterm( ii ) );
-#endif
   }
 }
 
@@ -330,9 +324,7 @@ void HLSyntaxReader::parseRefPicList(SPS* sps, ReferencePictureList* rpl)
   uint32_t numRefPic = code;
   uint32_t numStrp = 0;
   uint32_t numLtrp = 0;
-#if JVET_O1159_SCALABILITY
   uint32_t numIlrp = 0;
-#endif
 
   if (sps->getLongTermRefsPresent())
   {
@@ -345,13 +337,10 @@ void HLSyntaxReader::parseRefPicList(SPS* sps, ReferencePictureList* rpl)
   int deltaValue = 0;
   bool firstSTRP = true;
 
-#if JVET_O1159_SCALABILITY
   rpl->setInterLayerPresentFlag( sps->getInterLayerPresentFlag() );
-#endif
 
   for (int ii = 0; ii < numRefPic; ii++)
   {
-#if JVET_O1159_SCALABILITY
     uint32_t isInterLayerRefPic = 0;
 
     if( rpl->getInterLayerPresentFlag() )
@@ -368,7 +357,6 @@ void HLSyntaxReader::parseRefPicList(SPS* sps, ReferencePictureList* rpl)
 
     if( !isInterLayerRefPic )
     {
-#endif
     isLongTerm = false;
     if (sps->getLongTermRefsPresent())
     {
@@ -402,33 +390,21 @@ void HLSyntaxReader::parseRefPicList(SPS* sps, ReferencePictureList* rpl)
         prevDelta = deltaValue;
       }
 
-#if JVET_O1159_SCALABILITY
       rpl->setRefPicIdentifier( ii, deltaValue, isLongTerm, false, 0 );
-#else
-      rpl->setRefPicIdentifier(ii, deltaValue, isLongTerm);
-#endif
       numStrp++;
     }
     else
     {
       if (!rpl->getLtrpInSliceHeaderFlag())
         READ_CODE(sps->getBitsForPOC(), code, "poc_lsb_lt[listIdx][rplsIdx][j]");
-#if JVET_O1159_SCALABILITY
       rpl->setRefPicIdentifier( ii, code, isLongTerm, false, 0 );
-#else
-      rpl->setRefPicIdentifier(ii, code, isLongTerm);
-#endif 
       numLtrp++;
     }
-#if JVET_O1159_SCALABILITY
     }
-#endif
   }
   rpl->setNumberOfShorttermPictures(numStrp);
   rpl->setNumberOfLongtermPictures(numLtrp);
-#if JVET_O1159_SCALABILITY
   rpl->setNumberOfInterLayerPictures( numIlrp );
-#endif
 }
 
 void HLSyntaxReader::parsePPS( PPS* pcPPS, ParameterSetManager *parameterSetManager )
@@ -1635,9 +1611,7 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
   }
 
   READ_FLAG(uiCode, "long_term_ref_pics_flag");          pcSPS->setLongTermRefsPresent(uiCode);
-#if JVET_O1159_SCALABILITY
   READ_FLAG( uiCode, "inter_layer_ref_pics_present_flag" );  pcSPS->setInterLayerPresentFlag( uiCode );
-#endif 
 #if JVET_P2001_SYNTAX_ORDER_MISMATCHES
   READ_FLAG( uiCode, "sps_idr_rpl_present_flag" );       pcSPS->setIDRRefParamListPresent( (bool) uiCode );
 #endif
@@ -2207,7 +2181,6 @@ void HLSyntaxReader::parseVPS(VPS* pcVPS)
   READ_CODE(4, uiCode, "vps_video_parameter_set_id");         pcVPS->setVPSId(uiCode);
 #endif
 
-#if JVET_O1159_SCALABILITY
   READ_CODE(6, uiCode, "vps_max_layers_minus1");              pcVPS->setMaxLayers(uiCode + 1);    CHECK(uiCode + 1 > MAX_VPS_LAYERS, "Invalid code");
   if (pcVPS->getMaxLayers() - 1 == 0)
   {
@@ -2291,17 +2264,6 @@ void HLSyntaxReader::parseVPS(VPS* pcVPS)
       }
     }
   }
-#else
-  READ_CODE(8, uiCode, "vps_max_layers_minus1");              pcVPS->setMaxLayers(uiCode + 1);    CHECK(uiCode + 1 > MAX_VPS_LAYERS, "Invalid code");
-#if JVET_P0185
-  READ_CODE(3, uiCode, "vps_max_sub_layers_minus1");          pcVPS->setMaxSubLayers(uiCode + 1);
-#endif
-  for (uint32_t i = 0; i <= pcVPS->getMaxLayers() - 1; i++)
-  {
-    READ_CODE(7, uiCode, "vps_included_layer_id");          pcVPS->setVPSIncludedLayerId(uiCode, i);
-    READ_FLAG(uiCode, "vps_reserved_zero_1bit");
-  }
-#endif
   READ_FLAG(uiCode, "vps_extension_flag");
   if (uiCode)
   {
@@ -2538,11 +2500,7 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag
             if (picHeader->getRPL( listIdx )->getLtrpInSliceHeaderFlag())
             {
               READ_CODE(sps->getBitsForPOC(), uiCode, "pic_poc_lsb_lt[i][j]");
-#if JVET_O1159_SCALABILITY
               picHeader->getLocalRPL( listIdx )->setRefPicIdentifier( i, uiCode, true, false, 0 );
-#else
-              picHeader->getLocalRPL( listIdx )->setRefPicIdentifier(i, uiCode, true);
-#endif
             }
             READ_FLAG(uiCode, "pic_delta_poc_msb_present_flag[i][j]");
             picHeader->getLocalRPL( listIdx )->setDeltaPocMSBPresentFlag(i, uiCode ? true : false);
@@ -3388,11 +3346,7 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para
             if (pcSlice->getRPL0()->getLtrpInSliceHeaderFlag())
             {
               READ_CODE(sps->getBitsForPOC(), uiCode, "slice_poc_lsb_lt[i][j]");
-#if JVET_O1159_SCALABILITY
               pcSlice->getLocalRPL0()->setRefPicIdentifier( i, uiCode, true, false, 0 );
-#else
-              pcSlice->getLocalRPL0()->setRefPicIdentifier(i, uiCode, true);
-#endif
             }
             READ_FLAG(uiCode, "delta_poc_msb_present_flag[i][j]");
             pcSlice->getLocalRPL0()->setDeltaPocMSBPresentFlag(i, uiCode ? true : false);
@@ -3477,11 +3431,7 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para
             if (pcSlice->getRPL1()->getLtrpInSliceHeaderFlag())
             {
               READ_CODE(sps->getBitsForPOC(), uiCode, "slice_poc_lsb_lt[i][j]");
-#if JVET_O1159_SCALABILITY
               pcSlice->getLocalRPL1()->setRefPicIdentifier( i, uiCode, true, false, 0 );
-#else
-              pcSlice->getLocalRPL1()->setRefPicIdentifier(i, uiCode, true);
-#endif
             }
             READ_FLAG(uiCode, "delta_poc_msb_present_flag[i][j]");
             pcSlice->getLocalRPL1()->setDeltaPocMSBPresentFlag(i, uiCode ? true : false);
diff --git a/source/Lib/EncoderLib/EncAdaptiveLoopFilter.cpp b/source/Lib/EncoderLib/EncAdaptiveLoopFilter.cpp
index 5ff91d429..dc2d1d05d 100644
--- a/source/Lib/EncoderLib/EncAdaptiveLoopFilter.cpp
+++ b/source/Lib/EncoderLib/EncAdaptiveLoopFilter.cpp
@@ -640,11 +640,7 @@ void EncAdaptiveLoopFilter::ALFProcess(CodingStructure& cs, const double *lambda
 #endif
                                       )
 {
-#if JVET_O1159_SCALABILITY
   int layerIdx = cs.vps == nullptr ? 0 : cs.vps->getGeneralLayerIdx( cs.slice->getPic()->layerId );
-#else
-  int layerIdx = cs.slice->getPic()->layerId; //VS: layerId should be converted to layerIdx
-#endif
 
    // IRAP AU is assumed
   if( !layerIdx && ( cs.slice->getPendingRasInit() || cs.slice->isIDRorBLA() ) )
diff --git a/source/Lib/EncoderLib/EncCfg.h b/source/Lib/EncoderLib/EncCfg.h
index 543fcfc87..cb8de580a 100644
--- a/source/Lib/EncoderLib/EncCfg.h
+++ b/source/Lib/EncoderLib/EncCfg.h
@@ -886,9 +886,7 @@ protected:
   bool        m_rprEnabled;
   int         m_switchPocPeriod;
   int         m_upscaledOutput;
-#if JVET_O1159_SCALABILITY
   int         m_numRefLayers[MAX_VPS_LAYERS];
-#endif
 
 public:
   EncCfg()
@@ -2255,10 +2253,8 @@ public:
   void        setUpscaledOutput( int b )                             { m_upscaledOutput = b; }
   int         getUpscaledOutput()                              const { return m_upscaledOutput; }
 
-#if JVET_O1159_SCALABILITY
   void        setNumRefLayers( int* numRefLayers )                   { std::memcpy( m_numRefLayers, numRefLayers, sizeof( m_numRefLayers ) ); }
   int         getNumRefLayers( int layerIdx )                  const { return m_numRefLayers[layerIdx];  }
-#endif
 };
 
 //! \}
diff --git a/source/Lib/EncoderLib/EncGOP.cpp b/source/Lib/EncoderLib/EncGOP.cpp
index 597ea3dd6..791cd611c 100644
--- a/source/Lib/EncoderLib/EncGOP.cpp
+++ b/source/Lib/EncoderLib/EncGOP.cpp
@@ -332,17 +332,11 @@ int EncGOP::xWriteDPS (AccessUnit &accessUnit, const DPS *dps)
   }
 }
 
-#if JVET_O1159_SCALABILITY
 int EncGOP::xWriteSPS( AccessUnit &accessUnit, const SPS *sps, const int layerId )
-#else
-int EncGOP::xWriteSPS (AccessUnit &accessUnit, const SPS *sps)
-#endif
 {
   OutputNALUnit nalu(NAL_UNIT_SPS);
   m_HLSWriter->setBitstream( &nalu.m_Bitstream );
-#if JVET_O1159_SCALABILITY
   nalu.m_nuhLayerId = layerId;
-#endif
   CHECK( nalu.m_temporalId, "The value of TemporalId of SPS NAL units shall be equal to 0" );
   m_HLSWriter->codeSPS( sps );
   accessUnit.push_back(new NALUnitEBSP(nalu));
@@ -399,11 +393,7 @@ int EncGOP::xWriteParameterSets( AccessUnit &accessUnit, Slice *slice, const boo
     if( m_pcEncLib->SPSNeedsWriting( slice->getSPS()->getSPSId() ) ) // Note this assumes that all changes to the SPS are made at the EncLib level prior to picture creation (EncLib::xGetNewPicBuffer).
     {
       CHECK( !( bSeqFirst ), "Unspecified error" ); // Implementations that use more than 1 SPS need to be aware of activation issues.
-#if JVET_O1159_SCALABILITY
       actualTotalBits += xWriteSPS( accessUnit, slice->getSPS(), m_pcEncLib->getLayerId() );
-#else
-      actualTotalBits += xWriteSPS( accessUnit, slice->getSPS() );
-#endif
     }
   }
 
@@ -443,11 +433,7 @@ void EncGOP::xWriteAccessUnitDelimiter (AccessUnit &accessUnit, Slice *slice)
   }
   else
   {
-#if JVET_O1159_SCALABILITY
     nalu.m_nuhLayerId = slice->getVPS()->getLayerId(0);
-#else
-    nalu.m_nuhLayerId = slice->getVPS()->getVPSIncludedLayerId(0);
-#endif
   }
   CHECK( nalu.m_temporalId != accessUnit.temporalId, "TemporalId shall be equal to the TemporalId of the AU containing the NAL unit" );
 #else
@@ -2072,11 +2058,7 @@ void EncGOP::xPicInitLMCS(Picture *pic, Slice *slice)
 #endif
     if (m_pcReshaper->getSliceReshaperInfo().getSliceReshapeModelPresentFlag())
     {
-#if JVET_O1159_SCALABILITY
       int apsId = std::min<int>( 3, m_pcEncLib->getVPS() == nullptr ? 0 : m_pcEncLib->getVPS()->getGeneralLayerIdx( m_pcEncLib->getLayerId() ) );
-#else
-      int apsId = std::min<int>( 3, m_pcEncLib->getLayerId() ); //VS: layerId should be converted to laeyrIdx
-#endif
 #if JVET_P1006_PICTURE_HEADER
       picHeader->setLmcsAPSId(apsId);
       APS* lmcsAPS = picHeader->getLmcsAPS();
@@ -2120,11 +2102,7 @@ void EncGOP::xPicInitLMCS(Picture *pic, Slice *slice)
     if (slice->getLmcsEnabledFlag())
 #endif
     {
-#if JVET_O1159_SCALABILITY
       int apsId = std::min<int>( 3, m_pcEncLib->getVPS() == nullptr ? 0 : m_pcEncLib->getVPS()->getGeneralLayerIdx( m_pcEncLib->getLayerId() ) );
-#else
-      int apsId = std::min<int>( 3, m_pcEncLib->getLayerId() ); //VS: layerId should be converted to laeyrIdx
-#endif
 #if JVET_P1006_PICTURE_HEADER
       picHeader->setLmcsAPSId(apsId);
 #else
@@ -2409,23 +2387,13 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic,
 
     if (pcSlice->checkThatAllRefPicsAreAvailable(rcListPic, pcSlice->getRPL0(), 0, false) != 0 || pcSlice->checkThatAllRefPicsAreAvailable(rcListPic, pcSlice->getRPL1(), 1, false) != 0 ||
         (m_pcEncLib->getDependentRAPIndicationSEIEnabled() && !pcSlice->isIRAP() && ( pcSlice->isDRAP() || !pcSlice->isPOCInRefPicList(pcSlice->getRPL0(), pcSlice->getAssociatedIRAPPOC())) )
-#if JVET_O1159_SCALABILITY
       || ( !pcSlice->isIRAP() && pcSlice->getPic()->cs->vps && m_pcEncLib->getNumRefLayers( pcSlice->getPic()->cs->vps->getGeneralLayerIdx( m_pcEncLib->getLayerId() ) ) )
-#endif
       )
     {
-#if JVET_O1159_SCALABILITY
       xCreateExplicitReferencePictureSetFromReference( pcSlice, rcListPic, pcSlice->getRPL0(), pcSlice->getRPL1() );
-#else
-      pcSlice->createExplicitReferencePictureSetFromReference(rcListPic, pcSlice->getRPL0(), pcSlice->getRPL1());
-#endif
     }
 
-#if JVET_O1159_SCALABILITY
     pcSlice->applyReferencePictureListBasedMarking( rcListPic, pcSlice->getRPL0(), pcSlice->getRPL1(), pcSlice->getPic()->layerId );
-#else
-    pcSlice->applyReferencePictureListBasedMarking(rcListPic, pcSlice->getRPL0(), pcSlice->getRPL1());
-#endif
 
     if(pcSlice->getTLayer() > 0
       && !(pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL     // Check if not a leading picture
@@ -2436,12 +2404,10 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic,
       {
         bool isSTSA=true;
 
-#if JVET_O1159_SCALABILITY
         if( !m_pcEncLib->getVPS()->getAllIndependentLayersFlag() && m_pcEncLib->getVPS()->getGeneralLayerIdx( m_pcEncLib->getLayerId() ) )
         {
           isSTSA = false;
         }
-#endif
 
         for(int ii=iGOPid+1;(ii<m_pcCfg->getGOPSize() && isSTSA==true);ii++)
         {
@@ -2986,11 +2952,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic,
       pcSlice->setscalingListPresentFlag( true );
 #endif
 
-#if JVET_O1159_SCALABILITY
       int apsId = std::min<int>( 7, m_pcEncLib->getVPS() == nullptr ? 0 : m_pcEncLib->getVPS()->getGeneralLayerIdx( m_pcEncLib->getLayerId() ) );
-#else
-      int apsId = std::min<int>( 7, m_pcEncLib->getLayerId() ); //VS: layerId should be converted to laeyrIdx
-#endif
 #if JVET_P1006_PICTURE_HEADER
       picHeader->setScalingListAPSId( apsId );
 #else
@@ -3099,11 +3061,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic,
         pcSlice->setLmcsEnabledFlag(true);
 #endif
 
-#if JVET_O1159_SCALABILITY
         int apsId = std::min<int>( 3, m_pcEncLib->getVPS() == nullptr ? 0 : m_pcEncLib->getVPS()->getGeneralLayerIdx( m_pcEncLib->getLayerId() ) );
-#else
-        int apsId = std::min<int>( 3, m_pcEncLib->getLayerId() ); //VS: layerId should be converted to laeyrIdx
-#endif
 
 #if JVET_P1006_PICTURE_HEADER
         picHeader->setLmcsAPSId(apsId);
@@ -3306,11 +3264,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic,
         m_pcEncLib->setParamSetChanged(pcSlice->getSPS()->getSPSId(), pcSlice->getPPS()->getPPSId());
       }
 
-#if JVET_O1159_SCALABILITY
       int layerIdx = m_pcEncLib->getVPS() == nullptr ? 0 : m_pcEncLib->getVPS()->getGeneralLayerIdx( m_pcEncLib->getLayerId() );
-#else
-      int layerIdx = m_pcEncLib->getLayerId(); //VS: convert layerId to layerIdx after VPS is implemented
-#endif
 
       // it is assumed that layerIdx equal to 0 is always present
       actualTotalBits += xWriteParameterSets( accessUnit, pcSlice, writePS && !layerIdx );
@@ -4639,12 +4593,10 @@ void EncGOP::xCalculateAddPSNR(Picture* pcPic, PelUnitBuf cPicD, const AccessUni
             msg( NOTICE, "%d ", pcSlice->getRefPOC( RefPicList( iRefList ), iRefIndex ) );
         }
 
-#if JVET_O1159_SCALABILITY
         if( pcSlice->getRefPOC( RefPicList( iRefList ), iRefIndex ) == pcSlice->getPOC() )
         {
           msg( NOTICE, ".%d", pcSlice->getRefPic( RefPicList( iRefList ), iRefIndex )->layerId );
         }
-#endif
 
         msg( NOTICE, " " );
       }
@@ -5452,7 +5404,6 @@ void EncGOP::applyDeblockingFilterParameterSelection( Picture* pcPic, const uint
 }
 #endif
 
-#if JVET_O1159_SCALABILITY
 void EncGOP::xCreateExplicitReferencePictureSetFromReference( Slice* slice, PicList& rcListPic, const ReferencePictureList *rpl0, const ReferencePictureList *rpl1 )
 {
   Picture* rpcPic;
@@ -5721,5 +5672,4 @@ void EncGOP::xCreateExplicitReferencePictureSetFromReference( Slice* slice, PicL
   slice->setRPL1idx( -1 );
   slice->setRPL1( pLocalRPL1 );
 }
-#endif
 //! \}
diff --git a/source/Lib/EncoderLib/EncGOP.h b/source/Lib/EncoderLib/EncGOP.h
index b20a43b1f..16fd09138 100644
--- a/source/Lib/EncoderLib/EncGOP.h
+++ b/source/Lib/EncoderLib/EncGOP.h
@@ -328,11 +328,7 @@ protected:
 
   int xWriteVPS (AccessUnit &accessUnit, const VPS *vps);
   int xWriteDPS (AccessUnit &accessUnit, const DPS *dps);
-#if JVET_O1159_SCALABILITY
   int xWriteSPS( AccessUnit &accessUnit, const SPS *sps, const int layerId = 0 );
-#else
-  int xWriteSPS (AccessUnit &accessUnit, const SPS *sps);
-#endif
   int xWritePPS( AccessUnit &accessUnit, const PPS *pps, const SPS *sps, const int layerId = 0 );
 #if JVET_P0588_SUFFIX_APS
   int xWriteAPS( AccessUnit &accessUnit, APS *aps, const int layerId, const bool isPrefixNUT );
@@ -348,9 +344,7 @@ protected:
 #if W0038_DB_OPT
   void applyDeblockingFilterParameterSelection( Picture* pcPic, const uint32_t numSlices, const int gopID );
 #endif
-#if JVET_O1159_SCALABILITY
   void xCreateExplicitReferencePictureSetFromReference( Slice* slice, PicList& rcListPic, const ReferencePictureList *rpl0, const ReferencePictureList *rpl1 );
-#endif
 };// END CLASS DEFINITION EncGOP
 
 //! \}
diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp
index 30b7bc330..231884a4f 100644
--- a/source/Lib/EncoderLib/EncLib.cpp
+++ b/source/Lib/EncoderLib/EncLib.cpp
@@ -213,11 +213,7 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf )
   aps0.setAPSType( SCALING_LIST_APS );
 
   // initialize SPS
-#if JVET_O1159_SCALABILITY
   xInitSPS( sps0, m_cVPS );
-#else
-  xInitSPS(sps0);
-#endif
 #if JVET_P0185
   xInitVPS(m_cVPS, sps0);
 #else
@@ -439,11 +435,7 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf )
     picBg->create( sps0.getChromaFormatIdc(), Size( pps0.getPicWidthInLumaSamples(), pps0.getPicHeightInLumaSamples() ), sps0.getMaxCUWidth(), sps0.getMaxCUWidth() + 16, false, m_layerId );
     picBg->getRecoBuf().fill(0);
 #if JVET_P1006_PICTURE_HEADER
-#if JVET_O1159_SCALABILITY
     picBg->finalInit( &m_cVPS, sps0, pps0, &m_picHeader, m_apss, m_lmcsAPS, m_scalinglistAPS );
-#else
-    picBg->finalInit( sps0, pps0, &m_picHeader, m_apss, m_lmcsAPS, m_scalinglistAPS );
-#endif
 #else
     picBg->finalInit( sps0, pps0, m_apss, m_lmcsAPS, m_scalinglistAPS );
 #endif
@@ -596,11 +588,7 @@ bool EncLib::encodePrep( bool flush, PelStorage* pcPicYuvOrg, PelStorage* cPicYu
 
     picCurr->M_BUFS( 0, PIC_ORIGINAL ).copyFrom( m_cGOPEncoder.getPicBg()->getRecoBuf() );
 #if JVET_P1006_PICTURE_HEADER
-#if JVET_O1159_SCALABILITY
     picCurr->finalInit( &m_cVPS, *sps, *pps, &m_picHeader, m_apss, m_lmcsAPS, m_scalinglistAPS );
-#else
-    picCurr->finalInit( *sps, *pps, &m_picHeader, m_apss, m_lmcsAPS, m_scalinglistAPS );
-#endif
 #else
     picCurr->finalInit( *sps, *pps, m_apss, m_lmcsAPS, m_scalinglistAPS );
 #endif
@@ -732,11 +720,7 @@ bool EncLib::encodePrep( bool flush, PelStorage* pcPicYuvOrg, PelStorage* cPicYu
       pcPicCurr->M_BUFS( 0, PIC_TRUE_ORIGINAL ).swap( *cPicYuvTrueOrg );
     }
 #if JVET_P1006_PICTURE_HEADER
-#if JVET_O1159_SCALABILITY
     pcPicCurr->finalInit( &m_cVPS, *pSPS, *pPPS, &m_picHeader, m_apss, m_lmcsAPS, m_scalinglistAPS );
-#else
-    pcPicCurr->finalInit( *pSPS, *pPPS, &m_picHeader, m_apss, m_lmcsAPS, m_scalinglistAPS );
-#endif
 #else
     pcPicCurr->finalInit( *pSPS, *pPPS, m_apss, m_lmcsAPS, m_scalinglistAPS );
 #endif
@@ -881,11 +865,7 @@ bool EncLib::encodePrep( bool flush, PelStorage* pcPicYuvOrg, PelStorage* pcPicY
         const PPS *pPPS = ( ppsID < 0 ) ? m_ppsMap.getFirstPS() : m_ppsMap.getPS( ppsID );
         const SPS *pSPS = m_spsMap.getPS( pPPS->getSPSId() );
 #if JVET_P1006_PICTURE_HEADER
-#if JVET_O1159_SCALABILITY
         pcField->finalInit( &m_cVPS, *pSPS, *pPPS, &m_picHeader, m_apss, m_lmcsAPS, m_scalinglistAPS );
-#else
-        pcField->finalInit( *pSPS, *pPPS, &m_picHeader, m_apss, m_lmcsAPS, m_scalinglistAPS );
-#endif
 #else
         pcField->finalInit( *pSPS, *pPPS, m_apss, m_lmcsAPS, m_scalinglistAPS );
 #endif
@@ -1083,12 +1063,6 @@ void EncLib::xInitVPS(VPS& vps)
 {
   // The SPS must have already been set up.
   // set the VPS profile information.
-#if !JVET_O1159_SCALABILITY
-  for (uint32_t i = 0; i < vps.getMaxLayers(); i++)
-  {
-    vps.setVPSIncludedLayerId(0, i);
-  }
-#endif
 #if JVET_P0185
   vps.setMaxSubLayers(sps.getMaxTLayers());
 #endif
@@ -1110,11 +1084,7 @@ void EncLib::xInitDPS(DPS &dps, const SPS &sps, const int dpsId)
 #endif
 }
 
-#if JVET_O1159_SCALABILITY
 void EncLib::xInitSPS( SPS& sps, VPS& vps )
-#else
-void EncLib::xInitSPS(SPS &sps)
-#endif
 {
   ProfileTierLevel* profileTierLevel = sps.getProfileTierLevel();
   ConstraintInfo* cinfo = profileTierLevel->getConstraintInfo();
@@ -1173,9 +1143,7 @@ void EncLib::xInitSPS(SPS &sps)
   /* XXX: should Main be marked as compatible with still picture? */
   /* XXX: may be a good idea to refactor the above into a function
    * that chooses the actual compatibility based upon options */
-#if JVET_O1159_SCALABILITY
   sps.setVPSId(m_cVPS.getVPSId());
-#endif
   sps.setMaxPicWidthInLumaSamples( m_iSourceWidth );
   sps.setMaxPicHeightInLumaSamples( m_iSourceHeight );
   sps.setMaxCUWidth             ( m_maxCUWidth        );
@@ -1442,7 +1410,6 @@ void EncLib::xInitSPS(SPS &sps)
   }
 #endif
 
-#if JVET_O1159_SCALABILITY
   sps.setInterLayerPresentFlag( vps.getMaxLayers() > 1 && !vps.getAllIndependentLayersFlag() );
 #if JVET_P0182
   for (unsigned int i = 0; i < vps.getMaxLayers(); ++i)
@@ -1452,9 +1419,6 @@ void EncLib::xInitSPS(SPS &sps)
 #endif
 
   sps.setRprEnabledFlag( m_rprEnabled || sps.getInterLayerPresentFlag() );
-#elif JVET_P0590_SCALING_WINDOW
-  sps.setRprEnabledFlag( m_rprEnabled );
-#endif
 }
 
 void EncLib::xInitHrdParameters(SPS &sps)
@@ -1941,19 +1905,13 @@ void EncLib::xInitRPL(SPS &sps, bool isFieldCoding)
       rpl->setNumberOfLongtermPictures(0);   //Hardcoded as 0 for now. need to update this when implementing LTRP
       rpl->setNumberOfActivePictures(ge.m_numRefPicsActive);
       rpl->setLtrpInSliceHeaderFlag(ge.m_ltrp_in_slice_header_flag);
-#if JVET_O1159_SCALABILITY
       rpl->setInterLayerPresentFlag( sps.getInterLayerPresentFlag() );
       // inter-layer reference picture is not signaled in SPS RPL, SPS is shared currently
       rpl->setNumberOfInterLayerPictures( 0 );
-#endif
 
       for (int k = 0; k < ge.m_numRefPics; k++)
       {
-#if JVET_O1159_SCALABILITY
         rpl->setRefPicIdentifier( k, ge.m_deltaRefPics[k], 0, false, 0 );
-#else
-        rpl->setRefPicIdentifier(k, ge.m_deltaRefPics[k], 0);
-#endif
       }
     }
   }
@@ -1970,11 +1928,7 @@ void EncLib::xInitRPL(SPS &sps, bool isFieldCoding)
       rpl->setNumberOfLongtermPictures(0);
       rpl->setNumberOfActivePictures(1);
       rpl->setLtrpInSliceHeaderFlag(0);
-#if JVET_O1159_SCALABILITY
       rpl->setRefPicIdentifier(0, 1, 0, false, 0);
-#else      
-      rpl->setRefPicIdentifier(0, 1, 0);
-#endif      
       rpl->setPOC(0, 0);
     }
   }
diff --git a/source/Lib/EncoderLib/EncLib.h b/source/Lib/EncoderLib/EncLib.h
index 891fad8ed..a7b259861 100644
--- a/source/Lib/EncoderLib/EncLib.h
+++ b/source/Lib/EncoderLib/EncLib.h
@@ -170,11 +170,7 @@ protected:
   void  xInitVPS(VPS& vps); ///< initialize VPS from encoder options
 #endif
   void  xInitDPS          (DPS &dps, const SPS &sps, const int dpsId); ///< initialize DPS from encoder options
-#if JVET_O1159_SCALABILITY
   void  xInitSPS          ( SPS& sps, VPS& vps );       ///< initialize SPS from encoder options
-#else
-  void  xInitSPS          (SPS &sps);                 ///< initialize SPS from encoder options
-#endif
   void  xInitPPS          (PPS &pps, const SPS &sps); ///< initialize PPS from encoder options
 #if JVET_P1006_PICTURE_HEADER
   void  xInitPicHeader    (PicHeader &picHeader, const SPS &sps, const PPS &pps); ///< initialize Picture Header from encoder options
diff --git a/source/Lib/EncoderLib/VLCWriter.cpp b/source/Lib/EncoderLib/VLCWriter.cpp
index 5703f2d8f..35a537a4b 100644
--- a/source/Lib/EncoderLib/VLCWriter.cpp
+++ b/source/Lib/EncoderLib/VLCWriter.cpp
@@ -185,13 +185,8 @@ void AUDWriter::codeAUD(OutputBitstream& bs, const int pictureType)
 
 void HLSWriter::xCodeRefPicList( const ReferencePictureList* rpl, bool isLongTermPresent, uint32_t ltLsbBitsCount, const bool isForbiddenZeroDeltaPoc )
 {
-#if JVET_O1159_SCALABILITY
   uint32_t numRefPic = rpl->getNumberOfShorttermPictures() + rpl->getNumberOfLongtermPictures() + rpl->getNumberOfInterLayerPictures();
   WRITE_UVLC( numRefPic, "num_ref_entries[ listIdx ][ rplsIdx ]" );
-#else
-  WRITE_UVLC(rpl->getNumberOfShorttermPictures() + rpl->getNumberOfLongtermPictures(), "num_ref_entries[ listIdx ][ rplsIdx ]");
-  uint32_t numRefPic = rpl->getNumberOfShorttermPictures() + rpl->getNumberOfLongtermPictures();
-#endif
 
   if (isLongTermPresent)
   {
@@ -202,7 +197,6 @@ void HLSWriter::xCodeRefPicList( const ReferencePictureList* rpl, bool isLongTer
   bool firstSTRP = true;
   for (int ii = 0; ii < numRefPic; ii++)
   {
-#if JVET_O1159_SCALABILITY
     if( rpl->getInterLayerPresentFlag() )
     {
       WRITE_FLAG( rpl->isInterLayerRefPic( ii ), "inter_layer_ref_pic_flag[ listIdx ][ rplsIdx ][ i ]" );
@@ -216,7 +210,6 @@ void HLSWriter::xCodeRefPicList( const ReferencePictureList* rpl, bool isLongTer
 
     if( !rpl->isInterLayerRefPic( ii ) )
     {
-#endif
     if( isLongTermPresent )
     {
       WRITE_FLAG( !rpl->isRefPicLongterm( ii ), "st_ref_pic_flag[ listIdx ][ rplsIdx ][ i ]" );
@@ -249,9 +242,7 @@ void HLSWriter::xCodeRefPicList( const ReferencePictureList* rpl, bool isLongTer
     {
       WRITE_CODE(rpl->getRefPicIdentifier(ii), ltLsbBitsCount, "poc_lsb_lt[listIdx][rplsIdx][i]");
     }
-#if JVET_O1159_SCALABILITY
     }
-#endif
   }
 }
 
@@ -1033,9 +1024,7 @@ void HLSWriter::codeSPS( const SPS* pcSPS )
   }
   CHECK( pcSPS->getMaxCUWidth() != pcSPS->getMaxCUHeight(),                          "Rectangular CTUs not supported" );
   WRITE_FLAG(pcSPS->getLongTermRefsPresent() ? 1 : 0, "long_term_ref_pics_flag");
-#if JVET_O1159_SCALABILITY
   WRITE_FLAG( pcSPS->getInterLayerPresentFlag() ? 1 : 0, "inter_layer_ref_pics_present_flag" );
-#endif 
 #if JVET_P2001_SYNTAX_ORDER_MISMATCHES
   WRITE_FLAG(pcSPS->getIDRRefParamListPresent() ? 1 : 0, "sps_idr_rpl_present_flag" );
 #endif
@@ -1480,7 +1469,6 @@ void HLSWriter::codeVPS(const VPS* pcVPS)
   xTraceVPSHeader();
 #endif
   WRITE_CODE(pcVPS->getVPSId(), 4, "vps_video_parameter_set_id");
-#if JVET_O1159_SCALABILITY
   WRITE_CODE(pcVPS->getMaxLayers() - 1, 6, "vps_max_layers_minus1");
   WRITE_CODE(pcVPS->getMaxSubLayers() - 1, 3, "vps_max_sublayers_minus1");
   if (pcVPS->getMaxLayers() > 1 && pcVPS->getMaxSubLayers() > 1) 
@@ -1530,18 +1518,6 @@ void HLSWriter::codeVPS(const VPS* pcVPS)
       }
     }
   }
-#else
-  WRITE_CODE(pcVPS->getMaxLayers() - 1, 8, "vps_max_layers_minus1");
-#if JVET_P0185
-  CHECK(pcVPS->getMaxSubLayers() < 1 || pcVPS->getMaxSubLayers() > 7, "vps_max_sub_layers_minus1 must be in range 0..6");
-  WRITE_CODE(pcVPS->getMaxSubLayers() - 1, 3, "vps_max_sub_layers_minus1");
-#endif
-  for (uint32_t i = 0; i <= pcVPS->getMaxLayers() - 1; i++)
-  {
-    WRITE_CODE(pcVPS->getVPSIncludedLayerId(i), 7, "vps_included_layer_id");
-    WRITE_FLAG(0, "vps_reserved_zero_1bit");
-  }
-#endif
   WRITE_FLAG(0, "vps_extension_flag");
 
   //future extensions here..
-- 
GitLab