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


Ignore:
Timestamp:
16 Nov 2013, 22:09:25 (11 years ago)
Author:
seregin
Message:

reintegrate branch SHM-4.0-dev

Location:
trunk
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/source

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

    r442 r494  
    130130extern Int g_bitDepthY;
    131131extern Int g_bitDepthC;
    132 
     132#if O0194_DIFFERENT_BITDEPTH_EL_BL
     133extern Int  g_bitDepthYLayer[MAX_LAYERS];
     134extern Int  g_bitDepthCLayer[MAX_LAYERS];
     135
     136extern UInt g_uiPCMBitDepthLumaDec[MAX_LAYERS];    // PCM bit-depth
     137extern UInt g_uiPCMBitDepthChromaDec[MAX_LAYERS];    // PCM bit-depth
     138#endif
     139#if O0194_WEIGHTED_PREDICTION_CGS
     140extern void* g_refWeightACDCParam; //type:wpACDCParam
     141#endif
    133142/** clip x, such that 0 <= x <= #g_maxLumaVal */
    134143template <typename T> inline T ClipY(T x) { return std::min<T>(T((1 << g_bitDepthY)-1), std::max<T>( T(0), x)); }
  • trunk/source/Lib/TLibCommon/TComDataCU.cpp

    r442 r494  
    18721872#endif
    18731873
     1874#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     1875Bool TComDataCU::isInterLayerReference(UChar uhInterDir, TComMvField& cMvFieldL0, TComMvField& cMvFieldL1)
     1876{
     1877  Bool checkILR = false;
     1878
     1879  if(uhInterDir&0x1)  //list0
     1880  {
     1881    Int refIdxL0 = cMvFieldL0.getRefIdx();
     1882    checkILR = getSlice()->getRefPic(REF_PIC_LIST_0, refIdxL0)->isILR(m_layerId);
     1883  }
     1884  if(uhInterDir&0x2)  //list1
     1885  {
     1886    Int refIdxL1  = cMvFieldL1.getRefIdx();
     1887    checkILR = checkILR || getSlice()->getRefPic(REF_PIC_LIST_1, refIdxL1)->isILR(m_layerId);
     1888  }
     1889
     1890  return checkILR;
     1891}
     1892#endif
     1893
    18741894UInt TComDataCU::getCtxSkipFlag( UInt uiAbsPartIdx )
    18751895{
     
    40044024  uiPelY = (UInt)Clip3<UInt>(0, m_pcPic->getPicYuvRec()->getHeight() - 1, uiPelY);
    40054025
     4026#if !LAYER_CTB
    40064027  UInt uiMinUnitSize = m_pcPic->getMinCUWidth();
    4007 
    4008 #if SCALED_REF_LAYER_OFFSETS
     4028#endif
     4029
    40094030  Int leftStartL = this->getSlice()->getSPS()->getScaledRefLayerWindow(refLayerIdc).getWindowLeftOffset();
    40104031  Int topStartL  = this->getSlice()->getSPS()->getScaledRefLayerWindow(refLayerIdc).getWindowTopOffset();
    40114032  Int iBX = ((uiPelX - leftStartL)*g_posScalingFactor[refLayerIdc][0] + (1<<15)) >> 16;
    40124033  Int iBY = ((uiPelY - topStartL )*g_posScalingFactor[refLayerIdc][1] + (1<<15)) >> 16;
    4013 #else
    4014   Int iBX = (uiPelX*g_posScalingFactor[refLayerIdc][0] + (1<<15)) >> 16;
    4015   Int iBY = (uiPelY*g_posScalingFactor[refLayerIdc][1] + (1<<15)) >> 16;
    4016 #endif
    40174034
    40184035#if N0139_POSITION_ROUNDING_OFFSET
     
    40244041#endif
    40254042
    4026 #if SCALED_REF_LAYER_OFFSETS
    40274043  if ( iBX >= cBaseColPic->getPicYuvRec()->getWidth() || iBY >= cBaseColPic->getPicYuvRec()->getHeight() ||
    40284044       iBX < 0                                        || iBY < 0                                           )
     4045  {
     4046    return NULL;
     4047  }
     4048
     4049#if LAYER_CTB
     4050  UInt baseMaxCUHeight = cBaseColPic->getPicSym()->getMaxCUHeight();
     4051  UInt baseMaxCUWidth  = cBaseColPic->getPicSym()->getMaxCUWidth();
     4052  UInt baseMinUnitSize = cBaseColPic->getMinCUWidth();
     4053 
     4054  uiCUAddrBase = ( iBY / cBaseColPic->getPicSym()->getMaxCUHeight() ) * cBaseColPic->getFrameWidthInCU() + ( iBX / cBaseColPic->getPicSym()->getMaxCUWidth() );
    40294055#else
    4030   if ( iBX >= cBaseColPic->getPicYuvRec()->getWidth() || iBY >= cBaseColPic->getPicYuvRec()->getHeight())
     4056  uiCUAddrBase = (iBY/g_uiMaxCUHeight)*cBaseColPic->getFrameWidthInCU() + (iBX/g_uiMaxCUWidth);
    40314057#endif
    4032   {
    4033     return NULL;
    4034   }
    4035 
    4036   uiCUAddrBase = (iBY/g_uiMaxCUHeight)*cBaseColPic->getFrameWidthInCU() + (iBX/g_uiMaxCUWidth);
    40374058
    40384059  assert(uiCUAddrBase < cBaseColPic->getNumCUsInFrame());
    40394060
     4061#if LAYER_CTB
     4062  UInt uiRasterAddrBase = ( iBY - (iBY/baseMaxCUHeight)*baseMaxCUHeight ) / baseMinUnitSize * cBaseColPic->getNumPartInWidth() + ( iBX - (iBX/baseMaxCUWidth)*baseMaxCUWidth ) / baseMinUnitSize;
     4063 
     4064  uiAbsPartIdxBase = g_auiLayerRasterToZscan[cBaseColPic->getLayerId()][uiRasterAddrBase];
     4065#else
    40404066  UInt uiRasterAddrBase = (iBY - (iBY/g_uiMaxCUHeight)*g_uiMaxCUHeight)/uiMinUnitSize*cBaseColPic->getNumPartInWidth()
    40414067    + (iBX - (iBX/g_uiMaxCUWidth)*g_uiMaxCUWidth)/uiMinUnitSize;
    40424068
    40434069  uiAbsPartIdxBase = g_auiRasterToZscan[uiRasterAddrBase];
     4070#endif
    40444071
    40454072  return cBaseColPic->getCU(uiCUAddrBase);
  • trunk/source/Lib/TLibCommon/TComDataCU.h

    r442 r494  
    492492  Bool          isSkipped ( UInt uiPartIdx );                                                     ///< SKIP (no residual)
    493493  Bool          isBipredRestriction( UInt puIdx );
     494#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     495  Bool          isInterLayerReference(UChar uhInterDir, TComMvField& cMvFieldL0, TComMvField& cMvFieldL1);
     496#endif
    494497
    495498  // -------------------------------------------------------------------------------------------------------------------
  • trunk/source/Lib/TLibCommon/TComPic.cpp

    r442 r494  
    7979}
    8080#if SVC_UPSAMPLING
     81#if AUXILIARY_PICTURES
     82Void TComPic::create( Int iWidth, Int iHeight, ChromaFormat chromaFormatIDC, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, Window &conformanceWindow, Window &defaultDisplayWindow,
     83                      Int *numReorderPics, TComSPS* pcSps, Bool bIsVirtual)
     84#else
    8185Void TComPic::create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, Window &conformanceWindow, Window &defaultDisplayWindow,
    8286                      Int *numReorderPics, TComSPS* pcSps, Bool bIsVirtual)
    83 
     87#endif
    8488{
    8589  m_apcPicSym     = new TComPicSym;  m_apcPicSym   ->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth );
    8690  if (!bIsVirtual)
    8791  {
     92#if AUXILIARY_PICTURES
     93    m_apcPicYuv[0]  = new TComPicYuv;  m_apcPicYuv[0]->create( iWidth, iHeight, chromaFormatIDC, uiMaxWidth, uiMaxHeight, uiMaxDepth, pcSps );
     94#else
    8895    m_apcPicYuv[0]  = new TComPicYuv;  m_apcPicYuv[0]->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth, pcSps );
    89   }
     96#endif
     97  }
     98#if AUXILIARY_PICTURES
     99  m_apcPicYuv[1]  = new TComPicYuv;  m_apcPicYuv[1]->create( iWidth, iHeight, chromaFormatIDC, uiMaxWidth, uiMaxHeight, uiMaxDepth, pcSps );
     100#else
    90101  m_apcPicYuv[1]  = new TComPicYuv;  m_apcPicYuv[1]->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth, pcSps );
     102#endif
    91103
    92104  for( Int i = 0; i < MAX_LAYERS; i++ )
     
    94106    if( m_bSpatialEnhLayer[i] )
    95107    {
     108#if AUXILIARY_PICTURES
     109      m_pcFullPelBaseRec[i] = new TComPicYuv;  m_pcFullPelBaseRec[i]->create( iWidth, iHeight, chromaFormatIDC, uiMaxWidth, uiMaxHeight, uiMaxDepth, pcSps );
     110#else
    96111      m_pcFullPelBaseRec[i] = new TComPicYuv;  m_pcFullPelBaseRec[i]->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth, pcSps );
     112#endif
    97113    }
    98114  }
     
    407423  {
    408424    m_pNDBFilterYuvTmp = new TComPicYuv();
     425#if AUXILIARY_PICTURES
     426    m_pNDBFilterYuvTmp->create(picWidth, picHeight, getChromaFormat(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth);
     427#else
    409428    m_pNDBFilterYuvTmp->create(picWidth, picHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth);
     429#endif
     430
    410431  }
    411432
     
    801822#endif
    802823
     824#if MFM_ENCCONSTRAINT
     825Bool TComPic::checkSameRefInfo()
     826{
     827  Bool bSameRefInfo = true;
     828  TComSlice * pSlice0 = getSlice( 0 );
     829  for( UInt uSliceID = getNumAllocatedSlice() - 1 ; bSameRefInfo && uSliceID > 0 ; uSliceID-- )
     830  {
     831    TComSlice * pSliceN = getSlice( uSliceID );
     832    if( pSlice0->getSliceType() != pSliceN->getSliceType() )
     833    {
     834      bSameRefInfo = false;
     835    }
     836    else if( pSlice0->getSliceType() != I_SLICE )
     837    {
     838      Int nListNum = pSlice0->getSliceType() == B_SLICE ? 2 : 1;
     839      for( Int nList = 0 ; nList < nListNum ; nList++ )
     840      {
     841        RefPicList eRefList = ( RefPicList )nList;
     842        if( pSlice0->getNumRefIdx( eRefList ) == pSliceN->getNumRefIdx( eRefList ) )
     843        {
     844          for( Int refIdx = pSlice0->getNumRefIdx( eRefList ) - 1 ; refIdx >= 0 ; refIdx-- )
     845          {
     846            if( pSlice0->getRefPic( eRefList , refIdx ) != pSliceN->getRefPic( eRefList , refIdx ) )
     847            {
     848              bSameRefInfo = false;
     849              break;
     850            }
     851          }
     852        }
     853        else
     854        {
     855          bSameRefInfo = false;
     856          break;
     857        }
     858      }
     859    }
     860  }
     861
     862  return( bSameRefInfo ); 
     863}
     864#endif
    803865
    804866//! \}
  • trunk/source/Lib/TLibCommon/TComPic.h

    r442 r494  
    102102  virtual ~TComPic();
    103103 
     104#if AUXILIARY_PICTURES
     105#if SVC_UPSAMPLING
     106  Void          create( Int iWidth, Int iHeight, ChromaFormat chromaFormatIDC, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, Window &conformanceWindow, Window &defaultDisplayWindow,
     107                        Int *numReorderPics, TComSPS* pcSps = NULL, Bool bIsVirtual = false );
     108#else
     109  Void          create( Int iWidth, Int iHeight, ChromaFormat chromaFormatIDC, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, Window &conformanceWindow, Window &defaultDisplayWindow,
     110                        Int *numReorderPics, Bool bIsVirtual = false );                       
     111#endif
     112#else
    104113#if SVC_UPSAMPLING
    105114  Void          create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, Window &conformanceWindow, Window &defaultDisplayWindow,
     
    109118                        Int *numReorderPics, Bool bIsVirtual = false );                       
    110119#endif
     120#endif
    111121  virtual Void  destroy();
    112122 
     
    128138  Void          copyUpsampledMvField  ( UInt refLayerIdc, TComPic* pcPicBase );
    129139  Void          initUpsampledMvField  ();
     140#endif
     141#if MFM_ENCCONSTRAINT
     142  Bool          checkSameRefInfo();
    130143#endif
    131144
     
    163176 
    164177  Int           getStride()           { return m_apcPicYuv[1]->getStride(); }
     178#if AUXILIARY_PICTURES
     179  ChromaFormat  getChromaFormat() const { return m_apcPicYuv[1]->getChromaFormat(); }
     180#endif
    165181  Int           getCStride()          { return m_apcPicYuv[1]->getCStride(); }
    166182 
  • trunk/source/Lib/TLibCommon/TComPicSym.h

    r442 r494  
    126126  TComDataCU*&  getCU( UInt uiCUAddr )  { return m_apcTComDataCU[uiCUAddr];     }
    127127 
     128#if LAYER_CTB
     129  UInt        getMaxCUWidth()           { return m_uiMaxCUWidth;                }
     130  UInt        getMaxCUHeight()          { return m_uiMaxCUHeight;               }
     131#endif
     132
    128133#if AVC_SYNTAX
    129134  UInt        getMaxCUWidth()           { return m_uiMaxCUWidth;                }
  • trunk/source/Lib/TLibCommon/TComPicYuv.cpp

    r313 r494  
    6767{
    6868}
     69#if AUXILIARY_PICTURES
     70#if SVC_UPSAMPLING
     71Void TComPicYuv::create( Int iPicWidth, Int iPicHeight, ChromaFormat chromaFormatIDC, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth, TComSPS* pcSps )
     72#else
     73Void TComPicYuv::create( Int iPicWidth, Int iPicHeight, ChromaFormat chromaFormatIDC, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth )
     74#endif
     75#else
    6976#if SVC_UPSAMPLING
    7077Void TComPicYuv::create( Int iPicWidth, Int iPicHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth, TComSPS* pcSps )
    7178#else
    7279Void TComPicYuv::create( Int iPicWidth, Int iPicHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth )
     80#endif
    7381#endif
    7482{
     
    8694  m_iCuWidth        = uiMaxCUWidth;
    8795  m_iCuHeight       = uiMaxCUHeight;
     96#if AUXILIARY_PICTURES
     97  m_chromaFormatIDC = chromaFormatIDC;
     98#endif
    8899
    89100  Int numCuInWidth  = m_iPicWidth  / m_iCuWidth  + (m_iPicWidth  % m_iCuWidth  != 0);
    90101  Int numCuInHeight = m_iPicHeight / m_iCuHeight + (m_iPicHeight % m_iCuHeight != 0);
    91102 
     103#if LAYER_CTB
     104  m_iLumaMarginX    = uiMaxCUWidth  + 16; // for 16-byte alignment
     105  m_iLumaMarginY    = uiMaxCUHeight + 16;  // margin for 8-tap filter and infinite padding
     106#else
    92107  m_iLumaMarginX    = g_uiMaxCUWidth  + 16; // for 16-byte alignment
    93108  m_iLumaMarginY    = g_uiMaxCUHeight + 16;  // margin for 8-tap filter and infinite padding
     109#endif
    94110 
    95111  m_iChromaMarginX  = m_iLumaMarginX>>1;
     
    234250}
    235251
     252#if AUXILIARY_PICTURES
     253Void TComPicYuv::convertToMonochrome()
     254{
     255  Int numPix = ((m_iPicWidth >> 1) + (m_iChromaMarginX << 1)) * ((m_iPicHeight >> 1) + (m_iChromaMarginY << 1));
     256  Pel grayVal = (1 << (g_bitDepthC - 1));
     257
     258  for (UInt i = 0; i < numPix; i++)
     259  {
     260    m_apiPicBufU[i] = grayVal;
     261    m_apiPicBufV[i] = grayVal;
     262  }
     263}
     264#endif
     265
    236266Void TComPicYuv::extendPicBorder ()
    237267{
  • trunk/source/Lib/TLibCommon/TComPicYuv.h

    r313 r494  
    7575  Int   m_iPicWidth;            ///< Width of picture
    7676  Int   m_iPicHeight;           ///< Height of picture
     77#if AUXILIARY_PICTURES
     78  ChromaFormat m_chromaFormatIDC; ////< Chroma Format
     79#endif
    7780 
    7881  Int   m_iCuWidth;             ///< Width of Coding Unit (CU)
     
    108111  //  Memory management
    109112  // ------------------------------------------------------------------------------------------------
     113#if AUXILIARY_PICTURES
     114#if SVC_UPSAMPLING
     115  Void  create      ( Int iPicWidth, Int iPicHeight, ChromaFormat chromaFormatIDC, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth, TComSPS* pcSps = NULL);
     116#else
     117  Void  create      ( Int iPicWidth, Int iPicHeight, ChromaFormat chromaFormatIDC, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth );
     118#endif 
     119#else
    110120#if SVC_UPSAMPLING
    111121  Void  create      ( Int iPicWidth, Int iPicHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth, TComSPS* pcSps = NULL);
     
    113123  Void  create      ( Int iPicWidth, Int iPicHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth );
    114124#endif 
     125#endif
    115126 
    116127  Void  destroy     ();
     
    125136  Int   getWidth    ()     { return  m_iPicWidth;    }
    126137  Int   getHeight   ()     { return  m_iPicHeight;   }
     138#if AUXILIARY_PICTURES
     139  ChromaFormat  getChromaFormat   ()                     const { return m_chromaFormatIDC; }
     140#endif
    127141 
    128142#if SVC_EXTENSION
     
    184198#endif
    185199
     200#if AUXILIARY_PICTURES
     201  Void convertToMonochrome();
     202#endif
     203
    186204  // Set border extension flag
    187205  Void  setBorderExtension(Bool b) { m_bIsBorderExtended = b; }
  • trunk/source/Lib/TLibCommon/TComPrediction.cpp

    r442 r494  
    765765
    766766#if SVC_UPSAMPLING
    767 #if SCALED_REF_LAYER_OFFSETS
     767#if O0215_PHASE_ALIGNMENT
     768#if O0194_JOINT_US_BITSHIFT
     769Void TComPrediction::upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window, bool phaseAlignFlag )
     770{
     771  m_cUsf.upsampleBasePic( currSlice, refLayerIdc, pcUsPic, pcBasePic, pcTempPic, window, phaseAlignFlag );
     772}
     773#else
     774Void TComPrediction::upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window, bool phaseAlignFlag )
     775{
     776  m_cUsf.upsampleBasePic( refLayerIdc, pcUsPic, pcBasePic, pcTempPic, window, phaseAlignFlag );
     777}
     778#endif
     779#else
     780#if O0194_JOINT_US_BITSHIFT
     781Void TComPrediction::upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window)
     782{
     783  m_cUsf.upsampleBasePic( refLayerIdc, pcUsPic, pcBasePic, pcTempPic, window);
     784}
     785#else
    768786Void TComPrediction::upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window)
    769787{
    770788  m_cUsf.upsampleBasePic( refLayerIdc, pcUsPic, pcBasePic, pcTempPic, window);
    771789}
    772 #else
    773 Void TComPrediction::upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic)
    774 {
    775   m_cUsf.upsampleBasePic( refLayerIdc, pcUsPic, pcBasePic, pcTempPic);
    776 }
     790#endif
    777791#endif
    778792#endif
  • trunk/source/Lib/TLibCommon/TComPrediction.h

    r442 r494  
    120120#if SVC_EXTENSION
    121121#if SVC_UPSAMPLING
    122 #if SCALED_REF_LAYER_OFFSETS
     122#if O0215_PHASE_ALIGNMENT
     123#if O0194_JOINT_US_BITSHIFT
     124  Void upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window, bool phaseAlignFlag );
     125#else
     126  Void upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window, bool phaseAlignFlag );
     127#endif
     128#else
     129#if O0194_JOINT_US_BITSHIFT
     130  Void upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window );
     131#else
    123132  Void upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window );
    124 #else
    125   Void upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic );
    126133#endif
    127134#endif
    128135#endif
     136#endif //SVC_EXTENSION
    129137};
    130138
  • trunk/source/Lib/TLibCommon/TComRdCost.cpp

    r313 r494  
    22 * License, included below. This software may be subject to other third party
    33 * and contributor rights, including patent rights, and no such rights are
    4  * granted under this license. 
     4 * granted under this license.
    55 *
    66 * Copyright (c) 2010-2013, ITU/ISO/IEC
     
    6161  Double dRdCost = 0.0;
    6262  Double dLambda = 0.0;
    63  
     63
    6464  switch ( eDFunc )
    6565  {
     
    8080      break;
    8181  }
    82  
     82
    8383  if (bFlag)
    8484  {
     
    107107    }
    108108  }
    109  
     109
    110110  return dRdCost;
    111111}
     
    115115  Double dRdCost = 0.0;
    116116  Double dLambda = 0.0;
    117  
     117
    118118  switch ( eDFunc )
    119119  {
     
    134134      break;
    135135  }
    136  
     136
    137137  if (bFlag)
    138138  {
     
    161161    }
    162162  }
    163  
     163
    164164  return dRdCost;
    165165}
     
    178178{
    179179  m_afpDistortFunc[0]  = NULL;                  // for DF_DEFAULT
    180  
     180
    181181  m_afpDistortFunc[1]  = TComRdCost::xGetSSE;
    182182  m_afpDistortFunc[2]  = TComRdCost::xGetSSE4;
     
    186186  m_afpDistortFunc[6]  = TComRdCost::xGetSSE64;
    187187  m_afpDistortFunc[7]  = TComRdCost::xGetSSE16N;
    188  
     188
    189189  m_afpDistortFunc[8]  = TComRdCost::xGetSAD;
    190190  m_afpDistortFunc[9]  = TComRdCost::xGetSAD4;
     
    194194  m_afpDistortFunc[13] = TComRdCost::xGetSAD64;
    195195  m_afpDistortFunc[14] = TComRdCost::xGetSAD16N;
    196  
     196
    197197  m_afpDistortFunc[15] = TComRdCost::xGetSAD;
    198198  m_afpDistortFunc[16] = TComRdCost::xGetSAD4;
     
    202202  m_afpDistortFunc[20] = TComRdCost::xGetSAD64;
    203203  m_afpDistortFunc[21] = TComRdCost::xGetSAD16N;
    204  
     204
    205205#if AMP_SAD
    206206  m_afpDistortFunc[43] = TComRdCost::xGetSAD12;
     
    219219  m_afpDistortFunc[27] = TComRdCost::xGetHADs;
    220220  m_afpDistortFunc[28] = TComRdCost::xGetHADs;
    221  
     221
    222222#if !FIX203
    223223  m_puiComponentCostOriginP = NULL;
     
    239239  iSubPelSearchLimit += 4;
    240240  iSubPelSearchLimit *= 8;
    241  
     241
    242242  if( m_iSearchLimit != iSubPelSearchLimit )
    243243  {
    244244    xUninit();
    245    
     245
    246246    m_iSearchLimit = iSubPelSearchLimit;
    247    
     247
    248248    m_puiComponentCostOriginP = new UInt[ 4 * iSubPelSearchLimit ];
    249249    iSubPelSearchLimit *= 2;
    250    
     250
    251251    m_puiComponentCost = m_puiComponentCostOriginP + iSubPelSearchLimit;
    252    
     252
    253253    for( Int n = -iSubPelSearchLimit; n < iSubPelSearchLimit; n++)
    254254    {
     
    272272  UInt uiLength = 1;
    273273  UInt uiTemp   = ( iVal <= 0) ? (-iVal<<1)+1: (iVal<<1);
    274  
     274
    275275  assert ( uiTemp );
    276  
     276
    277277  while ( 1 != uiTemp )
    278278  {
     
    280280    uiLength += 2;
    281281  }
    282  
     282
    283283  return uiLength;
    284284}
     
    290290  rcDistParam.iRows    = uiBlkHeight;
    291291  rcDistParam.DistFunc = m_afpDistortFunc[eDFunc + g_aucConvertToBit[ rcDistParam.iCols ] + 1 ];
    292  
     292
    293293  // initialize
    294294  rcDistParam.iSubShift  = 0;
     
    301301  rcDistParam.pOrg = pcPatternKey->getROIY();
    302302  rcDistParam.pCur = piRefY;
    303  
     303
    304304  rcDistParam.iStrideOrg = pcPatternKey->getPatternLStride();
    305305  rcDistParam.iStrideCur = iRefStride;
    306  
     306
    307307  // set Block Width / Height
    308308  rcDistParam.iCols    = pcPatternKey->getROIYWidth();
    309309  rcDistParam.iRows    = pcPatternKey->getROIYHeight();
    310310  rcDistParam.DistFunc = m_afpDistortFunc[DF_SAD + g_aucConvertToBit[ rcDistParam.iCols ] + 1 ];
    311  
     311
    312312#if AMP_SAD
    313313  if (rcDistParam.iCols == 12)
     
    336336#endif
    337337{
     338#if O0194_WEIGHTED_PREDICTION_CGS
     339  // Bug fix: The correct bit depth has not been used for weighted cost calculation
     340  rcDistParam.bitDepth = g_bitDepthY;
     341#endif
    338342  // set Original & Curr Pointer / Stride
    339343  rcDistParam.pOrg = pcPatternKey->getROIY();
    340344  rcDistParam.pCur = piRefY;
    341  
     345
    342346  rcDistParam.iStrideOrg = pcPatternKey->getPatternLStride();
    343347  rcDistParam.iStrideCur = iRefStride * iStep;
    344  
     348
    345349  // set Step for interpolated buffer
    346350  rcDistParam.iStep = iStep;
    347  
     351
    348352  // set Block Width / Height
    349353  rcDistParam.iCols    = pcPatternKey->getROIYWidth();
     
    352356  rcDistParam.bUseNSHAD = bUseNSHAD;
    353357#endif
    354  
     358
    355359  // set distortion function
    356360  if ( !bHADME )
     
    376380    rcDistParam.DistFunc = m_afpDistortFunc[DF_HADS + g_aucConvertToBit[ rcDistParam.iCols ] + 1 ];
    377381  }
    378  
     382
    379383  // initialize
    380384  rcDistParam.iSubShift  = 0;
     
    407411  UInt uiSum = 0;
    408412  Int x, y;
    409  
     413
    410414  if ( ( (iWidth % 8) == 0 ) && ( (iHeight % 8) == 0 ) )
    411415  {
     
    444448    }
    445449  }
    446  
     450
    447451  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(bitDepth-8);
    448452
     
    523527  Int  iStrideCur = pcDtParam->iStrideCur;
    524528  Int  iStrideOrg = pcDtParam->iStrideOrg;
    525  
    526   UInt uiSum = 0;
    527  
     529
     530  UInt uiSum = 0;
     531
    528532  for( ; iRows != 0; iRows-- )
    529533  {
     
    535539    piCur += iStrideCur;
    536540  }
    537  
     541
    538542  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
    539543}
     
    541545UInt TComRdCost::xGetSAD4( DistParam* pcDtParam )
    542546{
    543   if ( pcDtParam->bApplyWeight ) 
     547  if ( pcDtParam->bApplyWeight )
    544548  {
    545549    return xGetSADw( pcDtParam );
     
    552556  Int  iStrideCur = pcDtParam->iStrideCur*iSubStep;
    553557  Int  iStrideOrg = pcDtParam->iStrideOrg*iSubStep;
    554  
    555   UInt uiSum = 0;
    556  
     558
     559  UInt uiSum = 0;
     560
    557561  for( ; iRows != 0; iRows-=iSubStep )
    558562  {
     
    561565    uiSum += abs( piOrg[2] - piCur[2] );
    562566    uiSum += abs( piOrg[3] - piCur[3] );
    563    
    564     piOrg += iStrideOrg;
    565     piCur += iStrideCur;
    566   }
    567  
     567
     568    piOrg += iStrideOrg;
     569    piCur += iStrideCur;
     570  }
     571
    568572  uiSum <<= iSubShift;
    569573  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
     
    583587  Int  iStrideCur = pcDtParam->iStrideCur*iSubStep;
    584588  Int  iStrideOrg = pcDtParam->iStrideOrg*iSubStep;
    585  
    586   UInt uiSum = 0;
    587  
     589
     590  UInt uiSum = 0;
     591
    588592  for( ; iRows != 0; iRows-=iSubStep )
    589593  {
     
    596600    uiSum += abs( piOrg[6] - piCur[6] );
    597601    uiSum += abs( piOrg[7] - piCur[7] );
    598    
    599     piOrg += iStrideOrg;
    600     piCur += iStrideCur;
    601   }
    602  
     602
     603    piOrg += iStrideOrg;
     604    piCur += iStrideCur;
     605  }
     606
    603607  uiSum <<= iSubShift;
    604608  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
     
    618622  Int  iStrideCur = pcDtParam->iStrideCur*iSubStep;
    619623  Int  iStrideOrg = pcDtParam->iStrideOrg*iSubStep;
    620  
    621   UInt uiSum = 0;
    622  
     624
     625  UInt uiSum = 0;
     626
    623627  for( ; iRows != 0; iRows-=iSubStep )
    624628  {
     
    639643    uiSum += abs( piOrg[14] - piCur[14] );
    640644    uiSum += abs( piOrg[15] - piCur[15] );
    641    
    642     piOrg += iStrideOrg;
    643     piCur += iStrideCur;
    644   }
    645  
     645
     646    piOrg += iStrideOrg;
     647    piCur += iStrideCur;
     648  }
     649
    646650  uiSum <<= iSubShift;
    647651  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
     
    662666  Int  iStrideCur = pcDtParam->iStrideCur*iSubStep;
    663667  Int  iStrideOrg = pcDtParam->iStrideOrg*iSubStep;
    664  
    665   UInt uiSum = 0;
    666  
     668
     669  UInt uiSum = 0;
     670
    667671  for( ; iRows != 0; iRows-=iSubStep )
    668672  {
     
    679683    uiSum += abs( piOrg[10] - piCur[10] );
    680684    uiSum += abs( piOrg[11] - piCur[11] );
    681    
    682     piOrg += iStrideOrg;
    683     piCur += iStrideCur;
    684   }
    685  
     685
     686    piOrg += iStrideOrg;
     687    piCur += iStrideCur;
     688  }
     689
    686690  uiSum <<= iSubShift;
    687691  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
     
    699703  Int  iStrideCur = pcDtParam->iStrideCur*iSubStep;
    700704  Int  iStrideOrg = pcDtParam->iStrideOrg*iSubStep;
    701  
    702   UInt uiSum = 0;
    703  
     705
     706  UInt uiSum = 0;
     707
    704708  for( ; iRows != 0; iRows-=iSubStep )
    705709  {
     
    726730    piCur += iStrideCur;
    727731  }
    728  
     732
    729733  uiSum <<= iSubShift;
    730734  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
     
    744748  Int  iStrideCur = pcDtParam->iStrideCur*iSubStep;
    745749  Int  iStrideOrg = pcDtParam->iStrideOrg*iSubStep;
    746  
    747   UInt uiSum = 0;
    748  
     750
     751  UInt uiSum = 0;
     752
    749753  for( ; iRows != 0; iRows-=iSubStep )
    750754  {
     
    781785    uiSum += abs( piOrg[30] - piCur[30] );
    782786    uiSum += abs( piOrg[31] - piCur[31] );
    783    
    784     piOrg += iStrideOrg;
    785     piCur += iStrideCur;
    786   }
    787  
     787
     788    piOrg += iStrideOrg;
     789    piCur += iStrideCur;
     790  }
     791
    788792  uiSum <<= iSubShift;
    789793  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
     
    804808  Int  iStrideCur = pcDtParam->iStrideCur*iSubStep;
    805809  Int  iStrideOrg = pcDtParam->iStrideOrg*iSubStep;
    806  
    807   UInt uiSum = 0;
    808  
     810
     811  UInt uiSum = 0;
     812
    809813  for( ; iRows != 0; iRows-=iSubStep )
    810814  {
     
    833837    uiSum += abs( piOrg[22] - piCur[22] );
    834838    uiSum += abs( piOrg[23] - piCur[23] );
    835    
    836     piOrg += iStrideOrg;
    837     piCur += iStrideCur;
    838   }
    839  
     839
     840    piOrg += iStrideOrg;
     841    piCur += iStrideCur;
     842  }
     843
    840844  uiSum <<= iSubShift;
    841845  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
     
    857861  Int  iStrideCur = pcDtParam->iStrideCur*iSubStep;
    858862  Int  iStrideOrg = pcDtParam->iStrideOrg*iSubStep;
    859  
    860   UInt uiSum = 0;
    861  
     863
     864  UInt uiSum = 0;
     865
    862866  for( ; iRows != 0; iRows-=iSubStep )
    863867  {
     
    926930    uiSum += abs( piOrg[62] - piCur[62] );
    927931    uiSum += abs( piOrg[63] - piCur[63] );
    928    
    929     piOrg += iStrideOrg;
    930     piCur += iStrideCur;
    931   }
    932  
     932
     933    piOrg += iStrideOrg;
     934    piCur += iStrideCur;
     935  }
     936
    933937  uiSum <<= iSubShift;
    934938  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
     
    949953  Int  iStrideCur = pcDtParam->iStrideCur*iSubStep;
    950954  Int  iStrideOrg = pcDtParam->iStrideOrg*iSubStep;
    951  
    952   UInt uiSum = 0;
    953  
     955
     956  UInt uiSum = 0;
     957
    954958  for( ; iRows != 0; iRows-=iSubStep )
    955959  {
     
    10021006    uiSum += abs( piOrg[46] - piCur[46] );
    10031007    uiSum += abs( piOrg[47] - piCur[47] );
    1004    
    1005     piOrg += iStrideOrg;
    1006     piCur += iStrideCur;
    1007   }
    1008  
     1008
     1009    piOrg += iStrideOrg;
     1010    piCur += iStrideCur;
     1011  }
     1012
    10091013  uiSum <<= iSubShift;
    10101014  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
     
    10281032  Int  iStrideOrg = pcDtParam->iStrideOrg;
    10291033  Int  iStrideCur = pcDtParam->iStrideCur;
    1030  
     1034
    10311035  UInt uiSum = 0;
    10321036  UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1);
    1033  
     1037
    10341038  Int iTemp;
    1035  
     1039
    10361040  for( ; iRows != 0; iRows-- )
    10371041  {
     
    10441048    piCur += iStrideCur;
    10451049  }
    1046  
     1050
    10471051  return ( uiSum );
    10481052}
     
    10601064  Int  iStrideOrg = pcDtParam->iStrideOrg;
    10611065  Int  iStrideCur = pcDtParam->iStrideCur;
    1062  
     1066
    10631067  UInt uiSum = 0;
    10641068  UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1);
    1065  
     1069
    10661070  Int  iTemp;
    1067  
     1071
    10681072  for( ; iRows != 0; iRows-- )
    10691073  {
    1070    
     1074
    10711075    iTemp = piOrg[0] - piCur[0]; uiSum += ( iTemp * iTemp ) >> uiShift;
    10721076    iTemp = piOrg[1] - piCur[1]; uiSum += ( iTemp * iTemp ) >> uiShift;
    10731077    iTemp = piOrg[2] - piCur[2]; uiSum += ( iTemp * iTemp ) >> uiShift;
    10741078    iTemp = piOrg[3] - piCur[3]; uiSum += ( iTemp * iTemp ) >> uiShift;
    1075    
    1076     piOrg += iStrideOrg;
    1077     piCur += iStrideCur;
    1078   }
    1079  
     1079
     1080    piOrg += iStrideOrg;
     1081    piCur += iStrideCur;
     1082  }
     1083
    10801084  return ( uiSum );
    10811085}
     
    10931097  Int  iStrideOrg = pcDtParam->iStrideOrg;
    10941098  Int  iStrideCur = pcDtParam->iStrideCur;
    1095  
     1099
    10961100  UInt uiSum = 0;
    10971101  UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1);
    1098  
     1102
    10991103  Int  iTemp;
    1100  
     1104
    11011105  for( ; iRows != 0; iRows-- )
    11021106  {
     
    11091113    iTemp = piOrg[6] - piCur[6]; uiSum += ( iTemp * iTemp ) >> uiShift;
    11101114    iTemp = piOrg[7] - piCur[7]; uiSum += ( iTemp * iTemp ) >> uiShift;
    1111    
    1112     piOrg += iStrideOrg;
    1113     piCur += iStrideCur;
    1114   }
    1115  
     1115
     1116    piOrg += iStrideOrg;
     1117    piCur += iStrideCur;
     1118  }
     1119
    11161120  return ( uiSum );
    11171121}
     
    11291133  Int  iStrideOrg = pcDtParam->iStrideOrg;
    11301134  Int  iStrideCur = pcDtParam->iStrideCur;
    1131  
     1135
    11321136  UInt uiSum = 0;
    11331137  UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1);
    1134  
     1138
    11351139  Int  iTemp;
    1136  
     1140
    11371141  for( ; iRows != 0; iRows-- )
    11381142  {
    1139    
     1143
    11401144    iTemp = piOrg[ 0] - piCur[ 0]; uiSum += ( iTemp * iTemp ) >> uiShift;
    11411145    iTemp = piOrg[ 1] - piCur[ 1]; uiSum += ( iTemp * iTemp ) >> uiShift;
     
    11541158    iTemp = piOrg[14] - piCur[14]; uiSum += ( iTemp * iTemp ) >> uiShift;
    11551159    iTemp = piOrg[15] - piCur[15]; uiSum += ( iTemp * iTemp ) >> uiShift;
    1156    
    1157     piOrg += iStrideOrg;
    1158     piCur += iStrideCur;
    1159   }
    1160  
     1160
     1161    piOrg += iStrideOrg;
     1162    piCur += iStrideCur;
     1163  }
     1164
    11611165  return ( uiSum );
    11621166}
     
    11741178  Int  iStrideOrg = pcDtParam->iStrideOrg;
    11751179  Int  iStrideCur = pcDtParam->iStrideCur;
    1176  
     1180
    11771181  UInt uiSum = 0;
    11781182  UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1);
    11791183  Int  iTemp;
    1180  
     1184
    11811185  for( ; iRows != 0; iRows-- )
    11821186  {
    11831187    for (Int n = 0; n < iCols; n+=16 )
    11841188    {
    1185      
     1189
    11861190      iTemp = piOrg[n+ 0] - piCur[n+ 0]; uiSum += ( iTemp * iTemp ) >> uiShift;
    11871191      iTemp = piOrg[n+ 1] - piCur[n+ 1]; uiSum += ( iTemp * iTemp ) >> uiShift;
     
    12001204      iTemp = piOrg[n+14] - piCur[n+14]; uiSum += ( iTemp * iTemp ) >> uiShift;
    12011205      iTemp = piOrg[n+15] - piCur[n+15]; uiSum += ( iTemp * iTemp ) >> uiShift;
    1202      
    1203     }
    1204     piOrg += iStrideOrg;
    1205     piCur += iStrideCur;
    1206   }
    1207  
     1206
     1207    }
     1208    piOrg += iStrideOrg;
     1209    piCur += iStrideCur;
     1210  }
     1211
    12081212  return ( uiSum );
    12091213}
     
    12211225  Int  iStrideOrg = pcDtParam->iStrideOrg;
    12221226  Int  iStrideCur = pcDtParam->iStrideCur;
    1223  
     1227
    12241228  UInt uiSum = 0;
    12251229  UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1);
    12261230  Int  iTemp;
    1227  
     1231
    12281232  for( ; iRows != 0; iRows-- )
    12291233  {
    1230    
     1234
    12311235    iTemp = piOrg[ 0] - piCur[ 0]; uiSum += ( iTemp * iTemp ) >> uiShift;
    12321236    iTemp = piOrg[ 1] - piCur[ 1]; uiSum += ( iTemp * iTemp ) >> uiShift;
     
    12611265    iTemp = piOrg[30] - piCur[30]; uiSum += ( iTemp * iTemp ) >> uiShift;
    12621266    iTemp = piOrg[31] - piCur[31]; uiSum += ( iTemp * iTemp ) >> uiShift;
    1263    
    1264     piOrg += iStrideOrg;
    1265     piCur += iStrideCur;
    1266   }
    1267  
     1267
     1268    piOrg += iStrideOrg;
     1269    piCur += iStrideCur;
     1270  }
     1271
    12681272  return ( uiSum );
    12691273}
     
    12811285  Int  iStrideOrg = pcDtParam->iStrideOrg;
    12821286  Int  iStrideCur = pcDtParam->iStrideCur;
    1283  
     1287
    12841288  UInt uiSum = 0;
    12851289  UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1);
    12861290  Int  iTemp;
    1287  
     1291
    12881292  for( ; iRows != 0; iRows-- )
    12891293  {
     
    13521356    iTemp = piOrg[62] - piCur[62]; uiSum += ( iTemp * iTemp ) >> uiShift;
    13531357    iTemp = piOrg[63] - piCur[63]; uiSum += ( iTemp * iTemp ) >> uiShift;
    1354    
    1355     piOrg += iStrideOrg;
    1356     piCur += iStrideCur;
    1357   }
    1358  
     1358
     1359    piOrg += iStrideOrg;
     1360    piCur += iStrideCur;
     1361  }
     1362
    13591363  return ( uiSum );
    13601364}
     
    13761380  m[2] = diff[0] - diff[2];
    13771381  m[3] = diff[1] - diff[3];
    1378  
     1382
    13791383  satd += abs(m[0] + m[1]);
    13801384  satd += abs(m[0] - m[1]);
    13811385  satd += abs(m[2] + m[3]);
    13821386  satd += abs(m[2] - m[3]);
    1383  
     1387
    13841388  return satd;
    13851389}
     
    13881392{
    13891393  Int k, satd = 0, diff[16], m[16], d[16];
    1390  
     1394
    13911395  assert( iStep == 1 );
    13921396  for( k = 0; k < 16; k+=4 )
     
    13961400    diff[k+2] = piOrg[2] - piCur[2];
    13971401    diff[k+3] = piOrg[3] - piCur[3];
    1398    
    1399     piCur += iStrideCur;
    1400     piOrg += iStrideOrg;
    1401   }
    1402  
     1402
     1403    piCur += iStrideCur;
     1404    piOrg += iStrideOrg;
     1405  }
     1406
    14031407  /*===== hadamard transform =====*/
    14041408  m[ 0] = diff[ 0] + diff[12];
     
    14181422  m[14] = diff[ 2] - diff[14];
    14191423  m[15] = diff[ 3] - diff[15];
    1420  
     1424
    14211425  d[ 0] = m[ 0] + m[ 4];
    14221426  d[ 1] = m[ 1] + m[ 5];
     
    14351439  d[14] = m[14] - m[10];
    14361440  d[15] = m[15] - m[11];
    1437  
     1441
    14381442  m[ 0] = d[ 0] + d[ 3];
    14391443  m[ 1] = d[ 1] + d[ 2];
     
    14521456  m[14] = d[13] - d[14];
    14531457  m[15] = d[12] - d[15];
    1454  
     1458
    14551459  d[ 0] = m[ 0] + m[ 1];
    14561460  d[ 1] = m[ 0] - m[ 1];
     
    14691473  d[14] = m[14] + m[15];
    14701474  d[15] = m[15] - m[14];
    1471  
     1475
    14721476  for (k=0; k<16; ++k)
    14731477  {
     
    14751479  }
    14761480  satd = ((satd+1)>>1);
    1477  
     1481
    14781482  return satd;
    14791483}
     
    14941498    diff[k+6] = piOrg[6] - piCur[6];
    14951499    diff[k+7] = piOrg[7] - piCur[7];
    1496    
    1497     piCur += iStrideCur;
    1498     piOrg += iStrideOrg;
    1499   }
    1500  
     1500
     1501    piCur += iStrideCur;
     1502    piOrg += iStrideOrg;
     1503  }
     1504
    15011505  //horizontal
    15021506  for (j=0; j < 8; j++)
     
    15111515    m2[j][6] = diff[jj+2] - diff[jj+6];
    15121516    m2[j][7] = diff[jj+3] - diff[jj+7];
    1513    
     1517
    15141518    m1[j][0] = m2[j][0] + m2[j][2];
    15151519    m1[j][1] = m2[j][1] + m2[j][3];
     
    15201524    m1[j][6] = m2[j][4] - m2[j][6];
    15211525    m1[j][7] = m2[j][5] - m2[j][7];
    1522    
     1526
    15231527    m2[j][0] = m1[j][0] + m1[j][1];
    15241528    m2[j][1] = m1[j][0] - m1[j][1];
     
    15301534    m2[j][7] = m1[j][6] - m1[j][7];
    15311535  }
    1532  
     1536
    15331537  //vertical
    15341538  for (i=0; i < 8; i++)
     
    15421546    m3[6][i] = m2[2][i] - m2[6][i];
    15431547    m3[7][i] = m2[3][i] - m2[7][i];
    1544    
     1548
    15451549    m1[0][i] = m3[0][i] + m3[2][i];
    15461550    m1[1][i] = m3[1][i] + m3[3][i];
     
    15511555    m1[6][i] = m3[4][i] - m3[6][i];
    15521556    m1[7][i] = m3[5][i] - m3[7][i];
    1553    
     1557
    15541558    m2[0][i] = m1[0][i] + m1[1][i];
    15551559    m2[1][i] = m1[0][i] - m1[1][i];
     
    15611565    m2[7][i] = m1[6][i] - m1[7][i];
    15621566  }
    1563  
     1567
    15641568  for (i = 0; i < 8; i++)
    15651569  {
     
    15691573    }
    15701574  }
    1571  
     1575
    15721576  sad=((sad+2)>>2);
    1573  
     1577
    15741578  return sad;
    15751579}
     
    16811685  //vertical
    16821686  for (i=0; i < 16; i++)
    1683   {   
     1687  {
    16841688    m2[0][i] = m1[0][i] + m1[2][i];
    16851689    m2[1][i] = m1[1][i] + m1[3][i];
     
    18381842  Int  iOffsetOrg = iStrideOrg<<2;
    18391843  Int  iOffsetCur = iStrideCur<<2;
    1840  
    1841   UInt uiSum = 0;
    1842  
     1844
     1845  UInt uiSum = 0;
     1846
    18431847  for ( y=0; y<iRows; y+= 4 )
    18441848  {
     
    18471851    piCur += iOffsetCur;
    18481852  }
    1849  
     1853
    18501854  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
    18511855}
     
    18641868  Int  iStep  = pcDtParam->iStep;
    18651869  Int  y;
    1866  
    1867   UInt uiSum = 0;
    1868  
     1870
     1871  UInt uiSum = 0;
     1872
    18691873  if ( iRows == 4 )
    18701874  {
     
    18831887    }
    18841888  }
    1885  
     1889
    18861890  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
    18871891}
     
    19001904  Int  iStrideOrg = pcDtParam->iStrideOrg;
    19011905  Int  iStep  = pcDtParam->iStep;
    1902  
     1906
    19031907  Int  x, y;
    1904  
    1905   UInt uiSum = 0;
    1906  
     1908
     1909  UInt uiSum = 0;
     1910
    19071911#if NS_HAD
    19081912  if( ( ( iRows % 8 == 0) && (iCols % 8 == 0) && ( iRows == iCols ) ) || ( ( iRows % 8 == 0 ) && (iCols % 8 == 0) && !pcDtParam->bUseNSHAD ) )
     
    19241928  }
    19251929#if NS_HAD
    1926   else if ( ( iCols > 8 ) && ( iCols > iRows ) && pcDtParam->bUseNSHAD ) 
     1930  else if ( ( iCols > 8 ) && ( iCols > iRows ) && pcDtParam->bUseNSHAD )
    19271931  {
    19281932    Int  iOffsetOrg = iStrideOrg<<2;
     
    19381942    }
    19391943  }
    1940   else if ( ( iRows > 8 ) && ( iCols < iRows ) && pcDtParam->bUseNSHAD ) 
     1944  else if ( ( iRows > 8 ) && ( iCols < iRows ) && pcDtParam->bUseNSHAD )
    19411945  {
    19421946    Int  iOffsetOrg = iStrideOrg<<4;
     
    19571961    Int  iOffsetOrg = iStrideOrg<<2;
    19581962    Int  iOffsetCur = iStrideCur<<2;
    1959    
     1963
    19601964    for ( y=0; y<iRows; y+= 4 )
    19611965    {
     
    19861990    assert(false);
    19871991  }
    1988  
     1992
    19891993  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
    19901994}
  • trunk/source/Lib/TLibCommon/TComRom.cpp

    r442 r494  
    8686// Data structure related table & variable
    8787// ====================================================================================================================
    88 
     88#if LAYER_CTB
     89UInt g_auiLayerMaxCUWidth[MAX_LAYERS];
     90UInt g_auiLayerMaxCUHeight[MAX_LAYERS];
     91UInt g_auiLayerMaxCUDepth[MAX_LAYERS];
     92UInt g_auiLayerAddCUDepth[MAX_LAYERS];
     93UInt g_auiLayerZscanToRaster[MAX_LAYERS][ MAX_NUM_SPU_W*MAX_NUM_SPU_W ];
     94UInt g_auiLayerRasterToZscan[MAX_LAYERS][ MAX_NUM_SPU_W*MAX_NUM_SPU_W ];
     95UInt g_auiLayerRasterToPelX[MAX_LAYERS][ MAX_NUM_SPU_W*MAX_NUM_SPU_W ];
     96UInt g_auiLayerRasterToPelY[MAX_LAYERS][ MAX_NUM_SPU_W*MAX_NUM_SPU_W ];
     97#endif
    8998UInt g_uiMaxCUWidth  = MAX_CU_SIZE;
    9099UInt g_uiMaxCUHeight = MAX_CU_SIZE;
     
    312321UInt g_uiPCMBitDepthLuma     = 8;    // PCM bit-depth
    313322UInt g_uiPCMBitDepthChroma   = 8;    // PCM bit-depth
    314 
     323#if O0194_DIFFERENT_BITDEPTH_EL_BL
     324Int  g_bitDepthYLayer[MAX_LAYERS];
     325Int  g_bitDepthCLayer[MAX_LAYERS];
     326
     327UInt g_uiPCMBitDepthLumaDec[MAX_LAYERS];    // PCM bit-depth
     328UInt g_uiPCMBitDepthChromaDec[MAX_LAYERS];    // PCM bit-depth
     329#endif
     330#if O0194_WEIGHTED_PREDICTION_CGS
     331void * g_refWeightACDCParam; // type=wpACDCParam
     332#endif
    315333// ====================================================================================================================
    316334// Misc.
  • trunk/source/Lib/TLibCommon/TComRom.h

    r442 r494  
    8181
    8282// global variable (LCU width/height, max. CU depth)
     83#if LAYER_CTB
     84extern       UInt g_auiLayerMaxCUWidth[MAX_LAYERS];
     85extern       UInt g_auiLayerMaxCUHeight[MAX_LAYERS];
     86extern       UInt g_auiLayerMaxCUDepth[MAX_LAYERS];
     87extern       UInt g_auiLayerAddCUDepth[MAX_LAYERS];
     88extern       UInt g_auiLayerZscanToRaster[MAX_LAYERS][ MAX_NUM_SPU_W*MAX_NUM_SPU_W ];
     89extern       UInt g_auiLayerRasterToZscan[MAX_LAYERS][ MAX_NUM_SPU_W*MAX_NUM_SPU_W ];
     90extern       UInt g_auiLayerRasterToPelX[MAX_LAYERS][ MAX_NUM_SPU_W*MAX_NUM_SPU_W ];
     91extern       UInt g_auiLayerRasterToPelY[MAX_LAYERS][ MAX_NUM_SPU_W*MAX_NUM_SPU_W ];
     92#endif
    8393extern       UInt g_uiMaxCUWidth;
    8494extern       UInt g_uiMaxCUHeight;
  • trunk/source/Lib/TLibCommon/TComSlice.cpp

    r442 r494  
    7575, m_iDepth                        ( 0 )
    7676, m_bRefenced                     ( false )
    77 #if POC_RESET_FLAG
    78 , m_bPocResetFlag                 ( false )
    79 #endif
    80 #if SH_DISCARDABLE_FLAG
    81 , m_bDiscardableFlag              ( false )
    82 #endif
    8377, m_pcSPS                         ( NULL )
    8478, m_pcPPS                         ( NULL )
     
    9387#endif
    9488, m_uiTLayer                      ( 0 )
    95 #if SVC_EXTENSION
    96 , m_layerId                     ( 0 )
    97 #endif
    9889, m_bTLayerSwitchingFlag          ( false )
    9990, m_sliceMode                   ( 0 )
     
    118109, m_temporalLayerNonReferenceFlag ( false )
    119110, m_enableTMVPFlag                ( true )
     111#if SVC_EXTENSION
     112, m_layerId                     ( 0 )
     113#if REF_IDX_MFM
     114, m_bMFMEnabledFlag               ( false )
     115#endif
     116#if POC_RESET_FLAG
     117, m_bPocResetFlag                 ( false )
     118#endif
     119, m_bDiscardableFlag              ( false )
     120#endif //SVC_EXTENSION
    120121{
    121122  m_aiNumRefIdx[0] = m_aiNumRefIdx[1] = 0;
     
    138139  m_interLayerSamplePredOnlyFlag = false;
    139140#endif
    140 #endif
     141#endif //SVC_EXTENSION
    141142
    142143  initEqualRef();
     
    455456    UInt refLayerIdc = m_interLayerPredLayerIdc[i];
    456457    //inter-layer reference picture
    457 
    458 #if ILR_RESTR
     458#if O0225_MAX_TID_FOR_REF_LAYERS
     459    Int maxTidIlRefPicsPlus1 = ( m_layerId > 0 && m_activeNumILRRefIdx > 0)? m_pcVPS->getMaxTidIlRefPicsPlus1(ilpPic[refLayerIdc]->getSlice(0)->getLayerId(),m_layerId) : 0;
     460#else
    459461    Int maxTidIlRefPicsPlus1 = ( m_layerId > 0 && m_activeNumILRRefIdx > 0)? m_pcVPS->getMaxTidIlRefPicsPlus1(ilpPic[refLayerIdc]->getSlice(0)->getLayerId()) : 0;
     462#endif
    460463    if( m_layerId > 0 && m_activeNumILRRefIdx > 0 && ( ( (Int)(ilpPic[refLayerIdc]->getSlice(0)->getTLayer())<=  maxTidIlRefPicsPlus1-1) || (maxTidIlRefPicsPlus1==0 && ilpPic[refLayerIdc]->getSlice(0)->getRapPicFlag()) )  )
    461 #else //#if ILR_RESTR
    462     if( m_layerId > 0 && m_activeNumILRRefIdx > 0 )
    463 #endif //#if ILR_RESTR
    464464    {
    465465#if REF_IDX_MFM
     
    485485  TComPic*  rpsCurrList1[MAX_NUM_REF+1];
    486486#if SVC_EXTENSION
    487 #if ILR_RESTR
    488487  Int numInterLayerRPSPics = 0;
    489488#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     
    495494    for( i=0; i < m_pcVPS->getNumDirectRefLayers( m_layerId ); i++ )
    496495    {
     496#if O0225_MAX_TID_FOR_REF_LAYERS
     497      Int maxTidIlRefPicsPlus1 = getVPS()->getMaxTidIlRefPicsPlus1(ilpPic[i]->getSlice(0)->getLayerId(),m_layerId);
     498#else
    497499      Int maxTidIlRefPicsPlus1 = getVPS()->getMaxTidIlRefPicsPlus1(ilpPic[i]->getSlice(0)->getLayerId());
     500#endif
    498501      if( ((Int)(ilpPic[i]->getSlice(0)->getTLayer())<= maxTidIlRefPicsPlus1-1) || (maxTidIlRefPicsPlus1==0 && ilpPic[i]->getSlice(0)->getRapPicFlag() ) )
    499502      {
     
    574577#endif
    575578  }
    576 #endif
    577579#if JCTVC_M0458_INTERLAYER_RPS_SIG
    578580  Int numPocTotalCurr = NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr + m_activeNumILRRefIdx;
     
    580582  Int numPocTotalCurr = NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr + m_numILRRefIdx;
    581583#endif
    582 #else
     584#else //SVC_EXTENSION
    583585  Int numPocTotalCurr = NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr;
    584 #endif
     586#endif //SVC_EXTENSION
    585587#if FIX1071
    586588  if (checkNumPocTotalCurr)
     
    631633#if RPL_INIT_N0316_N0082
    632634    if( m_layerId > 0 )
    633     {
     635    {     
    634636#if JCTVC_M0458_INTERLAYER_RPS_SIG
    635637      for( i = 0; i < m_activeNumILRRefIdx && cIdx < numPocTotalCurr; cIdx ++, i ++)     
     
    639641      {
    640642        Int refLayerIdc = m_interLayerPredLayerIdc[i];
    641 #if ILR_RESTR
     643#if O0225_MAX_TID_FOR_REF_LAYERS
     644        Int maxTidIlRefPicsPlus1 = getVPS()->getMaxTidIlRefPicsPlus1(ilpPic[refLayerIdc]->getSlice(0)->getLayerId(),m_layerId);
     645#else
    642646        Int maxTidIlRefPicsPlus1 = getVPS()->getMaxTidIlRefPicsPlus1(ilpPic[refLayerIdc]->getSlice(0)->getLayerId());
     647#endif
    643648        if( ((Int)(ilpPic[refLayerIdc]->getSlice(0)->getTLayer())<=maxTidIlRefPicsPlus1-1) || (maxTidIlRefPicsPlus1==0 && ilpPic[refLayerIdc]->getSlice(0)->getRapPicFlag()) )
    644 #endif
     649        {
    645650          rpsCurrList0[cIdx] = ilpPic[refLayerIdc];
    646       }
    647     }
    648 #endif
    649 #endif
     651        }
     652      }
     653    }
     654#endif
     655#endif //SVC_EXTENSION
    650656    for ( i=0; i<NumPocStCurr1; i++, cIdx++)
    651657    {
     
    667673      {
    668674        Int refLayerIdc = m_interLayerPredLayerIdc[i];
    669 #if ILR_RESTR
    670          Int maxTidIlRefPicsPlus1 = getVPS()->getMaxTidIlRefPicsPlus1(ilpPic[refLayerIdc]->getSlice(0)->getLayerId());
     675#if O0225_MAX_TID_FOR_REF_LAYERS
     676        Int maxTidIlRefPicsPlus1 = getVPS()->getMaxTidIlRefPicsPlus1(ilpPic[refLayerIdc]->getSlice(0)->getLayerId(),m_layerId);
     677#else
     678        Int maxTidIlRefPicsPlus1 = getVPS()->getMaxTidIlRefPicsPlus1(ilpPic[refLayerIdc]->getSlice(0)->getLayerId());
     679#endif
    671680        if( ((Int)(ilpPic[refLayerIdc]->getSlice(0)->getTLayer())<=maxTidIlRefPicsPlus1-1) || (maxTidIlRefPicsPlus1==0 && ilpPic[refLayerIdc]->getSlice(0)->getRapPicFlag()) )
    672 #endif
    673         rpsCurrList0[cIdx] = ilpPic[refLayerIdc];
     681        {
     682          rpsCurrList0[cIdx] = ilpPic[refLayerIdc];
     683        }
    674684      }
    675685    }
     
    704714      {
    705715        Int refLayerIdc = m_interLayerPredLayerIdc[i];
    706 #if ILR_RESTR
     716#if O0225_MAX_TID_FOR_REF_LAYERS
     717        Int maxTidIlRefPicsPlus1 = getVPS()->getMaxTidIlRefPicsPlus1(ilpPic[refLayerIdc]->getSlice(0)->getLayerId(),m_layerId);
     718#else
    707719        Int maxTidIlRefPicsPlus1 = getVPS()->getMaxTidIlRefPicsPlus1(ilpPic[refLayerIdc]->getSlice(0)->getLayerId());
     720#endif
    708721        if( ((Int)(ilpPic[refLayerIdc]->getSlice(0)->getTLayer())<=maxTidIlRefPicsPlus1-1) || (maxTidIlRefPicsPlus1==0 && ilpPic[refLayerIdc]->getSlice(0)->getRapPicFlag()) )
    709 #endif
    710         rpsCurrList1[cIdx] = ilpPic[refLayerIdc];
    711       }
    712     }
    713 #endif
     722        {
     723          rpsCurrList1[cIdx] = ilpPic[refLayerIdc];
     724        }
     725      }
     726    }
     727#endif //SVC_EXTENSION
    714728
    715729    assert(cIdx == numPocTotalCurr);
     
    781795#if N0147_IRAP_ALIGN_FLAG
    782796  hasModification = hasModification && ( m_aiNumRefIdx[REF_PIC_LIST_0] > 1 );
    783 #endif
    784 #if FINAL_RPL_CHANGE_N0082
    785   hasModification = false; //modification is not necessary
    786797#endif
    787798  refPicListModification->setRefPicListModificationFlagL0(hasModification);
     
    11331144#if SVC_EXTENSION
    11341145  m_pcVPS                = pSrc->m_pcVPS;
     1146  m_layerId              = pSrc->m_layerId;
    11351147#if JCTVC_M0458_INTERLAYER_RPS_SIG
    11361148  m_activeNumILRRefIdx         = pSrc->m_activeNumILRRefIdx;
     
    18471859  return retVal;
    18481860}
     1861#if AUXILIARY_PICTURES
     1862ChromaFormat TComSlice::getChromaFormatIdc()
     1863#else
    18491864UInt TComSlice::getChromaFormatIdc()
     1865#endif
     1866{
     1867  TComSPS *sps = getSPS();
     1868  TComVPS *vps = getVPS();
     1869#if AUXILIARY_PICTURES
     1870  ChromaFormat retVal;
     1871  UInt layerId = getLayerId();
     1872#else
     1873  UInt retVal, layerId = getLayerId();
     1874#endif
     1875  if( ( layerId == 0 ) || sps->getUpdateRepFormatFlag() )
     1876  {
     1877    retVal = sps->getChromaFormatIdc();
     1878  }
     1879  else
     1880  {
     1881    retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerId) )->getChromaFormatVpsIdc();
     1882  }
     1883  return retVal;
     1884}
     1885UInt TComSlice::getBitDepthY()
    18501886{
    18511887  TComSPS *sps = getSPS();
     
    18541890  if( ( layerId == 0 ) || sps->getUpdateRepFormatFlag() )
    18551891  {
    1856     retVal = sps->getChromaFormatIdc();
     1892    retVal = sps->getBitDepthY();
    18571893  }
    18581894  else
    18591895  {
    1860     retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerId) )->getChromaFormatVpsIdc();
     1896    retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerId) )->getBitDepthVpsLuma();
    18611897  }
    18621898  return retVal;
    18631899}
    1864 UInt TComSlice::getBitDepthY()
     1900UInt TComSlice::getBitDepthC()
    18651901{
    18661902  TComSPS *sps = getSPS();
     
    18691905  if( ( layerId == 0 ) || sps->getUpdateRepFormatFlag() )
    18701906  {
    1871     retVal = sps->getBitDepthY();
     1907    retVal = sps->getBitDepthC();
    18721908  }
    18731909  else
    18741910  {
    1875     retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerId) )->getBitDepthVpsLuma();
     1911    retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerId) )->getBitDepthVpsChroma();
    18761912  }
    18771913  return retVal;
    18781914}
    1879 UInt TComSlice::getBitDepthC()
    1880 {
    1881   TComSPS *sps = getSPS();
    1882   TComVPS *vps = getVPS();
    1883   UInt retVal, layerId = getLayerId();
    1884   if( ( layerId == 0 ) || sps->getUpdateRepFormatFlag() )
    1885   {
    1886     retVal = sps->getBitDepthC();
    1887   }
    1888   else
    1889   {
    1890     retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerId) )->getBitDepthVpsChroma();
    1891   }
    1892   return retVal;
    1893 }
    18941915Int TComSlice::getQpBDOffsetY()
    18951916{
     
    19021923
    19031924RepFormat::RepFormat()
     1925#if AUXILIARY_PICTURES
     1926: m_chromaFormatVpsIdc          (CHROMA_420)
     1927#else
    19041928: m_chromaFormatVpsIdc          (0)
     1929#endif
    19051930, m_separateColourPlaneVpsFlag  (false)
    19061931, m_picWidthVpsInLumaSamples    (0)
     
    19141939// Video parameter set (VPS)
    19151940// ------------------------------------------------------------------------------------------------
     1941#if SVC_EXTENSION
    19161942TComVPS::TComVPS()
    19171943: m_VPSId                     (  0)
     
    19331959, m_numOutputLayerSets        (0) 
    19341960#endif
    1935 #if VPS_PROFILE_OUTPUT_LAYERS
    19361961, m_numProfileTierLevel       (0)
    19371962, m_moreOutputLayerSetsThanDefaultFlag (false)
    19381963, m_numAddOutputLayerSets     (0)
    19391964, m_defaultOneTargetOutputLayerFlag    (false)
    1940 #endif
    19411965#if VPS_VUI_BITRATE_PICRATE
    19421966, m_bitRatePresentVpsFlag     (false)
     
    19922016  ::memset(m_numLayerInIdList,     0, sizeof(m_numLayerInIdList   ));
    19932017#endif
    1994 #if VPS_PROFILE_OUTPUT_LAYERS
    19952018  ::memset(m_profileLevelTierIdx,  0, sizeof(m_profileLevelTierIdx));
    1996 #endif
    19972019#if JCTVC_M0458_INTERLAYER_RPS_SIG
    19982020  m_maxOneActiveRefLayerFlag = true;
     2021#endif
     2022#if O0062_POC_LSB_NOT_PRESENT_FLAG
     2023  ::memset(m_pocLsbNotPresentFlag, 0, sizeof(m_pocLsbNotPresentFlag));
    19992024#endif
    20002025#if N0147_IRAP_ALIGN_FLAG
     
    20072032  for( Int i = 0; i < MAX_VPS_LAYER_ID_PLUS1 - 1; i++)
    20082033  {
     2034#if O0225_MAX_TID_FOR_REF_LAYERS
     2035  for( Int j = 0; j < MAX_VPS_LAYER_ID_PLUS1; j++)
     2036  {
     2037    m_maxTidIlRefPicsPlus1[i][j] = m_uiMaxTLayers + 1;
     2038  }
     2039#else
    20092040    m_maxTidIlRefPicsPlus1[i] = m_uiMaxTLayers + 1;
     2041#endif
    20102042  }
    20112043#endif
     
    20342066#endif
    20352067}
     2068#else
     2069TComVPS::TComVPS()
     2070: m_VPSId                     (  0)
     2071, m_uiMaxTLayers              (  1)
     2072, m_uiMaxLayers               (  1)
     2073, m_bTemporalIdNestingFlag    (false)
     2074, m_numHrdParameters          (  0)
     2075, m_maxNuhReservedZeroLayerId (  0)
     2076, m_hrdParameters             (NULL)
     2077, m_hrdOpSetIdx               (NULL)
     2078, m_cprmsPresentFlag          (NULL)
     2079{
     2080  for( Int i = 0; i < MAX_TLAYER; i++)
     2081  {
     2082    m_numReorderPics[i] = 0;
     2083    m_uiMaxDecPicBuffering[i] = 1;
     2084    m_uiMaxLatencyIncrease[i] = 0;
     2085  }
     2086}
     2087#endif //SVC_EXTENSION
    20362088
    20372089TComVPS::~TComVPS()
     
    21632215, m_vuiParametersPresentFlag  (false)
    21642216, m_vuiParameters             ()
     2217#if SVC_EXTENSION
    21652218#if M0463_VUI_EXT_ILP_REF
    21662219, m_interViewMvVertConstraintFlag (false)
    21672220, m_numIlpRestrictedRefLayers ( 0 )
    21682221#endif
    2169 #if SVC_EXTENSION
    2170 , m_layerId(0)
    2171 #endif
    2172 #if SCALED_REF_LAYER_OFFSETS
    2173 , m_numScaledRefLayerOffsets  (0)
    2174 #endif
     2222, m_layerId                   ( 0 )
     2223, m_numScaledRefLayerOffsets  ( 0 )
    21752224#if REPN_FORMAT_IN_VPS
    21762225, m_updateRepFormatFlag       (false)
    21772226#endif
     2227#endif //SVC_EXTENSION
    21782228{
    21792229  for ( Int i = 0; i < MAX_TLAYER; i++ )
     
    30383088#endif
    30393089}
    3040 #endif
     3090
     3091#if MFM_ENCCONSTRAINT
     3092TComPic* TComSlice::getBaseColPic(  TComList<TComPic*>& rcListPic )
     3093{
     3094#if POC_RESET_FLAG
     3095  return xGetRefPic( rcListPic, m_bPocResetFlag ? 0 : m_iPOC );
     3096#else
     3097  return xGetRefPic( rcListPic, m_iPOC );
     3098#endif
     3099}
     3100#endif
    30413101
    30423102#if REF_IDX_MFM
     
    30853145#endif
    30863146
     3147Void TComSlice::setILRPic(TComPic **pcIlpPic)
     3148{
     3149  for( Int i = 0; i < m_activeNumILRRefIdx; i++ )
     3150  {
     3151    Int refLayerIdc = m_interLayerPredLayerIdc[i];
     3152
     3153    if( pcIlpPic[refLayerIdc] )
     3154    {
     3155      pcIlpPic[refLayerIdc]->copyUpsampledPictureYuv( m_pcPic->getFullPelBaseRec( refLayerIdc ), pcIlpPic[refLayerIdc]->getPicYuvRec() );
     3156      pcIlpPic[refLayerIdc]->getSlice(0)->setPOC( m_iPOC );
     3157      pcIlpPic[refLayerIdc]->setLayerId( m_pcBaseColPic[refLayerIdc]->getLayerId() ); //set reference layerId
     3158      pcIlpPic[refLayerIdc]->getPicYuvRec()->setBorderExtension( false );
     3159      pcIlpPic[refLayerIdc]->getPicYuvRec()->extendPicBorder();
     3160      for (Int j=0; j<pcIlpPic[refLayerIdc]->getPicSym()->getNumberOfCUsInFrame(); j++)    // set reference CU layerId
     3161      {
     3162        pcIlpPic[refLayerIdc]->getPicSym()->getCU(j)->setLayerId( pcIlpPic[refLayerIdc]->getLayerId() );
     3163      }
     3164    }
     3165  }
     3166}
     3167
     3168#endif //SVC_EXTENSION
     3169
    30873170//! \}
  • trunk/source/Lib/TLibCommon/TComSlice.h

    r442 r494  
    436436class RepFormat
    437437{
     438#if AUXILIARY_PICTURES
     439  ChromaFormat m_chromaFormatVpsIdc;
     440#else
    438441  Int  m_chromaFormatVpsIdc;
     442#endif
    439443  Bool m_separateColourPlaneVpsFlag;
    440444  Int  m_picWidthVpsInLumaSamples;
     
    446450  RepFormat();
    447451
     452#if AUXILIARY_PICTURES
     453  ChromaFormat getChromaFormatVpsIdc()        { return m_chromaFormatVpsIdc; }
     454  Void setChromaFormatVpsIdc(ChromaFormat x)  { m_chromaFormatVpsIdc = x;    }
     455#else
    448456  Int  getChromaFormatVpsIdc()        { return m_chromaFormatVpsIdc; }
    449457  Void setChromaFormatVpsIdc(Int x)   { m_chromaFormatVpsIdc = x;    }
     458#endif
    450459
    451460  Bool getSeparateColourPlaneVpsFlag()        { return m_separateColourPlaneVpsFlag; }
     
    484493  UInt*       m_hrdOpSetIdx;
    485494  Bool*       m_cprmsPresentFlag;
     495#if !SVC_EXTENSION
     496  UInt        m_numOpSets;
     497  Bool        m_layerIdIncludedFlag[MAX_VPS_OP_SETS_PLUS1][MAX_VPS_NUH_RESERVED_ZERO_LAYER_ID_PLUS1];
     498#endif
     499  TComPTL     m_pcPTL;
     500  TimingInfo  m_timingInfo;
     501
     502#if SVC_EXTENSION
     503#if DERIVE_LAYER_ID_LIST_VARIABLES
     504  Int         m_layerSetLayerIdList[MAX_VPS_LAYER_SETS_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
     505  Int         m_numLayerInIdList[MAX_VPS_LAYER_SETS_PLUS1];
     506#endif
     507#if IL_SL_SIGNALLING_N0371
     508  Bool        m_scalingListLayerDependency[MAX_LAYERS][MAX_LAYERS];  // layer dependency for scaling list
     509#endif
     510#if VPS_EXTN_OFFSET
     511  UInt        m_extensionOffset;
     512#endif
    486513#if VPS_RENAME
    487514  UInt        m_maxLayerId;
    488515  UInt        m_numLayerSets;
    489516  Bool        m_layerIdIncludedFlag[MAX_VPS_LAYER_SETS_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
    490 #else
    491   UInt        m_numOpSets;
    492   Bool        m_layerIdIncludedFlag[MAX_VPS_OP_SETS_PLUS1][MAX_VPS_NUH_RESERVED_ZERO_LAYER_ID_PLUS1];
    493 #endif
    494 #if DERIVE_LAYER_ID_LIST_VARIABLES
    495   Int         m_layerSetLayerIdList[MAX_VPS_LAYER_SETS_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
    496   Int         m_numLayerInIdList[MAX_VPS_LAYER_SETS_PLUS1];
    497 #endif
    498 #if IL_SL_SIGNALLING_N0371
    499   Bool        m_scalingListLayerDependency[MAX_LAYERS][MAX_LAYERS];  // layer dependency for scaling list
    500 #endif
    501 #if VPS_EXTN_OFFSET
    502   UInt        m_extensionOffset;
    503 #endif
    504   TComPTL     m_pcPTL;
    505   TimingInfo  m_timingInfo;
     517#endif
    506518
    507519  // ------------------------------------------
     
    546558#endif
    547559#endif
    548 #if VPS_PROFILE_OUTPUT_LAYERS
    549560  UInt       m_numProfileTierLevel;
    550561  Bool       m_moreOutputLayerSetsThanDefaultFlag;
     
    552563  Bool       m_defaultOneTargetOutputLayerFlag;
    553564  Int        m_profileLevelTierIdx[64];     
    554 #endif
    555565#if JCTVC_M0458_INTERLAYER_RPS_SIG
    556566  Bool       m_maxOneActiveRefLayerFlag;
    557567#endif
     568#if O0062_POC_LSB_NOT_PRESENT_FLAG
     569  Bool       m_pocLsbNotPresentFlag[MAX_VPS_LAYER_ID_PLUS1];
     570#endif
    558571#if N0147_IRAP_ALIGN_FLAG
    559572  Bool       m_crossLayerIrapAlignFlag;
    560573#endif
    561574#if JCTVC_M0203_INTERLAYER_PRED_IDC
     575#if O0225_MAX_TID_FOR_REF_LAYERS
     576  UInt       m_maxTidIlRefPicsPlus1[MAX_VPS_LAYER_ID_PLUS1 - 1][MAX_VPS_LAYER_ID_PLUS1];
     577#else
    562578  UInt       m_maxTidIlRefPicsPlus1[MAX_VPS_LAYER_ID_PLUS1 - 1];
     579#endif
    563580#endif
    564581#if N0120_MAX_TID_REF_PRESENT_FLAG
     
    597614  Int         m_viewIdVal                [MAX_LAYERS];
    598615#endif
     616
     617#if O0215_PHASE_ALIGNMENT
     618  Bool       m_phaseAlignFlag;
     619#endif
     620#endif //SVC_EXTENSION
    599621public:
    600622  TComVPS();
     
    637659  UInt    getNumHrdParameters()                                 { return m_numHrdParameters; }
    638660  Void    setNumHrdParameters(UInt v)                           { m_numHrdParameters = v;    }
    639 
    640 #if VPS_RENAME
    641   UInt    getMaxLayerId()                                       { return m_maxLayerId; }
    642   Void    setMaxLayerId(UInt v)                                 { m_maxLayerId = v;    }
    643 
    644   UInt    getNumLayerSets()                                     { return m_numLayerSets; }
    645   Void    setNumLayerSets(UInt v)                               { m_numLayerSets = v;    }
    646 #else
     661 
     662#if !SVC_EXTENSION
    647663  UInt    getMaxNuhReservedZeroLayerId()                        { return m_maxNuhReservedZeroLayerId; }
    648664  Void    setMaxNuhReservedZeroLayerId(UInt v)                  { m_maxNuhReservedZeroLayerId = v;    }
     
    653669  Bool    getLayerIdIncludedFlag(UInt opsIdx, UInt id)          { return m_layerIdIncludedFlag[opsIdx][id]; }
    654670  Void    setLayerIdIncludedFlag(Bool v, UInt opsIdx, UInt id)  { m_layerIdIncludedFlag[opsIdx][id] = v;    }
     671
     672  TComPTL* getPTL() { return &m_pcPTL; }
     673  TimingInfo* getTimingInfo() { return &m_timingInfo; }
     674
     675#if SVC_EXTENSION
    655676#if DERIVE_LAYER_ID_LIST_VARIABLES
    656677  Int     getLayerSetLayerIdList(Int set, Int layerId)          { return m_layerSetLayerIdList[set][layerId]; }
     
    669690#endif
    670691
    671   TComPTL* getPTL() { return &m_pcPTL; }
    672   TimingInfo* getTimingInfo() { return &m_timingInfo; }
     692#if VPS_RENAME
     693  UInt    getMaxLayerId()                                       { return m_maxLayerId; }
     694  Void    setMaxLayerId(UInt v)                                 { m_maxLayerId = v;    }
     695
     696  UInt    getNumLayerSets()                                     { return m_numLayerSets; }
     697  Void    setNumLayerSets(UInt v)                               { m_numLayerSets = v;    }
     698#endif
    673699#if VPS_EXTN_MASK_AND_DIM_INFO
    674700  Bool   getAvcBaseLayerFlag()                                  { return m_avcBaseLayerFlag;       }
     
    743769#endif
    744770#endif
    745 #if VPS_PROFILE_OUTPUT_LAYERS
    746771  UInt   getNumProfileTierLevel()                                { return m_numProfileTierLevel; }
    747772  Void   setNumProfileTierLevel(Int x)                           { m_numProfileTierLevel = x;    }
     
    758783  Int    getProfileLevelTierIdx(Int i)                        { return m_profileLevelTierIdx[i]; }
    759784  Void   setProfileLevelTierIdx(Int i, Int x)                 { m_profileLevelTierIdx[i] = x   ; }
    760 #endif
    761785#if JCTVC_M0458_INTERLAYER_RPS_SIG
    762786  Bool   getMaxOneActiveRefLayerFlag()                                          { return m_maxOneActiveRefLayerFlag;                      }
    763787  Void   setMaxOneActiveRefLayerFlag(Bool x)                                    { m_maxOneActiveRefLayerFlag = x;                         }
    764 #endif
     788#endif
     789#if O0062_POC_LSB_NOT_PRESENT_FLAG
     790  UInt   getPocLsbNotPresentFlag(Int i)                                         { return m_pocLsbNotPresentFlag[i]; }
     791  Void   setPocLsbNotPresentFlag(Int i, Bool x)                                 { m_pocLsbNotPresentFlag[i] = x;    }
     792#endif
    765793#if N0147_IRAP_ALIGN_FLAG
    766794  Bool   getCrossLayerIrapAlignFlag()                                           { return m_crossLayerIrapAlignFlag;                      }
     
    768796#endif
    769797#if JCTVC_M0203_INTERLAYER_PRED_IDC
     798#if O0225_MAX_TID_FOR_REF_LAYERS
     799  UInt   getMaxTidIlRefPicsPlus1(Int layerId, Int refLayerId)                     { return m_maxTidIlRefPicsPlus1[layerId][refLayerId];           }
     800  Void   setMaxTidIlRefPicsPlus1(Int layerId, Int refLayerId, UInt maxSublayer)   { m_maxTidIlRefPicsPlus1[layerId][refLayerId] = maxSublayer;    }
     801#else
    770802  UInt   getMaxTidIlRefPicsPlus1(Int layerId)                     { return m_maxTidIlRefPicsPlus1[layerId];                   }
    771803  Void   setMaxTidIlRefPicsPlus1(Int layerId, UInt maxSublayer)   { m_maxTidIlRefPicsPlus1[layerId] = maxSublayer;            }
     804#endif
    772805#endif
    773806#if N0120_MAX_TID_REF_PRESENT_FLAG
     
    847880  Void    setExtensionOffset( UInt offset )    { m_extensionOffset = offset; }
    848881#endif
     882#if O0215_PHASE_ALIGNMENT
     883  Bool   getPhaseAlignFlag()                             { return m_phaseAlignFlag; }
     884  Void   setPhaseAlignFlag(Bool x)                       { m_phaseAlignFlag = x;    }
     885#endif
     886#endif //SVC_EXTENSION
    849887};
    850888
     
    924962  TComHRD m_hrdParameters;
    925963  TimingInfo m_timingInfo;
    926 #if M0464_TILE_BOUNDARY_ALIGNED_FLAG
    927   Bool m_tileBoundariesAlignedFlag;
    928 #endif
    929 
    930964
    931965public:
     
    960994    ,m_log2MaxMvLengthHorizontal(15)
    961995    ,m_log2MaxMvLengthVertical(15)
    962 #if M0464_TILE_BOUNDARY_ALIGNED_FLAG
    963     ,m_tileBoundariesAlignedFlag(true)
    964 #endif
    965996  {}
    966997
     
    10581089  TComHRD* getHrdParameters                 ()             { return &m_hrdParameters; }
    10591090  TimingInfo* getTimingInfo() { return &m_timingInfo; }
    1060 #if M0464_TILE_BOUNDARY_ALIGNED_FLAG
    1061   Bool getTileBoundariesAlignedFlag(  ) { return m_tileBoundariesAlignedFlag; }
    1062   Void setTileBoundariesAlignedFlag( Bool flag ) { m_tileBoundariesAlignedFlag = flag; }
    1063 #endif
    10641091};
    10651092
     
    10701097  Int         m_SPSId;
    10711098  Int         m_VPSId;
     1099#if AUXILIARY_PICTURES
     1100  ChromaFormat m_chromaFormatIdc;
     1101#else
    10721102  Int         m_chromaFormatIdc;
     1103#endif
    10731104
    10741105  UInt        m_uiMaxTLayers;           // maximum number of temporal layers
     
    11431174  TComPTL     m_pcPTL;
    11441175
     1176#if SVC_EXTENSION
    11451177#if M0463_VUI_EXT_ILP_REF
    11461178  Bool        m_interViewMvVertConstraintFlag;
     
    11511183#endif
    11521184
    1153 #if SVC_EXTENSION
    11541185  UInt m_layerId;
    11551186
     
    11611192#endif
    11621193
    1163 #endif
    11641194#if REF_IDX_MFM
    11651195#if !M0457_COL_PICTURE_SIGNALING
     
    11671197#endif
    11681198#endif
    1169 #if SCALED_REF_LAYER_OFFSETS
    11701199  UInt        m_numScaledRefLayerOffsets;
    11711200  Window      m_scaledRefLayerWindow[MAX_LAYERS];
    1172 #endif
    11731201#if REPN_FORMAT_IN_VPS
    11741202  Bool m_updateRepFormatFlag;
    11751203#endif
     1204#endif //SVC_EXTENSION
    11761205public:
    11771206  TComSPS();
     
    11821211  Int  getSPSId       ()         { return m_SPSId;          }
    11831212  Void setSPSId       (Int i)    { m_SPSId = i;             }
     1213
     1214#if AUXILIARY_PICTURES
     1215  ChromaFormat getChromaFormatIdc ()         { return m_chromaFormatIdc;       }
     1216  Void setChromaFormatIdc (ChromaFormat i)   { m_chromaFormatIdc = i;          }
     1217
     1218  static Int getWinUnitX (Int chromaFormatIdc) { assert (chromaFormatIdc >= 0 && chromaFormatIdc <= MAX_CHROMA_FORMAT_IDC); return m_winUnitX[chromaFormatIdc];      }
     1219  static Int getWinUnitY (Int chromaFormatIdc) { assert (chromaFormatIdc >= 0 && chromaFormatIdc <= MAX_CHROMA_FORMAT_IDC); return m_winUnitY[chromaFormatIdc];      }
     1220#else
    11841221  Int  getChromaFormatIdc ()         { return m_chromaFormatIdc;       }
    11851222  Void setChromaFormatIdc (Int i)    { m_chromaFormatIdc = i;          }
     
    11871224  static Int getWinUnitX (Int chromaFormatIdc) { assert (chromaFormatIdc > 0 && chromaFormatIdc <= MAX_CHROMA_FORMAT_IDC); return m_winUnitX[chromaFormatIdc];      }
    11881225  static Int getWinUnitY (Int chromaFormatIdc) { assert (chromaFormatIdc > 0 && chromaFormatIdc <= MAX_CHROMA_FORMAT_IDC); return m_winUnitY[chromaFormatIdc];      }
     1226#endif
    11891227 
    11901228  // structure
     
    13341372  Void     setLayerId(UInt layerId) { m_layerId = layerId; }
    13351373  UInt     getLayerId() { return m_layerId; }
    1336 #endif
    13371374#if REF_IDX_MFM
    13381375#if !M0457_COL_PICTURE_SIGNALING
     
    13411378#endif
    13421379#endif
    1343 #if SCALED_REF_LAYER_OFFSETS
    13441380  UInt     getNumScaledRefLayerOffsets()  { return m_numScaledRefLayerOffsets; }
    13451381  Void     setNumScaledRefLayerOffsets(Int x)  { m_numScaledRefLayerOffsets = x; }
    13461382  Window&  getScaledRefLayerWindow( Int x )   { return m_scaledRefLayerWindow[x]; }
    1347 #endif
    13481383#if REPN_FORMAT_IN_VPS
    13491384  Bool     getUpdateRepFormatFlag()       { return m_updateRepFormatFlag; }
    13501385  Void     setUpdateRepFormatFlag(Bool x) { m_updateRepFormatFlag = x;    }
    13511386#endif
     1387#endif //SVC_EXTENSION
    13521388};
    13531389
     
    16041640  Int64 iAC;
    16051641  Int64 iDC;
     1642#if O0194_WEIGHTED_PREDICTION_CGS
     1643  Int iSamples;
     1644#endif
    16061645} wpACDCParam;
    16071646
     
    16361675  Int         m_deblockingFilterBetaOffsetDiv2;    //< beta offset for deblocking filter
    16371676  Int         m_deblockingFilterTcOffsetDiv2;      //< tc offset for deblocking filter
    1638 #if JCTVC_M0458_INTERLAYER_RPS_SIG
    1639   Int         m_activeNumILRRefIdx;        //< Active inter-layer reference pictures
    1640   Int         m_interLayerPredLayerIdc  [MAX_VPS_LAYER_ID_PLUS1];
    1641 #else
    1642 #if SVC_EXTENSION
    1643   Int         m_numILRRefIdx;       //< for inter-layer reference picture ser
    1644 #endif
    1645 #endif
    1646 #if M0457_IL_SAMPLE_PRED_ONLY_FLAG
    1647   Int         m_numSamplePredRefLayers;
    1648   Bool        m_interLayerSamplePredOnlyFlag;
    1649 #endif
    16501677  Int         m_list1IdxToList0Idx[MAX_NUM_REF];
    16511678  Int         m_aiNumRefIdx   [2];    //  for multiple reference of current slice
     
    16641691  // referenced slice?
    16651692  Bool        m_bRefenced;
    1666  
    1667 #if POC_RESET_FLAG
    1668   Bool        m_bPocResetFlag;
    1669   Int         m_pocValueBeforeReset;
    1670 #endif 
    1671 #if SH_DISCARDABLE_FLAG
    1672   Bool        m_bDiscardableFlag;
    1673 #endif
     1693
    16741694  // access channel
    16751695  TComVPS*    m_pcVPS;
     
    16851705  UInt        m_maxNumMergeCand;
    16861706
    1687 
    16881707#if SAO_CHROMA_LAMBDA
    16891708  Double      m_dLambdaLuma;
     
    16951714  Bool        m_abEqualRef  [2][MAX_NUM_REF][MAX_NUM_REF];
    16961715  UInt        m_uiTLayer;
    1697 #if SVC_EXTENSION
    1698   UInt        m_layerId;
    1699   TComPic*    m_pcBaseColPic[MAX_LAYERS];
    1700   TComPicYuv* m_pcFullPelBaseRec[MAX_LAYERS];
    1701 #if M0457_COL_PICTURE_SIGNALING
    1702   Int         m_numMotionPredRefLayers;
    1703 #if REF_IDX_MFM
    1704   Bool        m_bMFMEnabledFlag;
    1705   Int         m_colRefLayerIdx;
    1706   Bool        m_altColIndicationFlag;
    1707   TComPic*    m_pcIlpPic;
    1708 #endif
    1709 #endif
    1710 #endif
    17111716  Bool        m_bTLayerSwitchingFlag;
    17121717
     
    17421747
    17431748  Bool       m_enableTMVPFlag;
     1749
     1750#if SVC_EXTENSION
     1751  UInt        m_layerId;
     1752  TComPic*    m_pcBaseColPic[MAX_LAYERS];
     1753  TComPicYuv* m_pcFullPelBaseRec[MAX_LAYERS];
     1754#if M0457_COL_PICTURE_SIGNALING
     1755  Int         m_numMotionPredRefLayers;
     1756#if REF_IDX_MFM
     1757  Bool        m_bMFMEnabledFlag;
     1758  Int         m_colRefLayerIdx;
     1759  Bool        m_altColIndicationFlag;
     1760  TComPic*    m_pcIlpPic;
     1761#endif
     1762#endif
     1763
    17441764#if JCTVC_M0458_INTERLAYER_RPS_SIG
    1745   Bool       m_interLayerPredEnabledFlag;
     1765  Bool        m_interLayerPredEnabledFlag;
     1766  Int         m_activeNumILRRefIdx;        //< Active inter-layer reference pictures
     1767  Int         m_interLayerPredLayerIdc  [MAX_VPS_LAYER_ID_PLUS1];
     1768#else
     1769#if SVC_EXTENSION
     1770  Int         m_numILRRefIdx;       //< for inter-layer reference picture ser
     1771#endif
    17461772#endif
     1773#if M0457_IL_SAMPLE_PRED_ONLY_FLAG
     1774  Int         m_numSamplePredRefLayers;
     1775  Bool        m_interLayerSamplePredOnlyFlag;
     1776#endif
     1777#if POC_RESET_FLAG
     1778  Bool        m_bPocResetFlag;
     1779  Int         m_pocValueBeforeReset;
     1780#endif 
     1781  Bool        m_bDiscardableFlag;
     1782#endif //SVC_EXTENSION
     1783
    17471784public:
    17481785  TComSlice();
     
    18181855  Bool      getMvdL1ZeroFlag ()                                  { return m_bLMvdL1Zero;    }
    18191856  Int       getNumRpsCurrTempList();
    1820 #if RPL_INIT_N0316_N0082
    1821   Int       getNumNegativeRpsCurrTempList();
    1822 #endif
    18231857  Int       getList1IdxToList0Idx ( Int list1Idx )               { return m_list1IdxToList0Idx[list1Idx]; }
    18241858  Void      setReferenced(Bool b)                               { m_bRefenced = b; }
     
    18311865  Bool      getIdrPicFlag       ()                              { return getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP; }
    18321866  Bool      isIRAP              () const                        { return (getNalUnitType() >= 16) && (getNalUnitType() <= 23); } 
    1833 #if RESTR_CHK
    1834    Bool     isRADL() {  return (m_eNalUnitType == NAL_UNIT_CODED_SLICE_RADL_N || m_eNalUnitType == NAL_UNIT_CODED_SLICE_RADL_R); }
    1835    Bool     isRASL()   {   return (m_eNalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || m_eNalUnitType == NAL_UNIT_CODED_SLICE_RASL_R); }
    1836 #endif
    1837 
    1838 #if POC_RESET_FLAG
    1839   Bool      getPocResetFlag  ()                              { return m_bPocResetFlag; }
    1840   Void      setPocResetFlag  (Bool b)                        { m_bPocResetFlag = b; }
    1841   Int       getPocValueBeforeReset ()                        { return m_pocValueBeforeReset; }
    1842   Void      setPocValueBeforeReset (Int x)                   { m_pocValueBeforeReset = x ; }
    1843 #endif
    1844 #if SH_DISCARDABLE_FLAG
    1845   Bool      getDiscardableFlag  ()                              { return m_bDiscardableFlag; }
    1846   Void      setDiscardableFlag  (Bool b)                        { m_bDiscardableFlag = b; }
    1847 #endif
    1848 
    18491867  Void      checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, NalUnitType& associatedIRAPType, TComList<TComPic *>& rcListPic);
    18501868  Void      decodingRefreshMarking(Int& pocCRA, Bool& bRefreshPending, TComList<TComPic*>& rcListPic);
     
    20082026  TComPic*  getBaseColPic       (UInt refLayerIdc)                { return m_pcBaseColPic[refLayerIdc]; }
    20092027  TComPic** getBaseColPic       ()                { return &m_pcBaseColPic[0]; }
     2028#if MFM_ENCCONSTRAINT
     2029  TComPic*  getBaseColPic( TComList<TComPic*>& rcListPic );
     2030#endif
    20102031
    20112032  Void      setLayerId (UInt layerId)   { m_layerId = layerId; }
     
    20632084#endif
    20642085
    2065 TComPic* getRefPic(TComList<TComPic*>& rcListPic, Int poc) { return xGetRefPic( rcListPic, poc ); }
    2066 
    2067 #endif //SVC_EXTENSION
     2086  TComPic* getRefPic(TComList<TComPic*>& rcListPic, Int poc) { return xGetRefPic( rcListPic, poc ); }
     2087
     2088#if RESTR_CHK
     2089  Bool     isRADL() {  return (m_eNalUnitType == NAL_UNIT_CODED_SLICE_RADL_N || m_eNalUnitType == NAL_UNIT_CODED_SLICE_RADL_R); }
     2090  Bool     isRASL()   {   return (m_eNalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || m_eNalUnitType == NAL_UNIT_CODED_SLICE_RASL_R); }
     2091#endif
     2092
     2093#if POC_RESET_FLAG
     2094  Bool      getPocResetFlag  ()                              { return m_bPocResetFlag;       }
     2095  Void      setPocResetFlag  (Bool b)                        { m_bPocResetFlag = b;          }
     2096  Int       getPocValueBeforeReset ()                        { return m_pocValueBeforeReset; }
     2097  Void      setPocValueBeforeReset (Int x)                   { m_pocValueBeforeReset = x ;   }
     2098#endif
     2099  Bool      getDiscardableFlag  ()                           { return m_bDiscardableFlag;    }
     2100  Void      setDiscardableFlag  (Bool b)                     { m_bDiscardableFlag = b;       }
     2101
     2102#if RPL_INIT_N0316_N0082
     2103  Int       getNumNegativeRpsCurrTempList();
     2104#endif
    20682105
    20692106#if REPN_FORMAT_IN_VPS
    20702107  UInt getPicWidthInLumaSamples();
    20712108  UInt getPicHeightInLumaSamples();
     2109#if AUXILIARY_PICTURES
     2110  ChromaFormat getChromaFormatIdc();
     2111#else
    20722112  UInt getChromaFormatIdc();
     2113#endif
    20732114  UInt getBitDepthY();
    20742115  UInt getBitDepthC();
    2075   Int getQpBDOffsetY();
    2076   Int getQpBDOffsetC();
    2077 #endif
     2116  Int  getQpBDOffsetY();
     2117  Int  getQpBDOffsetC();
     2118#endif
     2119
     2120  Void setILRPic(TComPic **pcIlpPic);
     2121
     2122#endif //SVC_EXTENSION
    20782123protected:
    20792124  TComPic*  xGetRefPic  (TComList<TComPic*>& rcListPic,
  • trunk/source/Lib/TLibCommon/TComUpsampleFilter.cpp

    r442 r494  
    1717  {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, //
    1818  {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, //
    19   {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, // 
    20   {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, //
    21 #endif
    22   { -1, 4, -11, 52, 26,  -8,  3, -1}, // <-> actual phase shift 1/3, used for spatial scalability x1.5     
     19  {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, //
     20  {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, //
     21#endif
     22  { -1, 4, -11, 52, 26,  -8,  3, -1}, // <-> actual phase shift 1/3, used for spatial scalability x1.5
    2323#if ARBITRARY_SPATIAL_RATIO
    2424  { -1, 3,  -9, 47, 31, -10,  4, -1},
    2525  { -1, 4, -11, 45, 34, -10,  4, -1},
    2626#else
    27   {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, //       
    28   {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, // 
     27  {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, //
     28  {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, //
    2929#endif
    3030  { -1, 4, -11, 40, 40, -11,  4, -1}, // <-> actual phase shift 1/2, equal to HEVC MC, used for spatial scalability x2
     
    3333  { -1,  4, -10, 31, 47,  -9,  3, -1},
    3434#else
    35   {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, // 
    36   {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, // 
     35  {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, //
     36  {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, //
    3737#endif
    3838  { -1, 3,  -8, 26, 52, -11, 4, -1}, // <-> actual phase shift 2/3, used for spatial scalability x1.5
     
    4343  { 0,  1,  -2,  4, 63,  -3,  1,  0}
    4444#else
    45   {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, // 
    46   {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, // 
    47   {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, // 
    48   {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}  // 
     45  {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, //
     46  {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, //
     47  {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, //
     48  {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}  //
    4949#endif
    5050};
     
    6060  {CNU,CNU,CNU,CNU},//
    6161  {CNU,CNU,CNU,CNU},//
    62   {CNU,CNU,CNU,CNU},// 
     62  {CNU,CNU,CNU,CNU},//
    6363#endif
    6464  { -4, 54, 16, -2},// <-> actual phase shift 1/4,equal to HEVC MC, used for spatial scalability x1.5 (only for accurate Chroma alignement)
    65   { -6, 52, 20, -2},// <-> actual phase shift 1/3, used for spatial scalability x1.5   
    66   { -6, 46, 28, -4},// <-> actual phase shift 3/8,equal to HEVC MC, used for spatial scalability x2 (only for accurate Chroma alignement)     
     65  { -6, 52, 20, -2},// <-> actual phase shift 1/3, used for spatial scalability x1.5
     66  { -6, 46, 28, -4},// <-> actual phase shift 3/8,equal to HEVC MC, used for spatial scalability x2 (only for accurate Chroma alignement)
    6767#if ARBITRARY_SPATIAL_RATIO
    6868  { -4, 42, 30, -4},
    6969#else
    70   {CNU,CNU,CNU,CNU},// 
     70  {CNU,CNU,CNU,CNU},//
    7171#endif
    7272  { -4, 36, 36, -4},// <-> actual phase shift 1/2,equal to HEVC MC, used for spatial scalability x2
     
    7575  { -4, 28, 46, -6},
    7676#else
    77   {CNU,CNU,CNU,CNU},// 
     77  {CNU,CNU,CNU,CNU},//
    7878#endif
    7979  { -2, 20, 52, -6},// <-> actual phase shift 2/3, used for spatial scalability x1.5
     
    8282  {-2, 14, 56, -4},
    8383#else
    84   {CNU,CNU,CNU,CNU},// 
    85   {CNU,CNU,CNU,CNU},// 
    86 #endif
    87   { -2, 10, 58, -2},// <-> actual phase shift 7/8,equal to HEVC MC, used for spatial scalability x2 (only for accurate Chroma alignement) 
     84  {CNU,CNU,CNU,CNU},//
     85  {CNU,CNU,CNU,CNU},//
     86#endif
     87  { -2, 10, 58, -2},// <-> actual phase shift 7/8,equal to HEVC MC, used for spatial scalability x2 (only for accurate Chroma alignement)
    8888  {  0,  4, 62, -2} // <-> actual phase shift 11/12, used for spatial scalability x1.5 (only for accurate Chroma alignement)
    8989};
     
    9797}
    9898
    99 #if SCALED_REF_LAYER_OFFSETS
     99#if O0215_PHASE_ALIGNMENT
     100#if O0194_JOINT_US_BITSHIFT
     101Void TComUpsampleFilter::upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window, bool phaseAlignFlag )
     102#else
     103Void TComUpsampleFilter::upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window, bool phaseAlignFlag )
     104#endif
     105#else
     106#if O0194_JOINT_US_BITSHIFT
     107Void TComUpsampleFilter::upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window )
     108#else
    100109Void TComUpsampleFilter::upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window )
    101 #else
    102 Void TComUpsampleFilter::upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic )
     110#endif
    103111#endif
    104112{
     
    109117
    110118  //========== Y component upsampling ===========
    111 #if SCALED_REF_LAYER_OFFSETS
    112119  const Window &scalEL = window;
    113120
     
    119126  Int heightEL  = pcUsPic->getHeight() - scalEL.getWindowTopOffset()  - scalEL.getWindowBottomOffset();
    120127  Int strideEL  = pcUsPic->getStride();
    121 #else
    122   const Window &confBL = pcBasePic->getConformanceWindow();
    123   const Window &confEL = pcUsPic->getConformanceWindow();
    124 
    125   Int widthBL   = pcBasePic->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset();
    126   Int heightBL  = pcBasePic->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset();
    127   Int strideBL  = pcBasePic->getStride();
    128 
    129   Int widthEL   = pcUsPic->getWidth () - confEL.getWindowLeftOffset() - confEL.getWindowRightOffset();
    130   Int heightEL  = pcUsPic->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset();
    131   Int strideEL  = pcUsPic->getStride();
    132 #endif
     128
    133129  Pel* piTempBufY = pcTempPic->getLumaAddr();
    134130  Pel* piSrcBufY  = pcBasePic->getLumaAddr();
     
    153149  Int scaleX = g_posScalingFactor[refLayerIdc][0];
    154150  Int scaleY = g_posScalingFactor[refLayerIdc][1];
     151
     152#if O0194_JOINT_US_BITSHIFT
     153  UInt currLayerId = currSlice->getLayerId();
     154  UInt refLayerId  = currSlice->getVPS()->getRefLayerId( currLayerId, refLayerIdc );
     155#endif
    155156
    156157  if( scaleX == 65536 && scaleY == 65536 ) // ratio 1x
     
    194195    Int refPos16 = 0;
    195196    Int phase    = 0;
    196     Int refPos   = 0; 
     197    Int refPos   = 0;
    197198    Int* coeff = m_chromaFilter[phase];
    198199    for ( i = 0; i < 16; i++)
     
    202203    }
    203204
    204 #if ARBITRARY_SPATIAL_RATIO 
     205#if ARBITRARY_SPATIAL_RATIO
    205206    assert ( widthEL >= widthBL );
    206207    assert ( heightEL >= heightBL );
     
    216217    Int   shiftY = 16;
    217218
     219#if O0215_PHASE_ALIGNMENT //for Luma, if Phase 0, then both PhaseX  and PhaseY should be 0. If symmetric: both PhaseX and PhaseY should be 2
     220    Int   phaseX = 2*phaseAlignFlag;
     221    Int   phaseY = 2*phaseAlignFlag;
     222#else
    218223    Int   phaseX = 0;
    219224    Int   phaseY = 0;
     225#endif
    220226
    221227#if ROUNDING_OFFSET
     
    228234
    229235    Int   deltaX     = 4 * phaseX;
    230     Int   deltaY     = 4 * phaseY; 
     236    Int   deltaY     = 4 * phaseY;
    231237
    232238    Int shiftXM4 = shiftX - 4;
     
    238244    widthBL   = pcBasePic->getWidth ();
    239245    heightBL  = min<Int>( pcBasePic->getHeight(), heightEL );
    240 #if SCALED_REF_LAYER_OFFSETS
     246
    241247    Int leftStartL = scalEL.getWindowLeftOffset();
    242248    Int rightEndL  = pcUsPic->getWidth() - scalEL.getWindowRightOffset();
    243249    Int topStartL  = scalEL.getWindowTopOffset();
    244250    Int bottomEndL = pcUsPic->getHeight() - scalEL.getWindowBottomOffset();
    245 #if BUGFIX_RESAMPLE
    246251    Int leftOffset = leftStartL > 0 ? leftStartL : 0;
    247 #endif
    248 #endif
    249252
    250253#if  N0214_INTERMEDIATE_BUFFER_16BITS
     254#if O0194_JOINT_US_BITSHIFT
     255    // g_bitDepthY was set to EL bit-depth, but shift1 should be calculated using BL bit-depth
     256    Int shift1 = g_bitDepthYLayer[refLayerId] - 8;
     257#else
    251258    Int shift1 = g_bitDepthY - 8;
     259#endif
    252260#endif
    253261
     
    255263    for( i = 0; i < widthEL; i++ )
    256264    {
    257 #if SCALED_REF_LAYER_OFFSETS
    258265      Int x = Clip3( leftStartL, rightEndL - 1, i );
    259266      refPos16 = (((x - leftStartL)*scaleX + addX) >> shiftXM4) - deltaX;
    260 #else
    261       refPos16 = ((i*scaleX + addX) >> shiftXM4) - deltaX;
    262 #endif
    263267      phase    = refPos16 & 15;
    264268      refPos   = refPos16 >> 4;
     
    287291
    288292#if  N0214_INTERMEDIATE_BUFFER_16BITS
     293#if O0194_JOINT_US_BITSHIFT
     294    Int nShift = 20 - g_bitDepthYLayer[currLayerId];
     295#else
    289296    Int nShift = US_FILTER_PREC*2 - shift1;
     297#endif
    290298#else
    291299    const Int nShift = US_FILTER_PREC*2;
    292300#endif
    293     Int iOffset = 1 << (nShift - 1);
    294 
    295 #if SCALED_REF_LAYER_OFFSETS
     301    Int iOffset = 1 << (nShift - 1);
     302
    296303    for( j = 0; j < pcTempPic->getHeight(); j++ )
    297 #else
    298     for( j = 0; j < heightEL; j++ )
    299 #endif
    300     {
    301 #if SCALED_REF_LAYER_OFFSETS
     304    {
    302305      Int y = Clip3(topStartL, bottomEndL - 1, j);
    303306      refPos16 = ((( y - topStartL )*scaleY + addY) >> shiftYM4) - deltaY;
    304 #else
    305       refPos16 = ((j*scaleY + addY) >> shiftYM4) - deltaY;
    306 #endif
    307307      phase    = refPos16 & 15;
    308308      refPos   = refPos16 >> 4;
     
    310310
    311311      piSrcY = piTempBufY + (refPos -((NTAPS_US_LUMA>>1) - 1))*strideEL;
    312 #if SCALED_REF_LAYER_OFFSETS
    313 #if BUGFIX_RESAMPLE
    314       Pel* piDstY0 = piDstBufY + j * strideEL;           
     312      Pel* piDstY0 = piDstBufY + j * strideEL;
    315313      piDstY = piDstY0 + leftOffset;
    316314      piSrcY += leftOffset;
     
    335333        piDstY++;
    336334      }
    337 #else
    338 #if 1 // it should provide identical result
    339       Pel* piDstY0 = piDstBufY + j * strideEL;           
    340       piDstY = piDstY0 + ( leftStartL > 0 ? leftStartL : 0 );
    341 
    342       for( i = min<Int>(rightEndL, pcTempPic->getWidth()) - max<Int>(0, leftStartL); i > 0; i-- )
    343       {
    344         *piDstY = ClipY( (sumLumaVer(piSrcY, coeff, strideEL) + iOffset) >> (nShift));
    345         piSrcY++;
    346         piDstY++;
    347       }
    348 
    349       for( i = rightEndL; i < pcTempPic->getWidth(); i++ )
    350       {
    351         *piDstY = piDstY0[rightEndL-1];
    352         piDstY++;
    353       }
    354 
    355       piDstY = piDstY0;
    356       for( i = 0; i < leftStartL; i++ )
    357       {
    358         *piDstY = piDstY0[leftStartL];
    359         piDstY++;
    360       }
    361 #else
    362       piDstY = piDstBufY + j * strideEL;
    363 
    364       for( i = 0; i < pcTempPic->getWidth(); i++ )
    365       {
    366         *piDstY = ClipY( (sumLumaVer(piSrcY, coeff, strideEL) + iOffset) >> (nShift));
    367 
    368         // Only increase the x position of reference upsample picture when within the window
    369         // "-2" to ensure that pointer doesn't go beyond the boundary rightEndL-1
    370         if( (i >= leftStartL) && (i <= rightEndL-2) )
    371         {
    372           piSrcY++;
    373         }
    374         piDstY++;
    375       }
    376 #endif
    377 #endif
    378 #else
    379       piDstY = piDstBufY + j * strideEL;
    380 
    381       for( i = 0; i < widthEL; i++ )
    382       {
    383         *piDstY = ClipY( (sumLumaVer(piSrcY, coeff, strideEL) + iOffset) >> (nShift));
    384         piSrcY++;
    385         piDstY++;
    386       }
    387 #endif
    388     }
    389 
    390 #if SCALED_REF_LAYER_OFFSETS
     335
     336    }
     337
    391338    widthBL   = pcBasePic->getWidth ();
    392339    heightBL  = pcBasePic->getHeight();
     
    394341    widthEL   = pcUsPic->getWidth () - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset();
    395342    heightEL  = pcUsPic->getHeight() - scalEL.getWindowTopOffset()  - scalEL.getWindowBottomOffset();
    396 #else
    397     widthBL   = pcBasePic->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset();
    398     heightBL  = pcBasePic->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset();
    399 
    400     widthEL   = pcUsPic->getWidth () - confEL.getWindowLeftOffset() - confEL.getWindowRightOffset();
    401     heightEL  = pcUsPic->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset();
    402 #endif
    403343
    404344    //========== UV component upsampling ===========
     
    412352    strideBL  = pcBasePic->getCStride();
    413353    strideEL  = pcUsPic->getCStride();
    414 #if SCALED_REF_LAYER_OFFSETS
     354
    415355    Int leftStartC = scalEL.getWindowLeftOffset() >> 1;
    416356    Int rightEndC  = (pcUsPic->getWidth() >> 1) - (scalEL.getWindowRightOffset() >> 1);
    417357    Int topStartC  = scalEL.getWindowTopOffset() >> 1;
    418358    Int bottomEndC = (pcUsPic->getHeight() >> 1) - (scalEL.getWindowBottomOffset() >> 1);
    419 #if BUGFIX_RESAMPLE
    420359    leftOffset = leftStartC > 0 ? leftStartC : 0;
    421 #endif
    422 #endif
    423360
    424361    shiftX = 16;
    425362    shiftY = 16;
    426363
     364#if O0215_PHASE_ALIGNMENT
     365    Int phaseXC = 0;
     366    Int phaseYC = 1;
     367
     368#if ROUNDING_OFFSET
     369    addX       = ( ( (phaseXC+phaseAlignFlag) * scaleX + 2 ) >> 2 ) + ( 1 << ( shiftX - 5 ) );
     370    addY       = ( ( (phaseYC+phaseAlignFlag) * scaleY + 2 ) >> 2 ) + ( 1 << ( shiftY - 5 ) );
     371#else
     372    addX       = ( ( ( widthBL * (phaseXC+phaseAlignFlag) ) << ( shiftX - 2 ) ) + ( widthEL >> 1 ) ) / widthEL + ( 1 << ( shiftX - 5 ) );
     373    addY       = ( ( ( heightBL * (phaseYC+phaseAlignFlag) ) << ( shiftY - 2 ) ) + ( heightEL >> 1 ) ) / heightEL+ ( 1 << ( shiftY - 5 ) );
     374#endif
     375
     376    deltaX     = 4 * (phaseXC+phaseAlignFlag);
     377    deltaY     = 4 * (phaseYC+phaseAlignFlag);
     378#else
    427379    phaseX = 0;
    428380    phaseY = 1;
     
    438390    deltaX     = 4 * phaseX;
    439391    deltaY     = 4 * phaseY;
     392#endif
    440393
    441394    shiftXM4 = shiftX - 4;
     
    449402
    450403#if  N0214_INTERMEDIATE_BUFFER_16BITS
     404#if O0194_JOINT_US_BITSHIFT
     405    // g_bitDepthC was set to EL bit-depth, but shift1 should be calculated using BL bit-depth
     406    shift1 = g_bitDepthCLayer[refLayerId] - 8;
     407#else
    451408    shift1 = g_bitDepthC - 8;
     409#endif
    452410#endif
    453411
     
    455413    for( i = 0; i < widthEL; i++ )
    456414    {
    457 #if SCALED_REF_LAYER_OFFSETS
    458415      Int x = Clip3(leftStartC, rightEndC - 1, i);
    459416      refPos16 = (((x - leftStartC)*scaleX + addX) >> shiftXM4) - deltaX;
    460 #else
    461       refPos16 = ((i*scaleX + addX) >> shiftXM4) - deltaX;
    462 #endif
    463417      phase    = refPos16 & 15;
    464418      refPos   = refPos16 >> 4;
     
    494448
    495449#if  N0214_INTERMEDIATE_BUFFER_16BITS
     450#if O0194_JOINT_US_BITSHIFT
     451    nShift = 20 - g_bitDepthCLayer[refLayerId];
     452#else
    496453    nShift = US_FILTER_PREC*2 - shift1;
    497     iOffset = 1 << (nShift - 1);
    498 #endif
    499 
    500 #if SCALED_REF_LAYER_OFFSETS
     454#endif
     455    iOffset = 1 << (nShift - 1);
     456#endif
     457
    501458    for( j = 0; j < pcTempPic->getHeight() >> 1; j++ )
    502 #else
    503     for( j = 0; j < heightEL; j++ )
    504 #endif
    505     {
    506 #if SCALED_REF_LAYER_OFFSETS
     459    {
    507460      Int y = Clip3(topStartC, bottomEndC - 1, j);
    508461      refPos16 = (((y - topStartC)*scaleY + addY) >> shiftYM4) - deltaY;
    509 #else
    510       refPos16 = ((j*scaleY + addY) >> shiftYM4) - deltaY;
    511 #endif
    512462      phase    = refPos16 & 15;
    513       refPos   = refPos16 >> 4; 
     463      refPos   = refPos16 >> 4;
    514464      coeff = m_chromaFilter[phase];
    515      
     465
    516466      piSrcU = piTempBufU  + (refPos -((NTAPS_US_CHROMA>>1) - 1))*strideEL;
    517467      piSrcV = piTempBufV  + (refPos -((NTAPS_US_CHROMA>>1) - 1))*strideEL;
    518 #if SCALED_REF_LAYER_OFFSETS
    519 #if BUGFIX_RESAMPLE
     468
    520469      Pel* piDstU0 = piDstBufU + j*strideEL;
    521470      Pel* piDstV0 = piDstBufV + j*strideEL;
     
    552501        piDstV++;
    553502      }
    554 #else
    555 #if 1 // it should provide identical result
    556       Pel* piDstU0 = piDstBufU + j*strideEL;
    557       Pel* piDstV0 = piDstBufV + j*strideEL;
    558       piDstU = piDstU0 + ( leftStartC > 0 ? leftStartC : 0 );
    559       piDstV = piDstV0 + ( leftStartC > 0 ? leftStartC : 0 );
    560 
    561       for( i = min<Int>(rightEndC, pcTempPic->getWidth() >> 1) - max<Int>(0, leftStartC); i > 0; i-- )
    562       {
    563         *piDstU = ClipC( (sumChromaVer(piSrcU, coeff, strideEL) + iOffset) >> (nShift));
    564         *piDstV = ClipC( (sumChromaVer(piSrcV, coeff, strideEL) + iOffset) >> (nShift));
    565         piSrcU++;
    566         piSrcV++;
    567         piDstU++;
    568         piDstV++;
    569       }
    570 
    571       for( i = rightEndC; i < pcTempPic->getWidth() >> 1; i++ )
    572       {
    573         *piDstU = piDstU0[rightEndC-1];
    574         *piDstV = piDstV0[rightEndC-1];
    575         piDstU++;
    576         piDstV++;
    577       }
    578 
    579       piDstU = piDstU0;
    580       piDstV = piDstV0;
    581       for( i = 0; i < leftStartC; i++ )
    582       {
    583         *piDstU = piDstU0[leftStartC];
    584         *piDstV = piDstV0[leftStartC];
    585         piDstU++;
    586         piDstV++;
    587       }
    588 #else
    589       piDstU = piDstBufU + j*strideEL;
    590       piDstV = piDstBufV + j*strideEL;
    591 
    592       for( i = 0; i < pcTempPic->getWidth() >> 1; i++ )
    593       {
    594         *piDstU = ClipC( (sumChromaVer(piSrcU, coeff, strideEL) + iOffset) >> (nShift));
    595         *piDstV = ClipC( (sumChromaVer(piSrcV, coeff, strideEL) + iOffset) >> (nShift));
    596 
    597         // Only increase the x position of reference upsample picture when within the window
    598         // "-2" to ensure that pointer doesn't go beyond the boundary rightEndC-1
    599         if( (i >= leftStartC) && (i <= rightEndC-2) )
    600         {
    601           piSrcU++;
    602           piSrcV++;
    603         }
    604 
    605         piDstU++;
    606         piDstV++;
    607       }
    608 #endif
    609 #endif
    610 #else
    611       piDstU = piDstBufU + j*strideEL;
    612       piDstV = piDstBufV + j*strideEL;
    613 
    614       for( i = 0; i < widthEL; i++ )
    615       {
    616         *piDstU = ClipC( (sumChromaVer(piSrcU, coeff, strideEL) + iOffset) >> (nShift));
    617         *piDstV = ClipC( (sumChromaVer(piSrcV, coeff, strideEL) + iOffset) >> (nShift));
    618         piSrcU++;
    619         piSrcV++;
    620         piDstU++;
    621         piDstV++;
    622       }
    623 #endif
     503
    624504    }
    625505  }
  • trunk/source/Lib/TLibCommon/TComUpsampleFilter.h

    r313 r494  
    4343  ~TComUpsampleFilter(void);
    4444
    45 #if SCALED_REF_LAYER_OFFSETS
     45#if O0215_PHASE_ALIGNMENT
     46#if O0194_JOINT_US_BITSHIFT
     47  Void upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window, bool phaseAlignFlag );
     48#else
     49  Void upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window, bool phaseAlignFlag );
     50#endif
     51#else
     52#if O0194_JOINT_US_BITSHIFT
     53  Void upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window );
     54#else
    4655  Void upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window );
    47 #else
    48  Void upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic );
    4956#endif
     57#endif
     58
    5059};
    5160
  • trunk/source/Lib/TLibCommon/TypeDef.h

    r442 r494  
    4545#define RANDOM_ACCESS_SEI_FIX            1
    4646#if SVC_EXTENSION
     47#define MAX_LAYERS                       2      ///< max number of layers the codec is supposed to handle
     48
     49#define O0194_DIFFERENT_BITDEPTH_EL_BL   1      ///< JCTVC-O0194: Support for different bitdepth values for BL and EL, add required configuration parameters (and Some bugfixes when REPN_FORMAT_IN_VPS (JCTVC-N0092) is enabled)
     50#if O0194_DIFFERENT_BITDEPTH_EL_BL
     51#define O0194_JOINT_US_BITSHIFT          1      ///< JCTVC-O0194: Joint Upsampling and bit-shift
     52#endif
     53#define O0194_WEIGHTED_PREDICTION_CGS    1      ///< JCTVC-O0194: Weighted prediciton for color gamut scalability
     54#define MFM_ENCCONSTRAINT                1      ///< JCTVC-O0216: Encoder constraint for motion field mapping
    4755#define VPS_NUH_LAYER_ID                 1      ///< JCTVC-N0085: Assert that the nuh_layer_id of VPS NAL unit should be 0
    48 #define MAX_LAYERS                       2      ///< max number of layers the codec is supposed to handle
    4956#define POC_RESET_FLAG                   1      ///< JCTVC-N0244: POC reset flag for  layer pictures.
    5057#define ALIGN_TSA_STSA_PICS              1      ///< JCTVC-N0084: Alignment of TSA and STSA pictures across AU.
     
    5259#define TIMING_INFO_NONZERO_LAYERID_SPS  1      ///< JCTVC-N0085: Semantics of vui_timing_info_present_flag to always set that flag to zero for non-zero layer ID SPS
    5360#define RPL_INIT_N0316_N0082             1      ///< JCTVC-N0316, JCTVC-N0082: initial reference picture list construction
    54 #define FINAL_RPL_CHANGE_N0082           1      ///< JCTVC-N0082: final ref picture list change (encoder)
    55 #if FINAL_RPL_CHANGE_N0082
    56 #define EXTERNAL_USEDBYCURR_N0082        1      ///< JCTVC-N0082: final ref picture list change (encoder) //dev ver.
    57 #define TEMP_SCALABILITY_FIX             1      ///< fix for temporal scalability
    58 #endif
     61
    5962#define IL_SL_SIGNALLING_N0371           0      ///< JCTVC-N0371: inter-layer scaling list
    60 #define M0464_TILE_BOUNDARY_ALIGNED_FLAG 0      ///< JCTVC-M0464: VUI flag to indicate tile boundary alignment
    6163#define M0463_VUI_EXT_ILP_REF            0      ///< JCTVC-M0463: VUI extension inter-layer dependency offset signalling
    6264#define SPS_EXTENSION                    1      ///< Define sps_extension() syntax structure
    63 #define SCALED_REF_LAYER_OFFSETS         1      ///< JCTVC-M0309: Signal scaled reference layer offsets in SPS
    6465#define VERT_MV_CONSTRAINT               1      ///< Vertical MV component constraint flag
    6566#define SCALABILITY_MASK_E0104           1      ///< JCT3V-E0104: scalability mask for depth
     67#define LAYER_CTB                        0      ///< enable layer-specific CTB structure
    6668
    6769#define ILP_SSH_SIG                      1      ///< JCTVC-N0195 proposal 2, JCTVC-N0118: add presence flag in VPS ext to condition inter-layer prediction signaling in slice segment header
     70#if ILP_SSH_SIG
     71#define ILP_SSH_SIG_FIX                  1      ///< fix for SHM ticket #5
     72#endif
    6873#define SPL_FLG_CHK                      1      ///< JCTVC-N0195 proposal 5, JCTVC-N0085: constrain sum of lengths to be less than or equal to 6
    6974#define ILP_NUM_REF_CHK                  1      ///< JCTVC-N0195 proposal 1, JCTVC-N0081, JCTVC-N0154, JCTVC-N0217: a condition on signaling inter_layer_pred_layer_idc[ i ], to avoid sending when NumDirectRefLayers equals NumActiveRefLayerPics, and instead infer values
     
    7681#define VPS_EXTN_PROFILE_INFO            1      ///< Include profile information for layer sets in VPS extension
    7782#define VPS_EXTN_DIRECT_REF_LAYERS       1      ///< Include indication of direct dependency of layers in VPS extension
    78 #define VPS_OUTPUT_LAYER_SET_IDX         1      ///< JCTVC-M0268: Signal output_layer_set_idx[i] as output_layer_set_idx_minus1[i]
    79 #define VPS_MOVE_DIR_DEPENDENCY_FLAG     1      ///< JCTVC-M0268: Move the syntax element direct_dependency_flag to follow the syntax element dimension_id
    80 #define VPS_PROFILE_OUTPUT_LAYERS        1      ///< JCTVC-M0268: Signal profile information and output layer information as in Sec. 3 of M0268v2
    81 #define SPS_SUB_LAYER_INFO               1      ///< JCTVC-M0268: Do not signal sps_max_sub_layers_minus1 and sps_temporal_id_nesting_flag for nuh_layer_id greater than 0
    82 #define VPS_SPLIT_FLAG                   1      ///< JCTVC-M0163: Do not signal dimension_id and the last dimension_id_len_minus1, when splitting_flag is equal to 1.
    8383#define M0457_PREDICTION_INDICATIONS     1
    8484#define M0040_ADAPTIVE_RESOLUTION_CHANGE 1
     
    8989#define N0160_VUI_EXT_ILP_REF            1      ///< VUI extension inter-layer dependency offset signalling
    9090#define VPS_VUI_BITRATE_PICRATE          1      ///< JCTVC-N0085: Signal bit rate and picture in VPS VUI
    91 #else
    92 #define M0464_TILE_BOUNDARY_ALIGNED_FLAG 0      ///< VUI flag to indicate tile boundary alignment
    9391#endif //VPS_VUI
    9492
     
    9694
    9795#define VPS_EXTN_OFFSET                  1      ///< implementation of vps_extension_offset syntax element
     96#define VPS_EXTN_OFFSET_CALC             1      ///< Calculation of VPS extension offset
    9897#define SPS_PTL_FIX                      1      ///< remove profile_tier_level from enhancement layer SPS
    99 #define SH_DISCARDABLE_FLAG              1      ///< JCTVC-M0152: Use one reserved flag in the slice header for discardable flag
    10098
    10199#define DERIVE_LAYER_ID_LIST_VARIABLES   1      ///< Derived variables based on the variables in VPS - for use in syntax table parsing
     
    104102#define ROUNDING_OFFSET                  1      ///< JCTVC-N0111: upsampling rounding offset using scalling factors
    105103#define N0214_INTERMEDIATE_BUFFER_16BITS 1      ///< JCTVC-N0214: support base layer input more than 8 bits
    106 #define ARBITRARY_SPATIAL_RATIO          0      ///< JCTVC-N0219, JCTVC-N0273: Support arbitrary spatial ratio
    107 #define BUGFIX_RESAMPLE                  1      ///< JCTVC-N0055: resampling bug fix for positive left scalled offset
     104#define ARBITRARY_SPATIAL_RATIO          1      ///< JCTVC-N0219, JCTVC-N0273: Support arbitrary spatial ratio
    108105
    109106#define JCTVC_M0259_LAMBDAREFINEMENT     1      ///< JCTVC-M0259: lambda refinement (encoder only optimization)
     
    126123#define JCTVC_M0203_INTERLAYER_PRED_IDC  1      ///< JCTVC-M0203: implementation of Inter-layer Prediction Indication
    127124#if JCTVC_M0203_INTERLAYER_PRED_IDC
    128 #define ILR_RESTR                        1      ///< JCTVC-M0209: Inter-layer RPS and RPL
    129 #define ILR_RESTR_FIX                    1      ///< Fix encoder crash when temporal layers are used with scalable coding
    130125#define EARLY_REF_PIC_MARKING            1      ///< Decoded picture marking of sub-layer non-reference pictures
    131126#define N0120_MAX_TID_REF_PRESENT_FLAG   1      ///< JCTVC-N0120: max_tid_ref_pics_plus1_present_flag
    132127#define N0120_MAX_TID_REF_CFG            1      ///< set max_tid_il_ref_pics_plus1 and max_tid_ref_present_flag in the config. file (configuration setting)
     128#define O0225_MAX_TID_FOR_REF_LAYERS     1
    133129#endif
    134130#if REF_IDX_MFM
     
    145141
    146142#define N0147_IRAP_ALIGN_FLAG            1      ///< a flag to indicatate whether IRAPs are aligned across layers
     143#if N0147_IRAP_ALIGN_FLAG
     144#define O0223_O0139_IRAP_ALIGN_NO_CONTRAINTS  1  ///< Remove IRAP align depedency constraints on poc_Reset_flag.
     145#define IRAP_ALIGN_FLAG_IN_VPS_VUI       1       ///< Move IRAP align flag to VPS VUI
     146#endif
    147147#if !N0147_IRAP_ALIGN_FLAG
    148148#define IDR_ALIGNMENT                    1      ///< align IDR picures across layers : As per JCTVC-N0373, IDR are not required to be aligned.
     
    159159#define N0383_IL_CONSTRAINED_TILE_SETS_SEI  1
    160160#define N0065_LAYER_POC_ALIGNMENT        1
     161
     162#define O0215_PHASE_ALIGNMENT            1      ///< JCTVC_O0215: signal a flag to specify phase alignment case, 0: zero-position-aligned, 1: central-position-aligned,
     163#define AUXILIARY_PICTURES               1      ///< JCTVC-O0041: auxiliary picture layers
     164
     165#define O0062_POC_LSB_NOT_PRESENT_FLAG   1      ///< JCTVC-O0062: signal poc_lsb_not_present_flag for each layer in VPS extension
     166#define SHM_FIX7                         1      ///< fix for SHVC WD ticket #7
     167
    161168#else
    162169#define SYNTAX_OUTPUT                    0
     
    469476  CHROMA_422  = 2,
    470477  CHROMA_444  = 3
     478#if AUXILIARY_PICTURES
     479  ,NUM_CHROMA_FORMAT = 4
     480#endif
    471481};
    472482
Note: See TracChangeset for help on using the changeset viewer.