Changeset 310 in SHVCSoftware for trunk/source/Lib/TLibCommon


Ignore:
Timestamp:
22 Jul 2013, 21:40:00 (12 years ago)
Author:
seregin
Message:

reintegrate SHM-2.1-dev branch

Location:
trunk
Files:
27 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/source

  • trunk/source/Lib/TLibCommon/CommonDef.h

    r230 r310  
    5656// ====================================================================================================================
    5757
    58 #define NV_VERSION        "2.0avc"                 ///< Current software version
     58#if SVC_EXTENSION
     59#define NV_VERSION        "2.1"                 ///< Current software version
     60#else
     61#define NV_VERSION        "11.0"                ///< Current software version
     62#endif
    5963
    6064// ====================================================================================================================
     
    110114#define MAX_NUM_REF_PICS            16          ///< max. number of pictures used for reference
    111115#define MAX_NUM_REF                 16          ///< max. number of entries in picture reference list
    112 #if !L0034_COMBINED_LIST_CLEANUP
    113 #define MAX_NUM_REF_LC              MAX_NUM_REF_PICS  // TODO: remove this macro definition (leftover from combined list concept)
    114 #endif
    115116
    116117#define MAX_UINT                    0xFFFFFFFFU ///< max. value of unsigned 32-bit integer
  • trunk/source/Lib/TLibCommon/NAL.h

    r191 r310  
    9191        || m_nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R;
    9292  }
    93 #if L0045_NON_NESTED_SEI_RESTRICTIONS
    9493  Bool isSei()
    9594  {
     
    102101    return ( (UInt)m_nalUnitType < 32 );
    103102  }
    104 #endif
    105103};
    106104
  • trunk/source/Lib/TLibCommon/SEI.cpp

    r189 r310  
    3939#include "SEI.h"
    4040
    41 #if J0149_TONE_MAPPING_SEI
    4241//Table D-7 Meaning of camera iso sensitivity indicator and exposure index rating indicator
    4342Int  Table_exp_indicator[32] = {0, 10, 12, 16, 20, 25, 32, 40, 50, 64, 80, 100, 125, 160, 200, 250, 320, 400, 500, 640, 800, 1000, 1250, 1600, 2000, 2500, 3200, 4000, 5000, 6400, 8000, -1};
    44 #endif
    4543
    4644SEIMessages getSeisByType(SEIMessages &seiList, SEI::PayloadType seiType)
  • trunk/source/Lib/TLibCommon/SEI.h

    r191 r310  
    7272    SCALABLE_NESTING                     = 133,
    7373    REGION_REFRESH_INFO                  = 134,
     74#if M0043_LAYERS_PRESENT_SEI
     75    LAYERS_PRESENT                       = 137,
     76#endif
    7477  };
    7578 
     
    124127
    125128  SEIActiveParameterSets()
    126 #if !L0047_APS_FLAGS
    127     :numSpsIdsMinus1(0)
    128 #else
    129129    : activeVPSId            (0)
    130130    , m_fullRandomAccessFlag (false)
    131131    , m_noParamSetUpdateFlag (false)
    132132    , numSpsIdsMinus1        (0)
    133 #endif
    134133  {}
    135134  virtual ~SEIActiveParameterSets() {}
    136135
    137136  Int activeVPSId;
    138 #if L0047_APS_FLAGS
    139137  Bool m_fullRandomAccessFlag;
    140138  Bool m_noParamSetUpdateFlag;
    141 #endif
    142139  Int numSpsIdsMinus1;
    143140  std::vector<Int> activeSeqParamSetId;
     
    150147
    151148  SEIBufferingPeriod()
    152 #if L0044_CPB_DPB_DELAY_OFFSET
    153149  : m_bpSeqParameterSetId (0)
    154150  , m_rapCpbParamsPresentFlag (false)
     
    161157    ::memset(m_initialAltCpbRemovalDelayOffset, 0, sizeof(m_initialAltCpbRemovalDelayOffset));
    162158  }
    163 #else
    164   {}
    165 #endif
    166159  virtual ~SEIBufferingPeriod() {}
    167160
    168161  UInt m_bpSeqParameterSetId;
    169162  Bool m_rapCpbParamsPresentFlag;
    170 #if L0044_CPB_DPB_DELAY_OFFSET
    171163  Bool m_cpbDelayOffset;
    172164  Bool m_dpbDelayOffset;
    173 #endif
    174165  UInt m_initialCpbRemovalDelay         [MAX_CPB_CNT][2];
    175166  UInt m_initialCpbRemovalDelayOffset   [MAX_CPB_CNT][2];
    176167  UInt m_initialAltCpbRemovalDelay      [MAX_CPB_CNT][2];
    177168  UInt m_initialAltCpbRemovalDelayOffset[MAX_CPB_CNT][2];
    178 #if L0328_SPLICING
    179169  Bool m_concatenationFlag;
    180170  UInt m_auCpbRemovalDelayDelta;
    181 #endif
    182171};
    183172class SEIPictureTiming : public SEI
     
    188177  SEIPictureTiming()
    189178  : m_picStruct               (0)
    190 #if L0046_RENAME_PROG_SRC_IDC
    191179  , m_sourceScanType          (0)
    192 #else
    193   , m_progressiveSourceIdc    (0)
    194 #endif
    195180  , m_duplicateFlag           (false)
    196 #if L0044_DU_DPB_OUTPUT_DELAY_HRD
    197181  , m_picDpbOutputDuDelay     (0)
    198 #endif
    199182  , m_numNalusInDuMinus1      (NULL)
    200183  , m_duCpbRemovalDelayMinus1 (NULL)
     
    213196
    214197  UInt  m_picStruct;
    215 #if L0046_RENAME_PROG_SRC_IDC
    216198  UInt  m_sourceScanType;
    217 #else
    218   UInt  m_progressiveSourceIdc;
    219 #endif
    220199  Bool  m_duplicateFlag;
    221200
    222201  UInt  m_auCpbRemovalDelay;
    223202  UInt  m_picDpbOutputDelay;
    224 #if L0044_DU_DPB_OUTPUT_DELAY_HRD
    225203  UInt  m_picDpbOutputDuDelay;
    226 #endif
    227204  UInt  m_numDecodingUnitsMinus1;
    228205  Bool  m_duCommonCpbRemovalDelayFlag;
     
    240217    : m_decodingUnitIdx(0)
    241218    , m_duSptCpbRemovalDelay(0)
    242 #if L0044_DU_DPB_OUTPUT_DELAY_HRD
    243219    , m_dpbOutputDuDelayPresentFlag(false)
    244220    , m_picSptDpbOutputDuDelay(0)
    245 #endif
    246221  {}
    247222  virtual ~SEIDecodingUnitInfo() {}
    248223  Int m_decodingUnitIdx;
    249224  Int m_duSptCpbRemovalDelay;
    250 #if L0044_DU_DPB_OUTPUT_DELAY_HRD
    251225  Bool m_dpbOutputDuDelayPresentFlag;
    252226  Int m_picSptDpbOutputDuDelay;
    253 #endif
    254227};
    255228
     
    290263  Int  m_frame1GridPositionY;
    291264  Int  m_arrangementReservedByte;
    292 #if L0045_PERSISTENCE_FLAGS
    293265  Bool m_arrangementPersistenceFlag;
    294 #else
    295   Int  m_arrangementRepetetionPeriod;
    296 #endif
    297266  Bool m_upsampledAspectRatio;
    298267};
     
    305274  SEIDisplayOrientation()
    306275    : cancelFlag(true)
    307 #if L0045_PERSISTENCE_FLAGS
    308276    , persistenceFlag(0)
    309 #else
    310     , repetitionPeriod(1)
    311 #endif
    312277    , extensionFlag(false)
    313278    {}
     
    319284
    320285  UInt anticlockwiseRotation;
    321 #if L0045_PERSISTENCE_FLAGS
    322286  Bool persistenceFlag;
    323 #else
    324   UInt repetitionPeriod;
    325 #endif
    326287  Bool extensionFlag;
    327288};
     
    355316};
    356317
    357 #if L0208_SOP_DESCRIPTION_SEI
     318#if M0043_LAYERS_PRESENT_SEI
     319class SEILayersPresent : public SEI
     320{
     321public:
     322  PayloadType payloadType() const { return LAYERS_PRESENT; }
     323
     324  SEILayersPresent() {}
     325  virtual ~SEILayersPresent() {}
     326
     327  UInt m_activeVpsId;
     328  UInt m_vpsMaxLayers;
     329  Bool m_layerPresentFlag[MAX_LAYERS];
     330};
     331#endif
     332
    358333class SEISOPDescription : public SEI
    359334{
     
    372347  Int m_sopDescPocDelta[MAX_NUM_PICS_IN_SOP];
    373348};
    374 #endif
    375 
    376 #if J0149_TONE_MAPPING_SEI
     349
    377350class SEIToneMappingInfo : public SEI
    378351{
     
    407380  Int    m_extendedWhiteLevelLumaCodeValue;
    408381};
    409 #endif
    410382
    411383typedef std::list<SEI*> SEIMessages;
     
    420392Void deleteSEIs (SEIMessages &seiList);
    421393
    422 #if K0180_SCALABLE_NESTING_SEI
    423394class SEIScalableNesting : public SEI
    424395{
     
    450421  SEIMessages m_nestedSEIs;
    451422};
    452 #endif
    453423
    454424//! \}
  • trunk/source/Lib/TLibCommon/TComBitStream.h

    r191 r310  
    193193  }
    194194
     195  Void        peekPreviousByte( UInt &byte )
     196  {
     197    assert(m_fifo_idx > 0);
     198    byte = (*m_fifo)[m_fifo_idx - 1];
     199  }
     200 
    195201  Void        readOutTrailingBits ();
    196202  UChar getHeldBits  ()          { return m_held_bits;          }
  • trunk/source/Lib/TLibCommon/TComDataCU.cpp

    r208 r310  
    589589  }
    590590
    591   UInt uiTmp = uhWidth*uhHeight;
    592 
    593591  if(getPic()->getPicSym()->getInverseCUOrderMap(getAddr())*m_pcPic->getNumPartInCU()+m_uiAbsIdxInLCU >= getSlice()->getSliceSegmentCurStartCUAddr())
    594592  {
    595593    m_acCUMvField[0].clearMvField();
    596594    m_acCUMvField[1].clearMvField();
    597     uiTmp = uhWidth*uhHeight;
     595    UInt uiTmp = uhWidth*uhHeight;
    598596   
    599597    memset( m_pcTrCoeffY,    0, uiTmp * sizeof( *m_pcTrCoeffY    ) );
     
    794792  m_uiCUPelY           = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ];
    795793 
    796   UInt uiWidth         = g_uiMaxCUWidth  >> uiDepth;
    797   UInt uiHeight        = g_uiMaxCUHeight >> uiDepth;
    798  
    799794  m_skipFlag=pcCU->getSkipFlag()          + uiPart;
    800795
     
    838833  m_apcCUColocated[1] = pcCU->getCUColocated(REF_PIC_LIST_1);
    839834 
    840   UInt uiTmp = uiWidth*uiHeight;
    841835  UInt uiMaxCuWidth=pcCU->getSlice()->getSPS()->getMaxCUWidth();
    842836  UInt uiMaxCuHeight=pcCU->getSlice()->getSPS()->getMaxCUHeight();
     
    850844  m_pcIPCMSampleY = pcCU->getPCMSampleY() + uiCoffOffset;
    851845
    852   uiTmp >>= 2;
    853846  uiCoffOffset >>=2;
    854847  m_pcTrCoeffCb=pcCU->getCoeffCb() + uiCoffOffset;
     
    15771570    return getSlice()->getSliceQp();
    15781571  }
    1579   else
    1580   if ( iLastValidPartIdx >= 0 )
     1572  else if ( iLastValidPartIdx >= 0 )
    15811573  {
    15821574    return getQP( iLastValidPartIdx );
     
    16471639  Int         iLeftIntraDir, iAboveIntraDir;
    16481640  Int         uiPredNum = 0;
    1649  
     1641
    16501642  // Get intra direction of left PU
    16511643  pcTempCU = getPULeft( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx );
     
    17381730  return uiPredNum;
    17391731}
     1732
     1733
     1734#if FAST_INTRA_SHVC
     1735/** generate limited set of remaining modes
     1736*\param   uiAbsPartIdx
     1737*\param   uiIntraDirPred  pointer to the array for MPM storage
     1738*\returns Number of intra coding modes (nb of remaining modes + 3 MPMs)
     1739*/
     1740Int TComDataCU::reduceSetOfIntraModes( UInt uiAbsPartIdx, Int* uiIntraDirPred, Int &fullSetOfModes )
     1741{
     1742  // check BL mode
     1743  UInt          uiCUAddrBase, uiAbsPartAddrBase;
     1744  // the right reference layerIdc should be specified, currently it is set to m_layerId-1
     1745  TComDataCU*   pcTempCU = getBaseColCU(m_layerId - 1, uiAbsPartIdx, uiCUAddrBase, uiAbsPartAddrBase );
     1746
     1747  if( pcTempCU->getPredictionMode( uiAbsPartAddrBase ) != MODE_INTRA )
     1748  {
     1749    return( NUM_INTRA_MODE-1 );
     1750  }
     1751
     1752  // compute set of enabled modes g_reducedSetIntraModes[...]
     1753  Int authorizedMode[NUM_INTRA_MODE-1]={1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
     1754  Int nbModes;
     1755  for (nbModes=0; nbModes<3; nbModes++)  // add 3 MPMs 1st
     1756  {
     1757    g_reducedSetIntraModes[nbModes] = uiIntraDirPred[nbModes];
     1758    authorizedMode[ uiIntraDirPred[nbModes] ] = 0;
     1759  }
     1760
     1761  Int iColBaseDir = pcTempCU->getLumaIntraDir( uiAbsPartAddrBase );
     1762  if ( authorizedMode[iColBaseDir] )  //possibly add BL mode
     1763  {
     1764    g_reducedSetIntraModes[nbModes++] = iColBaseDir;
     1765    authorizedMode[ iColBaseDir ] = 0;
     1766  }
     1767
     1768  Int iRefMode = ( iColBaseDir > 1 ) ? iColBaseDir : uiIntraDirPred[0];
     1769  if ( iRefMode > 1 )    //add neighboring modes of refMode
     1770  {
     1771    UInt Left  = iRefMode;
     1772    UInt Right = iRefMode;
     1773    while ( nbModes < NB_REMAIN_MODES+3 )
     1774    {
     1775      Left = ((Left + 29) % 32) + 2;
     1776      Right = ((Right - 1 ) % 32) + 2;
     1777      if ( authorizedMode[Left] )   g_reducedSetIntraModes[nbModes++] = Left;
     1778      if ( authorizedMode[Right] )  g_reducedSetIntraModes[nbModes++] = Right;
     1779    }
     1780  }
     1781  else      //add pre-defined modes
     1782  {
     1783    Int  idx = 0;
     1784    while ( nbModes < NB_REMAIN_MODES+3 )
     1785    {
     1786      UInt mode = g_predefSetIntraModes[idx++];
     1787      if ( authorizedMode[mode] )   g_reducedSetIntraModes[nbModes++] = mode;
     1788    }
     1789  }
     1790
     1791  fullSetOfModes = 0;
     1792  return ( nbModes );
     1793}
     1794#endif
     1795
    17401796
    17411797UInt TComDataCU::getCtxSplitFlag( UInt uiAbsPartIdx, UInt uiDepth )
     
    25412597    if(m_layerId) 
    25422598    {
    2543       pcColCU = getBaseColCU( xP + nPSW/2, yP + nPSH/2, uiCUAddrBase, uiAbsPartAddrBase );
     2599      pcColCU = getBaseColCU( m_layerId - 1, xP + nPSW/2, yP + nPSH/2, uiCUAddrBase, uiAbsPartAddrBase );
    25442600
    25452601#if INTRA_BL
     
    25632619        {
    25642620          pcColCU->getMvField( pcColCU, uiAbsPartAddrBase, REF_PIC_LIST_0, cMvFieldBaseColCU[0]);
    2565           scaleBaseMV( pcMvFieldNeighbours[iCount<<1], cMvFieldBaseColCU[0] );
     2621          scaleBaseMV( m_layerId - 1, pcMvFieldNeighbours[iCount<<1], cMvFieldBaseColCU[0] );
    25662622        }
    25672623
     
    25692625        {
    25702626          pcColCU->getMvField( pcColCU, uiAbsPartAddrBase, REF_PIC_LIST_1, cMvFieldBaseColCU[1] );
    2571           scaleBaseMV( pcMvFieldNeighbours[(iCount<<1)+1], cMvFieldBaseColCU[1] );
     2627          scaleBaseMV( m_layerId - 1, pcMvFieldNeighbours[(iCount<<1)+1], cMvFieldBaseColCU[1] );
    25722628        }
    25732629
     
    27962852    //>> MTK colocated-RightBottom
    27972853    UInt uiPartIdxRB;
    2798     Int uiLCUIdx = getAddr();
    27992854
    28002855    deriveRightBottomIdx( uiPUIdx, uiPartIdxRB ); 
     
    28052860    TComMv cColMv;
    28062861    Int iRefIdx;
     2862    Int uiLCUIdx = -1;
    28072863
    28082864    if      ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() ) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples() )  // image boundary check
    28092865    {
    2810       uiLCUIdx = -1;
    28112866    }
    28122867    else if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples() )
    28132868    {
    2814       uiLCUIdx = -1;
    28152869    }
    28162870    else
     
    28252879      {
    28262880        uiAbsPartAddr = g_auiRasterToZscan[ (uiAbsPartIdxTmp + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ];
    2827         uiLCUIdx = -1 ;
    28282881      }
    28292882      else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU
     
    28352888      {
    28362889        uiAbsPartAddr = 0;
    2837         uiLCUIdx = -1 ;
    28382890      }
    28392891    }
     
    30993151    if (!bAdded)
    31003152    {
    3101       bAdded = xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxLB, MD_LEFT );
     3153      xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxLB, MD_LEFT );
    31023154    }
    31033155  }
     
    31123164  if(!bAdded)
    31133165  {
    3114     bAdded = xAddMVPCand( pInfo, eRefPicList, iRefIdx, uiPartIdxLT, MD_ABOVE_LEFT);
     3166    xAddMVPCand( pInfo, eRefPicList, iRefIdx, uiPartIdxLT, MD_ABOVE_LEFT);
    31153167  }
    31163168  bAdded = bAddedSmvp;
     
    31273179    if(!bAdded)
    31283180    {
    3129       bAdded = xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxLT, MD_ABOVE_LEFT);
     3181      xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxLT, MD_ABOVE_LEFT);
    31303182    }
    31313183  }
     
    31473199    UInt uiAbsPartIdx; 
    31483200    UInt uiAbsPartAddr;
    3149     Int uiLCUIdx = getAddr();
    31503201
    31513202    deriveRightBottomIdx( uiPartIdx, uiPartIdxRB );
     
    31543205    //----  co-located RightBottom Temporal Predictor (H) ---//
    31553206    uiAbsPartIdx = g_auiZscanToRaster[uiPartIdxRB];
     3207    Int uiLCUIdx = -1;
    31563208    if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdx] + m_pcPic->getMinCUWidth() ) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples() )  // image boundary check
    31573209    {
    3158       uiLCUIdx = -1;
    31593210    }
    31603211    else if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdx] + m_pcPic->getMinCUHeight() ) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples() )
    31613212    {
    3162       uiLCUIdx = -1;
    31633213    }
    31643214    else
     
    31733223      {
    31743224        uiAbsPartAddr = g_auiRasterToZscan[ (uiAbsPartIdx + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ];
    3175         uiLCUIdx      = -1 ;
    31763225      }
    31773226      else if ( uiAbsPartIdx / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU
     
    31833232      {
    31843233        uiAbsPartAddr = 0;
    3185         uiLCUIdx      = -1 ;
    31863234      }
    31873235    }
     
    32453293UInt TComDataCU::getIntraSizeIdx(UInt uiAbsPartIdx)
    32463294{
    3247   UInt uiShift = ( (m_puhTrIdx[uiAbsPartIdx]==0) && (m_pePartSize[uiAbsPartIdx]==SIZE_NxN) ) ? m_puhTrIdx[uiAbsPartIdx]+1 : m_puhTrIdx[uiAbsPartIdx];
    3248   uiShift = ( m_pePartSize[uiAbsPartIdx]==SIZE_NxN ? 1 : 0 );
     3295  UInt uiShift = ( m_pePartSize[uiAbsPartIdx]==SIZE_NxN ? 1 : 0 );
    32493296 
    32503297  UChar uiWidth = m_puhWidth[uiAbsPartIdx]>>uiShift;
     
    33323379  }
    33333380 
    3334 #if L0363_MVP_POC
    33353381  if ( pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) >= 0 && m_pcSlice->getRefPic( eRefPicList, iRefIdx)->getPOC() == pcTmpCU->getSlice()->getRefPOC( eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ))
    3336 #else
    3337   if ( m_pcSlice->isEqualRef(eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx), iRefIdx) )
    3338 #endif
    33393382  {
    33403383    TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
     
    35193562
    35203563  // use coldir.
     3564#if M0457_COL_PICTURE_SIGNALING
     3565  TComPic *pColPic;
     3566  if (m_layerId > 0 && getSlice()->getAltColIndicationFlag())
     3567  {
     3568    pColPic = getSlice()->getMotionPredIlp();
     3569  }
     3570  else
     3571  {
     3572    pColPic = getSlice()->getRefPic( RefPicList(getSlice()->isInterB() ? 1-getSlice()->getColFromL0Flag() : 0), getSlice()->getColRefIdx());
     3573  }
     3574#else
    35213575  TComPic *pColPic = getSlice()->getRefPic( RefPicList(getSlice()->isInterB() ? 1-getSlice()->getColFromL0Flag() : 0), getSlice()->getColRefIdx());
     3576#endif
    35223577  TComDataCU *pColCU = pColPic->getCU( uiCUAddr );
    35233578  if(pColCU->getPic()==0||pColCU->getPartitionSize(uiPartUnitIdx)==SIZE_NONE)
     
    35263581  }
    35273582  iCurrPOC = m_pcSlice->getPOC();   
    3528   iCurrRefPOC = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getPOC();
    35293583  iColPOC = pColCU->getSlice()->getPOC(); 
    35303584
     
    41214175
    41224176#if SVC_COL_BLK
    4123 TComDataCU*  TComDataCU::getBaseColCU( UInt uiCuAbsPartIdx, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase )
     4177TComDataCU*  TComDataCU::getBaseColCU( UInt refLayerIdc, UInt uiCuAbsPartIdx, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase )
    41244178{
    41254179#if 1 // it should provide identical resutls
     
    41274181  UInt uiPelY = getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiCuAbsPartIdx] ];
    41284182
    4129   return getBaseColCU( uiPelX, uiPelY, uiCUAddrBase, uiAbsPartIdxBase );
     4183  return getBaseColCU( refLayerIdc, uiPelX, uiPelY, uiCUAddrBase, uiAbsPartIdxBase );
    41304184#else
    41314185  TComPic* cBaseColPic = m_pcSlice->getBaseColPic();
     
    41764230}
    41774231
    4178 TComDataCU*  TComDataCU::getBaseColCU( UInt uiPelX, UInt uiPelY, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase )
    4179 {
    4180   TComPic* cBaseColPic = m_pcSlice->getBaseColPic();
     4232TComDataCU*  TComDataCU::getBaseColCU( UInt refLayerIdc, UInt uiPelX, UInt uiPelY, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase )
     4233{
     4234  TComPic* cBaseColPic = m_pcSlice->getBaseColPic(refLayerIdc);
    41814235
    41824236#if !SIMPLIFIED_MV_POS_SCALING
     
    42064260#if SIMPLIFIED_MV_POS_SCALING
    42074261#if SCALED_REF_LAYER_OFFSETS
    4208   Int leftStartL = this->getSlice()->getSPS()->getScaledRefLayerWindow().getWindowLeftOffset();
    4209   Int topStartL  = this->getSlice()->getSPS()->getScaledRefLayerWindow().getWindowTopOffset();
    4210   Int iBX = ((uiPelX - leftStartL)*g_posScalingFactor[m_layerId][0] + (1<<15)) >> 16;
    4211   Int iBY = ((uiPelY - topStartL )*g_posScalingFactor[m_layerId][1] + (1<<15)) >> 16;
     4262  Int leftStartL = this->getSlice()->getSPS()->getScaledRefLayerWindow(refLayerIdc).getWindowLeftOffset();
     4263  Int topStartL  = this->getSlice()->getSPS()->getScaledRefLayerWindow(refLayerIdc).getWindowTopOffset();
     4264  Int iBX = ((uiPelX - leftStartL)*g_posScalingFactor[refLayerIdc][0] + (1<<15)) >> 16;
     4265  Int iBY = ((uiPelY - topStartL )*g_posScalingFactor[refLayerIdc][1] + (1<<15)) >> 16;
    42124266#else
    4213   Int iBX = (uiPelX*g_posScalingFactor[m_layerId][0] + (1<<15)) >> 16;
    4214   Int iBY = (uiPelY*g_posScalingFactor[m_layerId][1] + (1<<15)) >> 16;
     4267  Int iBX = (uiPelX*g_posScalingFactor[refLayerIdc][0] + (1<<15)) >> 16;
     4268  Int iBY = (uiPelY*g_posScalingFactor[refLayerIdc][1] + (1<<15)) >> 16;
    42154269#endif
    42164270#else
     
    42344288  const Window &confEL = m_pcPic->getPicYuvRec()->getConformanceWindow();
    42354289
    4236   Int widthBL   = m_pcSlice->getBaseColPic()->getPicYuvRec()->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset();
    4237   Int heightBL  = m_pcSlice->getBaseColPic()->getPicYuvRec()->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset();
     4290  Int widthBL   = m_pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset();
     4291  Int heightBL  = m_pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset();
    42384292#endif
    42394293  if( iBX >= widthBL || iBY >= heightBL ) //outside of the reference layer cropped picture
     
    42554309}
    42564310
    4257 Void TComDataCU::scaleBaseMV( TComMvField& rcMvFieldEnhance, TComMvField& rcMvFieldBase )
     4311Void TComDataCU::scaleBaseMV( UInt refLayerIdc, TComMvField& rcMvFieldEnhance, TComMvField& rcMvFieldBase )
    42584312{
    42594313  TComMvField cMvFieldBase;
    42604314  TComMv cMv;
    42614315#if SIMPLIFIED_MV_POS_SCALING
    4262   cMv = rcMvFieldBase.getMv().scaleMv( g_mvScalingFactor[m_layerId][0], g_mvScalingFactor[m_layerId][1] );
     4316  cMv = rcMvFieldBase.getMv().scaleMv( g_mvScalingFactor[refLayerIdc][0], g_mvScalingFactor[refLayerIdc][1] );
    42634317#else
    42644318  const Window &confBL = m_pcSlice->getBaseColPic()->getPicYuvRec()->getConformanceWindow();
  • trunk/source/Lib/TLibCommon/TComDataCU.h

    r191 r310  
    533533#endif 
    534534
     535#if FAST_INTRA_SHVC
     536  Int           reduceSetOfIntraModes              (  UInt   uiAbsPartIdx, Int* uiIntraDirPred, Int &fullSetOfModes );
     537#endif
     538
    535539#if REF_IDX_ME_ZEROMV
    536540  Bool xCheckZeroMVILRMerge(UChar uhInterDir, TComMvField& cMvFieldL0, TComMvField& cMvFieldL1);
     
    550554
    551555#if SVC_COL_BLK
    552   TComDataCU*   getBaseColCU( UInt uiCuAbsPartIdx, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase );
    553   TComDataCU*   getBaseColCU( UInt uiPelX, UInt uiPelY, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase );
    554   Void          scaleBaseMV( TComMvField& rcMvFieldEnhance, TComMvField& rcMvFieldBase );
     556  TComDataCU*   getBaseColCU( UInt refLayerIdc, UInt uiCuAbsPartIdx, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase );
     557  TComDataCU*   getBaseColCU( UInt refLayerIdc, UInt uiPelX, UInt uiPelY, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase );
     558  Void          scaleBaseMV( UInt refLayerIdc, TComMvField& rcMvFieldEnhance, TComMvField& rcMvFieldBase );
    555559#endif
    556560};
  • trunk/source/Lib/TLibCommon/TComLoopFilter.cpp

    r191 r310  
    461461        if ( ((piRefP0==piRefQ0)&&(piRefP1==piRefQ1)) || ((piRefP0==piRefQ1)&&(piRefP1==piRefQ0)) )
    462462        {
    463           uiBs = 0;
    464463          if ( piRefP0 != piRefP1 )   // Different L0 & L1
    465464          {
     
    694693  for ( UInt iIdx = 0; iIdx < uiNumParts; iIdx++ )
    695694  {
    696     ucBs = 0;
    697    
    698695    uiBsAbsIdx = xCalcBsIdx( pcCU, uiAbsZorderIdx, iDir, iEdge, iIdx);
    699696    ucBs = m_aapucBS[iDir][uiBsAbsIdx];
  • trunk/source/Lib/TLibCommon/TComMv.h

    r191 r310  
    152152  const TComMv scaleMv( Int iScaleX, Int iScaleY ) const
    153153  {
    154     Int mvx = Clip3( -32768, 32767, (iScaleX * getHor() + 127 + (iScaleX * getHor() < 0)) >> 8 );
    155     Int mvy = Clip3( -32768, 32767, (iScaleY * getVer() + 127 + (iScaleY * getVer() < 0)) >> 8 );
     154    Int mvx = iScaleX == 4096 ? getHor() : Clip3( -32768, 32767, (iScaleX * getHor() + 127 + (iScaleX * getHor() < 0)) >> 8 );
     155    Int mvy = iScaleY == 4096 ? getVer() : Clip3( -32768, 32767, (iScaleY * getVer() + 127 + (iScaleY * getVer() < 0)) >> 8 );
    156156    return TComMv( mvx, mvy );
    157157  }
  • trunk/source/Lib/TLibCommon/TComPic.cpp

    r191 r310  
    6767, m_pNDBFilterYuvTmp                      (NULL)
    6868, m_bCheckLTMSB                           (false)
     69{
    6970#if SVC_EXTENSION
    70 , m_bSpatialEnhLayer( false )
    71 , m_pcFullPelBaseRec( NULL )
    72 #endif
    73 {
     71  memset( m_pcFullPelBaseRec, 0, sizeof( m_pcFullPelBaseRec ) );
     72  memset( m_bSpatialEnhLayer, false, sizeof( m_bSpatialEnhLayer ) );
     73#endif
    7474  m_apcPicYuv[0]      = NULL;
    7575  m_apcPicYuv[1]      = NULL;
     
    9191  m_apcPicYuv[1]  = new TComPicYuv;  m_apcPicYuv[1]->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth, pcSps );
    9292
    93   if (m_bSpatialEnhLayer)
    94   {
    95     m_pcFullPelBaseRec = new TComPicYuv;  m_pcFullPelBaseRec->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth, pcSps );
     93  for( Int i = 0; i < MAX_LAYERS; i++ )
     94  {
     95    if( m_bSpatialEnhLayer[i] )
     96    {
     97      m_pcFullPelBaseRec[i] = new TComPicYuv;  m_pcFullPelBaseRec[i]->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth, pcSps );
     98    }
    9699  }
    97100
     
    173176  deleteSEIs(m_SEIs);
    174177#if SVC_EXTENSION && SVC_UPSAMPLING
    175   if (m_bSpatialEnhLayer)
    176   {
    177     m_pcFullPelBaseRec->destroy();
    178     delete m_pcFullPelBaseRec;
    179     m_pcFullPelBaseRec  = NULL;
     178  for( Int i = 0; i < MAX_LAYERS; i++ )
     179  {
     180    if( m_bSpatialEnhLayer[i] )
     181    {
     182      m_pcFullPelBaseRec[i]->destroy();
     183      delete m_pcFullPelBaseRec[i];
     184      m_pcFullPelBaseRec[i]  = NULL;
     185    }
    180186  }
    181187#endif
     
    562568
    563569#if REF_IDX_MFM
    564 Void TComPic::copyUpsampledMvField(TComPic* pcPicBase)
     570Void TComPic::copyUpsampledMvField(UInt refLayerIdc, TComPic* pcPicBase)
    565571{
    566572#if AVC_SYNTAX && !ILP_DECODED_PICTURE
     
    592598
    593599      TComDataCU *pcColCU = 0;
    594       pcColCU = pcCUDes->getBaseColCU(pelX + 8, pelY + 8, baseCUAddr, baseAbsPartIdx);
     600      pcColCU = pcCUDes->getBaseColCU(refLayerIdc, pelX + 8, pelY + 8, baseCUAddr, baseAbsPartIdx);
    595601
    596602#if AVC_SYNTAX && !ILP_DECODED_PICTURE
     
    607613          TComMvField sMvFieldBase, sMvField;
    608614          pcColCU->getMvField( pcColCU, baseAbsPartIdx, (RefPicList)refPicList, sMvFieldBase);
    609           pcCUDes->scaleBaseMV( sMvField, sMvFieldBase );
     615          pcCUDes->scaleBaseMV( refLayerIdc, sMvField, sMvFieldBase );
    610616
    611617          pcCUDes->getCUMvField((RefPicList)refPicList)->setMvField(sMvField, absPartIdx);
  • trunk/source/Lib/TLibCommon/TComPic.h

    r191 r310  
    9292  SEIMessages  m_SEIs; ///< Any SEI messages that have been received.  If !NULL we own the object.
    9393#if SVC_EXTENSION
    94   Bool                  m_bSpatialEnhLayer;       // whether current layer is a spatial enhancement layer,
    95   TComPicYuv*           m_pcFullPelBaseRec;    // upsampled base layer recontruction for difference domain inter prediction
     94  Bool                  m_bSpatialEnhLayer[MAX_LAYERS];       // whether current layer is a spatial enhancement layer,
     95  TComPicYuv*           m_pcFullPelBaseRec[MAX_LAYERS];    // upsampled base layer recontruction for difference domain inter prediction
    9696#endif
    9797
     
    114114  Void          setLayerId (UInt layerId) { m_layerId = layerId; }
    115115  UInt          getLayerId ()               { return m_layerId; }
    116   Bool          isSpatialEnhLayer()             { return m_bSpatialEnhLayer; }
    117   Void          setSpatialEnhLayerFlag (Bool b) { m_bSpatialEnhLayer = b; }
    118   Void          setFullPelBaseRec   ( TComPicYuv* p) { m_pcFullPelBaseRec = p; }
    119   TComPicYuv*   getFullPelBaseRec   ()  { return  m_pcFullPelBaseRec;  }
     116  Bool          isSpatialEnhLayer(UInt refLayerIdc)             { return m_bSpatialEnhLayer[refLayerIdc]; }
     117  Void          setSpatialEnhLayerFlag (UInt refLayerIdc, Bool b) { m_bSpatialEnhLayer[refLayerIdc] = b; }
     118  Void          setFullPelBaseRec   (UInt refLayerIdc, TComPicYuv* p) { m_pcFullPelBaseRec[refLayerIdc] = p; }
     119  TComPicYuv*   getFullPelBaseRec   (UInt refLayerIdc)  { return  m_pcFullPelBaseRec[refLayerIdc];  }
    120120#endif
    121121#if REF_IDX_ME_ZEROMV || ENCODER_FAST_MODE || REF_IDX_MFM
     
    124124
    125125#if REF_IDX_MFM
    126   Void          copyUpsampledMvField  ( TComPic* pcPicBase );
     126  Void          copyUpsampledMvField  ( UInt refLayerIdc, TComPic* pcPicBase );
    127127  Void          initUpsampledMvField  ();
    128128#endif
  • trunk/source/Lib/TLibCommon/TComPicYuv.h

    r191 r310  
    9292#endif
    9393
     94#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     95  Bool    m_isReconstructed;
     96#endif
     97
    9498  Bool  m_bIsBorderExtended;
    9599 
     
    126130#endif
    127131
    128 #if JCTVC_L0178
    129   Void   setWidth   ( Int iPicWidth )     { m_iPicWidth = iPicWidth; }
    130 #endif
    131132  Int   getStride   ()     { return (m_iPicWidth     ) + (m_iLumaMarginX  <<1); }
    132133  Int   getCStride  ()     { return (m_iPicWidth >> 1) + (m_iChromaMarginX<<1); }
     
    177178  //  Dump picture
    178179  Void  dump (Char* pFileName, Bool bAdd = false);
    179  
     180
     181#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     182  Void  setReconstructed(Bool x) { m_isReconstructed = x;    }
     183  Bool  isReconstructed()        { return m_isReconstructed; }
     184#endif
     185
    180186  // Set border extension flag
    181187  Void  setBorderExtension(Bool b) { m_bIsBorderExtended = b; }
  • trunk/source/Lib/TLibCommon/TComPrediction.cpp

    r191 r310  
    122122Pel TComPrediction::predIntraGetPredValDC( Int* pSrc, Int iSrcStride, UInt iWidth, UInt iHeight, Bool bAbove, Bool bLeft )
    123123{
     124  assert(iWidth > 0 && iHeight > 0);
    124125  Int iInd, iSum = 0;
    125126  Pel pDcVal;
     
    774775#if SVC_UPSAMPLING
    775776#if SCALED_REF_LAYER_OFFSETS
    776 Void TComPrediction::upsampleBasePic( TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window)
    777 {
    778   m_cUsf.upsampleBasePic( pcUsPic, pcBasePic, pcTempPic, window);
     777Void TComPrediction::upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window)
     778{
     779  m_cUsf.upsampleBasePic( refLayerIdc, pcUsPic, pcBasePic, pcTempPic, window);
    779780}
    780781#else
    781 Void TComPrediction::upsampleBasePic( TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic)
    782 {
    783   m_cUsf.upsampleBasePic( pcUsPic, pcBasePic, pcTempPic);
     782Void TComPrediction::upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic)
     783{
     784  m_cUsf.upsampleBasePic( refLayerIdc, pcUsPic, pcBasePic, pcTempPic);
    784785}
    785786#endif
  • trunk/source/Lib/TLibCommon/TComPrediction.h

    r191 r310  
    123123#if SVC_UPSAMPLING
    124124#if SCALED_REF_LAYER_OFFSETS
    125   Void upsampleBasePic( TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window );
     125  Void upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window );
    126126#else
    127   Void upsampleBasePic( TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic );
     127  Void upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic );
    128128#endif
    129129#endif
  • trunk/source/Lib/TLibCommon/TComRdCost.cpp

    r191 r310  
    485485}
    486486
    487 #if RATE_CONTROL_LAMBDA_DOMAIN
     487#if RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT
    488488UInt TComRdCost::getSADPart ( Int bitDepth, Pel* pelCur, Int curStride,  Pel* pelOrg, Int orgStride, UInt width, UInt height )
    489489{
  • trunk/source/Lib/TLibCommon/TComRdCost.h

    r191 r310  
    168168#if RATE_CONTROL_LAMBDA_DOMAIN
    169169  Double  getLambda() { return m_dLambda; }
     170#if M0036_RC_IMPROVEMENT
     171  Double  getChromaWeight () {return((m_cbDistortionWeight+m_crDistortionWeight)/2.0);}
     172#endif
    170173#endif
    171174 
     
    264267#endif
    265268
    266 #if RATE_CONTROL_LAMBDA_DOMAIN
     269#if RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT
    267270  UInt   getSADPart ( Int bitDepth, Pel* pelCur, Int curStride,  Pel* pelOrg, Int orgStride, UInt width, UInt height );
    268271#endif
  • trunk/source/Lib/TLibCommon/TComRom.cpp

    r191 r310  
    9999UInt g_auiPUOffset[8] = { 0, 8, 4, 4, 2, 10, 1, 5};
    100100
     101#if FAST_INTRA_SHVC
     102UInt g_reducedSetIntraModes[NUM_INTRA_MODE-1] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 };
     103UInt g_predefSetIntraModes[NUM_INTRA_MODE-1] = {26,10,18,34,2,22,14,30,6,24,12,28,8,20,16,32,4,17,19,15,21,13,23,11,25,9,27,7,29,5,31,3,33,0,2};
     104#endif
     105
    101106Void initZscanToRaster ( Int iMaxDepth, Int iDepth, UInt uiStartVal, UInt*& rpuiCurrIdx )
    102107{
  • trunk/source/Lib/TLibCommon/TComRom.h

    r191 r310  
    132132
    133133extern const UChar  g_aucIntraModeNumFast[7];
     134
     135#if FAST_INTRA_SHVC
     136extern       UInt  g_reducedSetIntraModes[NUM_INTRA_MODE-1];
     137extern       UInt  g_predefSetIntraModes[NUM_INTRA_MODE-1];
     138#endif
    134139
    135140// ====================================================================================================================
  • trunk/source/Lib/TLibCommon/TComSlice.cpp

    r191 r310  
    6565, m_deblockingFilterBetaOffsetDiv2 ( 0 )
    6666, m_deblockingFilterTcOffsetDiv2   ( 0 )
    67 #if !L0034_COMBINED_LIST_CLEANUP
    68 , m_bRefPicListModificationFlagLC ( false )
    69 , m_bRefPicListCombinationFlag    ( false )
    70 #endif
    7167, m_bCheckLDC                     ( false )
    7268, m_iSliceQpDelta                 ( 0 )
     
    7571, m_iDepth                        ( 0 )
    7672, m_bRefenced                     ( false )
     73#if SH_DISCARDABLE_FLAG
     74, m_bDiscardableFlag              ( false )
     75#endif
    7776, m_pcSPS                         ( NULL )
    7877, m_pcPPS                         ( NULL )
     
    8685, m_dLambda                       ( 0.0 )
    8786#endif
    88 #if !L0034_COMBINED_LIST_CLEANUP
    89 , m_bNoBackPredFlag             ( false )
    90 #endif
    9187, m_uiTLayer                      ( 0 )
    9288#if SVC_EXTENSION
    9389, m_layerId                     ( 0 )
    94 , m_pcBaseColPic                  ( NULL )
    9590#endif
    9691, m_bTLayerSwitchingFlag          ( false )
     
    117112, m_enableTMVPFlag                ( true )
    118113{
    119 #if L0034_COMBINED_LIST_CLEANUP
    120114  m_aiNumRefIdx[0] = m_aiNumRefIdx[1] = 0;
    121 #else
    122   m_aiNumRefIdx[0] = m_aiNumRefIdx[1] = m_aiNumRefIdx[2] = 0;
    123 #endif
    124  
     115
     116#if SVC_EXTENSION
     117  memset( m_pcBaseColPic, 0, sizeof( m_pcBaseColPic ) );
    125118#if REF_IDX_FRAMEWORK
    126119#if JCTVC_M0458_INTERLAYER_RPS_SIG
     
    131124  m_numILRRefIdx = 0;
    132125#endif
     126#if M0457_COL_PICTURE_SIGNALING
     127  m_altColIndicationFlag = false;
     128  m_colRefLayerIdx       = 0;
     129#endif
     130#if M0457_IL_SAMPLE_PRED_ONLY_FLAG
     131  m_numSamplePredRefLayers       = 0;
     132  m_interLayerSamplePredOnlyFlag = false;
     133#endif
     134#endif
    133135#endif
    134136
    135137  initEqualRef();
    136138 
    137 #if L0034_COMBINED_LIST_CLEANUP
    138139  for ( Int idx = 0; idx < MAX_NUM_REF; idx++ )
    139140  {
    140141    m_list1IdxToList0Idx[idx] = -1;
    141142  }
    142 #else
    143   for(Int iNumCount = 0; iNumCount < MAX_NUM_REF_LC; iNumCount++)
    144   {
    145     m_iRefIdxOfLC[REF_PIC_LIST_0][iNumCount]=-1;
    146     m_iRefIdxOfLC[REF_PIC_LIST_1][iNumCount]=-1;
    147     m_eListIdFromIdxOfLC[iNumCount]=0;
    148     m_iRefIdxFromIdxOfLC[iNumCount]=0;
    149     m_iRefIdxOfL0FromRefIdxOfL1[iNumCount] = -1;
    150     m_iRefIdxOfL1FromRefIdxOfL0[iNumCount] = -1;
    151   }   
    152 #endif
    153143  for(Int iNumCount = 0; iNumCount < MAX_NUM_REF; iNumCount++)
    154144  {
     
    188178  m_numILRRefIdx              = 0;
    189179#endif 
    190 
     180#if M0457_IL_SAMPLE_PRED_ONLY_FLAG
     181  m_numSamplePredRefLayers       = 0;
     182  m_interLayerSamplePredOnlyFlag = false;
     183#endif
    191184#endif
    192185  m_colFromL0Flag = 1;
     
    194187  m_colRefIdx = 0;
    195188  initEqualRef();
    196 #if !L0034_COMBINED_LIST_CLEANUP
    197   m_bNoBackPredFlag = false;
    198   m_bRefPicListCombinationFlag = false;
    199   m_bRefPicListModificationFlagLC = false;
    200 #endif
    201189  m_bCheckLDC = false;
    202190  m_iSliceQpDeltaCb = 0;
    203191  m_iSliceQpDeltaCr = 0;
    204 
    205 #if !L0034_COMBINED_LIST_CLEANUP
    206   m_aiNumRefIdx[REF_PIC_LIST_C]      = 0;
    207 #endif
    208192
    209193  m_maxNumMergeCand = MRG_MAX_NUM_CANDS;
     
    348332}
    349333
    350 #if L0034_COMBINED_LIST_CLEANUP
    351334Void TComSlice::setList1IdxToList0Idx()
    352335{
     
    365348  }
    366349}
    367 #else
    368 Void TComSlice::generateCombinedList()
    369 {
    370   if(m_aiNumRefIdx[REF_PIC_LIST_C] > 0)
    371   {
    372     m_aiNumRefIdx[REF_PIC_LIST_C]=0;
    373     for(Int iNumCount = 0; iNumCount < MAX_NUM_REF_LC; iNumCount++)
    374     {
    375       m_iRefIdxOfLC[REF_PIC_LIST_0][iNumCount]=-1;
    376       m_iRefIdxOfLC[REF_PIC_LIST_1][iNumCount]=-1;
    377       m_eListIdFromIdxOfLC[iNumCount]=0;
    378       m_iRefIdxFromIdxOfLC[iNumCount]=0;
    379       m_iRefIdxOfL0FromRefIdxOfL1[iNumCount] = -1;
    380       m_iRefIdxOfL1FromRefIdxOfL0[iNumCount] = -1;
    381     }
    382 
    383     for (Int iNumRefIdx = 0; iNumRefIdx < MAX_NUM_REF; iNumRefIdx++)
    384     {
    385       if(iNumRefIdx < m_aiNumRefIdx[REF_PIC_LIST_0])
    386       {
    387         Bool bTempRefIdxInL2 = true;
    388         for ( Int iRefIdxLC = 0; iRefIdxLC < m_aiNumRefIdx[REF_PIC_LIST_C]; iRefIdxLC++ )
    389         {
    390           if ( m_apcRefPicList[REF_PIC_LIST_0][iNumRefIdx]->getPOC() == m_apcRefPicList[m_eListIdFromIdxOfLC[iRefIdxLC]][m_iRefIdxFromIdxOfLC[iRefIdxLC]]->getPOC() )
    391           {
    392             m_iRefIdxOfL1FromRefIdxOfL0[iNumRefIdx] = m_iRefIdxFromIdxOfLC[iRefIdxLC];
    393             m_iRefIdxOfL0FromRefIdxOfL1[m_iRefIdxFromIdxOfLC[iRefIdxLC]] = iNumRefIdx;
    394             bTempRefIdxInL2 = false;
    395             break;
    396           }
    397         }
    398 
    399         if(bTempRefIdxInL2 == true)
    400         {
    401           m_eListIdFromIdxOfLC[m_aiNumRefIdx[REF_PIC_LIST_C]] = REF_PIC_LIST_0;
    402           m_iRefIdxFromIdxOfLC[m_aiNumRefIdx[REF_PIC_LIST_C]] = iNumRefIdx;
    403           m_iRefIdxOfLC[REF_PIC_LIST_0][iNumRefIdx] = m_aiNumRefIdx[REF_PIC_LIST_C]++;
    404         }
    405       }
    406 
    407       if(iNumRefIdx < m_aiNumRefIdx[REF_PIC_LIST_1])
    408       {
    409         Bool bTempRefIdxInL2 = true;
    410         for ( Int iRefIdxLC = 0; iRefIdxLC < m_aiNumRefIdx[REF_PIC_LIST_C]; iRefIdxLC++ )
    411         {
    412           if ( m_apcRefPicList[REF_PIC_LIST_1][iNumRefIdx]->getPOC() == m_apcRefPicList[m_eListIdFromIdxOfLC[iRefIdxLC]][m_iRefIdxFromIdxOfLC[iRefIdxLC]]->getPOC() )
    413           {
    414             m_iRefIdxOfL0FromRefIdxOfL1[iNumRefIdx] = m_iRefIdxFromIdxOfLC[iRefIdxLC];
    415             m_iRefIdxOfL1FromRefIdxOfL0[m_iRefIdxFromIdxOfLC[iRefIdxLC]] = iNumRefIdx;
    416             bTempRefIdxInL2 = false;
    417             break;
    418           }
    419         }
    420         if(bTempRefIdxInL2 == true)
    421         {
    422           m_eListIdFromIdxOfLC[m_aiNumRefIdx[REF_PIC_LIST_C]] = REF_PIC_LIST_1;
    423           m_iRefIdxFromIdxOfLC[m_aiNumRefIdx[REF_PIC_LIST_C]] = iNumRefIdx;
    424           m_iRefIdxOfLC[REF_PIC_LIST_1][iNumRefIdx] = m_aiNumRefIdx[REF_PIC_LIST_C]++;
    425         }
    426       }
    427     }
    428   }
    429 }
    430 #endif
    431350
    432351#if FIX1071
     352#if SVC_EXTENSION
    433353Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic, Bool checkNumPocTotalCurr, TComPic** ilpPic)
     354#else
     355Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic, Bool checkNumPocTotalCurr )
     356#endif
    434357#else
    435358Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic )
     
    440363#endif
    441364  {
    442     if( m_eSliceType == I_SLICE )
     365    if (m_eSliceType == I_SLICE)
    443366    {
    444367      ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList));
    445368      ::memset( m_aiNumRefIdx,   0, sizeof ( m_aiNumRefIdx ));
     369     
    446370      return;
    447371    }
     
    479403      pcRefPic->getPicYuvRec()->extendPicBorder();
    480404      RefPicSetStCurr0[NumPocStCurr0] = pcRefPic;
     405#if M0457_IL_SAMPLE_PRED_ONLY_FLAG
     406      if( !m_interLayerSamplePredOnlyFlag || pcRefPic->getLayerId() < getLayerId())
     407#endif
    481408      NumPocStCurr0++;
    482409      pcRefPic->setCheckLTMSBPresent(false); 
     
    492419      pcRefPic->getPicYuvRec()->extendPicBorder();
    493420      RefPicSetStCurr1[NumPocStCurr1] = pcRefPic;
     421#if M0457_IL_SAMPLE_PRED_ONLY_FLAG
     422      if( !m_interLayerSamplePredOnlyFlag || pcRefPic->getLayerId() < getLayerId())
     423#endif
    494424      NumPocStCurr1++;
    495425      pcRefPic->setCheckLTMSBPresent(false); 
     
    505435      pcRefPic->getPicYuvRec()->extendPicBorder();
    506436      RefPicSetLtCurr[NumPocLtCurr] = pcRefPic;
     437#if M0457_IL_SAMPLE_PRED_ONLY_FLAG
     438      if( !m_interLayerSamplePredOnlyFlag || pcRefPic->getLayerId() < getLayerId())
     439#endif
    507440      NumPocLtCurr++;
    508441    }
     
    518451
    519452#if REF_IDX_FRAMEWORK
    520   //inter-layer reference picture
     453  for( i = 0; i < m_activeNumILRRefIdx; i++ )
     454  {
     455    UInt refLayerIdc = m_interLayerPredLayerIdc[i];
     456    //inter-layer reference picture
    521457#if REF_IDX_MFM
     458
     459#if ILR_RESTR
     460    Int maxSubLayerForILPPlus1 = ( m_layerId > 0 && m_activeNumILRRefIdx > 0)? m_pcVPS->getMaxSublayerForIlpPlus1(ilpPic[refLayerIdc]->getSlice(0)->getLayerId()) : 0;
    522461#if ZERO_NUM_DIRECT_LAYERS
    523   if( m_layerId > 0 && m_activeNumILRRefIdx > 0 )
    524 #else
    525   if (getLayerId())
    526 #endif
    527   {
    528     if(!(getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA) && getSPS()->getMFMEnabledFlag())
    529     {
    530       ilpPic[0]->copyUpsampledMvField(getBaseColPic());
    531     }
    532     else
    533     {
    534       ilpPic[0]->initUpsampledMvField();
    535     }
    536   #endif
    537     ilpPic[0]->setIsLongTerm(1);
     462    if( m_layerId > 0 && m_activeNumILRRefIdx > 0 && ( ( (Int)(ilpPic[refLayerIdc]->getSlice(0)->getTLayer())<=  maxSubLayerForILPPlus1-1) || (maxSubLayerForILPPlus1==0 && ilpPic[refLayerIdc]->getSlice(0)->getRapPicFlag()) )  )
     463#else
     464    if( m_layerId > 0 && ( ( (Int)(ilpPic[refLayerIdc]->getSlice(0)->getTLayer())<=maxSubLayerForILPPlus1-1) || (maxSubLayerForILPPlus1==0 && ilpPic[refLayerIdc]->getSlice(0)->getRapPicFlag()) )  )
     465#endif
     466
     467#else
     468#if ZERO_NUM_DIRECT_LAYERS
     469    if( m_layerId > 0 && m_activeNumILRRefIdx > 0 )
     470#else
     471    if( m_layerId > 0 )
     472#endif
     473#endif
     474    {
     475#if M0457_COL_PICTURE_SIGNALING
     476      if(!(m_eNalUnitType >= NAL_UNIT_CODED_SLICE_BLA_W_LP && m_eNalUnitType <= NAL_UNIT_CODED_SLICE_CRA) && getMFMEnabledFlag())
     477#else
     478      if(!(m_eNalUnitType >= NAL_UNIT_CODED_SLICE_BLA_W_LP && m_eNalUnitType <= NAL_UNIT_CODED_SLICE_CRA) && m_pcSPS->getMFMEnabledFlag())
     479#endif
     480      {
     481        ilpPic[refLayerIdc]->copyUpsampledMvField( refLayerIdc, m_pcBaseColPic[refLayerIdc] );
     482      }
     483      else
     484      {
     485        ilpPic[refLayerIdc]->initUpsampledMvField();
     486      }
     487#endif
     488      ilpPic[refLayerIdc]->setIsLongTerm(1);
     489    }
    538490  }
    539491#endif
     
    542494  TComPic*  rpsCurrList1[MAX_NUM_REF+1];
    543495#if REF_IDX_FRAMEWORK
     496#if ILR_RESTR
     497  Int numInterLayerRPSPics = 0;
     498#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     499  if( m_layerId > 0 && m_activeNumILRRefIdx > 0 )
     500#else
     501  if( m_layerId > 0 )
     502#endif
     503  {
     504    for( i=0; i < m_pcVPS->getNumDirectRefLayers( m_layerId ); i++ )
     505    {
     506      Int maxSubLayerForILPPlus1 = getVPS()->getMaxSublayerForIlpPlus1(ilpPic[i]->getSlice(0)->getLayerId());
     507      if( ((Int)(ilpPic[i]->getSlice(0)->getTLayer())<= maxSubLayerForILPPlus1-1) || (maxSubLayerForILPPlus1==0 && ilpPic[i]->getSlice(0)->getRapPicFlag() ) )
     508      {
     509        numInterLayerRPSPics++;
     510      }
     511    }
     512#if JCTVC_M0458_INTERLAYER_RPS_SIG
     513    if (numInterLayerRPSPics < m_activeNumILRRefIdx)
     514    {
     515      m_activeNumILRRefIdx = numInterLayerRPSPics;
     516    }
     517#if MAX_ONE_RESAMPLING_DIRECT_LAYERS && SIMPLIFIED_MV_POS_SCALING
     518    if( m_pcVPS->getScalabilityMask(1) )
     519    {
     520      Int numResampler = 0;
     521      const Window &scalEL = getSPS()->getScaledRefLayerWindow(m_interLayerPredLayerIdc[i]);
     522      Int scalingOffset = ((scalEL.getWindowLeftOffset()   == 0 ) &&
     523                           (scalEL.getWindowRightOffset()  == 0 ) &&
     524                           (scalEL.getWindowTopOffset()    == 0 ) &&
     525                           (scalEL.getWindowBottomOffset() == 0 )
     526                          );
     527
     528      for( i=0; i < m_activeNumILRRefIdx; i++ )
     529      {
     530        UInt refLayerIdc = m_interLayerPredLayerIdc[i];
     531        if(!( g_posScalingFactor[refLayerIdc][0] == 65536 && g_posScalingFactor[refLayerIdc][1] == 65536 ) && (scalingOffset)) // ratio 1x
     532        {
     533          numResampler++;
     534        }
     535      }
     536
     537      //Bitstream constraint for SHVC: The picture resampling process as specified in subclause G.8.1.4.1 shall not be invoked more than once for decoding of each particular picture.
     538      assert(numResampler <= 1);
     539    }
     540#endif
     541#else
     542    if (numInterLayerRPSPics < m_numILRRefIdx)
     543    {
     544      m_numILRRefIdx = numInterLayerRPSPics;
     545    }
     546#endif
     547  }
     548#endif
    544549#if JCTVC_M0458_INTERLAYER_RPS_SIG
    545550  Int numPocTotalCurr = NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr + m_activeNumILRRefIdx;
     
    554559  {
    555560    // The variable NumPocTotalCurr is derived as specified in subclause 7.4.7.2. It is a requirement of bitstream conformance that the following applies to the value of NumPocTotalCurr:
     561#if ILP_RAP    // inter-layer prediction is allowed for BLA, CRA pictures of nuh_layer_id>0
     562    // – If the current picture is a BLA or CRA picture with nuh_layer_id equal to 0, the value of NumPocTotalCurr shall be equal to 0.
     563    // – Otherwise, when the current picture contains a P or B slice, the value of NumPocTotalCurr shall not be equal to 0.
     564    if (getRapPicFlag() && getLayerId()==0)
     565#else
    556566    // – If the current picture is a BLA or CRA picture, the value of NumPocTotalCurr shall be equal to 0.
    557567    // – Otherwise, when the current picture contains a P or B slice, the value of NumPocTotalCurr shall not be equal to 0.
    558568    if (getRapPicFlag())
     569#endif
    559570    {
    560571      assert(numPocTotalCurr == 0);
     
    569580    }
    570581   
    571     assert(numPocTotalCurr != 0);
     582    assert(numPocTotalCurr > 0);
    572583   
    573584    m_aiNumRefIdx[0] = getNumRefIdx(REF_PIC_LIST_0);
     
    575586  }
    576587#endif
    577  
     588
     589#if M0457_IL_SAMPLE_PRED_ONLY_FLAG
     590    if( m_interLayerSamplePredOnlyFlag && getLayerId() )
     591    {
     592      m_aiNumRefIdx[0] = m_aiNumRefIdx[0] > m_activeNumILRRefIdx ? m_activeNumILRRefIdx : m_aiNumRefIdx[0];
     593      m_aiNumRefIdx[1] = m_aiNumRefIdx[1] > m_activeNumILRRefIdx ? m_activeNumILRRefIdx : m_aiNumRefIdx[1];
     594    }
     595#endif
     596 
    578597    Int cIdx = 0;
    579598    for ( i=0; i<NumPocStCurr0; i++, cIdx++)
     
    588607    {
    589608      rpsCurrList0[cIdx] = RefPicSetLtCurr[i];
    590     }
     609    }   
     610
    591611#if REF_IDX_FRAMEWORK
    592     if(getLayerId())
     612    if( m_layerId > 0 )
    593613    {
    594614#if JCTVC_M0458_INTERLAYER_RPS_SIG
     
    598618#endif
    599619      {
    600         rpsCurrList0[cIdx] = ilpPic[i];
    601       }
    602     }
    603 #endif
     620        Int refLayerIdc = m_interLayerPredLayerIdc[i];
     621#if ILR_RESTR
     622         Int maxSubLayerForILPPlus1 = getVPS()->getMaxSublayerForIlpPlus1(ilpPic[refLayerIdc]->getSlice(0)->getLayerId());
     623        if( ((Int)(ilpPic[refLayerIdc]->getSlice(0)->getTLayer())<=maxSubLayerForILPPlus1-1) || (maxSubLayerForILPPlus1==0 && ilpPic[refLayerIdc]->getSlice(0)->getRapPicFlag()) )
     624#endif
     625        rpsCurrList0[cIdx] = ilpPic[refLayerIdc];
     626      }
     627    }
     628#endif
     629  assert(cIdx == numPocTotalCurr);
     630
    604631  if (m_eSliceType==B_SLICE)
    605632  {
     
    616643    {
    617644      rpsCurrList1[cIdx] = RefPicSetLtCurr[i];
    618     }
     645    }   
     646
    619647#if REF_IDX_FRAMEWORK
    620     if(getLayerId())
     648    if( m_layerId > 0 )
    621649    {
    622650#if JCTVC_M0458_INTERLAYER_RPS_SIG
     
    626654#endif
    627655      {
    628         rpsCurrList1[cIdx] = ilpPic[i];
    629       }
    630     }
    631 #endif
     656        Int refLayerIdc = m_interLayerPredLayerIdc[i];
     657#if ILR_RESTR
     658        Int maxSubLayerForILPPlus1 = getVPS()->getMaxSublayerForIlpPlus1(ilpPic[refLayerIdc]->getSlice(0)->getLayerId());
     659        if( ((Int)(ilpPic[refLayerIdc]->getSlice(0)->getTLayer())<=maxSubLayerForILPPlus1-1) || (maxSubLayerForILPPlus1==0 && ilpPic[refLayerIdc]->getSlice(0)->getRapPicFlag()) )
     660#endif
     661        rpsCurrList1[cIdx] = ilpPic[refLayerIdc];
     662      }
     663    }
     664#endif
     665
     666    assert(cIdx == numPocTotalCurr);
    632667  }
    633668
    634669  ::memset(m_bIsUsedAsLongTerm, 0, sizeof(m_bIsUsedAsLongTerm));
    635670
    636   for (Int rIdx = 0; rIdx <= (m_aiNumRefIdx[0]-1); rIdx ++)
    637   {
    638     m_apcRefPicList[0][rIdx] = m_RefPicListModification.getRefPicListModificationFlagL0() ? rpsCurrList0[ m_RefPicListModification.getRefPicSetIdxL0(rIdx) ] : rpsCurrList0[rIdx % numPocTotalCurr];
    639     m_bIsUsedAsLongTerm[0][rIdx] = m_RefPicListModification.getRefPicListModificationFlagL0() ? (m_RefPicListModification.getRefPicSetIdxL0(rIdx) >= (NumPocStCurr0 + NumPocStCurr1))
    640                                   : ((rIdx % numPocTotalCurr) >= (NumPocStCurr0 + NumPocStCurr1));
    641   }
    642   if ( m_eSliceType == P_SLICE )
     671  for (Int rIdx = 0; rIdx < m_aiNumRefIdx[0]; rIdx ++)
     672  {
     673    cIdx = m_RefPicListModification.getRefPicListModificationFlagL0() ? m_RefPicListModification.getRefPicSetIdxL0(rIdx) : rIdx % numPocTotalCurr;
     674    assert(cIdx >= 0 && cIdx < numPocTotalCurr);
     675    m_apcRefPicList[0][rIdx] = rpsCurrList0[ cIdx ];
     676    m_bIsUsedAsLongTerm[0][rIdx] = ( cIdx >= NumPocStCurr0 + NumPocStCurr1 );
     677  }
     678  if ( m_eSliceType != B_SLICE )
    643679  {
    644680    m_aiNumRefIdx[1] = 0;
     
    647683  else
    648684  {
    649     for (Int rIdx = 0; rIdx <= (m_aiNumRefIdx[1]-1); rIdx ++)
    650     {
    651       m_apcRefPicList[1][rIdx] = m_RefPicListModification.getRefPicListModificationFlagL1() ? rpsCurrList1[ m_RefPicListModification.getRefPicSetIdxL1(rIdx) ] : rpsCurrList1[rIdx % numPocTotalCurr];
    652       m_bIsUsedAsLongTerm[1][rIdx] = m_RefPicListModification.getRefPicListModificationFlagL1() ?
    653                                   (m_RefPicListModification.getRefPicSetIdxL1(rIdx) >= (NumPocStCurr0 + NumPocStCurr1)): ((rIdx % numPocTotalCurr) >= (NumPocStCurr0 + NumPocStCurr1));
     685    for (Int rIdx = 0; rIdx < m_aiNumRefIdx[1]; rIdx ++)
     686    {
     687      cIdx = m_RefPicListModification.getRefPicListModificationFlagL1() ? m_RefPicListModification.getRefPicSetIdxL1(rIdx) : rIdx % numPocTotalCurr;
     688      assert(cIdx >= 0 && cIdx < numPocTotalCurr);
     689      m_apcRefPicList[1][rIdx] = rpsCurrList1[ cIdx ];
     690      m_bIsUsedAsLongTerm[1][rIdx] = ( cIdx >= NumPocStCurr0 + NumPocStCurr1 );
    654691    }
    655692  }
     
    659696Void TComSlice::setRefPicListModificationSvc()
    660697{
    661   if( !this->getPPS()->getListsModificationPresentFlag())
     698  if( !m_pcPPS->getListsModificationPresentFlag())
    662699  {
    663700    return;
    664701  }
    665702
    666   if(this->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && this->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA)
     703  if(m_eNalUnitType >= NAL_UNIT_CODED_SLICE_BLA_W_LP && m_eNalUnitType <= NAL_UNIT_CODED_SLICE_CRA)
    667704  {
    668705    return;
    669706  }
    670707
    671   TComRefPicListModification* refPicListModification = this->getRefPicListModification();
     708  TComRefPicListModification* refPicListModification = &m_RefPicListModification;
    672709  Int numberOfRpsCurrTempList = this->getNumRpsCurrTempList();  // total number of ref pics in listTemp0 including inter-layer ref pics
    673710
     
    743780
    744781#if REF_IDX_FRAMEWORK
    745   if( m_eSliceType == I_SLICE || ( getSPS()->getLayerId() &&
    746     (getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP) &&
    747     (getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA) ) )
     782  if( m_eSliceType == I_SLICE || ( m_pcSPS->getLayerId() &&
     783    (m_eNalUnitType >= NAL_UNIT_CODED_SLICE_BLA_W_LP) &&
     784    (m_eNalUnitType <= NAL_UNIT_CODED_SLICE_CRA) ) )
    748785#else
    749786  if (m_eSliceType == I_SLICE)
     
    768805  }
    769806#if REF_IDX_FRAMEWORK
    770   if(getLayerId())
     807  if( m_layerId > 0 )
    771808  {
    772809#if JCTVC_M0458_INTERLAYER_RPS_SIG
     
    950987  m_deblockingFilterTcOffsetDiv2 = pSrc->m_deblockingFilterTcOffsetDiv2;
    951988 
    952 #if L0034_COMBINED_LIST_CLEANUP
    953989  for (i = 0; i < 2; i++)
    954 #else
    955   for (i = 0; i < 3; i++)
    956 #endif
    957990  {
    958991    m_aiNumRefIdx[i]     = pSrc->m_aiNumRefIdx[i];
    959992  }
    960993
    961 #if L0034_COMBINED_LIST_CLEANUP
    962994  for (i = 0; i < MAX_NUM_REF; i++)
    963995  {
    964996    m_list1IdxToList0Idx[i] = pSrc->m_list1IdxToList0Idx[i];
    965997  }
    966 #else
    967   for (i = 0; i < 2; i++)
    968   {
    969     for (j = 0; j < MAX_NUM_REF_LC; j++)
    970     {
    971        m_iRefIdxOfLC[i][j]  = pSrc->m_iRefIdxOfLC[i][j];
    972     }
    973   }
    974   for (i = 0; i < MAX_NUM_REF_LC; i++)
    975   {
    976     m_eListIdFromIdxOfLC[i] = pSrc->m_eListIdFromIdxOfLC[i];
    977     m_iRefIdxFromIdxOfLC[i] = pSrc->m_iRefIdxFromIdxOfLC[i];
    978     m_iRefIdxOfL1FromRefIdxOfL0[i] = pSrc->m_iRefIdxOfL1FromRefIdxOfL0[i];
    979     m_iRefIdxOfL0FromRefIdxOfL1[i] = pSrc->m_iRefIdxOfL0FromRefIdxOfL1[i];
    980   }
    981   m_bRefPicListModificationFlagLC = pSrc->m_bRefPicListModificationFlagLC;
    982   m_bRefPicListCombinationFlag    = pSrc->m_bRefPicListCombinationFlag;
    983 #endif
    984998  m_bCheckLDC             = pSrc->m_bCheckLDC;
    985999  m_iSliceQpDelta        = pSrc->m_iSliceQpDelta;
     
    10121026  m_activeNumILRRefIdx         = pSrc->m_activeNumILRRefIdx;
    10131027  m_interLayerPredEnabledFlag  = pSrc->m_interLayerPredEnabledFlag;
    1014   m_numInterLayerRefPics       = pSrc->m_numInterLayerRefPics;
    10151028  memcpy( m_interLayerPredLayerIdc, pSrc->m_interLayerPredLayerIdc, sizeof( m_interLayerPredLayerIdc ) );
    10161029#elif REF_IDX_FRAMEWORK
     
    10441057  }
    10451058
    1046 #if !L0034_COMBINED_LIST_CLEANUP
    1047   m_bNoBackPredFlag      = pSrc->m_bNoBackPredFlag;
    1048 #endif
    10491059  m_uiTLayer                      = pSrc->m_uiTLayer;
    10501060  m_bTLayerSwitchingFlag          = pSrc->m_bTLayerSwitchingFlag;
     
    13511361/** Function for constructing an explicit Reference Picture Set out of the available pictures in a referenced Reference Picture Set
    13521362*/
     1363#if FIX1071
     1364Void TComSlice::createExplicitReferencePictureSetFromReference( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool isRAP)
     1365#else
    13531366Void TComSlice::createExplicitReferencePictureSetFromReference( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet)
     1367#endif
    13541368{
    13551369  TComPic* rpcPic;
     
    13761390        // and should be added to the explicit Reference Picture Set
    13771391        pcRPS->setDeltaPOC(k, pReferencePictureSet->getDeltaPOC(i));
     1392#if FIX1071
     1393        pcRPS->setUsed(k, pReferencePictureSet->getUsed(i) && (!isRAP));
     1394#else
    13781395        pcRPS->setUsed(k, pReferencePictureSet->getUsed(i));
     1396#endif
    13791397        if(pcRPS->getDeltaPOC(k) < 0)
    13801398        {
     
    15541572  {
    15551573    m_numReorderPics[i] = 0;
    1556 #if L0323_DPB
    15571574    m_uiMaxDecPicBuffering[i] = 1;
    1558 #else
    1559     m_uiMaxDecPicBuffering[i] = 0;
    1560 #endif
    15611575    m_uiMaxLatencyIncrease[i] = 0;
    15621576  }
     
    15871601  ::memset(m_numDirectRefLayers,   0, sizeof(m_numDirectRefLayers  ));
    15881602  ::memset(m_refLayerId,           0, sizeof(m_refLayerId          ));
     1603#if M0457_PREDICTION_INDICATIONS
     1604  m_directDepTypeLen = 2;
     1605  ::memset(m_directDependencyType, 0, sizeof(m_directDependencyType));
     1606#endif
    15891607#endif
    15901608#if DERIVE_LAYER_ID_LIST_VARIABLES
     
    15971615#if JCTVC_M0458_INTERLAYER_RPS_SIG
    15981616  m_maxOneActiveRefLayerFlag = true;
     1617#endif
     1618#if JCTVC_M0203_INTERLAYER_PRED_IDC
     1619  for( Int i = 0; i < MAX_VPS_LAYER_ID_PLUS1 - 1; i++)
     1620  {
     1621    m_maxSublayerForIlpPlus1[i] = m_uiMaxTLayers + 1;
     1622  }
    15991623#endif
    16001624}
     
    16561680, m_pcmLog2MaxSize            (  5)
    16571681, m_uiPCMLog2MinSize          (  7)
    1658 #if !L0034_COMBINED_LIST_CLEANUP
    1659 , m_bUseLComb                 (false)
    1660 #endif
    16611682, m_bitDepthY                 (  8)
    16621683, m_bitDepthC                 (  8)
     
    16761697, m_vuiParametersPresentFlag  (false)
    16771698, m_vuiParameters             ()
     1699#if M0463_VUI_EXT_ILP_REF
     1700, m_interViewMvVertConstraintFlag (false)
     1701, m_numIlpRestrictedRefLayers ( 0 )
     1702#endif
    16781703#if SVC_EXTENSION
    16791704, m_layerId(0)
    16801705#endif
     1706#if SCALED_REF_LAYER_OFFSETS
     1707, m_numScaledRefLayerOffsets  (0)
     1708#endif
    16811709{
    16821710  for ( Int i = 0; i < MAX_TLAYER; i++ )
    16831711  {
    16841712    m_uiMaxLatencyIncrease[i] = 0;
    1685 #if L0323_DPB
    16861713    m_uiMaxDecPicBuffering[i] = 1;
    1687 #else
    1688     m_uiMaxDecPicBuffering[i] = 0;
    1689 #endif
    16901714    m_numReorderPics[i]       = 0;
    16911715  }
     
    16931717  ::memset(m_ltRefPicPocLsbSps, 0, sizeof(m_ltRefPicPocLsbSps));
    16941718  ::memset(m_usedByCurrPicLtSPSFlag, 0, sizeof(m_usedByCurrPicLtSPSFlag));
     1719#if M0463_VUI_EXT_ILP_REF
     1720  for (Int i = 0; i < MAX_LAYERS; i++ )
     1721  {
     1722    m_minSpatialSegmentOffsetPlus1[ i ] = 0;
     1723    m_ctuBasedOffsetEnabledFlag   [ i ] = false;
     1724    m_minHorizontalCtuOffsetPlus1 [ i ] = 0;
     1725  }
     1726#endif
    16951727}
    16961728
     
    17171749  TComHRD *hrd = vui->getHrdParameters();
    17181750
    1719 #if L0043_TIMING_INFO
    17201751  TimingInfo *timingInfo = vui->getTimingInfo();
    17211752  timingInfo->setTimingInfoPresentFlag( true );
     
    17411772    break;
    17421773  }
    1743 #else
    1744   hrd->setTimingInfoPresentFlag( true );
    1745   switch( frameRate )
    1746   {
    1747   case 24:
    1748     hrd->setNumUnitsInTick( 1125000 );    hrd->setTimeScale    ( 27000000 );
    1749     break;
    1750   case 25:
    1751     hrd->setNumUnitsInTick( 1080000 );    hrd->setTimeScale    ( 27000000 );
    1752     break;
    1753   case 30:
    1754     hrd->setNumUnitsInTick( 900900 );     hrd->setTimeScale    ( 27000000 );
    1755     break;
    1756   case 50:
    1757     hrd->setNumUnitsInTick( 540000 );     hrd->setTimeScale    ( 27000000 );
    1758     break;
    1759   case 60:
    1760     hrd->setNumUnitsInTick( 450450 );     hrd->setTimeScale    ( 27000000 );
    1761     break;
    1762   default:
    1763     hrd->setNumUnitsInTick( 1001 );       hrd->setTimeScale    ( 60000 );
    1764     break;
    1765   }
    1766 #endif
    17671774
    17681775  Bool rateCnt = ( bitRate > 0 );
     
    17771784    hrd->setDuCpbRemovalDelayLengthMinus1( 7 );                    // 8-bit precision ( plus 1 for last DU in AU )
    17781785    hrd->setSubPicCpbParamsInPicTimingSEIFlag( true );
    1779 #if L0044_DU_DPB_OUTPUT_DELAY_HRD
    17801786    hrd->setDpbOutputDelayDuLengthMinus1( 5 + 7 );                 // With sub-clock tick factor of 100, at least 7 bits to have the same value as AU dpb delay
    1781 #endif
    17821787  }
    17831788  else
     
    18081813  UInt birateValue, cpbSizeValue;
    18091814  UInt ducpbSizeValue;
    1810 #if L0363_DU_BIT_RATE
    18111815  UInt duBitRateValue = 0;
    1812 #endif
    18131816
    18141817  for( i = 0; i < MAX_TLAYER; i ++ )
     
    18221825    cpbSizeValue = bitRate;                                     // 1 second
    18231826    ducpbSizeValue = bitRate/numDU;
    1824 #if L0363_DU_BIT_RATE
    18251827    duBitRateValue = bitRate;
    1826 #endif
    18271828    for( j = 0; j < ( hrd->getCpbCntMinus1( i ) + 1 ); j ++ )
    18281829    {
     
    18351836      hrd->setCpbSizeValueMinus1( i, j, 1, ( cpbSizeValue - 1 ) );
    18361837      hrd->setDuCpbSizeValueMinus1( i, j, 1, ( ducpbSizeValue - 1 ) );
    1837 #if L0363_DU_BIT_RATE
    18381838      hrd->setDuBitRateValueMinus1( i, j, 1, ( duBitRateValue - 1 ) );
    1839 #endif
    18401839      hrd->setCbrFlag( i, j, 1, ( j == 0 ) );
    18411840    }
     
    24142413  , m_profileIdc      (0)
    24152414  , m_levelIdc        (0)
    2416 #if L0046_CONSTRAINT_FLAGS
    24172415, m_progressiveSourceFlag  (false)
    24182416, m_interlacedSourceFlag   (false)
    24192417, m_nonPackedConstraintFlag(false)
    24202418, m_frameOnlyConstraintFlag(false)
    2421 #endif
    24222419{
    24232420  ::memset(m_profileCompatibilityFlag, 0, sizeof(m_profileCompatibilityFlag));
     
    24502447  // Copy all information related to general profile
    24512448  this->getGeneralPTL()->copyProfileInfo(ptl->getGeneralPTL());
    2452 }
    2453 #endif
    2454 #if SIGNAL_BITRATE_PICRATE_IN_VPS
    2455 TComBitRatePicRateInfo::TComBitRatePicRateInfo()
    2456 {
    2457   ::memset(m_bitRateInfoPresentFlag, 0, sizeof(m_bitRateInfoPresentFlag));
    2458   ::memset(m_picRateInfoPresentFlag, 0, sizeof(m_picRateInfoPresentFlag));
    2459   ::memset(m_avgBitRate,             0, sizeof(m_avgBitRate));
    2460   ::memset(m_maxBitRate,             0, sizeof(m_maxBitRate));
    2461   ::memset(m_constantPicRateIdc,     0, sizeof(m_constantPicRateIdc));
    2462   ::memset(m_avgPicRate,             0, sizeof(m_avgPicRate));
    24632449}
    24642450#endif
     
    25092495#endif
    25102496
    2511 Void TComSlice::setBaseColPic(  TComList<TComPic*>& rcListPic, UInt layerID )
     2497Void TComSlice::setBaseColPic(  TComList<TComPic*>& rcListPic, UInt refLayerIdc )
    25122498
    2513   if (layerID == 0)
    2514   {
    2515     m_pcBaseColPic = NULL;
     2499  if(m_layerId == 0)
     2500  {
     2501    memset( m_pcBaseColPic, 0, sizeof( m_pcBaseColPic ) );
    25162502    return;
    25172503  }       
    2518   setBaseColPic(xGetRefPic(rcListPic, getPOC()));
     2504  setBaseColPic(refLayerIdc, xGetRefPic(rcListPic, getPOC()));
    25192505}
    25202506#endif
    25212507
    25222508#if REF_IDX_MFM
    2523 Void TComSlice::setRefPOCListILP( TComPic** ilpPic, TComPic *pcRefPicBL )
    2524 {
    2525   //set reference picture POC of each ILP reference
    2526   Int thePoc = ilpPic[0]->getPOC();
    2527   assert(thePoc >= 0);
    2528   assert(thePoc == pcRefPicBL->getPOC());
    2529 
    2530   ilpPic[0]->getSlice(0)->setBaseColPic( pcRefPicBL );
    2531 
    2532   //copy reference pictures marking from the reference layer
    2533   ilpPic[0]->getSlice(0)->copySliceInfo(pcRefPicBL->getSlice(0));
    2534  
    2535   for( Int refList = 0; refList < 2; refList++ )
    2536   {
    2537     RefPicList refPicList = RefPicList( refList );
    2538    
    2539     //set reference POC of ILP
    2540     ilpPic[0]->getSlice(0)->setNumRefIdx(refPicList, pcRefPicBL->getSlice(0)->getNumRefIdx(refPicList));
    2541     assert(ilpPic[0]->getSlice(0)->getNumRefIdx(refPicList) >= 0);
    2542     assert(ilpPic[0]->getSlice(0)->getNumRefIdx(refPicList) <= MAX_NUM_REF);
    2543 
    2544     //initialize reference POC of ILP
    2545     for(Int refIdx = 0; refIdx < pcRefPicBL->getSlice(0)->getNumRefIdx(refPicList); refIdx++)
    2546     {
    2547       ilpPic[0]->getSlice(0)->setRefPOC(pcRefPicBL->getSlice(0)->getRefPOC(refPicList, refIdx), refPicList, refIdx);
    2548       ilpPic[0]->getSlice(0)->setRefPic(pcRefPicBL->getSlice(0)->getRefPic(refPicList, refIdx), refPicList, refIdx);
    2549     }
    2550 
    2551     for(Int refIdx = pcRefPicBL->getSlice(0)->getNumRefIdx(refPicList); refIdx < MAX_NUM_REF; refIdx++)
    2552     {
    2553       ilpPic[0]->getSlice(0)->setRefPOC(0, refPicList, refIdx);
    2554       ilpPic[0]->getSlice(0)->setRefPic(NULL, refPicList, refIdx);
     2509Void TComSlice::setRefPOCListILP( TComPic** ilpPic, TComPic** pcRefPicRL )
     2510{
     2511  for( UInt i = 0; i < m_activeNumILRRefIdx; i++ )
     2512  {
     2513    UInt refLayerIdc = m_interLayerPredLayerIdc[i];
     2514
     2515    TComPic* pcRefPicBL = pcRefPicRL[refLayerIdc];
     2516    //set reference picture POC of each ILP reference
     2517    Int thePoc = ilpPic[refLayerIdc]->getPOC();
     2518    assert(thePoc >= 0);
     2519    assert(thePoc == pcRefPicBL->getPOC());
     2520
     2521    ilpPic[refLayerIdc]->getSlice(0)->setBaseColPic( refLayerIdc, pcRefPicBL );
     2522
     2523    //copy reference pictures marking from the reference layer
     2524    ilpPic[refLayerIdc]->getSlice(0)->copySliceInfo(pcRefPicBL->getSlice(0));
     2525
     2526    for( Int refList = 0; refList < 2; refList++ )
     2527    {
     2528      RefPicList refPicList = RefPicList( refList );
     2529
     2530      //set reference POC of ILP
     2531      ilpPic[refLayerIdc]->getSlice(0)->setNumRefIdx(refPicList, pcRefPicBL->getSlice(0)->getNumRefIdx(refPicList));
     2532      assert(ilpPic[refLayerIdc]->getSlice(0)->getNumRefIdx(refPicList) >= 0);
     2533      assert(ilpPic[refLayerIdc]->getSlice(0)->getNumRefIdx(refPicList) <= MAX_NUM_REF);
     2534
     2535      //initialize reference POC of ILP
     2536      for(Int refIdx = 0; refIdx < pcRefPicBL->getSlice(0)->getNumRefIdx(refPicList); refIdx++)
     2537      {
     2538        ilpPic[refLayerIdc]->getSlice(0)->setRefPOC(pcRefPicBL->getSlice(0)->getRefPOC(refPicList, refIdx), refPicList, refIdx);
     2539        ilpPic[refLayerIdc]->getSlice(0)->setRefPic(pcRefPicBL->getSlice(0)->getRefPic(refPicList, refIdx), refPicList, refIdx);
     2540      }
     2541
     2542      for(Int refIdx = pcRefPicBL->getSlice(0)->getNumRefIdx(refPicList); refIdx < MAX_NUM_REF; refIdx++)
     2543      {
     2544        ilpPic[refLayerIdc]->getSlice(0)->setRefPOC(0, refPicList, refIdx);
     2545        ilpPic[refLayerIdc]->getSlice(0)->setRefPic(NULL, refPicList, refIdx);
     2546      }
    25552547    }
    25562548  }
  • trunk/source/Lib/TLibCommon/TComSlice.h

    r191 r310  
    191191  Int     m_levelIdc;
    192192
    193 #if L0046_CONSTRAINT_FLAGS
    194193  Bool m_progressiveSourceFlag;
    195194  Bool m_interlacedSourceFlag;
    196195  Bool m_nonPackedConstraintFlag;
    197196  Bool m_frameOnlyConstraintFlag;
    198 #endif
    199197 
    200198public:
     
    216214  Void  setLevelIdc(Int x)      { m_levelIdc = x; }
    217215 
    218 #if L0046_CONSTRAINT_FLAGS
    219216  Bool getProgressiveSourceFlag() const { return m_progressiveSourceFlag; }
    220217  Void setProgressiveSourceFlag(Bool b) { m_progressiveSourceFlag = b; }
     
    228225  Bool getFrameOnlyConstraintFlag() const { return m_frameOnlyConstraintFlag; }
    229226  Void setFrameOnlyConstraintFlag(Bool b) { m_frameOnlyConstraintFlag = b; }
    230 #endif
    231227#if VPS_EXTN_PROFILE_INFO
    232228  Void copyProfileInfo(ProfileTierLevel *ptl);
     
    257253};
    258254/// VPS class
    259 
    260 #if SIGNAL_BITRATE_PICRATE_IN_VPS
    261 class TComBitRatePicRateInfo
    262 {
    263   Bool        m_bitRateInfoPresentFlag[MAX_TLAYER];
    264   Bool        m_picRateInfoPresentFlag[MAX_TLAYER];
    265   Int         m_avgBitRate[MAX_TLAYER];
    266   Int         m_maxBitRate[MAX_TLAYER];
    267   Int         m_constantPicRateIdc[MAX_TLAYER];
    268   Int         m_avgPicRate[MAX_TLAYER];
    269 public:
    270   TComBitRatePicRateInfo();
    271   Bool        getBitRateInfoPresentFlag(Int i) {return m_bitRateInfoPresentFlag[i];}
    272   Void        setBitRateInfoPresentFlag(Int i, Bool x) {m_bitRateInfoPresentFlag[i] = x;}
    273 
    274   Bool        getPicRateInfoPresentFlag(Int i) {return m_picRateInfoPresentFlag[i];}
    275   Void        setPicRateInfoPresentFlag(Int i, Bool x) {m_picRateInfoPresentFlag[i] = x;}
    276 
    277   Int         getAvgBitRate(Int i) {return m_avgBitRate[i];}
    278   Void        setAvgBitRate(Int i, Int x) {m_avgBitRate[i] = x;}
    279 
    280   Int         getMaxBitRate(Int i) {return m_maxBitRate[i];}
    281   Void        setMaxBitRate(Int i, Int x) {m_maxBitRate[i] = x;}
    282 
    283   Int         getConstantPicRateIdc(Int i) {return m_constantPicRateIdc[i];}
    284   Void        setConstantPicRateIdc(Int i, Int x) {m_constantPicRateIdc[i] = x;}
    285 
    286   Int         getAvgPicRate(Int i) {return m_avgPicRate[i];}
    287   Void        setAvgPicRate(Int i, Int x) {m_avgPicRate[i] = x;}
    288 };
    289 #endif
    290255
    291256struct HrdSubLayerInfo
     
    300265  UInt ducpbSizeValue    [MAX_CPB_CNT][2];
    301266  UInt cbrFlag           [MAX_CPB_CNT][2];
    302 #if L0363_DU_BIT_RATE
    303267  UInt duBitRateValue    [MAX_CPB_CNT][2];
    304 #endif
    305268};
    306269
     
    308271{
    309272private:
    310 #if !L0043_TIMING_INFO
    311   Bool m_timingInfoPresentFlag;
    312   UInt m_numUnitsInTick;
    313   UInt m_timeScale;
    314 #endif
    315273  Bool m_nalHrdParametersPresentFlag;
    316274  Bool m_vclHrdParametersPresentFlag;
     
    319277  UInt m_duCpbRemovalDelayLengthMinus1;
    320278  Bool m_subPicCpbParamsInPicTimingSEIFlag;
    321 #if L0044_DU_DPB_OUTPUT_DELAY_HRD
    322279  UInt m_dpbOutputDelayDuLengthMinus1;
    323 #endif
    324280  UInt m_bitRateScale;
    325281  UInt m_cpbSizeScale;
     
    333289public:
    334290  TComHRD()
    335 #if !L0043_TIMING_INFO
    336   :m_timingInfoPresentFlag(false)
    337   ,m_numUnitsInTick(1001)
    338   ,m_timeScale(60000)
    339   ,m_nalHrdParametersPresentFlag(0)
    340 #else
    341291  :m_nalHrdParametersPresentFlag(0)
    342 #endif
    343292  ,m_vclHrdParametersPresentFlag(0)
    344293  ,m_subPicCpbParamsPresentFlag(false)
     
    346295  ,m_duCpbRemovalDelayLengthMinus1(0)
    347296  ,m_subPicCpbParamsInPicTimingSEIFlag(false)
    348 #if L0044_DU_DPB_OUTPUT_DELAY_HRD
    349297  ,m_dpbOutputDelayDuLengthMinus1(0)
    350 #endif
    351298  ,m_bitRateScale(0)
    352299  ,m_cpbSizeScale(0)
     
    357304
    358305  virtual ~TComHRD() {}
    359 #if !L0043_TIMING_INFO
    360   Void setTimingInfoPresentFlag             ( Bool flag )  { m_timingInfoPresentFlag = flag;               }
    361   Bool getTimingInfoPresentFlag             ( )            { return m_timingInfoPresentFlag;               }
    362 
    363   Void setNumUnitsInTick                    ( UInt value ) { m_numUnitsInTick = value;                     }
    364   UInt getNumUnitsInTick                    ( )            { return m_numUnitsInTick;                      }
    365 
    366   Void setTimeScale                         ( UInt value ) { m_timeScale = value;                          }
    367   UInt getTimeScale                         ( )            { return m_timeScale;                           }
    368 #endif
    369306
    370307  Void setNalHrdParametersPresentFlag       ( Bool flag )  { m_nalHrdParametersPresentFlag = flag;         }
     
    386323  Bool getSubPicCpbParamsInPicTimingSEIFlag ()             { return m_subPicCpbParamsInPicTimingSEIFlag;   }
    387324
    388 #if L0044_DU_DPB_OUTPUT_DELAY_HRD
    389325  Void setDpbOutputDelayDuLengthMinus1      (UInt value )  { m_dpbOutputDelayDuLengthMinus1 = value;       }
    390326  UInt getDpbOutputDelayDuLengthMinus1      ()             { return m_dpbOutputDelayDuLengthMinus1;        }
    391 #endif
    392327
    393328  Void setBitRateScale                      ( UInt value ) { m_bitRateScale = value;                       }
     
    430365  Void setDuCpbSizeValueMinus1     ( Int layer, Int cpbcnt, Int nalOrVcl, UInt value ) { m_HRD[layer].ducpbSizeValue[cpbcnt][nalOrVcl] = value;       }
    431366  UInt getDuCpbSizeValueMinus1     ( Int layer, Int cpbcnt, Int nalOrVcl            )  { return m_HRD[layer].ducpbSizeValue[cpbcnt][nalOrVcl];        }
    432 #if L0363_DU_BIT_RATE
    433367  Void setDuBitRateValueMinus1     ( Int layer, Int cpbcnt, Int nalOrVcl, UInt value ) { m_HRD[layer].duBitRateValue[cpbcnt][nalOrVcl] = value;       }
    434368  UInt getDuBitRateValueMinus1     (Int layer, Int cpbcnt, Int nalOrVcl )              { return m_HRD[layer].duBitRateValue[cpbcnt][nalOrVcl];        }
    435 #endif
    436369  Void setCbrFlag                ( Int layer, Int cpbcnt, Int nalOrVcl, UInt value ) { m_HRD[layer].cbrFlag[cpbcnt][nalOrVcl] = value;            }
    437370  Bool getCbrFlag                ( Int layer, Int cpbcnt, Int nalOrVcl             ) { return m_HRD[layer].cbrFlag[cpbcnt][nalOrVcl];             }
     
    439372  Void setNumDU                              ( UInt value ) { m_numDU = value;                            }
    440373  UInt getNumDU                              ( )            { return m_numDU;          }
    441 #if L0045_CONDITION_SIGNALLING
    442374  Bool getCpbDpbDelaysPresentFlag() { return getNalHrdParametersPresentFlag() || getVclHrdParametersPresentFlag(); }
    443 #endif
    444375};
    445376
    446 #if L0043_TIMING_INFO
    447377class TimingInfo
    448378{
     
    475405  Void setNumTicksPocDiffOneMinus1          (Int x       ) { m_numTicksPocDiffOneMinus1 = x;               }
    476406};
    477 #endif
    478407
    479408class TComVPS
     
    487416  UInt        m_numReorderPics[MAX_TLAYER];
    488417  UInt        m_uiMaxDecPicBuffering[MAX_TLAYER];
    489   UInt        m_uiMaxLatencyIncrease[MAX_TLAYER];
     418  UInt        m_uiMaxLatencyIncrease[MAX_TLAYER]; // Really max latency increase plus 1 (value 0 expresses no limit)
    490419
    491420  UInt        m_numHrdParameters;
     
    509438#endif
    510439  TComPTL     m_pcPTL;
    511 #if SIGNAL_BITRATE_PICRATE_IN_VPS
    512   TComBitRatePicRateInfo    m_bitRatePicRateInfo;
    513 #endif
    514 #if L0043_TIMING_INFO
    515440  TimingInfo  m_timingInfo;
    516 #endif
    517441
    518442  // ------------------------------------------
     
    549473  UInt       m_numDirectRefLayers[MAX_VPS_LAYER_ID_PLUS1];
    550474  UInt       m_refLayerId[MAX_VPS_LAYER_ID_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
     475#if M0457_PREDICTION_INDICATIONS
     476  UInt       m_directDepTypeLen;
     477  UInt       m_directDependencyType[MAX_VPS_LAYER_ID_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
     478#endif
    551479#endif
    552480#if VPS_PROFILE_OUTPUT_LAYERS
     
    560488  Bool       m_maxOneActiveRefLayerFlag;
    561489#endif
     490#if JCTVC_M0203_INTERLAYER_PRED_IDC
     491  UInt       m_maxSublayerForIlpPlus1[MAX_VPS_LAYER_ID_PLUS1 - 1];
     492#endif
     493#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     494  Bool       m_singleLayerForNonIrapFlag;
     495#endif
    562496public:
    563497  TComVPS();
     
    626560#endif
    627561  TComPTL* getPTL() { return &m_pcPTL; }
    628 #if SIGNAL_BITRATE_PICRATE_IN_VPS
    629   TComBitRatePicRateInfo *getBitratePicrateInfo() { return &m_bitRatePicRateInfo; }
    630 #endif
    631 #if L0043_TIMING_INFO
    632562  TimingInfo* getTimingInfo() { return &m_timingInfo; }
    633 #endif
    634563#if VPS_EXTN_MASK_AND_DIM_INFO
    635564  Bool   getAvcBaseLayerFlag()                                  { return m_avcBaseLayerFlag;       }
     
    691620  UInt   getRefLayerId(Int layerId, Int refLayerIdx)                            { return m_refLayerId[layerId][refLayerIdx];              }
    692621  Void   setRefLayerId(Int layerId, Int refLayerIdx, UInt refLayerId)           { m_refLayerId[layerId][refLayerIdx] = refLayerId;        }
     622
     623#if M0457_PREDICTION_INDICATIONS
     624  UInt   getDirectDepTypeLen()                                                  { return m_directDepTypeLen;                              }
     625  Void   setDirectDepTypeLen(UInt x)                                            { m_directDepTypeLen = x;                                 }
     626
     627  UInt   getDirectDependencyType(Int currLayerId, Int refLayerId)               { return m_directDependencyType[currLayerId][refLayerId]; }
     628  Void   setDirectDependencyType(Int currLayerId, Int refLayerId, UInt x)       { m_directDependencyType[currLayerId][refLayerId] = x;    }
     629#endif
    693630#endif
    694631#if VPS_PROFILE_OUTPUT_LAYERS
     
    712649  Void   setMaxOneActiveRefLayerFlag(Bool x)                                    { m_maxOneActiveRefLayerFlag = x;                         }
    713650#endif
     651#if JCTVC_M0203_INTERLAYER_PRED_IDC
     652  Bool   getMaxSublayerForIlpPlus1(Int layerId)                     { return m_maxSublayerForIlpPlus1[layerId];                   }
     653  Void   setMaxSublayerForIlpPlus1(Int layerId, UInt maxSublayer)   { m_maxSublayerForIlpPlus1[layerId] = maxSublayer;            }
     654#endif
     655#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     656  Bool   getSingleLayerForNonIrapFlag()                             { return m_singleLayerForNonIrapFlag; }
     657  Void   setSingleLayerForNonIrapFlag(Bool x)                       { m_singleLayerForNonIrapFlag = x;    }
     658#endif
    714659};
    715660
     
    788733  Int  m_log2MaxMvLengthVertical;
    789734  TComHRD m_hrdParameters;
    790 #if L0043_TIMING_INFO
    791735  TimingInfo m_timingInfo;
    792 #else
    793   Bool m_pocProportionalToTimingFlag;
    794   Int  m_numTicksPocDiffOneMinus1;
    795 #endif
     736#if M0464_TILE_BOUNDARY_ALIGNED_FLAG
     737  Bool m_tileBoundariesAlignedFlag;
     738#endif
     739
    796740
    797741public:
     
    826770    ,m_log2MaxMvLengthHorizontal(15)
    827771    ,m_log2MaxMvLengthVertical(15)
    828 #if !L0043_TIMING_INFO 
    829     ,m_pocProportionalToTimingFlag(false)
    830     ,m_numTicksPocDiffOneMinus1(0)
     772#if M0464_TILE_BOUNDARY_ALIGNED_FLAG
     773    ,m_tileBoundariesAlignedFlag(true)
    831774#endif
    832775  {}
     
    924867
    925868  TComHRD* getHrdParameters                 ()             { return &m_hrdParameters; }
    926 #if L0043_TIMING_INFO
    927869  TimingInfo* getTimingInfo() { return &m_timingInfo; }
    928 #else
    929   Bool getPocProportionalToTimingFlag() {return m_pocProportionalToTimingFlag; }
    930   Void setPocProportionalToTimingFlag(Bool x) {m_pocProportionalToTimingFlag = x;}
    931   Int  getNumTicksPocDiffOneMinus1() {return m_numTicksPocDiffOneMinus1;}
    932   Void setNumTicksPocDiffOneMinus1(Int x) { m_numTicksPocDiffOneMinus1 = x;}
     870#if M0464_TILE_BOUNDARY_ALIGNED_FLAG
     871  Bool getTileBoundariesAlignedFlag(  ) { return m_tileBoundariesAlignedFlag; }
     872  Void setTileBoundariesAlignedFlag( Bool flag ) { m_tileBoundariesAlignedFlag = flag; }
    933873#endif
    934874};
     
    971911  Bool        m_useAMP;
    972912
    973 #if !L0034_COMBINED_LIST_CLEANUP
    974   Bool        m_bUseLComb;
    975 #endif
    976  
    977913  // Parameter
    978914  Int         m_bitDepthY;
     
    1003939  TComScalingList*     m_scalingList;   //!< ScalingList class pointer
    1004940  UInt        m_uiMaxDecPicBuffering[MAX_TLAYER];
    1005   UInt        m_uiMaxLatencyIncrease[MAX_TLAYER];
     941  UInt        m_uiMaxLatencyIncrease[MAX_TLAYER];  // Really max latency increase plus 1 (value 0 expresses no limit)
    1006942
    1007943  Bool        m_useDF;
     
    1015951  TComPTL     m_pcPTL;
    1016952
     953#if M0463_VUI_EXT_ILP_REF
     954  Bool        m_interViewMvVertConstraintFlag;
     955  Int         m_numIlpRestrictedRefLayers        ;
     956  Int         m_minSpatialSegmentOffsetPlus1[MAX_LAYERS];
     957  Bool        m_ctuBasedOffsetEnabledFlag   [MAX_LAYERS];
     958  Int         m_minHorizontalCtuOffsetPlus1 [MAX_LAYERS];
     959#endif
     960
    1017961#if SVC_EXTENSION
    1018962  UInt m_layerId;
    1019963#endif
    1020964#if REF_IDX_MFM
     965#if !M0457_COL_PICTURE_SIGNALING
    1021966  Bool m_bMFMEnabledFlag;
    1022967#endif
     968#endif
    1023969#if SCALED_REF_LAYER_OFFSETS
    1024   Window      m_scaledRefLayerWindow;
     970  UInt        m_numScaledRefLayerOffsets;
     971  Window      m_scaledRefLayerWindow[MAX_LAYERS];
    1025972#endif
    1026973public:
     
    10981045 
    10991046  // Tool list
    1100 #if !L0034_COMBINED_LIST_CLEANUP
    1101   Void setUseLComb    (Bool b)   { m_bUseLComb = b;         }
    1102   Bool getUseLComb    ()         { return m_bUseLComb;      }
    1103 #endif
    1104 
    11051047  Bool getUseLossless ()         { return m_useLossless; }
    11061048  Void setUseLossless ( Bool b ) { m_useLossless  = b; }
     
    11561098
    11571099#if SVC_EXTENSION
     1100#if M0463_VUI_EXT_ILP_REF
     1101  Void setInterViewMvVertConstraintFlag(Bool val) { m_interViewMvVertConstraintFlag = val; }
     1102  Bool getInterViewMvVertConstraintFlag()         { return m_interViewMvVertConstraintFlag;}
     1103
     1104  ////  sps_extension_vui_parameters( )
     1105  Void setNumIlpRestrictedRefLayers   ( Int val )        { m_numIlpRestrictedRefLayers         = val;}
     1106  Int  getNumIlpRestrictedRefLayers   ( )                { return m_numIlpRestrictedRefLayers        ;}
     1107
     1108  Void setMinSpatialSegmentOffsetPlus1( Int i, Int val ) { m_minSpatialSegmentOffsetPlus1[ i ] = val;}
     1109  Int  getMinSpatialSegmentOffsetPlus1( Int i )          { return m_minSpatialSegmentOffsetPlus1[ i ];}
     1110
     1111  Void setCtuBasedOffsetEnabledFlag   ( Int i, Bool flag ) { m_ctuBasedOffsetEnabledFlag   [ i ] = flag;}
     1112  Bool getCtuBasedOffsetEnabledFlag   ( Int i )            { return m_ctuBasedOffsetEnabledFlag   [ i ];}
     1113
     1114  Void setMinHorizontalCtuOffsetPlus1 ( Int i, Int val )   { m_minHorizontalCtuOffsetPlus1 [ i ] = val;}
     1115  Int  getMinHorizontalCtuOffsetPlus1 ( Int i )            { return m_minHorizontalCtuOffsetPlus1 [ i ];}
     1116#endif
    11581117  Void     setLayerId(UInt layerId) { m_layerId = layerId; }
    11591118  UInt     getLayerId() { return m_layerId; }
    11601119#endif
    11611120#if REF_IDX_MFM
     1121#if !M0457_COL_PICTURE_SIGNALING
    11621122  Void     setMFMEnabledFlag(Bool flag) {m_bMFMEnabledFlag = flag;}
    11631123  Bool     getMFMEnabledFlag()          {return m_bMFMEnabledFlag;}
    11641124#endif
     1125#endif
    11651126#if SCALED_REF_LAYER_OFFSETS
    1166   Window&  getScaledRefLayerWindow(     )   { return m_scaledRefLayerWindow; }
     1127  UInt     getNumScaledRefLayerOffsets()  { return m_numScaledRefLayerOffsets; }
     1128  Void     setNumScaledRefLayerOffsets(Int x)  { m_numScaledRefLayerOffsets = x; }
     1129  Window&  getScaledRefLayerWindow( Int x )   { return m_scaledRefLayerWindow[x]; }
    11671130#endif
    11681131};
     
    14311394#endif
    14321395#endif
    1433 #if L0034_COMBINED_LIST_CLEANUP
     1396#if M0457_IL_SAMPLE_PRED_ONLY_FLAG
     1397  Int         m_numSamplePredRefLayers;
     1398  Bool        m_interLayerSamplePredOnlyFlag;
     1399#endif
    14341400  Int         m_list1IdxToList0Idx[MAX_NUM_REF];
    14351401  Int         m_aiNumRefIdx   [2];    //  for multiple reference of current slice
    1436 #else
    1437   Int         m_aiNumRefIdx   [3];    //  for multiple reference of current slice
    1438   Int         m_iRefIdxOfLC[2][MAX_NUM_REF_LC];
    1439   Int         m_eListIdFromIdxOfLC[MAX_NUM_REF_LC];
    1440   Int         m_iRefIdxFromIdxOfLC[MAX_NUM_REF_LC];
    1441   Int         m_iRefIdxOfL1FromRefIdxOfL0[MAX_NUM_REF_LC];
    1442   Int         m_iRefIdxOfL0FromRefIdxOfL1[MAX_NUM_REF_LC];
    1443   Bool        m_bRefPicListModificationFlagLC;
    1444   Bool        m_bRefPicListCombinationFlag;
    1445 #endif
    14461402
    14471403  Bool        m_bCheckLDC;
     
    14591415  Bool        m_bRefenced;
    14601416 
     1417#if SH_DISCARDABLE_FLAG
     1418  Bool        m_bDiscardableFlag;
     1419#endif
     1420
    14611421  // access channel
    14621422  TComVPS*    m_pcVPS;
     
    14811441
    14821442  Bool        m_abEqualRef  [2][MAX_NUM_REF][MAX_NUM_REF];
    1483 #if !L0034_COMBINED_LIST_CLEANUP
    1484   Bool        m_bNoBackPredFlag;
    1485 #endif
    14861443  UInt        m_uiTLayer;
    14871444#if SVC_EXTENSION
    14881445  UInt        m_layerId;
    1489   TComPic*    m_pcBaseColPic;
    1490   TComPicYuv* m_pcFullPelBaseRec;
     1446  TComPic*    m_pcBaseColPic[MAX_LAYERS];
     1447  TComPicYuv* m_pcFullPelBaseRec[MAX_LAYERS];
     1448#if REF_IDX_FRAMEWORK && M0457_COL_PICTURE_SIGNALING
     1449  Int         m_numMotionPredRefLayers;
     1450#if REF_IDX_MFM
     1451  Bool        m_bMFMEnabledFlag;
     1452  Int         m_colRefLayerIdx;
     1453  Bool        m_altColIndicationFlag;
     1454  TComPic*    m_pcIlpPic;
     1455#endif
     1456#endif
    14911457#endif
    14921458  Bool        m_bTLayerSwitchingFlag;
     
    15251491#if JCTVC_M0458_INTERLAYER_RPS_SIG
    15261492  Bool       m_interLayerPredEnabledFlag;
    1527   Int        m_numInterLayerRefPics;
    15281493#endif
    15291494public:
     
    15951560  Bool      getMvdL1ZeroFlag ()                                  { return m_bLMvdL1Zero;    }
    15961561  Int       getNumRpsCurrTempList();
    1597 #if L0034_COMBINED_LIST_CLEANUP
    15981562  Int       getList1IdxToList0Idx ( Int list1Idx )               { return m_list1IdxToList0Idx[list1Idx]; }
    1599 #else
    1600   Int       getRefIdxOfLC       (RefPicList e, Int iRefIdx)     { return m_iRefIdxOfLC[e][iRefIdx];           }
    1601   Int       getListIdFromIdxOfLC(Int iRefIdx)                   { return m_eListIdFromIdxOfLC[iRefIdx];       }
    1602   Int       getRefIdxFromIdxOfLC(Int iRefIdx)                   { return m_iRefIdxFromIdxOfLC[iRefIdx];       }
    1603   Int       getRefIdxOfL0FromRefIdxOfL1(Int iRefIdx)            { return m_iRefIdxOfL0FromRefIdxOfL1[iRefIdx];}
    1604   Int       getRefIdxOfL1FromRefIdxOfL0(Int iRefIdx)            { return m_iRefIdxOfL1FromRefIdxOfL0[iRefIdx];}
    1605   Bool      getRefPicListModificationFlagLC()                   {return m_bRefPicListModificationFlagLC;}
    1606   Void      setRefPicListModificationFlagLC(Bool bflag)         {m_bRefPicListModificationFlagLC=bflag;}     
    1607   Bool      getRefPicListCombinationFlag()                      {return m_bRefPicListCombinationFlag;}
    1608   Void      setRefPicListCombinationFlag(Bool bflag)            {m_bRefPicListCombinationFlag=bflag;}   
    1609 #endif
    16101563  Void      setReferenced(Bool b)                               { m_bRefenced = b; }
    16111564  Bool      isReferenced()                                      { return m_bRefenced; }
     
    16161569  Bool      getIdrPicFlag       ()                              { return getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP; }
    16171570  Bool      isIRAP              () const                        { return (getNalUnitType() >= 16) && (getNalUnitType() <= 23); } 
     1571#if RESTR_CHK
     1572   Bool     isRADL() {  return (m_eNalUnitType == NAL_UNIT_CODED_SLICE_RADL_N || m_eNalUnitType == NAL_UNIT_CODED_SLICE_RADL_R); }
     1573   Bool     isRASL()   {   return (m_eNalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || m_eNalUnitType == NAL_UNIT_CODED_SLICE_RASL_R); }
     1574#endif
     1575
     1576#if SH_DISCARDABLE_FLAG
     1577  Bool      getDiscardableFlag  ()                              { return m_bDiscardableFlag; }
     1578  Void      setDiscardableFlag  (Bool b)                        { m_bDiscardableFlag = b; }
     1579#endif
     1580
    16181581  Void      checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, Bool& prevRAPisBLA, TComList<TComPic *>& rcListPic);
    16191582  Void      decodingRefreshMarking(Int& pocCRA, Bool& bRefreshPending, TComList<TComPic*>& rcListPic);
     
    16381601
    16391602#if FIX1071
     1603#if SVC_EXTENSION
    16401604  Void      setRefPicList       ( TComList<TComPic*>& rcListPic, Bool checkNumPocTotalCurr = false, TComPic** ilpPic = NULL );
     1605#else
     1606  Void      setRefPicList       ( TComList<TComPic*>& rcListPic, Bool checkNumPocTotalCurr = false );
     1607#endif
    16411608#else
    16421609  Void      setRefPicList       ( TComList<TComPic*>& rcListPic );
     
    16741641 
    16751642  static Void      sortPicList         ( TComList<TComPic*>& rcListPic );
    1676 #if L0034_COMBINED_LIST_CLEANUP
    16771643  Void setList1IdxToList0Idx();
    1678 #else
    1679   Bool getNoBackPredFlag() { return m_bNoBackPredFlag; }
    1680   Void setNoBackPredFlag( Bool b ) { m_bNoBackPredFlag = b; }
    1681   Void generateCombinedList       ();
    1682 #endif
    16831644
    16841645  UInt getTLayer             ()                            { return m_uiTLayer;                      }
     
    16911652  Bool isStepwiseTemporalLayerSwitchingPointCandidate( TComList<TComPic*>& rcListPic );
    16921653  Int       checkThatAllRefPicsAreAvailable( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool printErrors, Int pocRandomAccess = 0);
     1654#if FIX1071
     1655  Void      createExplicitReferencePictureSetFromReference( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool isRAP);
     1656#else
    16931657  Void      createExplicitReferencePictureSetFromReference( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet);
     1658#endif
    16941659
    16951660  Void setMaxNumMergeCand               (UInt val )         { m_maxNumMergeCand = val;                    }
     
    17641729
    17651730#if SVC_EXTENSION
    1766   Void      setBaseColPic       ( TComList<TComPic*>& rcListPic , UInt layerID );
    1767   Void      setBaseColPic       ( TComPic* p)     { m_pcBaseColPic = p; }
    1768   TComPic*  getBaseColPic       ()                { return m_pcBaseColPic; }
     1731  Void      setBaseColPic       ( TComList<TComPic*>& rcListPic , UInt refLayerIdc );
     1732  Void      setBaseColPic       (UInt refLayerIdc, TComPic* p)     { m_pcBaseColPic[refLayerIdc] = p; }
     1733  TComPic*  getBaseColPic       (UInt refLayerIdc)                { return m_pcBaseColPic[refLayerIdc]; }
     1734  TComPic** getBaseColPic       ()                { return &m_pcBaseColPic[0]; }
    17691735
    17701736  Void      setLayerId (UInt layerId)   { m_layerId = layerId; }
    17711737  UInt      getLayerId ()               { return m_layerId;    }
    17721738
    1773   Void        setFullPelBaseRec   ( TComPicYuv* p) { m_pcFullPelBaseRec = p; }
    1774   TComPicYuv* getFullPelBaseRec   ()               { return  m_pcFullPelBaseRec;  }
     1739  Void        setFullPelBaseRec   (UInt refLayerIdc, TComPicYuv* p) { m_pcFullPelBaseRec[refLayerIdc] = p; }
     1740  TComPicYuv* getFullPelBaseRec   (UInt refLayerIdc)               { return  m_pcFullPelBaseRec[refLayerIdc];  }
    17751741
    17761742#if AVC_SYNTAX
     
    17831749
    17841750#if REF_IDX_MFM
    1785   Void      setRefPOCListILP(TComPic** ilpPic, TComPic *pcRefPicBL);
     1751  Void      setRefPOCListILP(TComPic** ilpPic, TComPic** pcRefPicRL);
    17861752#endif
    17871753
     
    17901756  Void      setActiveNumILRRefIdx     ( Int i )         { m_activeNumILRRefIdx = i;     } 
    17911757
    1792   Int       getInterLayerPredLayerIdc (UInt Idx )               { return  m_interLayerPredLayerIdc[Idx];}
    1793   Void      setInterLayerPredLayerIdc (UInt val, UInt Idx)      { m_interLayerPredLayerIdc[Idx] = val;  }
     1758  Int       getInterLayerPredLayerIdc (UInt layerIdx)                        { return  m_interLayerPredLayerIdc[layerIdx];}
     1759  Void      setInterLayerPredLayerIdc (UInt refLayerIdc, UInt layerIdx)      { m_interLayerPredLayerIdc[layerIdx] = refLayerIdc;  }
    17941760
    17951761  Void      setInterLayerPredEnabledFlag     ( Bool   val )    { m_interLayerPredEnabledFlag = val; }
    17961762  Bool      getInterLayerPredEnabledFlag     ()                { return m_interLayerPredEnabledFlag;}
    1797 
    1798   Void      setNumInterLayerRefPics          ( UInt   val )    { m_numInterLayerRefPics = val; }
    1799   UInt      getNumInterLayerRefPics          ()                { return m_numInterLayerRefPics;} 
    18001763#else
    18011764  Void      setNumILRRefIdx     ( Int i )               { m_numILRRefIdx = i;     }
    18021765#endif
    1803 #endif
     1766
     1767#if M0457_IL_SAMPLE_PRED_ONLY_FLAG
     1768  Int       getNumSamplePredRefLayers      ( )          { return  m_numSamplePredRefLayers;       }
     1769  Void      setNumSamplePredRefLayers      ( Int i )    { m_numSamplePredRefLayers = i;           }
     1770  Bool      getInterLayerSamplePredOnlyFlag( )          { return  m_interLayerSamplePredOnlyFlag; }
     1771  Void      setInterLayerSamplePredOnlyFlag( Bool val ) { m_interLayerSamplePredOnlyFlag = val;   }
     1772#endif
     1773
     1774#if REF_IDX_FRAMEWORK && M0457_COL_PICTURE_SIGNALING
     1775  Void      setNumMotionPredRefLayers(int i)            { m_numMotionPredRefLayers = i; }
     1776  Int       getNumMotionPredRefLayers()                 { return m_numMotionPredRefLayers; }
     1777#if REF_IDX_MFM
     1778  Void      setMFMEnabledFlag(Bool flag)                { m_bMFMEnabledFlag = flag; }
     1779  Bool      getMFMEnabledFlag()                         { return m_bMFMEnabledFlag; }
     1780  Void      setColRefLayerIdx(Int i)                    { m_colRefLayerIdx = i;     }
     1781  Int       getColRefLayerIdx()                         { return m_colRefLayerIdx;  }
     1782  Void      setAltColIndicationFlag(Bool i)             { m_altColIndicationFlag = i; }
     1783  Bool      getAltColIndicationFlag()                   { return m_altColIndicationFlag; }
     1784  Void      setMotionPredIlp(TComPic *ilpPic)           { m_pcIlpPic = ilpPic; }
     1785  TComPic*  getMotionPredIlp()                          { return m_pcIlpPic; }
     1786#endif
     1787#endif
     1788
     1789#else
     1790  // temporal solution for IntraBL. Only one reference layer is supported.
     1791  Int       getActiveNumILRRefIdx     ( )               { return  1; }
     1792  Int       getInterLayerPredLayerIdc (UInt layerIdx)   { return  m_layerId - 1;}
     1793  Void      setActiveNumILRRefIdx     ( Int i )         {}
     1794  Void      setInterLayerPredEnabledFlag( Bool   val )  {}
     1795#endif
     1796
     1797TComPic* getRefPic(TComList<TComPic*>& rcListPic, Int poc) { return xGetRefPic( rcListPic, poc ); }
    18041798
    18051799#endif //SVC_EXTENSION
  • trunk/source/Lib/TLibCommon/TComTrQuant.cpp

    r191 r310  
    10751075    Int iTransformShift = MAX_TR_DYNAMIC_RANGE - uiBitDepth - uiLog2TrSize;  // Represents scaling through forward transform
    10761076
    1077     Int iQBits = QUANT_SHIFT + m_cQP.m_iPer + iTransformShift;                // Right shift of non-RDOQ quantizer;  level = (coeff*uiQ + offset)>>q_bits
    1078 
    1079     iAdd = (pcCU->getSlice()->getSliceType()==I_SLICE ? 171 : 85) << (iQBits-9);
    1080 
    10811077#if ADAPTIVE_QP_SELECTION
    1082     iQBits = QUANT_SHIFT + cQpBase.m_iPer + iTransformShift;
     1078    Int iQBits = QUANT_SHIFT + cQpBase.m_iPer + iTransformShift;
    10831079    iAdd = (pcCU->getSlice()->getSliceType()==I_SLICE ? 171 : 85) << (iQBits-9);
    10841080    Int iQBitsC = QUANT_SHIFT + cQpBase.m_iPer + iTransformShift - ARL_C_PRECISION; 
    10851081    Int iAddC   = 1 << (iQBitsC-1);
     1082#else
     1083    Int iQBits = QUANT_SHIFT + m_cQP.m_iPer + iTransformShift;                // Right shift of non-RDOQ quantizer;  level = (coeff*uiQ + offset)>>q_bits
     1084    iAdd = (pcCU->getSlice()->getSliceType()==I_SLICE ? 171 : 85) << (iQBits-9);
    10861085#endif
    10871086
     
    13641363#else
    13651364  Int j;
    1366   {
    1367     Short block[ 64 * 64 ];
    1368     Short coeff[ 64 * 64 ];
    1369     {
    1370       for (j = 0; j < iHeight; j++)
    1371       {   
    1372         memcpy( block + j * iWidth, piBlkResi + j * uiStride, iWidth * sizeof( Short ) );
    1373       }
    1374     }
    1375     xTrMxN(bitDepth, block, coeff, iWidth, iHeight, uiMode );
    1376     for ( j = 0; j < iHeight * iWidth; j++ )
    1377     {   
    1378       psCoeff[ j ] = coeff[ j ];
    1379     }
    1380     return ;
     1365  Short block[ 32 * 32 ];
     1366  Short coeff[ 32 * 32 ];
     1367  for (j = 0; j < iHeight; j++)
     1368  {   
     1369    memcpy( block + j * iWidth, piBlkResi + j * uiStride, iWidth * sizeof( Short ) );
     1370  }
     1371  xTrMxN(bitDepth, block, coeff, iWidth, iHeight, uiMode );
     1372  for ( j = 0; j < iHeight * iWidth; j++ )
     1373  {   
     1374    psCoeff[ j ] = coeff[ j ];
    13811375  }
    13821376#endif 
     
    13991393  Int j;
    14001394  {
    1401     Short block[ 64 * 64 ];
    1402     Short coeff[ 64 * 64 ];
     1395    Short block[ 32 * 32 ];
     1396    Short coeff[ 32 * 32 ];
    14031397    for ( j = 0; j < iHeight * iWidth; j++ )
    14041398    {   
     
    15221516                                                      UInt                            uiAbsPartIdx )
    15231517{
    1524   Int    iQBits      = m_cQP.m_iBits;
    1525   Double dTemp       = 0;
    15261518  UInt uiLog2TrSize = g_aucConvertToBit[ uiWidth ] + 2;
    1527   Int uiQ = g_quantScales[m_cQP.rem()];
    15281519 
    15291520  UInt uiBitDepth = eTType == TEXT_LUMA ? g_bitDepthY : g_bitDepthC;
     
    15361527  assert(scalingListType < 6);
    15371528 
    1538   iQBits = QUANT_SHIFT + m_cQP.m_iPer + iTransformShift;                   // Right shift of non-RDOQ quantizer;  level = (coeff*uiQ + offset)>>q_bits
    1539   Double dErrScale   = 0;
     1529  Int iQBits = QUANT_SHIFT + m_cQP.m_iPer + iTransformShift;                   // Right shift of non-RDOQ quantizer;  level = (coeff*uiQ + offset)>>q_bits
    15401530  Double *pdErrScaleOrg = getErrScaleCoeff(scalingListType,uiLog2TrSize-2,m_cQP.m_iRem);
    15411531  Int *piQCoefOrg = getQuantCoeff(scalingListType,m_cQP.m_iRem,uiLog2TrSize-2);
     
    15891579  Double  d64BaseCost         = 0;
    15901580  Int     iLastScanPos        = -1;
    1591   dTemp                       = dErrScale;
    15921581 
    15931582  UInt    c1Idx     = 0;
     
    16181607      UInt    uiBlkPos          = scan[iScanPos];
    16191608      // set coeff
    1620       uiQ  = piQCoef[uiBlkPos];
    1621       dTemp = pdErrScale[uiBlkPos];
     1609      Int uiQ  = piQCoef[uiBlkPos];
     1610      Double dTemp = pdErrScale[uiBlkPos];
    16221611      Int lLevelDouble          = plSrcCoeff[ uiBlkPos ];
    16231612      lLevelDouble              = (Int)min<Int64>((Int64)abs((Int)lLevelDouble) * uiQ , MAX_INT - (1 << (iQBits - 1)));
  • trunk/source/Lib/TLibCommon/TComUpsampleFilter.cpp

    r229 r310  
    44
    55#if SVC_UPSAMPLING
    6 // ====================================================================================================================
    7 // Tables:
    8 // 1. PHASE_DERIVATION_IN_INTEGER = 0 is the implementation using 2 multi-phase (12 phase and 8 phase) filter sets
    9 //    by following K0378.
    10 // 2. PHASE_DERIVATION_IN_INTEGER = 1 is the implemetation using a 16-phase filter set just for speed up. Some phases
    11 //    is approximated to x/16 (e.g. 1/3 -> 5/16).
    12 // 3. It was confirmed that two implementations provides the identical result.
    13 // 4. By default, PHASE_DERIVATION_IN_INTEGER is set to 1.
    14 // ====================================================================================================================
    156#define CNU -1 ///< Coefficients Not Used
    167
    17 #if PHASE_DERIVATION_IN_INTEGER
    188const Int TComUpsampleFilter::m_lumaFixedFilter[16][NTAPS_US_LUMA] =
    199{
     
    7464#endif
    7565};
    76 #else
    77 const Int TComUpsampleFilter::m_lumaFixedFilter[12][NTAPS_US_LUMA] =
    78 {
    79   { 0,  0,   0, 64,  0,   0, 0,  0},
    80   {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU},//1/12
    81   {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU},//2/12
    82   {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU},//3/12
    83   { -1, 4, -11, 52, 26,  -8, 3, -1},//4/12
    84   {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU},//5/12
    85   { -1, 4, -11, 40, 40, -11, 4, -1},//6/12       
    86   {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU},//7/12
    87   { -1, 3,  -8, 26, 52, -11, 4, -1},//8/12
    88   {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU},//9/12
    89   {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU},//10/12
    90   {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU},//11/12
    91 };
    92 
    93 const Int TComUpsampleFilter::m_chromaFixedFilter15[12][NTAPS_US_CHROMA] =
    94 {
    95   {  0, 64,  0,  0},
    96   {CNU,CNU,CNU,CNU},//1/12
    97   {CNU,CNU,CNU,CNU},//2/12
    98   { -4, 54, 16, -2},//3/12
    99   { -5, 50, 22, -3},//4/12
    100   {CNU,CNU,CNU,CNU},//5/12
    101   {CNU,CNU,CNU,CNU},//6/12
    102   { -4, 30, 43, -5},//7/12
    103   { -3, 22, 50, -5},//8/12
    104   {CNU,CNU,CNU,CNU},//9/12
    105   {CNU,CNU,CNU,CNU},//10/12
    106   { -1,  5, 62, -2} //11/12
    107 };
    108 
    109 const Int TComUpsampleFilter::m_chromaFixedFilter20[8][NTAPS_US_CHROMA] =
    110 {
    111   {  0, 64,  0,  0},
    112   {CNU,CNU,CNU,CNU},//1/8
    113   {CNU,CNU,CNU,CNU},//2/8
    114   { -6, 46, 28, -4},//3/8
    115   { -4, 36, 36, -4},//4/8
    116   {CNU,CNU,CNU,CNU},//5/8
    117   {CNU,CNU,CNU,CNU},//6/8
    118   { -2, 10, 58, -2},//7/8
    119 };
    120 #endif
    12166
    12267TComUpsampleFilter::TComUpsampleFilter(void)
     
    12974
    13075#if SCALED_REF_LAYER_OFFSETS
    131 Void TComUpsampleFilter::upsampleBasePic( TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window )
    132 #else
    133 Void TComUpsampleFilter::upsampleBasePic( TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic )
     76Void TComUpsampleFilter::upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window )
     77#else
     78Void TComUpsampleFilter::upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic )
    13479#endif
    13580{
     
    165110  Pel* piSrcBufY  = pcBasePic->getLumaAddr();
    166111  Pel* piDstBufY  = pcUsPic->getLumaAddr();
    167  
     112
    168113  Pel* piSrcY;
    169114  Pel* piDstY;
    170  
     115
    171116  Pel* piTempBufU = pcTempPic->getCbAddr();
    172117  Pel* piSrcBufU  = pcBasePic->getCbAddr();
    173118  Pel* piDstBufU  = pcUsPic->getCbAddr();
    174  
     119
    175120  Pel* piTempBufV = pcTempPic->getCrAddr();
    176121  Pel* piSrcBufV  = pcBasePic->getCrAddr();
    177122  Pel* piDstBufV  = pcUsPic->getCrAddr();
    178  
     123
    179124  Pel* piSrcU;
    180125  Pel* piDstU;
    181126  Pel* piSrcV;
    182127  Pel* piDstV;
    183  
    184 #if JCTVC_L0178
    185   Pel *tempBufRight = NULL, *tempBufBottom = NULL;
    186   Int tempBufSizeRight = 0, tempBufSizeBottom = 0;
    187  
    188   if( confBL.getWindowRightOffset())
    189   {
    190     tempBufSizeRight = confBL.getWindowRightOffset() * pcBasePic->getHeight();
    191   }
    192  
    193   if( confBL.getWindowBottomOffset() )
    194   {
    195     tempBufSizeBottom = confBL.getWindowBottomOffset() * pcBasePic->getWidth ();
    196   }
    197  
    198   if( tempBufSizeRight )
    199   {
    200     tempBufRight = (Pel *) xMalloc(Pel, tempBufSizeRight + (tempBufSizeRight>>1) );
    201     assert( tempBufRight );
    202   }
    203  
    204   if( tempBufSizeBottom )
    205   {
    206     tempBufBottom = (Pel *) xMalloc(Pel, tempBufSizeBottom + (tempBufSizeBottom>>1) );
    207     assert( tempBufBottom );
    208   }
    209  
    210 #endif
    211 
    212   if( widthEL == widthBL && heightEL == heightBL )
     128
     129#if SIMPLIFIED_MV_POS_SCALING
     130  Int scaleX = g_posScalingFactor[refLayerIdc][0];
     131  Int scaleY = g_posScalingFactor[refLayerIdc][1];
     132#else
     133  Int   scaleX     = ( ( widthBL << shiftX ) + ( widthEL >> 1 ) ) / widthEL;
     134  Int   scaleY     = ( ( heightBL << shiftY ) + ( heightEL >> 1 ) ) / heightEL;
     135#endif
     136
     137  if( scaleX == 65536 && scaleY == 65536 ) // ratio 1x
    213138  {
    214139    piSrcY = piSrcBufY - scalEL.getWindowLeftOffset() - scalEL.getWindowTopOffset() * strideEL;
     
    248173  else
    249174  {
    250 #if PHASE_DERIVATION_IN_INTEGER
    251   Int refPos16 = 0;
    252   Int phase    = 0;
    253   Int refPos   = 0;
    254   Int* coeff = m_chromaFilter[phase];
    255   for ( i = 0; i < 16; i++)
    256   {
    257     memcpy(   m_lumaFilter[i],   m_lumaFixedFilter[i], sizeof(Int) * NTAPS_US_LUMA   );
    258     memcpy( m_chromaFilter[i], m_chromaFixedFilter[i], sizeof(Int) * NTAPS_US_CHROMA );
    259   }
    260 #else
    261   for ( i = 0; i < 12; i++)
    262   {
    263     memcpy( m_lumaFilter[i], m_lumaFixedFilter[i], sizeof(Int) * NTAPS_US_LUMA );
    264   }
    265 
    266   Int chromaPhaseDenominator;
    267   if (widthEL == 2*widthBL) // 2x scalability
    268   {
    269     for ( i = 0; i < 8; i++)
    270     {
    271       memcpy( m_chromaFilter[i], m_chromaFixedFilter20[i], sizeof(Int) * NTAPS_US_CHROMA );
    272     }
    273     chromaPhaseDenominator = 8;
    274   }
    275   else
    276   {
    277     for ( i = 0; i < 12; i++) // 1.5x scalability
    278     {
    279       memcpy( m_chromaFilter[i], m_chromaFixedFilter15[i], sizeof(Int) * NTAPS_US_CHROMA );
    280     }
    281     chromaPhaseDenominator = 12;
    282   }
    283 #endif
    284 
    285   assert ( widthEL == widthBL || widthEL == 2*widthBL || 2*widthEL == 3*widthBL );
    286   assert ( heightEL == heightBL || heightEL == 2*heightBL || 2*heightEL == 3*heightBL );
    287 
    288 #if JCTVC_L0178
    289   // save the cropped region to copy back to the base picture since the base picture might be used as a reference picture
    290   if( tempBufSizeRight )
    291   {
    292     piSrcY = piSrcBufY + widthBL;
    293     piDstY = tempBufRight;
    294     for( i = 0; i < pcBasePic->getHeight(); i++ )
    295     {
    296       memcpy(piDstY, piSrcY, sizeof(Pel) * confBL.getWindowRightOffset());
    297       piSrcY += strideBL;
    298       piDstY += confBL.getWindowRightOffset();
    299     }
    300    
    301     if(confBL.getWindowRightOffset()>>1)
    302     {
    303       Int strideBLChroma = (strideBL>>1);
    304       piSrcU = piSrcBufU + (widthBL>>1);
    305       piDstU = tempBufRight + confBL.getWindowRightOffset() * pcBasePic->getHeight();
    306       piSrcV = piSrcBufV + (widthBL>>1);
    307       piDstV = piDstU + (confBL.getWindowRightOffset()>>1) * (pcBasePic->getHeight()>>1);
    308    
    309       for( i = 0; i < pcBasePic->getHeight()>>1; i++ )
    310       {
    311         memcpy(piDstU, piSrcU, sizeof(Pel) * (confBL.getWindowRightOffset()>>1));
    312         piSrcU += strideBLChroma;
    313         piDstU += (confBL.getWindowRightOffset()>>1);
    314        
    315         memcpy(piDstV, piSrcV, sizeof(Pel) * (confBL.getWindowRightOffset()>>1));
    316         piSrcV += strideBLChroma;
    317         piDstV += (confBL.getWindowRightOffset()>>1);
    318       }
    319     }
    320    
    321     pcBasePic->setWidth(widthBL);
    322   }
    323  
    324   if( tempBufSizeBottom )
    325   {
    326     piSrcY = piSrcBufY + heightBL * strideBL;
    327     piDstY = tempBufBottom;
    328     for( i = 0; i < confBL.getWindowBottomOffset(); i++ )
    329     {
    330       memcpy(piDstY, piSrcY, sizeof(Pel) * pcBasePic->getWidth());
    331       piSrcY += strideBL;
    332       piDstY += pcBasePic->getWidth();
    333     }
    334    
    335     if(confBL.getWindowBottomOffset()>>1)
    336     {
    337       Int strideBLChroma = (strideBL>>1);
    338       piSrcU = piSrcBufU + (heightBL>>1) * strideBLChroma;
    339       piDstU = tempBufBottom + confBL.getWindowBottomOffset() * pcBasePic->getWidth();
    340       piSrcV = piSrcBufV + (heightBL>>1) * strideBLChroma;
    341       piDstV = piDstU + (confBL.getWindowBottomOffset()>>1) * (pcBasePic->getWidth()>>1);
     175    Int refPos16 = 0;
     176    Int phase    = 0;
     177    Int refPos   = 0;
     178    Int* coeff = m_chromaFilter[phase];
     179    for ( i = 0; i < 16; i++)
     180    {
     181      memcpy(   m_lumaFilter[i],   m_lumaFixedFilter[i], sizeof(Int) * NTAPS_US_LUMA   );
     182      memcpy( m_chromaFilter[i], m_chromaFixedFilter[i], sizeof(Int) * NTAPS_US_CHROMA );
     183    }
     184
     185    assert ( widthEL == widthBL || widthEL == 2*widthBL || 2*widthEL == 3*widthBL );
     186    assert ( heightEL == heightBL || heightEL == 2*heightBL || 2*heightEL == 3*heightBL );
     187
     188    pcBasePic->setBorderExtension(false);
     189    pcBasePic->extendPicBorder   (); // extend the border.
     190
     191    Int   shiftX = 16;
     192    Int   shiftY = 16;
     193
     194    Int   phaseX = 0;
     195    Int   phaseY = 0;
     196
     197    Int   addX       = ( ( ( widthBL * phaseX ) << ( shiftX - 2 ) ) + ( widthEL >> 1 ) ) / widthEL + ( 1 << ( shiftX - 5 ) );
     198    Int   addY       = ( ( ( heightBL * phaseY ) << ( shiftY - 2 ) ) + ( heightEL >> 1 ) ) / heightEL+ ( 1 << ( shiftY - 5 ) );
     199
     200    Int   deltaX     = 4 * phaseX;
     201    Int   deltaY     = 4 * phaseY; 
     202
     203    Int shiftXM4 = shiftX - 4;
     204    Int shiftYM4 = shiftY - 4;
     205
     206#if ILP_DECODED_PICTURE
     207    widthEL   = pcUsPic->getWidth ();
     208    heightEL  = pcUsPic->getHeight();
     209
     210    widthBL   = pcBasePic->getWidth ();
     211    heightBL  = min<Int>( pcBasePic->getHeight(), heightEL );
     212#endif
     213#if SCALED_REF_LAYER_OFFSETS
     214    Int leftStartL = scalEL.getWindowLeftOffset();
     215    Int rightEndL  = pcUsPic->getWidth() - scalEL.getWindowRightOffset();
     216    Int topStartL  = scalEL.getWindowTopOffset();
     217    Int bottomEndL = pcUsPic->getHeight() - scalEL.getWindowBottomOffset();
     218#endif
     219
     220    //========== horizontal upsampling ===========
     221    for( i = 0; i < widthEL; i++ )
     222    {
     223#if SCALED_REF_LAYER_OFFSETS
     224      Int x = Clip3( leftStartL, rightEndL - 1, i );
     225      refPos16 = (((x - leftStartL)*scaleX + addX) >> shiftXM4) - deltaX;
     226#else
     227      refPos16 = ((i*scaleX + addX) >> shiftXM4) - deltaX;
     228#endif
     229      phase    = refPos16 & 15;
     230      refPos   = refPos16 >> 4;
     231      coeff = m_lumaFilter[phase];
     232
     233      piSrcY = piSrcBufY + refPos -((NTAPS_US_LUMA>>1) - 1);
     234      piDstY = piTempBufY + i;
     235
     236      for( j = 0; j < heightBL ; j++ )
     237      {
     238        *piDstY = sumLumaHor(piSrcY, coeff);
     239        piSrcY += strideBL;
     240        piDstY += strideEL;
     241      }
     242    }
     243
     244    //========== vertical upsampling ===========
     245    pcTempPic->setBorderExtension(false);
     246    pcTempPic->setHeight(heightBL);
     247    pcTempPic->extendPicBorder   (); // extend the border.
     248    pcTempPic->setHeight(heightEL);
     249
     250    const Int nShift = US_FILTER_PREC*2;
     251    Int iOffset = 1 << (nShift - 1);
     252
     253#if SCALED_REF_LAYER_OFFSETS
     254    for( j = 0; j < pcTempPic->getHeight(); j++ )
     255#else
     256    for( j = 0; j < heightEL; j++ )
     257#endif
     258    {
     259#if SCALED_REF_LAYER_OFFSETS
     260      Int y = Clip3(topStartL, bottomEndL - 1, j);
     261      refPos16 = ((( y - topStartL )*scaleY + addY) >> shiftYM4) - deltaY;
     262#else
     263      refPos16 = ((j*scaleY + addY) >> shiftYM4) - deltaY;
     264#endif
     265      phase    = refPos16 & 15;
     266      refPos   = refPos16 >> 4;
     267      coeff = m_lumaFilter[phase];
     268
     269      piSrcY = piTempBufY + (refPos -((NTAPS_US_LUMA>>1) - 1))*strideEL;
     270#if SCALED_REF_LAYER_OFFSETS
     271#if 1 // it should provide identical result
     272      Pel* piDstY0 = piDstBufY + j * strideEL;           
     273      piDstY = piDstY0 + ( leftStartL > 0 ? leftStartL : 0 );
     274
     275      for( i = min<Int>(rightEndL, pcTempPic->getWidth()) - max<Int>(0, leftStartL); i > 0; i-- )
     276      {
     277        *piDstY = ClipY( (sumLumaVer(piSrcY, coeff, strideEL) + iOffset) >> (nShift));
     278        piSrcY++;
     279        piDstY++;
     280      }
     281
     282      for( i = rightEndL; i < pcTempPic->getWidth(); i++ )
     283      {
     284        *piDstY = piDstY0[rightEndL-1];
     285        piDstY++;
     286      }
     287
     288      piDstY = piDstY0;
     289      for( i = 0; i < leftStartL; i++ )
     290      {
     291        *piDstY = piDstY0[leftStartL];
     292        piDstY++;
     293      }
     294#else
     295      piDstY = piDstBufY + j * strideEL;
     296
     297      for( i = 0; i < pcTempPic->getWidth(); i++ )
     298      {
     299        *piDstY = ClipY( (sumLumaVer(piSrcY, coeff, strideEL) + iOffset) >> (nShift));
     300
     301        // Only increase the x position of reference upsample picture when within the window
     302        // "-2" to ensure that pointer doesn't go beyond the boundary rightEndL-1
     303        if( (i >= leftStartL) && (i <= rightEndL-2) )
     304        {
     305          piSrcY++;
     306        }
     307        piDstY++;
     308      }
     309#endif
     310#else
     311      piDstY = piDstBufY + j * strideEL;
     312
     313      for( i = 0; i < widthEL; i++ )
     314      {
     315        *piDstY = ClipY( (sumLumaVer(piSrcY, coeff, strideEL) + iOffset) >> (nShift));
     316        piSrcY++;
     317        piDstY++;
     318      }
     319#endif
     320    }
     321
     322#if ILP_DECODED_PICTURE
     323#if SCALED_REF_LAYER_OFFSETS
     324    widthBL   = pcBasePic->getWidth ();
     325    heightBL  = pcBasePic->getHeight();
     326
     327    widthEL   = pcUsPic->getWidth () - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset();
     328    heightEL  = pcUsPic->getHeight() - scalEL.getWindowTopOffset()  - scalEL.getWindowBottomOffset();
     329#else
     330    widthBL   = pcBasePic->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset();
     331    heightBL  = pcBasePic->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset();
     332
     333    widthEL   = pcUsPic->getWidth () - confEL.getWindowLeftOffset() - confEL.getWindowRightOffset();
     334    heightEL  = pcUsPic->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset();
     335#endif
     336#endif
     337
     338    //========== UV component upsampling ===========
     339
     340    widthEL  >>= 1;
     341    heightEL >>= 1;
     342
     343    widthBL  >>= 1;
     344    heightBL >>= 1;
     345
     346    strideBL  = pcBasePic->getCStride();
     347    strideEL  = pcUsPic->getCStride();
     348#if SCALED_REF_LAYER_OFFSETS
     349    Int leftStartC = scalEL.getWindowLeftOffset() >> 1;
     350    Int rightEndC  = (pcUsPic->getWidth() >> 1) - (scalEL.getWindowRightOffset() >> 1);
     351    Int topStartC  = scalEL.getWindowTopOffset() >> 1;
     352    Int bottomEndC = (pcUsPic->getHeight() >> 1) - (scalEL.getWindowBottomOffset() >> 1);
     353#endif
     354
     355    shiftX = 16;
     356    shiftY = 16;
     357
     358    phaseX = 0;
     359    phaseY = 1;
     360
     361    addX       = ( ( ( widthBL * phaseX ) << ( shiftX - 2 ) ) + ( widthEL >> 1 ) ) / widthEL + ( 1 << ( shiftX - 5 ) );
     362    addY       = ( ( ( heightBL * phaseY ) << ( shiftY - 2 ) ) + ( heightEL >> 1 ) ) / heightEL+ ( 1 << ( shiftY - 5 ) );
     363
     364    deltaX     = 4 * phaseX;
     365    deltaY     = 4 * phaseY;
     366
     367    shiftXM4 = shiftX - 4;
     368    shiftYM4 = shiftY - 4;
     369
     370#if !SIMPLIFIED_MV_POS_SCALING
     371    scaleX     = ( ( widthBL << shiftX ) + ( widthEL >> 1 ) ) / widthEL;
     372    scaleY     = ( ( heightBL << shiftY ) + ( heightEL >> 1 ) ) / heightEL;
     373#endif
     374
     375#if ILP_DECODED_PICTURE
     376    widthEL   = pcUsPic->getWidth () >> 1;
     377    heightEL  = pcUsPic->getHeight() >> 1;
     378
     379    widthBL   = pcBasePic->getWidth () >> 1;
     380    heightBL  = min<Int>( pcBasePic->getHeight() >> 1, heightEL );
     381#endif
     382
     383    //========== horizontal upsampling ===========
     384    for( i = 0; i < widthEL; i++ )
     385    {
     386#if SCALED_REF_LAYER_OFFSETS
     387      Int x = Clip3(leftStartC, rightEndC - 1, i);
     388      refPos16 = (((x - leftStartC)*scaleX + addX) >> shiftXM4) - deltaX;
     389#else
     390      refPos16 = ((i*scaleX + addX) >> shiftXM4) - deltaX;
     391#endif
     392      phase    = refPos16 & 15;
     393      refPos   = refPos16 >> 4;
     394      coeff = m_chromaFilter[phase];
     395
     396      piSrcU = piSrcBufU + refPos -((NTAPS_US_CHROMA>>1) - 1);
     397      piSrcV = piSrcBufV + refPos -((NTAPS_US_CHROMA>>1) - 1);
     398      piDstU = piTempBufU + i;
     399      piDstV = piTempBufV + i;
     400
     401      for( j = 0; j < heightBL ; j++ )
     402      {
     403        *piDstU = sumChromaHor(piSrcU, coeff);
     404        *piDstV = sumChromaHor(piSrcV, coeff);
     405
     406        piSrcU += strideBL;
     407        piSrcV += strideBL;
     408        piDstU += strideEL;
     409        piDstV += strideEL;
     410      }
     411    }
     412
     413    //========== vertical upsampling ===========
     414    pcTempPic->setBorderExtension(false);
     415    pcTempPic->setHeight(heightBL << 1);
     416    pcTempPic->extendPicBorder   (); // extend the border.
     417    pcTempPic->setHeight(heightEL << 1);
     418
     419#if SCALED_REF_LAYER_OFFSETS
     420    for( j = 0; j < pcTempPic->getHeight() >> 1; j++ )
     421#else
     422    for( j = 0; j < heightEL; j++ )
     423#endif
     424    {
     425#if SCALED_REF_LAYER_OFFSETS
     426      Int y = Clip3(topStartC, bottomEndC - 1, j);
     427      refPos16 = (((y - topStartC)*scaleY + addY) >> shiftYM4) - deltaY;
     428#else
     429      refPos16 = ((j*scaleY + addY) >> shiftYM4) - deltaY;
     430#endif
     431      phase    = refPos16 & 15;
     432      refPos   = refPos16 >> 4;
     433      coeff = m_chromaFilter[phase];
    342434     
    343       for( i = 0; i < confBL.getWindowBottomOffset()>>1; i++ )
    344       {
    345         memcpy(piDstU, piSrcU, sizeof(Pel) * (pcBasePic->getWidth()>>1));
    346         piSrcU += strideBLChroma;
    347         piDstU += (pcBasePic->getWidth()>>1);
    348        
    349         memcpy(piDstV, piSrcV, sizeof(Pel) * (pcBasePic->getWidth()>>1));
    350         piSrcV += strideBLChroma;
    351         piDstV += (pcBasePic->getWidth()>>1);
    352       }
    353     }
    354 
    355     pcBasePic->setHeight(heightBL);
    356   }
    357 #endif
    358  
    359   pcBasePic->setBorderExtension(false);
    360   pcBasePic->extendPicBorder   (); // extend the border.
    361 
    362 #if PHASE_DERIVATION_IN_INTEGER
    363   Int   shiftX = 16;
    364   Int   shiftY = 16;
    365 
    366   Int   phaseX = 0;
    367   Int   phaseY = 0;
    368 
    369   Int   addX       = ( ( ( widthBL * phaseX ) << ( shiftX - 2 ) ) + ( widthEL >> 1 ) ) / widthEL + ( 1 << ( shiftX - 5 ) );
    370   Int   addY       = ( ( ( heightBL * phaseY ) << ( shiftY - 2 ) ) + ( heightEL >> 1 ) ) / heightEL+ ( 1 << ( shiftY - 5 ) );
    371 
    372   Int   deltaX     = 4 * phaseX;
    373   Int   deltaY     = 4 * phaseY; 
    374  
    375   Int shiftXM4 = shiftX - 4;
    376   Int shiftYM4 = shiftY - 4;
    377 
    378   Int   scaleX     = ( ( widthBL << shiftX ) + ( widthEL >> 1 ) ) / widthEL;
    379   Int   scaleY     = ( ( heightBL << shiftY ) + ( heightEL >> 1 ) ) / heightEL;
    380 #else
    381   const Double sFactor = 1.0 * widthBL / widthEL;
    382   const Double sFactor12 = sFactor * 12;
    383 #endif
    384 #if ILP_DECODED_PICTURE
    385   widthEL   = pcUsPic->getWidth ();
    386   heightEL  = pcUsPic->getHeight();
    387 
    388   widthBL   = pcBasePic->getWidth ();
    389   heightBL  = min<Int>( pcBasePic->getHeight(), heightEL );
    390 #endif
    391 #if SCALED_REF_LAYER_OFFSETS
    392   Int leftStartL = scalEL.getWindowLeftOffset();
    393   Int rightEndL  = pcUsPic->getWidth() - scalEL.getWindowRightOffset();
    394   Int topStartL  = scalEL.getWindowTopOffset();
    395   Int bottomEndL = pcUsPic->getHeight() - scalEL.getWindowBottomOffset();
    396 #endif
    397 
    398   //========== horizontal upsampling ===========
    399   for( i = 0; i < widthEL; i++ )
    400   {
    401 #if SCALED_REF_LAYER_OFFSETS
    402     Int x = Clip3( leftStartL, rightEndL - 1, i );
    403 #endif
    404 #if PHASE_DERIVATION_IN_INTEGER
    405 #if SCALED_REF_LAYER_OFFSETS
    406     refPos16 = (((x - leftStartL)*scaleX + addX) >> shiftXM4) - deltaX;
    407 #else
    408     refPos16 = ((i*scaleX + addX) >> shiftXM4) - deltaX;
    409 #endif
    410     phase    = refPos16 & 15;
    411     refPos   = refPos16 >> 4;
    412     coeff = m_lumaFilter[phase];
    413 #else
    414     Int refPos12 = (Int) ( i * sFactor12 );
    415     Int refPos = (Int)( i * sFactor );
    416     Int phase = (refPos12 + 12) % 12;
    417     Int* coeff = m_lumaFilter[phase];
    418 #endif
    419 
    420     piSrcY = piSrcBufY + refPos -((NTAPS_US_LUMA>>1) - 1);
    421     piDstY = piTempBufY + i;
    422 
    423     for( j = 0; j < heightBL ; j++ )
    424     {
    425       *piDstY = sumLumaHor(piSrcY, coeff);
    426       piSrcY += strideBL;
    427       piDstY += strideEL;
    428     }
    429   }
    430 
    431 
    432   //========== vertical upsampling ===========
    433   pcTempPic->setBorderExtension(false);
    434   pcTempPic->setHeight(heightBL);
    435   pcTempPic->extendPicBorder   (); // extend the border.
    436   pcTempPic->setHeight(heightEL);
    437 
    438   const Int nShift = US_FILTER_PREC*2;
    439   Int iOffset = 1 << (nShift - 1);
    440 
    441 #if SCALED_REF_LAYER_OFFSETS
    442   for( j = 0; j < pcTempPic->getHeight(); j++ )
    443 #else
    444   for( j = 0; j < heightEL; j++ )
    445 #endif
    446   {
    447 #if SCALED_REF_LAYER_OFFSETS
    448     Int y = Clip3(topStartL, bottomEndL - 1, j);
    449 #endif
    450 #if PHASE_DERIVATION_IN_INTEGER
    451 #if SCALED_REF_LAYER_OFFSETS
    452     refPos16 = ((( y - topStartL )*scaleY + addY) >> shiftYM4) - deltaY;
    453 #else
    454     refPos16 = ((j*scaleY + addY) >> shiftYM4) - deltaY;
    455 #endif
    456     phase    = refPos16 & 15;
    457     refPos   = refPos16 >> 4;
    458     coeff = m_lumaFilter[phase];
    459 #else
    460     Int refPos12 = (Int) (j * sFactor12 );
    461     Int refPos = (Int)( j * sFactor );
    462     Int phase = (refPos12 + 12) % 12;
    463     Int* coeff = m_lumaFilter[phase];
    464 #endif
    465 
    466     piSrcY = piTempBufY + (refPos -((NTAPS_US_LUMA>>1) - 1))*strideEL;
    467     piDstY = piDstBufY + j * strideEL;
    468 #if SCALED_REF_LAYER_OFFSETS
    469     for( i = 0; i < pcTempPic->getWidth(); i++ )
    470 #else
    471     for( i = 0; i < widthEL; i++ )
    472 #endif
    473     {
    474       *piDstY = ClipY( (sumLumaVer(piSrcY, coeff, strideEL) + iOffset) >> (nShift));
    475 #if SCALED_REF_LAYER_OFFSETS
    476       // Only increase the x position of reference upsample picture when within the window
    477       // "-2" to ensure that pointer doesn't go beyond the boundary rightEndL-1
    478       if( (i >= leftStartL) && (i <= rightEndL-2) )
    479       {
    480         piSrcY++;
    481       }
    482 #else
    483       piSrcY++;
    484 #endif
    485       piDstY++;
    486     }
    487   }
    488 
    489 #if ILP_DECODED_PICTURE
    490 #if SCALED_REF_LAYER_OFFSETS
    491   widthBL   = pcBasePic->getWidth ();
    492   heightBL  = pcBasePic->getHeight();
    493 
    494   widthEL   = pcUsPic->getWidth () - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset();
    495   heightEL  = pcUsPic->getHeight() - scalEL.getWindowTopOffset()  - scalEL.getWindowBottomOffset();
    496 #else
    497   widthBL   = pcBasePic->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset();
    498   heightBL  = pcBasePic->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset();
    499 
    500   widthEL   = pcUsPic->getWidth () - confEL.getWindowLeftOffset() - confEL.getWindowRightOffset();
    501   heightEL  = pcUsPic->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset();
    502 #endif
    503 #endif
    504 
    505   //========== UV component upsampling ===========
    506 
    507   widthEL  >>= 1;
    508   heightEL >>= 1;
    509 
    510   widthBL  >>= 1;
    511   heightBL >>= 1;
    512 
    513   strideBL  = pcBasePic->getCStride();
    514   strideEL  = pcUsPic->getCStride();
    515 #if SCALED_REF_LAYER_OFFSETS
    516   Int leftStartC = scalEL.getWindowLeftOffset() >> 1;
    517   Int rightEndC  = (pcUsPic->getWidth() >> 1) - (scalEL.getWindowRightOffset() >> 1);
    518   Int topStartC  = scalEL.getWindowTopOffset() >> 1;
    519   Int bottomEndC = (pcUsPic->getHeight() >> 1) - (scalEL.getWindowBottomOffset() >> 1);
    520 #endif
    521 
    522 #if PHASE_DERIVATION_IN_INTEGER
    523   shiftX = 16;
    524   shiftY = 16;
    525 
    526   phaseX = 0;
    527   phaseY = 1;
    528 
    529   addX       = ( ( ( widthBL * phaseX ) << ( shiftX - 2 ) ) + ( widthEL >> 1 ) ) / widthEL + ( 1 << ( shiftX - 5 ) );
    530   addY       = ( ( ( heightBL * phaseY ) << ( shiftY - 2 ) ) + ( heightEL >> 1 ) ) / heightEL+ ( 1 << ( shiftY - 5 ) );
    531 
    532   deltaX     = 4 * phaseX;
    533   deltaY     = 4 * phaseY;
    534 
    535   shiftXM4 = shiftX - 4;
    536   shiftYM4 = shiftY - 4;
    537 
    538   scaleX     = ( ( widthBL << shiftX ) + ( widthEL >> 1 ) ) / widthEL;
    539   scaleY     = ( ( heightBL << shiftY ) + ( heightEL >> 1 ) ) / heightEL;
    540 #endif
    541 
    542 #if ILP_DECODED_PICTURE
    543   widthEL   = pcUsPic->getWidth () >> 1;
    544   heightEL  = pcUsPic->getHeight() >> 1;
    545 
    546   widthBL   = pcBasePic->getWidth () >> 1;
    547   heightBL  = min<Int>( pcBasePic->getHeight(), heightEL );
    548 #endif
    549 
    550   //========== horizontal upsampling ===========
    551   for( i = 0; i < widthEL; i++ )
    552   {
    553 #if SCALED_REF_LAYER_OFFSETS
    554     Int x = Clip3(leftStartC, rightEndC - 1, i);
    555 #endif
    556 #if PHASE_DERIVATION_IN_INTEGER
    557 #if SCALED_REF_LAYER_OFFSETS
    558     refPos16 = (((x - leftStartC)*scaleX + addX) >> shiftXM4) - deltaX;
    559 #else
    560     refPos16 = ((i*scaleX + addX) >> shiftXM4) - deltaX;
    561 #endif
    562     phase    = refPos16 & 15;
    563     refPos   = refPos16 >> 4;
    564     coeff = m_chromaFilter[phase];
    565 #else
    566     Int refPosM = (Int) ( i * chromaPhaseDenominator * sFactor );
    567     Int refPos = (Int)( i * sFactor );
    568     Int phase = (refPosM + chromaPhaseDenominator) % chromaPhaseDenominator;
    569     Int* coeff = m_chromaFilter[phase];
    570 #endif
    571 
    572     piSrcU = piSrcBufU + refPos -((NTAPS_US_CHROMA>>1) - 1);
    573     piSrcV = piSrcBufV + refPos -((NTAPS_US_CHROMA>>1) - 1);
    574     piDstU = piTempBufU + i;
    575     piDstV = piTempBufV + i;
    576 
    577     for( j = 0; j < heightBL ; j++ )
    578     {
    579       *piDstU = sumChromaHor(piSrcU, coeff);
    580       *piDstV = sumChromaHor(piSrcV, coeff);
    581 
    582       piSrcU += strideBL;
    583       piSrcV += strideBL;
    584       piDstU += strideEL;
    585       piDstV += strideEL;
    586     }
    587   }
    588 
    589   //========== vertical upsampling ===========
    590   pcTempPic->setBorderExtension(false);
    591   pcTempPic->setHeight(heightBL << 1);
    592   pcTempPic->extendPicBorder   (); // extend the border.
    593   pcTempPic->setHeight(heightEL << 1);
    594 
    595 #if SCALED_REF_LAYER_OFFSETS
    596   for( j = 0; j < pcTempPic->getHeight() >> 1; j++ )
    597 #else
    598     for( j = 0; j < heightEL; j++ )
    599 #endif
    600   {
    601 #if SCALED_REF_LAYER_OFFSETS
    602     Int y = Clip3(topStartC, bottomEndC - 1, j);
    603 #endif
    604 #if PHASE_DERIVATION_IN_INTEGER
    605 #if SCALED_REF_LAYER_OFFSETS
    606     refPos16 = (((y - topStartC)*scaleY + addY) >> shiftYM4) - deltaY;
    607 #else
    608     refPos16 = ((j*scaleY + addY) >> shiftYM4) - deltaY;
    609 #endif
    610     phase    = refPos16 & 15;
    611     refPos   = refPos16 >> 4;
    612     coeff = m_chromaFilter[phase];
    613 #else
    614     Int refPosM = (Int) (j * chromaPhaseDenominator * sFactor) - 1;
    615     Int refPos;
    616     if ( refPosM < 0 )
    617     {
    618       refPos = (Int)( j * sFactor ) - 1;
    619     }
    620     else
    621     {
    622       refPos = refPosM / chromaPhaseDenominator;
    623     }
    624     Int phase = (refPosM + chromaPhaseDenominator) % chromaPhaseDenominator;
    625     Int* coeff = m_chromaFilter[phase];
    626 #endif
    627 
    628     piSrcU = piTempBufU  + (refPos -((NTAPS_US_CHROMA>>1) - 1))*strideEL;
    629     piSrcV = piTempBufV  + (refPos -((NTAPS_US_CHROMA>>1) - 1))*strideEL;
    630 
    631     piDstU = piDstBufU + j*strideEL;
    632     piDstV = piDstBufV + j*strideEL;
    633 
    634 #if SCALED_REF_LAYER_OFFSETS
    635     for( i = 0; i < pcTempPic->getWidth() >> 1; i++ )
    636 #else
    637     for( i = 0; i < widthEL; i++ )
    638 #endif
    639     {
    640       *piDstU = ClipC( (sumChromaVer(piSrcU, coeff, strideEL) + iOffset) >> (nShift));
    641       *piDstV = ClipC( (sumChromaVer(piSrcV, coeff, strideEL) + iOffset) >> (nShift));
    642 
    643 #if SCALED_REF_LAYER_OFFSETS
    644       // Only increase the x position of reference upsample picture when within the window
    645       // "-2" to ensure that pointer doesn't go beyond the boundary rightEndC-1
    646       if( (i >= leftStartC) && (i <= rightEndC-2) )
    647       {
     435      piSrcU = piTempBufU  + (refPos -((NTAPS_US_CHROMA>>1) - 1))*strideEL;
     436      piSrcV = piTempBufV  + (refPos -((NTAPS_US_CHROMA>>1) - 1))*strideEL;
     437#if SCALED_REF_LAYER_OFFSETS
     438#if 1 // it should provide identical result
     439      Pel* piDstU0 = piDstBufU + j*strideEL;
     440      Pel* piDstV0 = piDstBufV + j*strideEL;
     441      piDstU = piDstU0 + ( leftStartC > 0 ? leftStartC : 0 );
     442      piDstV = piDstV0 + ( leftStartC > 0 ? leftStartC : 0 );
     443
     444      for( i = min<Int>(rightEndC, pcTempPic->getWidth() >> 1) - max<Int>(0, leftStartC); i > 0; i-- )
     445      {
     446        *piDstU = ClipC( (sumChromaVer(piSrcU, coeff, strideEL) + iOffset) >> (nShift));
     447        *piDstV = ClipC( (sumChromaVer(piSrcV, coeff, strideEL) + iOffset) >> (nShift));
    648448        piSrcU++;
    649449        piSrcV++;
    650       }
    651 #else
    652       piSrcU++;
    653       piSrcV++;
    654 #endif
    655       piDstU++;
    656       piDstV++;
    657     }
    658   }
    659 
    660   pcUsPic->setBorderExtension(false);
    661   pcUsPic->extendPicBorder   (); // extend the border.
    662 
    663   //Reset the Border extension flag
    664   pcUsPic->setBorderExtension(false);
    665   pcTempPic->setBorderExtension(false);
    666   pcBasePic->setBorderExtension(false);
    667  
    668 #if JCTVC_L0178
    669   // copy back the saved cropped region
    670   if( tempBufSizeRight )
    671   {
    672     // put the correct width back
    673     pcBasePic->setWidth(pcBasePic->getWidth() + confBL.getWindowRightOffset());
    674   }
    675   if( tempBufSizeBottom )
    676   {
    677     pcBasePic->setHeight(pcBasePic->getHeight() + confBL.getWindowBottomOffset());
    678   }
    679  
    680   widthBL   = pcBasePic->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset();
    681   heightBL  = pcBasePic->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset();
    682  
    683   strideBL  = pcBasePic->getStride();
    684  
    685   if( tempBufSizeRight )
    686   {
    687     piSrcY = tempBufRight;
    688     piDstY = piSrcBufY + widthBL;
    689    
    690     for( i = 0; i < pcBasePic->getHeight(); i++ )
    691     {
    692       memcpy(piDstY, piSrcY, sizeof(Pel) * confBL.getWindowRightOffset() );
    693       piSrcY += confBL.getWindowRightOffset();
    694       piDstY += strideBL;
    695     }
    696    
    697     if(confBL.getWindowRightOffset()>>1)
    698     {
    699       Int strideBLChroma = (strideBL>>1);
    700       piSrcU = tempBufRight + confBL.getWindowRightOffset() * pcBasePic->getHeight();
    701       piDstU = piSrcBufU + (widthBL>>1);
    702       piSrcV = piSrcU + (confBL.getWindowRightOffset()>>1) * (pcBasePic->getHeight()>>1);
    703       piDstV = piSrcBufV + (widthBL>>1);
    704 
    705       for( i = 0; i < pcBasePic->getHeight()>>1; i++ )
    706       {
    707         memcpy(piDstU, piSrcU, sizeof(Pel) * (confBL.getWindowRightOffset()>>1));
    708         piSrcU += (confBL.getWindowRightOffset()>>1);
    709         piDstU += strideBLChroma;
    710        
    711         memcpy(piDstV, piSrcV, sizeof(Pel) * (confBL.getWindowRightOffset()>>1));
    712         piSrcV += (confBL.getWindowRightOffset()>>1);
    713         piDstV += strideBLChroma;
    714       }
    715     }
    716   }
    717  
    718   if( tempBufSizeBottom )
    719   {
    720     piDstY = piSrcBufY + heightBL * strideBL;
    721     piSrcY = tempBufBottom;
    722     for( i = 0; i < confBL.getWindowBottomOffset(); i++ )
    723     {
    724       memcpy(piDstY, piSrcY, sizeof(Pel) * pcBasePic->getWidth());
    725       piDstY += strideBL;
    726       piSrcY += pcBasePic->getWidth();
    727     }
    728    
    729     if(confBL.getWindowBottomOffset()>>1)
    730     {
    731       Int strideBLChroma = (strideBL>>1);
    732       piSrcU = tempBufBottom + confBL.getWindowBottomOffset() * pcBasePic->getWidth();
    733       piDstU = piSrcBufU + (heightBL>>1) * strideBLChroma;
    734       piSrcV = piSrcU + (confBL.getWindowBottomOffset()>>1) * (pcBasePic->getWidth()>>1);
    735       piDstV = piSrcBufV + (heightBL>>1) * strideBLChroma;
    736            
    737       for( i = 0; i < confBL.getWindowBottomOffset()>>1; i++ )
    738       {
    739         memcpy(piDstU, piSrcU, sizeof(Pel) * (pcBasePic->getWidth()>>1));
    740         piSrcU += (pcBasePic->getWidth()>>1);
    741         piDstU += strideBLChroma;
    742        
    743         memcpy(piDstV, piSrcV, sizeof(Pel) * (pcBasePic->getWidth()>>1));
    744         piSrcV += (pcBasePic->getWidth()>>1);
    745         piDstV += strideBLChroma;
    746       }
    747     }
    748  
    749   }
    750 
    751   if( tempBufSizeRight )
    752   {
    753     xFree( tempBufRight );
    754   }
    755   if( tempBufSizeBottom )
    756   {
    757     xFree( tempBufBottom );
    758   }
    759 #endif
     450        piDstU++;
     451        piDstV++;
     452      }
     453
     454      for( i = rightEndC; i < pcTempPic->getWidth() >> 1; i++ )
     455      {
     456        *piDstU = piDstU0[rightEndC-1];
     457        *piDstV = piDstV0[rightEndC-1];
     458        piDstU++;
     459        piDstV++;
     460      }
     461
     462      piDstU = piDstU0;
     463      piDstV = piDstV0;
     464      for( i = 0; i < leftStartC; i++ )
     465      {
     466        *piDstU = piDstU0[leftStartC];
     467        *piDstV = piDstV0[leftStartC];
     468        piDstU++;
     469        piDstV++;
     470      }
     471#else
     472      piDstU = piDstBufU + j*strideEL;
     473      piDstV = piDstBufV + j*strideEL;
     474
     475      for( i = 0; i < pcTempPic->getWidth() >> 1; i++ )
     476      {
     477        *piDstU = ClipC( (sumChromaVer(piSrcU, coeff, strideEL) + iOffset) >> (nShift));
     478        *piDstV = ClipC( (sumChromaVer(piSrcV, coeff, strideEL) + iOffset) >> (nShift));
     479
     480        // Only increase the x position of reference upsample picture when within the window
     481        // "-2" to ensure that pointer doesn't go beyond the boundary rightEndC-1
     482        if( (i >= leftStartC) && (i <= rightEndC-2) )
     483        {
     484          piSrcU++;
     485          piSrcV++;
     486        }
     487
     488        piDstU++;
     489        piDstV++;
     490      }
     491#endif
     492#else
     493      piDstU = piDstBufU + j*strideEL;
     494      piDstV = piDstBufV + j*strideEL;
     495
     496      for( i = 0; i < widthEL; i++ )
     497      {
     498        *piDstU = ClipC( (sumChromaVer(piSrcU, coeff, strideEL) + iOffset) >> (nShift));
     499        *piDstV = ClipC( (sumChromaVer(piSrcV, coeff, strideEL) + iOffset) >> (nShift));
     500        piSrcU++;
     501        piSrcV++;
     502        piDstU++;
     503        piDstV++;
     504      }
     505#endif
     506    }
     507
     508    pcUsPic->setBorderExtension(false);
     509    pcUsPic->extendPicBorder   (); // extend the border.
     510
     511    //Reset the Border extension flag
     512    pcUsPic->setBorderExtension(false);
     513    pcTempPic->setBorderExtension(false);
     514    pcBasePic->setBorderExtension(false);
    760515  }
    761516}
  • trunk/source/Lib/TLibCommon/TComUpsampleFilter.h

    r189 r310  
    1313{
    1414private:
    15 #if PHASE_DERIVATION_IN_INTEGER
    1615  static const Int m_lumaFixedFilter[16][NTAPS_US_LUMA];     ///< Luma filter taps for both 1.5x and 2x scalability
    1716  static const Int m_chromaFixedFilter[16][NTAPS_US_CHROMA]; ///< Chroma filter taps for 1.5x scalability
     
    1918  Int m_lumaFilter[16][NTAPS_US_LUMA];
    2019  Int m_chromaFilter[16][NTAPS_US_CHROMA];
    21 #else
    22   static const Int m_lumaFixedFilter[12][NTAPS_US_LUMA];     ///< Luma filter taps for both 1.5x and 2x scalability
    23   static const Int m_chromaFixedFilter20[8][NTAPS_US_CHROMA]; ///< Chroma filter taps for 2x scalability
    24   static const Int m_chromaFixedFilter15[12][NTAPS_US_CHROMA]; ///< Chroma filter taps for 1.5x scalability
    25 
    26   Int m_lumaFilter[12][NTAPS_US_LUMA];
    27   Int m_chromaFilter[12][NTAPS_US_CHROMA];
    28 #endif
    2920
    3021  static inline Int sumLumaHor( Pel* pel, Int* coeff )
     
    5344
    5445#if SCALED_REF_LAYER_OFFSETS
    55   Void upsampleBasePic( TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window );
     46  Void upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window );
    5647#else
    57  Void upsampleBasePic( TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic );
     48 Void upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic );
    5849#endif
    5950};
  • trunk/source/Lib/TLibCommon/TComWeightPrediction.cpp

    r191 r310  
    271271Void TComWeightPrediction::getWpScaling( TComDataCU* pcCU, Int iRefIdx0, Int iRefIdx1, wpScalingParam *&wp0, wpScalingParam *&wp1)
    272272{
     273  assert(iRefIdx0 >= 0 || iRefIdx1 >= 0);
     274 
    273275  TComSlice*      pcSlice       = pcCU->getSlice();
    274276  TComPPS*        pps           = pcCU->getSlice()->getPPS();
  • trunk/source/Lib/TLibCommon/TypeDef.h

    r208 r310  
    4444
    4545#if SVC_EXTENSION
     46#define MAX_LAYERS                       2      ///< max number of layers the codec is supposed to handle
     47
     48#define M0464_TILE_BOUNDARY_ALIGNED_FLAG 1      ///< VUI flag to indicate tile boundary alignment
     49#define M0463_VUI_EXT_ILP_REF            1      ///< VUI extension inter-layer dependency offset signalling
     50#define SPS_EXTENSION                    1      ///< Define sps_extension() syntax structure
     51#define SCALED_REF_LAYER_OFFSET_FLAG     0      ///< M0309: Signal scaled reference layer offsets in SPS
    4652#define SCALED_REF_LAYER_OFFSETS         1      ///< M0309: Signal scaled reference layer offsets in SPS
    47 #define MAX_LAYERS                       2      ///< max number of layers the codec is supposed to handle
    4853
    4954#define VPS_RENAME                       1      ///< Rename variables max_layer_id and num_layer_sets_minus1 in VPS
     
    5459#define VPS_EXTN_PROFILE_INFO            1      ///< Include profile information for layer sets in VPS extension
    5560#define VPS_EXTN_DIRECT_REF_LAYERS       1      ///< Include indication of direct dependency of layers in VPS extension
    56 #define VPS_EXTN_DIRECT_REF_LAYERS_CONTINUE   1
    5761#define VPS_OUTPUT_LAYER_SET_IDX         1      ///< M0268: Signal output_layer_set_idx[i] as output_layer_set_idx_minus1[i]
    5862#define VPS_MOVE_DIR_DEPENDENCY_FLAG     1      ///< M0268: Move the syntax element direct_dependency_flag to follow the syntax element dimension_id
    5963#define VPS_PROFILE_OUTPUT_LAYERS        1      ///< M0268: Signal profile information and output layer information as in Sec. 3 of M0268v2
    60 #endif
     64#define SPS_SUB_LAYER_INFO               1      ///< M0268: Do not signal sps_max_sub_layers_minus1 and sps_temporal_id_nesting_flag for nuh_layer_id greater than 0
     65#define VPS_SPLIT_FLAG                   1      ///< M0163: Do not signal dimension_id and the last dimension_id_len_minus1, when splitting_flag is equal to 1.
     66#define M0457_PREDICTION_INDICATIONS     1
     67#define M0040_ADAPTIVE_RESOLUTION_CHANGE 1
     68#endif
     69
     70#define SH_DISCARDABLE_FLAG              1      ///< M0152: Use one reserved flag in the slice header for discardable flag
    6171
    6272#define DERIVE_LAYER_ID_LIST_VARIABLES   1      ///< Derived variables based on the variables in VPS - for use in syntax table parsing
     
    6474#define SVC_COL_BLK                      1      ///< get co-located block
    6575#define SVC_UPSAMPLING                   1      ///< upsampling filters
    66 #define PHASE_DERIVATION_IN_INTEGER      1      ///< upsampling filters implementation using only integer arithmetic
    67 #define ENCODER_BUGFIX                   1      ///< L0167: encoder bug fix for inter mode
    6876#define CHROMA_UPSAMPLING                1      ///< L0335: Chroma upsampling with 5 bits coefficients
    6977
     
    7179#define ILP_DECODED_PICTURE              1      ///< M0274: use decoded picture for inter-layer prediction
    7280#define JCTVC_M0259_LAMBDAREFINEMENT     1      ///< JCTVC-M0259: lambda refinement (encoder only optimization)
     81#define RESTR_CHK                        1      ///< JCTVC-M0208 proposal 1
     82#define ILP_RAP                          1      ///< JCTVC-M0208 proposal 3
    7383
    7484#define REF_IDX_FRAMEWORK                1      ///< inter-layer reference framework
    75 
    76 #if SVC_UPSAMPLING && !ILP_DECODED_PICTURE
    77 #define JCTVC_L0178                      1      ///< implementation of JCTVC-L0178 (code only supports right and bottom croppping offsets)
    78 #endif
    7985
    8086#define IDR_ALIGNMENT                    1      ///< align IDR picures across layers
     
    8995#define ENCODER_FAST_MODE                1      ///< L0174: enable encoder fast mode. TestMethod 1 is enabled by setting to 1 and TestMethod 2 is enable by setting to 2. By default it is set to 1.
    9096#define REF_IDX_MFM                      1      ///< L0336: motion vector mapping of inter-layer reference picture
    91 #define JCTVC_M0458_INTERLAYER_RPS_SIG   1      ///< implementation of JCTVC-L0178 (currently only one reference layer is supported )
     97#define JCTVC_M0458_INTERLAYER_RPS_SIG   1      ///< implementation of JCTVC-L0178
    9298#if JCTVC_M0458_INTERLAYER_RPS_SIG
    9399#define ZERO_NUM_DIRECT_LAYERS           1      ///< support of zero direct reference layers
    94 #endif
     100#define MAX_ONE_RESAMPLING_DIRECT_LAYERS 1      ///< Allow maximum of one resampling process for direct reference layers
     101#endif
     102#define JCTVC_M0203_INTERLAYER_PRED_IDC  1      ///< implementation of JCTVC-M0203 Inter-layer Prediction Indication
     103#if JCTVC_M0203_INTERLAYER_PRED_IDC
     104#define ILR_RESTR                        1     ///< JCTVC-M0209 Inter-layer RPS and RPL
     105#endif
     106#define M0457_COL_PICTURE_SIGNALING      1
     107
     108#if !VPS_EXTN_DIRECT_REF_LAYERS || !M0457_PREDICTION_INDICATIONS || !JCTVC_M0458_INTERLAYER_RPS_SIG
     109#define M0457_IL_SAMPLE_PRED_ONLY_FLAG   0
     110#else
     111#define M0457_IL_SAMPLE_PRED_ONLY_FLAG   0
     112#endif
     113
    95114#else
    96115#define INTRA_BL                         1      ///< inter-layer texture prediction
     
    110129#endif
    111130#endif
     131
     132#define FAST_INTRA_SHVC                  1      ///< M0115: reduction number of intra modes in the EL (encoder only)
     133#if FAST_INTRA_SHVC
     134  #define NB_REMAIN_MODES                2      ///< nb of remaining modes (M0115)
     135#endif
     136
     137#define RC_SHVC_HARMONIZATION            1  ///< JCTVC-M0037, rate control for SHVC
     138
    112139#else
    113140#define ILP_DECODED_PICTURE              0
    114141#define SYNTAX_OUTPUT                    0
    115 #endif
     142#endif // SVC_EXTENSION
     143
    116144
    117145//! \ingroup TLibCommon
    118146//! \{
    119147
    120 #define FIX1071 1 ///< Temporary fix for issue #1071
    121 
    122 #define L0208_SOP_DESCRIPTION_SEI     1 ///< L0208: add SOP descrioption SEI
     148#define FIX1071 1 ///< fix for issue #1071
     149#define M0043_LAYERS_PRESENT_SEI         0 ///< M0043: add layers present SEI
     150
    123151#define MAX_NUM_PICS_IN_SOP           1024
    124152
    125 #define K0180_SCALABLE_NESTING_SEI  1   ///JCTVC-K0180 scalable nesting sei message
    126153#define MAX_NESTING_NUM_OPS         1024
    127154#define MAX_NESTING_NUM_LAYER       64
    128 
    129 #define J0149_TONE_MAPPING_SEI        1 ///< J0149: Tone mapping information SEI
    130 #define L0363_DU_BIT_RATE             1 ///< L0363: add bit_rate_du_value_minus1 to HRD parameters
    131 #define L0328_SPLICING                1 ///< L0328: splicing support in HRD
    132 #define L0044_DU_DPB_OUTPUT_DELAY_HRD 1 ///< L0044: Include dpb_output_delay_du_length_minus1 in hrd_parameters(), dpb_output_du_delay in
    133                                         ///<        picture timing SEI and DU information SEI
    134 #define L0045_PERSISTENCE_FLAGS  1      ///< L0045: Replace "repetition_period" syntax elements in SEI with "persistence_flag"
    135 #define L0045_NON_NESTED_SEI_RESTRICTIONS 1 ///< L0045; Include restriction on the order of APS and non-nested BP, PT and DU info SEI messages
    136 #define L0044_CPB_DPB_DELAY_OFFSET 1  ///< L0044: Include syntax elements cpb_delay_offset and dpb_delay_offset in the BP SEI message
    137 #define L0047_APS_FLAGS            1  ///< L0047: Include full_random_access_flag and no_param_set_update_flag in the active parameter set SEI message
    138 #define L0043_TIMING_INFO          1  ///< L0043: Timing information is signalled in VUI outside hrd_parameters()
    139 #define L0046_RENAME_PROG_SRC_IDC  1  ///< L0046: Rename progressive_source_idc to source_scan_type
    140 #define L0045_CONDITION_SIGNALLING 1  ///< L0045: Condition the signaling of some syntax elements in picture timing SEI message
    141 #define L0043_MSS_IDC 1
    142 #define L0116_ENTRY_POINT 1
    143 #define L0363_MORE_BITS 1
    144 #define L0363_MVP_POC 1
    145 #define L0363_BYTE_ALIGN 1
    146 #define L0363_SEI_ALLOW_SUFFIX 1
    147 #define L0323_LIMIT_DEFAULT_LIST_SIZE 1
    148 #define L0046_CONSTRAINT_FLAGS 1
    149 #define L0255_MOVE_PPS_FLAGS       1  ///< move some flags to earlier positions in the PPS
    150 #define L0444_FPA_TYPE             1  ///< allow only FPA types 3, 4 and 5
    151 #define L0372 1
    152 #define SIGNAL_BITRATE_PICRATE_IN_VPS               0  ///< K0125: Signal bit_rate and pic_rate in VPS
    153 #define L0232_RD_PENALTY           1  ///< L0232: RD-penalty for 32x32 TU for intra in non-intra slices
    154 #define L0386_DB_METRIC            1  ///< L0386: non-normative blockiness metric (automatically configures deblocking parameters in bitstream)
    155 #define L0323_DPB                     1 ///< L0323: Specification of active reference indices and decoded picture buffer
    156 
    157 #define L0034_COMBINED_LIST_CLEANUP 1
    158155
    159156#if VPS_EXTN_MASK_AND_DIM_INFO
     
    169166#endif
    170167#define RATE_CONTROL_LAMBDA_DOMAIN                  1  ///< JCTVC-K0103, rate control by R-lambda model
    171 #define L0033_RC_BUGFIX                             1  ///< JCTVC-L0033, bug fix for R-lambda model based rate control
     168#define M0036_RC_IMPROVEMENT                        1  ///< JCTVC-M0036, improvement for R-lambda model based rate control
     169#define TICKET_1090_FIX                             1
     170
     171#define RC_FIX                                      1  /// suggested fix for M0036
     172#define RATE_CONTROL_INTRA                          1  ///< JCTVC-M0257, rate control for intra
    172173
    173174#define MAX_CPB_CNT                     32  ///< Upper bound of (cpb_cnt_minus1 + 1)
     
    190191
    191192#define REMOVE_SAO_LCU_ENC_CONSTRAINTS_3 1  ///< disable the encoder constraint that conditionally disable SAO for chroma for entire slice in interleaved mode
    192 
    193 #define REMOVE_SINGLE_SEI_EXTENSION_FLAGS 1 ///< remove display orientation SEI extension flag (there is a generic SEI extension mechanism now)
    194193
    195194#define SAO_ENCODING_CHOICE              1  ///< I0184: picture early termination
     
    205204#define MAX_NUM_SPS                16
    206205#define MAX_NUM_PPS                64
    207 
    208 
    209206
    210207#define WEIGHTED_CHROMA_DISTORTION  1   ///< F386: weighting of chroma for RDO
     
    495492  REF_PIC_LIST_0 = 0,   ///< reference list 0
    496493  REF_PIC_LIST_1 = 1,   ///< reference list 1
    497 #if !L0034_COMBINED_LIST_CLEANUP
    498   REF_PIC_LIST_C = 2,   ///< combined reference list for uni-prediction in B-Slices
    499 #endif
    500494  REF_PIC_LIST_X = 100  ///< special mark
    501495};
Note: See TracChangeset for help on using the changeset viewer.