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


Ignore:
Timestamp:
15 Oct 2014, 07:25:10 (10 years ago)
Author:
seregin
Message:

merge SHM-dev

Location:
trunk
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/source

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

    r815 r906  
    5858#if SVC_EXTENSION
    5959#include <vector>
    60 #define NV_VERSION        "6.1 (HM-14.0)"                 ///< Current software version
     60#define NV_VERSION        "7.0 (HM-15.0)"                 ///< Current software version
    6161#else
    62 #define NV_VERSION        "14.0"                ///< Current software version
     62#define NV_VERSION        "15.0"                ///< Current software version
    6363#endif
    6464
  • trunk/source/Lib/TLibCommon/SEI.h

    r815 r906  
    9494    BSP_NESTING                          = 140,
    9595    BSP_INITIAL_ARRIVAL_TIME             = 141,
     96#if !REMOVE_BSP_HRD_SEI
    9697    BSP_HRD                              = 142,
    9798#endif
    98 #if Q0074_SEI_COLOR_MAPPING
    99     COLOR_MAPPING_INFO                   = 143,
     99#endif
     100#if Q0074_COLOUR_REMAPPING_SEI
     101    COLOUR_REMAPPING_INFO                = 143,
    100102#endif
    101103#if Q0078_ADD_LAYER_SETS
     
    173175  Int numSpsIdsMinus1;
    174176  std::vector<Int> activeSeqParameterSetId;
     177#if R0247_SEI_ACTIVE
     178  std::vector<Int> layerSpsIdx;
     179#endif
    175180};
    176181
     
    199204  UInt m_bpSeqParameterSetId;
    200205  Bool m_rapCpbParamsPresentFlag;
    201   Bool m_cpbDelayOffset;
    202   Bool m_dpbDelayOffset;
     206  UInt m_cpbDelayOffset;
     207  UInt m_dpbDelayOffset;
    203208  UInt m_initialCpbRemovalDelay         [MAX_CPB_CNT][2];
    204209  UInt m_initialCpbRemovalDelayOffset   [MAX_CPB_CNT][2];
     
    445450};
    446451#endif
    447 #if Q0074_SEI_COLOR_MAPPING
    448 class SEIColorMappingInfo : public SEI
    449 {
    450 public:
    451   PayloadType payloadType() const { return COLOR_MAPPING_INFO; }
    452   SEIColorMappingInfo() {
    453   }
    454   virtual ~SEIColorMappingInfo() {}
    455 
    456   Int   m_colorMapId;
    457   Bool  m_colorMapCancelFlag;
    458   Bool  m_colorMapPersistenceFlag;
    459   Bool  m_colorMap_video_signal_type_present_flag;
    460   Bool  m_colorMap_video_full_range_flag;
    461   Int   m_colorMap_primaries;
    462   Int   m_colorMap_transfer_characteristics;
    463   Int   m_colorMap_matrix_coeffs;
    464   Int   m_colorMapModelId;
    465 
    466   Int   m_colour_map_coded_data_bit_depth;
    467   Int   m_colour_map_target_bit_depth;
    468 
    469   Int   m_num_input_pivots[3];
    470   Int*  m_coded_input_pivot_value[3];
    471   Int*  m_target_input_pivot_value[3];
    472  
    473   Bool  m_matrix_flag;
    474   Int   m_log2_matrix_denom;
    475   Int   m_matrix_coef[3][3];
    476 
    477   Int   m_num_output_pivots[3];
    478   Int*  m_coded_output_pivot_value[3];
    479   Int*  m_target_output_pivot_value[3];
     452#if Q0074_COLOUR_REMAPPING_SEI
     453class SEIColourRemappingInfo : public SEI
     454{
     455public:
     456  PayloadType payloadType() const { return COLOUR_REMAPPING_INFO; }
     457  SEIColourRemappingInfo() {}
     458  ~SEIColourRemappingInfo() {}
     459 
     460  Int   m_colourRemapId;
     461  Bool  m_colourRemapCancelFlag;
     462  Bool  m_colourRemapPersistenceFlag;
     463  Bool  m_colourRemapVideoSignalInfoPresentFlag;
     464  Bool  m_colourRemapFullRangeFlag;
     465  Int   m_colourRemapPrimaries;
     466  Int   m_colourRemapTransferFunction;
     467  Int   m_colourRemapMatrixCoefficients;
     468  Int   m_colourRemapInputBitDepth;
     469  Int   m_colourRemapBitDepth;
     470  Int   m_preLutNumValMinus1[3];
     471  std::vector<Int> m_preLutCodedValue[3];
     472  std::vector<Int> m_preLutTargetValue[3];
     473  Bool  m_colourRemapMatrixPresentFlag;
     474  Int   m_log2MatrixDenom;
     475  Int   m_colourRemapCoeffs[3][3];
     476  Int   m_postLutNumValMinus1[3];
     477  std::vector<Int> m_postLutCodedValue[3];
     478  std::vector<Int> m_postLutTargetValue[3];
    480479};
    481480#endif
     
    593592  Bool  m_callerOwnsSEIs;
    594593  SEIMessages m_nestedSEIs;
     594#if VPS_VUI_BSP_HRD_PARAMS
     595  Int  m_seiPartitioningSchemeIdx;
     596  Int  m_seiOlsIdx;
     597#endif
    595598};
    596599
     
    607610};
    608611
     612#if !REMOVE_BSP_HRD_SEI
    609613class SEIBspHrd : public SEI
    610614{
     
    627631  TComHRD *hrd;
    628632};
     633#endif
    629634
    630635#endif
  • trunk/source/Lib/TLibCommon/TCom3DAsymLUT.cpp

    r815 r906  
    1717  m_pCuboid = NULL;
    1818  m_nResQuanBit = 0;
     19#if R0164_CGS_LUT_BUGFIX_CHECK
     20  m_pCuboidExplicit = NULL;
     21  m_pCuboidFilled = NULL;
     22#endif
    1923}
    2024
     
    2428}
    2529
    26 Void TCom3DAsymLUT::create( Int nMaxOctantDepth , Int nInputBitDepth , Int nInputBitDepthC , Int nOutputBitDepth , Int nOutputBitDepthC , Int nMaxYPartNumLog2 )
     30Void TCom3DAsymLUT::create( Int nMaxOctantDepth , Int nInputBitDepth , Int nInputBitDepthC , Int nOutputBitDepth , Int nOutputBitDepthC , Int nMaxYPartNumLog2
     31#if R0151_CGS_3D_ASYMLUT_IMPROVE
     32  , Int nAdaptCThresholdU , Int nAdaptCThresholdV
     33#endif
     34  )
    2735{
    2836  m_nMaxOctantDepth = nMaxOctantDepth;
     
    3644  m_nMaxPartNumLog2 = 3 * m_nMaxOctantDepth + m_nMaxYPartNumLog2;
    3745
    38   xUpdatePartitioning( nMaxOctantDepth , nMaxYPartNumLog2 );
     46  xUpdatePartitioning( nMaxOctantDepth , nMaxYPartNumLog2
     47#if R0151_CGS_3D_ASYMLUT_IMPROVE
     48    , nAdaptCThresholdU , nAdaptCThresholdV
     49#endif
     50    );
    3951
    4052  m_nYSize = 1 << ( m_nMaxOctantDepth + m_nMaxYPartNumLog2 );
     
    4860  }
    4961  xAllocate3DArray( m_pCuboid , m_nYSize , m_nUSize , m_nVSize );
     62
     63#if R0164_CGS_LUT_BUGFIX_CHECK
     64  xAllocate3DArray( m_pCuboidExplicit , m_nYSize , m_nUSize , m_nVSize );
     65  xAllocate3DArray( m_pCuboidFilled   , m_nYSize , m_nUSize , m_nVSize );
     66#endif
    5067}
    5168
     
    5370{
    5471  xFree3DArray( m_pCuboid );
    55 }
    56 
    57 Void TCom3DAsymLUT::xUpdatePartitioning( Int nCurOctantDepth , Int nCurYPartNumLog2 )
     72#if R0164_CGS_LUT_BUGFIX_CHECK
     73  xFree3DArray( m_pCuboidExplicit );
     74  xFree3DArray( m_pCuboidFilled   );
     75#endif
     76}
     77
     78
     79Void TCom3DAsymLUT::xUpdatePartitioning( Int nCurOctantDepth , Int nCurYPartNumLog2
     80#if R0151_CGS_3D_ASYMLUT_IMPROVE
     81  , Int nAdaptCThresholdU , Int nAdaptCThresholdV
     82#endif
     83  )
    5884{
    5985  assert( nCurOctantDepth <= m_nMaxOctantDepth );
     86#if R0179_CGS_SIZE_8x1x1
     87  assert( nCurYPartNumLog2 + nCurOctantDepth <= m_nMaxYPartNumLog2 + m_nMaxOctantDepth );
     88#else
    6089  assert( nCurYPartNumLog2 <= m_nMaxYPartNumLog2 );
     90#endif
    6191
    6292  m_nCurOctantDepth = nCurOctantDepth;
     
    6494  m_nYShift2Idx = m_nInputBitDepthY - m_nCurOctantDepth - m_nCurYPartNumLog2;
    6595  m_nUShift2Idx = m_nVShift2Idx = m_nInputBitDepthC - m_nCurOctantDepth;
     96#if R0151_CGS_3D_ASYMLUT_IMPROVE
     97  m_nMappingShift = 10 + m_nInputBitDepthY - m_nOutputBitDepthY;
     98  m_nAdaptCThresholdU = nAdaptCThresholdU;
     99  m_nAdaptCThresholdV = nAdaptCThresholdV;
     100#else
    66101  m_nMappingShift = m_nYShift2Idx + m_nUShift2Idx;
     102#endif
    67103  m_nMappingOffset = 1 << ( m_nMappingShift - 1 );
     104
     105#if R0179_ENC_OPT_3DLUT_SIZE
     106  m_nYSize = 1 << ( m_nCurOctantDepth + m_nCurYPartNumLog2 );
     107  m_nUSize = 1 << m_nCurOctantDepth;
     108  m_nVSize = 1 << m_nCurOctantDepth;
     109#endif
    68110}
    69111
     
    159201 
    160202  SYUVP sPred;
     203#if R0151_CGS_3D_ASYMLUT_IMPROVE
     204  sPred.Y = sPred.U = sPred.V = 0;
     205  if( nVertexIdx == 0 )
     206    sPred.Y = xGetNormCoeffOne() << ( m_nOutputBitDepthY - m_nInputBitDepthY );
     207  else if( nVertexIdx == 1 )
     208    sPred.U = xGetNormCoeffOne() << ( m_nOutputBitDepthY - m_nInputBitDepthY );
     209  else if( nVertexIdx == 2 )
     210    sPred.V = xGetNormCoeffOne() << ( m_nOutputBitDepthY - m_nInputBitDepthY );
     211#else
    161212  sPred.Y = ( yIdx + m_nVertexIdxOffset[nVertexIdx][0] ) << ( m_nYShift2Idx + m_nDeltaBitDepth );
    162213  sPred.U = ( uIdx + m_nVertexIdxOffset[nVertexIdx][1] ) << ( m_nUShift2Idx + m_nDeltaBitDepthC );
    163214  sPred.V = ( vIdx + m_nVertexIdxOffset[nVertexIdx][2] ) << ( m_nVShift2Idx + m_nDeltaBitDepthC );
     215#endif
    164216  return( sPred );
    165217}
     
    169221  SCuboid***  pCuboid = pCurCuboid ? pCurCuboid : m_pCuboid ;
    170222
     223#if R0151_CGS_3D_ASYMLUT_IMPROVE
     224  SYUVP sPred;
     225  if( yIdx == 0 )
     226  {
     227    sPred.Y = nVertexIdx == 0 ? 1024 : 0;
     228    sPred.U = nVertexIdx == 1 ? 1024 : 0;
     229    sPred.V = nVertexIdx == 2 ? 1024 : 0;
     230  }
     231  else
     232  {
     233    sPred = pCuboid[yIdx-1][uIdx][vIdx].P[nVertexIdx];
     234  }
     235#else
    171236  // PredA
    172237  SYUVP sPredA = xGetCuboidVertexPredA( yIdx , uIdx , vIdx , nVertexIdx );
     
    196261  sPred.U = sPredA.U + sPredB.U;
    197262  sPred.V = sPredA.V + sPredB.V;
    198 
     263#endif
    199264  return sPred ;
    200265}
     
    220285  rYUVP.U = sPred.U + ( deltaU << m_nResQuanBit );
    221286  rYUVP.V = sPred.V + ( deltaV << m_nResQuanBit );
     287#if R0150_CGS_SIGNAL_CONSTRAINTS
     288  // LUT coefficients are less than 12-bit
     289  assert( -2048 <= rYUVP.Y && rYUVP.Y <= 2047 );
     290  assert( -2048 <= rYUVP.U && rYUVP.U <= 2047 );
     291  assert( -2048 <= rYUVP.V && rYUVP.V <= 2047 );
     292#endif
    222293}
    223294
    224295Pel TCom3DAsymLUT::xMapY( Pel y , Pel u , Pel v )
    225296{
     297#if R0151_CGS_3D_ASYMLUT_IMPROVE
     298  const SCuboid & rCuboid = m_pCuboid[xGetYIdx(y)][xGetUIdx(u)][xGetVIdx(v)];
     299  Pel dstY = ( ( rCuboid.P[0].Y * y + rCuboid.P[1].Y * u + rCuboid.P[2].Y * v + m_nMappingOffset ) >> m_nMappingShift ) + rCuboid.P[3].Y;
     300#else
    226301  const SCuboid & rCuboid = m_pCuboid[y>>m_nYShift2Idx][u>>m_nUShift2Idx][v>>m_nVShift2Idx];
    227302  Pel dstY = rCuboid.P[0].Y;
     
    233308                   + ( ( deltaV * ( rCuboid.P[2].Y - rCuboid.P[1].Y ) ) << m_nYShift2Idx )
    234309                   + m_nMappingOffset ) >> m_nMappingShift );
     310#endif
    235311  return( dstY );
    236312}
     
    238314SYUVP TCom3DAsymLUT::xMapUV( Pel y , Pel u , Pel v )
    239315{
     316#if R0151_CGS_3D_ASYMLUT_IMPROVE
     317  const SCuboid & rCuboid = m_pCuboid[xGetYIdx(y)][xGetUIdx(u)][xGetVIdx(v)];
     318  SYUVP dst;
     319  dst.Y = 0;
     320  dst.U = ( ( rCuboid.P[0].U * y + rCuboid.P[1].U * u + rCuboid.P[2].U * v + m_nMappingOffset ) >> m_nMappingShift ) + rCuboid.P[3].U;
     321  dst.V = ( ( rCuboid.P[0].V * y + rCuboid.P[1].V * u + rCuboid.P[2].V * v + m_nMappingOffset ) >> m_nMappingShift ) + rCuboid.P[3].V;
     322#else
    240323  const SCuboid & rCuboid = m_pCuboid[y>>m_nYShift2Idx][u>>m_nUShift2Idx][v>>m_nVShift2Idx];
    241324  SYUVP dst = rCuboid.P[0];
     
    251334                    + ( ( deltaV * ( rCuboid.P[2].V - rCuboid.P[1].V ) ) << m_nYShift2Idx )
    252335                    + m_nMappingOffset ) >> m_nMappingShift );
     336#endif
    253337  return( dst );
    254338}
     
    256340Void TCom3DAsymLUT::xSaveCuboids( SCuboid *** pSrcCuboid )
    257341{
     342#if R0179_ENC_OPT_3DLUT_SIZE
     343  memcpy( m_pCuboid[0][0] , pSrcCuboid[0][0] , sizeof( SCuboid ) * getMaxYSize() * getMaxCSize() * getMaxCSize() );
     344#else
    258345  memcpy( m_pCuboid[0][0] , pSrcCuboid[0][0] , sizeof( SCuboid ) * m_nYSize * m_nUSize * m_nVSize );
     346#endif
    259347}
    260348
     
    262350{
    263351  assert( pSrc->getMaxOctantDepth() == getMaxOctantDepth() && pSrc->getMaxYPartNumLog2() == getMaxYPartNumLog2() );
    264   xUpdatePartitioning( pSrc->getCurOctantDepth() , pSrc->getCurYPartNumLog2() );
     352  xUpdatePartitioning( pSrc->getCurOctantDepth() , pSrc->getCurYPartNumLog2()
     353#if R0151_CGS_3D_ASYMLUT_IMPROVE
     354    , pSrc->getAdaptChromaThresholdU() , pSrc->getAdaptChromaThresholdV()
     355#endif
     356    );
    265357  setResQuantBit( pSrc->getResQuantBit() );
    266358  xSaveCuboids( pSrc->m_pCuboid );
    267359}
    268360
    269 #endif
    270 
     361#if R0164_CGS_LUT_BUGFIX_CHECK
     362Void TCom3DAsymLUT::xInitCuboids( )
     363{
     364  // All vertices are initialized as non-exlicitly-encoded
     365  for( Int yIdx = 0 ; yIdx < m_nYSize ; yIdx++ )
     366  {
     367    for( Int uIdx = 0 ; uIdx < m_nUSize ; uIdx++ )
     368    {
     369      for( Int vIdx = 0 ; vIdx < m_nVSize ; vIdx++ )
     370      {
     371        m_pCuboidExplicit[yIdx][uIdx][vIdx] = false;
     372        m_pCuboidFilled[yIdx][uIdx][vIdx]   = false;
     373      }
     374    }
     375  }
     376}
     377
     378Void TCom3DAsymLUT::xCuboidsFilledCheck( Int yIdx , Int uIdx , Int vIdx )
     379{
     380  if ( m_pCuboidFilled[yIdx][uIdx][vIdx] == false )
     381  {
     382    if( yIdx > 0)
     383      assert ( m_pCuboidFilled[yIdx-1][uIdx][vIdx] );
     384
     385    for ( Int nVertexIdx=0 ; nVertexIdx<4 ; nVertexIdx++ )
     386      m_pCuboid[yIdx][uIdx][vIdx].P[nVertexIdx] = yIdx == 0 ? xGetCuboidVertexPredA( yIdx , uIdx , vIdx , nVertexIdx ): xGetCuboidVertexPredAll( yIdx , uIdx , vIdx , nVertexIdx );
     387
     388    m_pCuboidFilled[yIdx][uIdx][vIdx] = true ;
     389  }
     390}
     391
     392
     393Void TCom3DAsymLUT::xCuboidsFilledCheck( Bool bDecode )
     394{
     395  Int ySize = 1 << ( getCurOctantDepth() + getCurYPartNumLog2() );
     396  Int uSize = 1 << getCurOctantDepth();
     397  Int vSize = 1 << getCurOctantDepth();
     398  for( Int yIdx = 0 ; yIdx < ySize ; yIdx++ )
     399  {
     400    for( Int uIdx = 0 ; uIdx < uSize ; uIdx++ )
     401    {
     402      for( Int vIdx = 0 ; vIdx < vSize ; vIdx++ )
     403      {
     404        if ( bDecode )
     405          xCuboidsFilledCheck( yIdx , uIdx , vIdx );
     406
     407        assert( m_pCuboidFilled[yIdx][uIdx][vIdx] );
     408      }
     409    }
     410  }
     411
     412}
     413#endif
     414
     415#if R0150_CGS_SIGNAL_CONSTRAINTS
     416Bool TCom3DAsymLUT::isRefLayer( UInt uiRefLayerId )
     417{
     418  Bool bIsRefLayer = false;
     419  for( UInt i = 0 ; i < m_vRefLayerId.size() ; i++ )
     420  {
     421    if( m_vRefLayerId[i] == uiRefLayerId )
     422    {
     423      bIsRefLayer = true;
     424      break;
     425    }
     426  }
     427
     428  return( bIsRefLayer );
     429}
     430#endif
     431
     432#if R0164_CGS_LUT_BUGFIX_CHECK
     433Void  TCom3DAsymLUT::display( Bool bFilled )
     434{
     435  Int ySize = 1 << ( getCurOctantDepth() + getCurYPartNumLog2() );
     436  Int uSize = 1 << getCurOctantDepth();
     437  Int vSize = 1 << getCurOctantDepth();
     438  Int vIdx=0;
     439
     440  printf("\n");
     441  printf("3DLut Explicit flag:\n");
     442  for( Int uIdx = 0 ; uIdx < uSize ; uIdx++ )
     443  {
     444    for( Int yIdx = 0 ; yIdx < ySize ; yIdx++ )
     445    {
     446      printf("%d\t", m_pCuboidExplicit[yIdx][uIdx][vIdx] );
     447    }
     448    printf("\n");
     449  }
     450
     451  printf("3DLut values (explicit):\n");
     452  for( Int uIdx = 0 ; uIdx < uSize ; uIdx++ )
     453  {
     454    for( Int yIdx = 0 ; yIdx < ySize ; yIdx++ )
     455    {
     456      if ( m_pCuboidExplicit[yIdx][uIdx][vIdx] )  printf("%d\t", m_pCuboid[yIdx][uIdx][vIdx].P[0].Y );
     457      else                                        printf("?\t", m_pCuboid[yIdx][uIdx][vIdx].P[0].Y );
     458    }
     459    printf("\n");
     460  }
     461
     462  printf("3DLut values (all):\n");
     463  for( Int uIdx = 0 ; uIdx < uSize ; uIdx++ )
     464  {
     465    for( Int yIdx = 0 ; yIdx < ySize ; yIdx++ )
     466    {
     467      if ( bFilled ) {
     468        if ( m_pCuboidFilled[yIdx][uIdx][vIdx] )  printf("%d\t"  , m_pCuboid[yIdx][uIdx][vIdx].P[0].Y );
     469        else                                      printf("unk\t" , m_pCuboid[yIdx][uIdx][vIdx].P[0].Y );
     470      }
     471      else
     472        printf("%d\t"  , m_pCuboid[yIdx][uIdx][vIdx].P[0].Y );
     473    }
     474    printf("\n");
     475  }
     476
     477}
     478#endif
     479
     480#endif
     481
  • trunk/source/Lib/TLibCommon/TCom3DAsymLUT.h

    r815 r906  
    44
    55#include "TypeDef.h"
     6#if R0150_CGS_SIGNAL_CONSTRAINTS
     7#include <cassert>
     8#include <vector>
     9#endif
    610
    711#if Q0048_CGS_3D_ASYMLUT
     
    2529  virtual ~TCom3DAsymLUT();
    2630
    27   virtual Void  create( Int nMaxOctantDepth , Int nInputBitDepth , Int nInputBitDepthC , Int nOutputBitDepth , Int nOutputBitDepthC , Int nMaxYPartNumLog2 );
     31  virtual Void  create( Int nMaxOctantDepth , Int nInputBitDepth , Int nInputBitDepthC , Int nOutputBitDepth , Int nOutputBitDepthC , Int nMaxYPartNumLog2
     32#if R0151_CGS_3D_ASYMLUT_IMPROVE
     33  , Int nAdaptCThresholdU , Int nAdaptCThresholdV
     34#endif
     35    );
    2836  virtual Void  destroy();
    2937
     
    3644  Int   getResQuantBit()     { return m_nResQuanBit; }
    3745  Void  setResQuantBit(Int n){ m_nResQuanBit = n; }
     46#if R0300_CGS_RES_COEFF_CODING
     47  Int   getMappingShift()     { return m_nMappingShift; }
     48  Int   getDeltaBits()        { return m_nDeltaBits; }
     49  Void  setDeltaBits(Int n)   { m_nDeltaBits = n; }
     50#endif
    3851  Int   getMaxYPartNumLog2() { return m_nMaxYPartNumLog2; }
    3952  Int   getCurYPartNumLog2() { return m_nCurYPartNumLog2; }
     53#if R0150_CGS_SIGNAL_CONSTRAINTS
     54  Void  addRefLayerId( UInt uiRefLayerId ) 
     55  {
     56    if( !isRefLayer( uiRefLayerId ) )
     57      m_vRefLayerId.push_back( uiRefLayerId );
     58  }
     59  size_t  getRefLayerNum()     { return m_vRefLayerId.size();  }
     60  UInt  getRefLayerId( UInt n )  { assert( n < m_vRefLayerId.size() ); return m_vRefLayerId[n];   }
     61  Bool  isRefLayer( UInt uiRefLayerId );
     62#endif
     63#if R0151_CGS_3D_ASYMLUT_IMPROVE
     64  Void  setAdaptChromaThresholdU( Int n ) { m_nAdaptCThresholdU = n; }
     65  Int   getAdaptChromaThresholdU()        { return m_nAdaptCThresholdU; }
     66  Void  setAdaptChromaThresholdV( Int n ) { m_nAdaptCThresholdV = n;  }
     67  Int   getAdaptChromaThresholdV()        { return m_nAdaptCThresholdV; }
     68#endif
     69#if R0179_ENC_OPT_3DLUT_SIZE
     70  Int   getMaxYSize() { return 1<<(m_nMaxOctantDepth+m_nMaxYPartNumLog2); }
     71  Int   getMaxCSize() { return 1<<m_nMaxOctantDepth; }
     72#endif
    4073
    4174  Void  colorMapping( TComPicYuv * pcPicSrc,  TComPicYuv * pcPicDst );
     
    4578  SYUVP getCuboidVertexResTree( Int yIdx , Int uIdx , Int vIdx , Int nVertexIdx );
    4679  Void  setCuboidVertexResTree( Int yIdx , Int uIdx , Int vIdx , Int nVertexIdx , Int deltaY , Int deltaU , Int deltaV );
    47 
     80#if R0164_CGS_LUT_BUGFIX_CHECK
     81  Void  xInitCuboids( );
     82  Void  xCuboidsFilledCheck( Int yIdx , Int uIdx , Int vIdx );
     83  Void  xCuboidsFilledCheck( Bool bDecode );
     84  Void  display( Bool bFilled=true );
     85  Void  xSetExplicit( Int yIdx , Int uIdx , Int vIdx )  { m_pCuboidExplicit[yIdx][uIdx][vIdx] = true ; xSetFilled(yIdx,uIdx,vIdx); }
     86  Void  xSetFilled( Int yIdx , Int uIdx , Int vIdx )    { m_pCuboidFilled[yIdx][uIdx][vIdx] = true ; }
     87#endif
    4888
    4989private:
     
    68108  Int   m_nMappingOffset;
    69109  Int   m_nResQuanBit;
     110#if R0300_CGS_RES_COEFF_CODING
     111  Int   m_nDeltaBits;
     112#endif
    70113  SCuboid *** m_pCuboid;
    71114  const static Int m_nVertexIdxOffset[4][3];
     115#if R0150_CGS_SIGNAL_CONSTRAINTS
     116  std::vector<UInt> m_vRefLayerId;
     117#endif
     118#if R0151_CGS_3D_ASYMLUT_IMPROVE
     119  Int   m_nAdaptCThresholdU;
     120  Int   m_nAdaptCThresholdV;
     121#endif
     122#if R0164_CGS_LUT_BUGFIX_CHECK
     123  Bool  *** m_pCuboidExplicit;
     124  Bool  *** m_pCuboidFilled;
     125#endif
    72126
    73127protected:
     
    79133  Void xFree3DArray( T *** &p );
    80134
    81   Void  xUpdatePartitioning( Int nCurOctantDepth , Int nCurYPartNumLog2 );
     135  Void  xUpdatePartitioning( Int nCurOctantDepth , Int nCurYPartNumLog2
     136#if R0151_CGS_3D_ASYMLUT_IMPROVE
     137    , Int nAdaptCThresholdU , Int nAdaptCThreshodV
     138#endif
     139    );
    82140  SYUVP xGetCuboidVertexPredA( Int yIdx , Int uIdx , Int vIdx , Int nVertexIdx );
    83141  Pel   xMapY( Pel y , Pel u , Pel v );
     
    87145  Int   xGetUSize()  { return m_nUSize;  }
    88146  Int   xGetVSize()  { return m_nVSize;  }
     147#if R0151_CGS_3D_ASYMLUT_IMPROVE
     148  Int   xGetYIdx(Pel y)  { return( y >> m_nYShift2Idx ); }
     149  Int   xGetUIdx(Pel u)  { return( m_nCurOctantDepth == 1 ? u >= m_nAdaptCThresholdU : u >> m_nUShift2Idx ); }
     150  Int   xGetVIdx(Pel v)  { return( m_nCurOctantDepth == 1 ? v >= m_nAdaptCThresholdV : v >> m_nVShift2Idx ); }
     151  Int   xGetNormCoeffOne()    { return( 1 << m_nMappingShift ); }
     152#else
    89153  Int   xGetYShift2Idx() { return m_nYShift2Idx; }
    90154  Int   xGetUShift2Idx() { return m_nUShift2Idx; }
    91155  Int   xGetVShift2Idx() { return m_nVShift2Idx; }
     156#endif
    92157  SCuboid & xGetCuboid( Int yIdx , Int uIdx , Int vIdx ){ return m_pCuboid[yIdx][uIdx][vIdx];  }
    93158  Void  xSaveCuboids( SCuboid *** pSrcCuboid );
  • trunk/source/Lib/TLibCommon/TComDataCU.cpp

    r815 r906  
    34813481
    34823482#if SVC_EXTENSION
    3483 TComDataCU*  TComDataCU::getBaseColCU( UInt refLayerIdc, UInt uiCuAbsPartIdx, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase, Int iMotionMapping )
     3483TComDataCU* TComDataCU::getBaseColCU( UInt refLayerIdc, UInt uiCuAbsPartIdx, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase, Bool motionMapping )
    34843484{
    34853485  UInt uiPelX = getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiCuAbsPartIdx] ];
    34863486  UInt uiPelY = getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiCuAbsPartIdx] ];
    34873487
    3488   return getBaseColCU( refLayerIdc, uiPelX, uiPelY, uiCUAddrBase, uiAbsPartIdxBase, iMotionMapping );
    3489 }
    3490 
    3491 TComDataCU*  TComDataCU::getBaseColCU( UInt refLayerIdc, UInt uiPelX, UInt uiPelY, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase, Int iMotionMapping )
     3488  return getBaseColCU( refLayerIdc, uiPelX, uiPelY, uiCUAddrBase, uiAbsPartIdxBase, motionMapping );
     3489}
     3490
     3491TComDataCU* TComDataCU::getBaseColCU( UInt refLayerIdc, UInt pelX, UInt pelY, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase, Bool motionMapping )
    34923492{
    34933493  TComPic* baseColPic = m_pcSlice->getBaseColPic(refLayerIdc);
    34943494
    3495   uiPelX = (UInt)Clip3<UInt>(0, m_pcPic->getPicYuvRec()->getWidth() - 1, uiPelX);
    3496   uiPelY = (UInt)Clip3<UInt>(0, m_pcPic->getPicYuvRec()->getHeight() - 1, uiPelY);
     3495  UInt uiPelX = (UInt)Clip3<UInt>(0, m_pcPic->getPicYuvRec()->getWidth()  - 1, pelX);
     3496  UInt uiPelY = (UInt)Clip3<UInt>(0, m_pcPic->getPicYuvRec()->getHeight() - 1, pelY);
     3497
     3498#if REF_IDX_MFM
     3499  // centre of the collocated 16x16 block for motion mapping
     3500  if( motionMapping )
     3501  {
     3502    uiPelX = pelX + 8;
     3503    uiPelY = pelY + 8;
     3504  }
     3505#endif
    34973506
    34983507#if !LAYER_CTB
     
    35003509#endif
    35013510
     3511#if MOVE_SCALED_OFFSET_TO_PPS
     3512#if O0098_SCALED_REF_LAYER_ID
     3513  Int leftStartL = baseColPic->getSlice(0)->getPPS()->getScaledRefLayerWindowForLayer(baseColPic->getSlice(0)->getVPS()->getRefLayerId(getSlice()->getLayerId(), refLayerIdc)).getWindowLeftOffset();
     3514  Int topStartL  = baseColPic->getSlice(0)->getPPS()->getScaledRefLayerWindowForLayer(baseColPic->getSlice(0)->getVPS()->getRefLayerId(getSlice()->getLayerId(), refLayerIdc)).getWindowTopOffset();
     3515#else
     3516  Int leftStartL = baseColPic->getSlice(0)->getPPS()->getScaledRefLayerWindow(refLayerIdc).getWindowLeftOffset();
     3517  Int topStartL  = baseColPic->getSlice(0)->getPPS()->getScaledRefLayerWindow(refLayerIdc).getWindowTopOffset();
     3518#endif
     3519#else
    35023520#if O0098_SCALED_REF_LAYER_ID
    35033521  Int leftStartL = baseColPic->getSlice(0)->getSPS()->getScaledRefLayerWindowForLayer(baseColPic->getSlice(0)->getVPS()->getRefLayerId(getSlice()->getLayerId(), refLayerIdc)).getWindowLeftOffset();
     
    35073525  Int topStartL  = baseColPic->getSlice(0)->getSPS()->getScaledRefLayerWindow(refLayerIdc).getWindowTopOffset();
    35083526#endif
    3509 
     3527#endif
     3528
     3529#if REF_REGION_OFFSET
     3530  const Window &windowRL = baseColPic->getSlice(0)->getPPS()->getRefLayerWindow(refLayerIdc);
     3531  Int iBX = (((uiPelX - leftStartL)*g_posScalingFactor[refLayerIdc][0] + (1<<15)) >> 16) + windowRL.getWindowLeftOffset();
     3532  Int iBY = (((uiPelY - topStartL )*g_posScalingFactor[refLayerIdc][1] + (1<<15)) >> 16) + windowRL.getWindowTopOffset();
     3533#else
    35103534#if Q0200_CONFORMANCE_BL_SIZE
    35113535  Int chromaFormatIdc = baseColPic->getSlice(0)->getChromaFormatIdc();
     
    35163540  Int iBY = ((uiPelY - topStartL )*g_posScalingFactor[refLayerIdc][1] + (1<<15)) >> 16;
    35173541#endif
     3542#endif
    35183543
    35193544#if REF_IDX_MFM
    35203545  // offset for collocated block in the motion mapping
    3521   if( iMotionMapping == 1 )
    3522   {
    3523     Bool unequalPictureSizeFlag = g_posScalingFactor[refLayerIdc][0] != 65536 || g_posScalingFactor[refLayerIdc][1] != 65536; //the condition should be updated according to the WD.
    3524 
    3525     // actually, motion field compression is performed in the Void TComPic::compressMotion() function, but with (+4) the rounding may have effect on the picture boundary check.
    3526     if( unequalPictureSizeFlag )
    3527     {
     3546  if( motionMapping )
     3547  {
     3548    if( m_pcPic->equalPictureSizeAndOffsetFlag(refLayerIdc) )
     3549    {
     3550      // copy motion field from the same sample position for the case of 1x scaling ratio and same offset value between the current and reference layers
     3551      iBX = pelX;
     3552      iBY = pelY;
     3553    }
     3554    else
     3555    {
     3556      // actually, motion field compression is performed in the Void TComPic::compressMotion() function, but with (+4) the rounding may have effect on the picture boundary check.
    35283557      iBX = ( ( iBX + 4 ) >> 4 ) << 4;
    35293558      iBY = ( ( iBY + 4 ) >> 4 ) << 4;
    3530     }
    3531     else
    3532     {
    3533       iBX += 4;
    3534       iBY += 4;
    35353559    }
    35363560  }
     
    35873611{
    35883612  // check BL mode
    3589   UInt          uiCUAddrBase = 0, uiAbsPartAddrBase = 0;
     3613  UInt uiCUAddrBase = 0, uiAbsPartAddrBase = 0;
    35903614  // the right reference layerIdc should be specified, currently it is set to m_layerId-1
    3591   TComDataCU*   pcTempCU = getBaseColCU(m_layerId - 1, uiAbsPartIdx, uiCUAddrBase, uiAbsPartAddrBase, 0 );
     3615  TComDataCU* pcTempCU = getBaseColCU(m_layerId - 1, uiAbsPartIdx, uiCUAddrBase, uiAbsPartAddrBase, false );
    35923616
    35933617  if( pcTempCU->getPredictionMode( uiAbsPartAddrBase ) != MODE_INTRA )
  • trunk/source/Lib/TLibCommon/TComDataCU.h

    r713 r906  
    469469  Bool xCheckZeroMVILRMvdL1Zero(Int iRefList, Int iRefIdx, Int MvpIdx);
    470470#endif
    471   TComDataCU*   getBaseColCU( UInt refLayerIdc, UInt uiCuAbsPartIdx, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase, Int iMotionMapping = 0 );
    472   TComDataCU*   getBaseColCU( UInt refLayerIdc, UInt uiPelX, UInt uiPelY, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase, Int iMotionMapping = 0 );
     471  TComDataCU*   getBaseColCU( UInt refLayerIdc, UInt uiCuAbsPartIdx, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase, Bool motionMapping = false );
     472  TComDataCU*   getBaseColCU( UInt refLayerIdc, UInt pelX, UInt pelY, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase, Bool motionMapping = false );
    473473  Void          scaleBaseMV( UInt refLayerIdc, TComMvField& rcMvFieldEnhance, TComMvField& rcMvFieldBase );
    474474#endif
  • trunk/source/Lib/TLibCommon/TComMotionInfo.h

    r713 r906  
    155155  Void compress(Char* pePredMode, Int scale);
    156156
    157 #if AVC_SYNTAX
    158   Void           setMv    (TComMv cMv,  Int iIdx )         { m_pcMv    [iIdx] = cMv; }
    159   Void           setRefIdx(Int iRefIdx, Int iIdx   )       { m_piRefIdx[iIdx] =  iRefIdx; }
    160 #endif
    161 
    162157#if REF_IDX_MFM
    163158  Void setMvField( TComMvField const& mvField, Int iIdx )
  • trunk/source/Lib/TLibCommon/TComPic.cpp

    r815 r906  
    6464  memset( m_pcFullPelBaseRec, 0, sizeof( m_pcFullPelBaseRec ) );
    6565  memset( m_bSpatialEnhLayer, false, sizeof( m_bSpatialEnhLayer ) );
     66  memset( m_equalPictureSizeAndOffsetFlag, false, sizeof( m_equalPictureSizeAndOffsetFlag ) );
    6667#endif
    6768  m_apcPicYuv[0]      = NULL;
     
    8485  if (!bIsVirtual)
    8586  {
     87#if R0156_CONF_WINDOW_IN_REP_FORMAT
     88#if AUXILIARY_PICTURES
     89    m_apcPicYuv[0]  = new TComPicYuv;  m_apcPicYuv[0]->create( iWidth, iHeight, chromaFormatIDC, uiMaxWidth, uiMaxHeight, uiMaxDepth, &conformanceWindow );
     90#else
     91    m_apcPicYuv[0]  = new TComPicYuv;  m_apcPicYuv[0]->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth, &conformanceWindow );
     92#endif
     93#else
    8694#if AUXILIARY_PICTURES
    8795    m_apcPicYuv[0]  = new TComPicYuv;  m_apcPicYuv[0]->create( iWidth, iHeight, chromaFormatIDC, uiMaxWidth, uiMaxHeight, uiMaxDepth, pcSps );
     
    8997    m_apcPicYuv[0]  = new TComPicYuv;  m_apcPicYuv[0]->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth, pcSps );
    9098#endif
    91   }
     99#endif
     100  }
     101#if R0156_CONF_WINDOW_IN_REP_FORMAT
     102#if AUXILIARY_PICTURES
     103  m_apcPicYuv[1]  = new TComPicYuv;  m_apcPicYuv[1]->create( iWidth, iHeight, chromaFormatIDC, uiMaxWidth, uiMaxHeight, uiMaxDepth, &conformanceWindow );
     104#else
     105  m_apcPicYuv[1]  = new TComPicYuv;  m_apcPicYuv[1]->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth, &conformanceWindow );
     106#endif
     107#else
    92108#if AUXILIARY_PICTURES
    93109  m_apcPicYuv[1]  = new TComPicYuv;  m_apcPicYuv[1]->create( iWidth, iHeight, chromaFormatIDC, uiMaxWidth, uiMaxHeight, uiMaxDepth, pcSps );
     
    95111  m_apcPicYuv[1]  = new TComPicYuv;  m_apcPicYuv[1]->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth, pcSps );
    96112#endif
     113#endif
    97114
    98115  for( Int i = 0; i < MAX_LAYERS; i++ )
     
    100117    if( m_bSpatialEnhLayer[i] )
    101118    {
     119#if R0156_CONF_WINDOW_IN_REP_FORMAT
     120#if AUXILIARY_PICTURES
     121      m_pcFullPelBaseRec[i] = new TComPicYuv;  m_pcFullPelBaseRec[i]->create( iWidth, iHeight, chromaFormatIDC, uiMaxWidth, uiMaxHeight, uiMaxDepth, &conformanceWindow );
     122#else
     123      m_pcFullPelBaseRec[i] = new TComPicYuv;  m_pcFullPelBaseRec[i]->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth, &conformanceWindow );
     124#endif
     125#else
    102126#if AUXILIARY_PICTURES
    103127      m_pcFullPelBaseRec[i] = new TComPicYuv;  m_pcFullPelBaseRec[i]->create( iWidth, iHeight, chromaFormatIDC, uiMaxWidth, uiMaxHeight, uiMaxDepth, pcSps );
    104128#else
    105129      m_pcFullPelBaseRec[i] = new TComPicYuv;  m_pcFullPelBaseRec[i]->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth, pcSps );
     130#endif
    106131#endif
    107132    }
     
    187212  for( Int i = 0; i < MAX_LAYERS; i++ )
    188213  {
    189     if( m_bSpatialEnhLayer[i] )
     214    if( m_bSpatialEnhLayer[i] && m_pcFullPelBaseRec[i] )
    190215    {
    191216      m_pcFullPelBaseRec[i]->destroy();
     
    260285Void TComPic::copyUpsampledMvField(UInt refLayerIdc, TComPic* pcPicBase)
    261286{
    262   UInt numPartitions   = 1<<(g_uiMaxCUDepth<<1);
    263   UInt widthMinPU      = g_uiMaxCUWidth/(1<<g_uiMaxCUDepth);
    264   UInt heightMinPU     = g_uiMaxCUHeight/(1<<g_uiMaxCUDepth);
    265   Int  unitNum         = max (1, (Int)((16/widthMinPU)*(16/heightMinPU)) );
     287  UInt numPartitions = 1<<(g_uiMaxCUDepth<<1);
     288  UInt widthMinPU    = g_uiMaxCUWidth/(1<<g_uiMaxCUDepth);
     289  UInt heightMinPU   = g_uiMaxCUHeight/(1<<g_uiMaxCUDepth);
     290  Int  unitNum       = max (1, (Int)((16/widthMinPU)*(16/heightMinPU)) );
    266291
    267292  for(UInt cuIdx = 0; cuIdx < getPicSym()->getNumberOfCUsInFrame(); cuIdx++)  //each LCU
     
    277302
    278303      TComDataCU *pcColCU = 0;
    279       pcColCU = pcCUDes->getBaseColCU(refLayerIdc, pelX + 8, pelY + 8, baseCUAddr, baseAbsPartIdx, 1);
     304      pcColCU = pcCUDes->getBaseColCU(refLayerIdc, pelX, pelY, baseCUAddr, baseAbsPartIdx, true);
    280305
    281306      if( pcColCU && (pcColCU->getPredictionMode(baseAbsPartIdx) != MODE_NONE) && (pcColCU->getPredictionMode(baseAbsPartIdx) != MODE_INTRA) )  //base layer unit not skip and invalid mode
     
    306331      }
    307332    }
    308     memset( pcCUDes->getPartitionSize(), SIZE_2Nx2N, sizeof(Char)*numPartitions);
     333    memset( pcCUDes->getPartitionSize(), SIZE_2Nx2N, sizeof(Char)*numPartitions );
    309334  }
    310335}
     
    332357}
    333358#endif
    334 #endif
    335 
    336 #if AVC_SYNTAX
    337 Void TComPic::readBLSyntax( fstream* filestream, UInt numBytes )
    338 {
    339   if( !filestream->good() )
    340   {
    341     return;
    342   }
    343 
    344   UInt   width      = this->getPicYuvRec()->getWidth();
    345   UInt   height     = this->getPicYuvRec()->getHeight();
    346 
    347   UInt64 poc        = (UInt64)this->getPOC();
    348   UInt   partWidth  = width / 4;
    349   UInt   partHeight = height / 4;
    350 
    351   UInt numPartInWidth    = this->getNumPartInWidth();
    352   UInt numPartInHeight   = this->getNumPartInHeight();
    353   UInt numPartLCUInWidth = this->getFrameWidthInCU();
    354 
    355   UInt64 uiPos = (UInt64)poc * width * height * numBytes / 16;
    356    
    357   filestream->seekg( uiPos, ios_base::beg );
    358 
    359   for( Int i = 0; i < partHeight; i++ )
    360   {
    361     for( Int j = 0; j < partWidth; j++ )
    362     {
    363       UInt x = ( j / numPartInWidth );
    364       UInt y = ( i / numPartInHeight );
    365 
    366       UInt addrLCU = y * numPartLCUInWidth + x;
    367       UInt partAddr = ( i - y * numPartInHeight ) * numPartInWidth + ( j - x * numPartInWidth );
    368       partAddr = g_auiRasterToZscan[partAddr];
    369      
    370       TComDataCU* pcCU = this->getCU( addrLCU );
    371      
    372       TComMv mv;
    373       Short temp;
    374 
    375       // RefIdxL0
    376       Char refIdxL0 = -1;
    377       filestream->read( &refIdxL0, 1 );
    378       assert( refIdxL0 >= -1 );
    379       pcCU->getCUMvField( REF_PIC_LIST_0 )->setRefIdx( (Int)refIdxL0, partAddr );
    380 
    381       // RefIdxL1
    382       Char refIdxL1 = -1;
    383       filestream->read( &refIdxL1, 1 );
    384       assert( refIdxL1 >= -1 );
    385       pcCU->getCUMvField( REF_PIC_LIST_1 )->setRefIdx( (Int)refIdxL1, partAddr );
    386 
    387       // MV L0
    388       temp = 0;
    389       filestream->read( reinterpret_cast<char*>(&temp), 2 );
    390       mv.setHor( (Short)temp );
    391       temp = 0;
    392       filestream->read( reinterpret_cast<char*>(&temp), 2 );
    393       mv.setVer( (Short)temp );
    394       pcCU->getCUMvField( REF_PIC_LIST_0 )->setMv( mv, partAddr );
    395 
    396       // MV L1
    397       temp = 0;
    398       filestream->read( reinterpret_cast<char*>(&temp), 2 );
    399       mv.setHor( (Short)temp );
    400       temp = 0;
    401       filestream->read( reinterpret_cast<char*>(&temp), 2 );
    402       mv.setVer( (Short)temp );
    403       pcCU->getCUMvField( REF_PIC_LIST_1 )->setMv( mv, partAddr );
    404 
    405       // set dependent information
    406       pcCU->setPredictionMode( partAddr, ( refIdxL0 == NOT_VALID && refIdxL1 == NOT_VALID ) ? MODE_INTRA : MODE_INTER );
    407       UInt interDir = ( refIdxL0 != NOT_VALID ) + ( refIdxL1 != NOT_VALID && this->getSlice(0)->isInterB() ) * 2;
    408       assert( interDir <= 3 );
    409       pcCU->setInterDir( partAddr, interDir );     
    410     }
    411   }
    412 }
    413 #endif
    414 
    415 #if SYNTAX_OUTPUT
    416 Void TComPic::wrireBLSyntax( fstream* filestream, UInt numBytes )
    417 {
    418   if( !filestream->good() )
    419   {
    420     return;
    421   }
    422 
    423   UInt   width       = this->getPicYuvRec()->getWidth();
    424   UInt   height      = this->getPicYuvRec()->getHeight();
    425 
    426   UInt64 poc        = (UInt64)this->getPOC();
    427   UInt   partWidth  = width / 4;
    428   UInt   partHeight = height / 4;
    429 
    430   UInt numPartInWidth    = this->getNumPartInWidth();
    431   UInt numPartInHeight   = this->getNumPartInHeight();
    432   UInt numPartLCUInWidth = this->getFrameWidthInCU();
    433 
    434   filestream->seekg( poc * width * height * numBytes / 16 );
    435    
    436   for( Int i = 0; i < partHeight; i++ )
    437   {
    438     for( Int j = 0; j < partWidth; j++ )
    439     {
    440       UInt x = ( j / numPartInWidth );
    441       UInt y = ( i / numPartInHeight );
    442 
    443       UInt addrLCU = y * numPartLCUInWidth + x;
    444       UInt partAddr = ( i - y * numPartInHeight ) * numPartInWidth + ( j - x * numPartInWidth );
    445       partAddr = g_auiRasterToZscan[partAddr];
    446      
    447       TComDataCU* pcCU = this->getCU( addrLCU );
    448      
    449       TComMv mv;
    450       Short temp;
    451       Char refIdxL0 = NOT_VALID, refIdxL1 = NOT_VALID;
    452 
    453       // RefIdx
    454       if( !pcCU->isIntra( partAddr ) )
    455       {
    456         refIdxL0 = (Char)pcCU->getCUMvField( REF_PIC_LIST_0 )->getRefIdx( partAddr );
    457         refIdxL1 = (Char)pcCU->getCUMvField( REF_PIC_LIST_1 )->getRefIdx( partAddr );
    458       }
    459       assert( refIdxL0 >= - 1 && refIdxL1 >= - 1 );
    460       filestream->put( refIdxL0 );
    461       filestream->put( refIdxL1 );
    462 
    463       // MV L0
    464       mv.setZero();
    465       if( refIdxL0 >= 0 )
    466       {
    467         mv = pcCU->getCUMvField( REF_PIC_LIST_0 )->getMv( partAddr );
    468       }
    469       temp = (Short)mv.getHor();
    470       filestream->write( reinterpret_cast<char*>(&temp), 2 );
    471       temp = (Short)mv.getVer();
    472       filestream->write( reinterpret_cast<char*>(&temp), 2 );
    473 
    474       // MV L1
    475       mv.setZero();
    476       if( refIdxL1 >= 0 )
    477       {
    478         mv = pcCU->getCUMvField( REF_PIC_LIST_1 )->getMv( partAddr );
    479       }
    480       temp = (Short)mv.getHor();
    481       filestream->write( reinterpret_cast<char*>(&temp), 2 );
    482       temp = (Short)mv.getVer();
    483       filestream->write( reinterpret_cast<char*>(&temp), 2 );
    484     }
    485   }
    486 }
    487359#endif
    488360
     
    529401#endif
    530402
     403#if WPP_FIX
     404UInt TComPic::getSubstreamForLCUAddr(const UInt uiLCUAddr, const Bool bAddressInRaster, TComSlice *pcSlice)
     405{
     406  const Int iNumSubstreams = pcSlice->getPPS()->getNumSubstreams();
     407  UInt uiSubStrm;
     408
     409  if (iNumSubstreams > 1) // wavefronts, and possibly tiles being used.
     410  {
     411    TComPicSym &picSym=*(getPicSym());
     412    const UInt uiLCUAddrRaster = bAddressInRaster?uiLCUAddr : picSym.getCUOrderMap(uiLCUAddr);
     413    const UInt uiWidthInLCUs  = picSym.getFrameWidthInCU();
     414    const UInt uiTileIndex=picSym.getTileIdxMap(uiLCUAddrRaster);
     415    const UInt widthInTiles=(picSym.getNumColumnsMinus1()+1);
     416    TComTile *pTile=picSym.getTComTile(uiTileIndex);
     417    const UInt uiTileStartLCU = pTile->getFirstCUAddr();
     418    const UInt uiTileLCUY = uiTileStartLCU / uiWidthInLCUs;
     419    // independent tiles => substreams are "per tile".  iNumSubstreams has already been multiplied.
     420    const UInt uiLin = uiLCUAddrRaster / uiWidthInLCUs;
     421          UInt uiStartingSubstreamForTile=(uiTileLCUY*widthInTiles) + (pTile->getTileHeight()*(uiTileIndex%widthInTiles));
     422    uiSubStrm = uiStartingSubstreamForTile + (uiLin-uiTileLCUY);
     423  }
     424  else
     425  {
     426    // dependent tiles => substreams are "per frame".
     427    uiSubStrm = 0;//uiLin % iNumSubstreams; // x modulo 1 = 0 !
     428  }
     429  return uiSubStrm;
     430}
     431#endif
     432
     433
    531434//! \}
  • trunk/source/Lib/TLibCommon/TComPic.h

    r815 r906  
    4545#include "TComBitStream.h"
    4646#include "SEI.h"
    47 #if AVC_BASE || SYNTAX_OUTPUT
     47#if AVC_BASE
    4848#include <fstream>
    4949#endif
     
    8888  Bool                  m_bSpatialEnhLayer[MAX_LAYERS];       // whether current layer is a spatial enhancement layer,
    8989  TComPicYuv*           m_pcFullPelBaseRec[MAX_LAYERS];    // upsampled base layer recontruction for difference domain inter prediction
     90#if REF_IDX_MFM
     91  Bool                  m_equalPictureSizeAndOffsetFlag[MAX_LAYERS];
     92#endif
    9093#endif
    9194#if Q0048_CGS_3D_ASYMLUT
     
    203206#endif
    204207#if REF_IDX_MFM
     208  Bool          equalPictureSizeAndOffsetFlag(UInt refLayerIdc)             { return m_equalPictureSizeAndOffsetFlag[refLayerIdc]; }
     209  Void          setEqualPictureSizeAndOffsetFlag(UInt refLayerIdc, Bool b)  { m_equalPictureSizeAndOffsetFlag[refLayerIdc] = b;    }
    205210  Void          copyUpsampledMvField  ( UInt refLayerIdc, TComPic* pcPicBase );
    206211  Void          initUpsampledMvField  ();
     
    213218#endif
    214219  Void  copyUpsampledPictureYuv(TComPicYuv*   pcPicYuvIn, TComPicYuv*   pcPicYuvOut);
    215 #if AVC_SYNTAX
    216   Void readBLSyntax( fstream* filestream, UInt numBytes );
    217 #endif
    218 #endif
    219 #if SYNTAX_OUTPUT
    220   Void wrireBLSyntax( fstream* filestream, UInt numBytes );
    221220#endif
    222221
     
    229228  Void setCurrAuFlag(Bool x) {m_currAuFlag = x; }
    230229#endif
     230#if WPP_FIX
     231  UInt          getSubstreamForLCUAddr(const UInt uiLCUAddr, const Bool bAddressInRaster, TComSlice *pcSlice);
     232#endif
    231233};// END CLASS DEFINITION TComPic
    232234
  • trunk/source/Lib/TLibCommon/TComPicSym.cpp

    r595 r906  
    3838#include "TComPicSym.h"
    3939#include "TComSampleAdaptiveOffset.h"
     40#include "TComSlice.h"
    4041
    4142//! \ingroup TLibCommon
     
    6364,m_iNumColumnsMinus1 (0)
    6465,m_iNumRowsMinus1(0)
    65 ,m_apcTComTile(NULL)
    6666,m_puiCUOrderMap(0)
    6767,m_puiTileIdxMap(NULL)
     
    101101    delete [] m_apcTComSlice;
    102102  }
    103   m_apcTComSlice      = new TComSlice*[m_uiNumCUsInFrame*m_uiNumPartitions]; 
     103  m_apcTComSlice      = new TComSlice*[m_uiNumCUsInFrame];
    104104  m_apcTComSlice[0]   = new TComSlice;
    105105  m_uiNumAllocatedSlice = 1;
     
    152152  delete [] m_apcTComDataCU;
    153153  m_apcTComDataCU = NULL;
    154 
    155 #if SVC_EXTENSION
    156   if( m_apcTComTile )
    157   {
    158 #endif
    159   for(Int i = 0; i < (m_iNumColumnsMinus1+1)*(m_iNumRowsMinus1+1); i++ )
    160   {
    161     delete m_apcTComTile[i];
    162   }
    163   delete [] m_apcTComTile;
    164 #if SVC_EXTENSION
    165   }
    166 #endif
    167 
    168   m_apcTComTile = NULL;
    169154
    170155  delete [] m_puiCUOrderMap;
     
    193178Void TComPicSym::allocateNewSlice()
    194179{
     180  assert ((m_uiNumAllocatedSlice + 1) <= m_uiNumCUsInFrame);
    195181  m_apcTComSlice[m_uiNumAllocatedSlice ++] = new TComSlice;
    196182  if (m_uiNumAllocatedSlice>=2)
     
    225211}
    226212
    227 Void TComPicSym::xCreateTComTileArray()
    228 {
    229   m_apcTComTile = new TComTile*[(m_iNumColumnsMinus1+1)*(m_iNumRowsMinus1+1)];
    230   for( UInt i=0; i<(m_iNumColumnsMinus1+1)*(m_iNumRowsMinus1+1); i++ )
    231   {
    232     m_apcTComTile[i] = new TComTile;
    233   }
    234 }
    235 
    236 Void TComPicSym::xInitTiles()
    237 {
    238   UInt  uiTileIdx;
    239   UInt  uiColumnIdx = 0;
    240   UInt  uiRowIdx = 0;
    241   UInt  uiRightEdgePosInCU;
    242   UInt  uiBottomEdgePosInCU;
    243   Int   i, j;
     213Void TComPicSym::initTiles(TComPPS *pps)
     214{
     215  //set NumColumnsMinus1 and NumRowsMinus1
     216  setNumColumnsMinus1( pps->getNumTileColumnsMinus1() );
     217  setNumRowsMinus1( pps->getTileNumRowsMinus1() );
     218
     219  const Int numCols = pps->getNumTileColumnsMinus1() + 1;
     220  const Int numRows = pps->getTileNumRowsMinus1() + 1;
     221  const Int numTiles = numRows * numCols;
     222
     223  // allocate memory for tile parameters
     224  m_tileParameters.resize(numTiles);
     225
     226  if( pps->getTileUniformSpacingFlag() )
     227  {
     228    //set width and height for each (uniform) tile
     229    for(Int row=0; row < numRows; row++)
     230  {
     231      for(Int col=0; col < numCols; col++)
     232      {
     233        const Int tileIdx = row * numCols + col;
     234        m_tileParameters[tileIdx].setTileWidth( (col+1)*getFrameWidthInCU()/numCols
     235                                              - (col*getFrameWidthInCU())/numCols );
     236        m_tileParameters[tileIdx].setTileHeight( (row+1)*getFrameHeightInCU()/numRows
     237                                               - (row*getFrameHeightInCU())/numRows );
     238      }
     239    }
     240  }
     241  else
     242  {
     243    //set the width for each tile
     244    for(Int row=0; row < numRows; row++)
     245    {
     246      Int cumulativeTileWidth = 0;
     247      for(Int col=0; col < getNumColumnsMinus1(); col++)
     248      {
     249        m_tileParameters[row * numCols + col].setTileWidth( pps->getTileColumnWidth(col) );
     250        cumulativeTileWidth += pps->getTileColumnWidth(col);
     251      }
     252      m_tileParameters[row * numCols + getNumColumnsMinus1()].setTileWidth( getFrameWidthInCU()-cumulativeTileWidth );
     253  }
     254
     255    //set the height for each tile
     256    for(Int col=0; col < numCols; col++)
     257    {
     258      Int cumulativeTileHeight = 0;
     259      for(Int row=0; row < getNumRowsMinus1(); row++)
     260      {
     261        m_tileParameters[row * numCols + col].setTileHeight( pps->getTileRowHeight(row) );
     262        cumulativeTileHeight += pps->getTileRowHeight(row);
     263      }
     264      m_tileParameters[getNumRowsMinus1() * numCols + col].setTileHeight( getFrameHeightInCU()-cumulativeTileHeight );
     265    }
     266  }
     267
     268#if TILE_SIZE_CHECK
     269  Int minWidth  = 1;
     270  Int minHeight = 1;
     271  const Int profileIdc = pps->getSPS()->getPTL()->getGeneralPTL()->getProfileIdc();
     272  if (  profileIdc == Profile::MAIN || profileIdc == Profile::MAIN10)
     273  {
     274    if (pps->getTilesEnabledFlag())
     275    {
     276      minHeight = 64  / g_uiMaxCUHeight;
     277      minWidth  = 256 / g_uiMaxCUWidth;
     278    }
     279  }
     280  for(Int row=0; row < numRows; row++)
     281  {
     282    for(Int col=0; col < numCols; col++)
     283    {
     284      const Int tileIdx = row * numCols + col;
     285      assert (m_tileParameters[tileIdx].getTileWidth() >= minWidth);
     286      assert (m_tileParameters[tileIdx].getTileHeight() >= minHeight);
     287    }
     288  }
     289#endif
    244290
    245291  //initialize each tile of the current picture
    246   for( uiRowIdx=0; uiRowIdx < m_iNumRowsMinus1+1; uiRowIdx++ )
    247   {
    248     for( uiColumnIdx=0; uiColumnIdx < m_iNumColumnsMinus1+1; uiColumnIdx++ )
    249     {
    250       uiTileIdx = uiRowIdx * (m_iNumColumnsMinus1+1) + uiColumnIdx;
     292  for( Int row=0; row < numRows; row++ )
     293  {
     294    for( Int col=0; col < numCols; col++ )
     295    {
     296      const Int tileIdx = row * numCols + col;
    251297
    252298      //initialize the RightEdgePosInCU for each tile
    253       uiRightEdgePosInCU = 0;
    254       for( i=0; i <= uiColumnIdx; i++ )
    255       {
    256         uiRightEdgePosInCU += this->getTComTile(uiRowIdx * (m_iNumColumnsMinus1+1) + i)->getTileWidth();
    257       }
    258       this->getTComTile(uiTileIdx)->setRightEdgePosInCU(uiRightEdgePosInCU-1);
     299      Int rightEdgePosInCTU = 0;
     300      for( Int i=0; i <= col; i++ )
     301      {
     302        rightEdgePosInCTU += m_tileParameters[row * numCols + i].getTileWidth();
     303      }
     304      m_tileParameters[tileIdx].setRightEdgePosInCU(rightEdgePosInCTU-1);
    259305
    260306      //initialize the BottomEdgePosInCU for each tile
    261       uiBottomEdgePosInCU = 0;
    262       for( i=0; i <= uiRowIdx; i++ )
    263       {
    264         uiBottomEdgePosInCU += this->getTComTile(i * (m_iNumColumnsMinus1+1) + uiColumnIdx)->getTileHeight();
    265       }
    266       this->getTComTile(uiTileIdx)->setBottomEdgePosInCU(uiBottomEdgePosInCU-1);
     307      Int bottomEdgePosInCTU = 0;
     308      for( Int i=0; i <= row; i++ )
     309      {
     310        bottomEdgePosInCTU += m_tileParameters[i * numCols + col].getTileHeight();
     311      }
     312      m_tileParameters[tileIdx].setBottomEdgePosInCU(bottomEdgePosInCTU-1);
    267313
    268314      //initialize the FirstCUAddr for each tile
    269       this->getTComTile(uiTileIdx)->setFirstCUAddr( (this->getTComTile(uiTileIdx)->getBottomEdgePosInCU() - this->getTComTile(uiTileIdx)->getTileHeight() +1)*m_uiWidthInCU +
    270         this->getTComTile(uiTileIdx)->getRightEdgePosInCU() - this->getTComTile(uiTileIdx)->getTileWidth() + 1);
    271     }
    272   }
     315      m_tileParameters[tileIdx].setFirstCUAddr( (m_tileParameters[tileIdx].getBottomEdgePosInCU() - m_tileParameters[tileIdx].getTileHeight() + 1) * getFrameWidthInCU() +
     316                                                 m_tileParameters[tileIdx].getRightEdgePosInCU() - m_tileParameters[tileIdx].getTileWidth() + 1);
     317    }
     318  }
     319
     320  Int  columnIdx = 0;
     321  Int  rowIdx = 0;
    273322
    274323  //initialize the TileIdxMap
    275   for( i=0; i<m_uiNumCUsInFrame; i++)
    276   {
    277     for(j=0; j < m_iNumColumnsMinus1+1; j++)
    278     {
    279       if(i % m_uiWidthInCU <= this->getTComTile(j)->getRightEdgePosInCU())
    280       {
    281         uiColumnIdx = j;
    282         j = m_iNumColumnsMinus1+1;
    283       }
    284     }
    285     for(j=0; j < m_iNumRowsMinus1+1; j++)
    286     {
    287       if(i/m_uiWidthInCU <= this->getTComTile(j*(m_iNumColumnsMinus1 + 1))->getBottomEdgePosInCU())
    288       {
    289         uiRowIdx = j;
    290         j = m_iNumRowsMinus1 + 1;
    291       }
    292     }
    293     m_puiTileIdxMap[i] = uiRowIdx * (m_iNumColumnsMinus1 + 1) + uiColumnIdx;
    294   }
    295 
     324  for( Int i=0; i<m_uiNumCUsInFrame; i++)
     325  {
     326    for( Int col=0; col < numCols; col++)
     327    {
     328      if(i % getFrameWidthInCU() <= m_tileParameters[col].getRightEdgePosInCU())
     329      {
     330        columnIdx = col;
     331        break;
     332      }
     333    }
     334    for(Int row=0; row < numRows; row++)
     335    {
     336      if(i / getFrameWidthInCU() <= m_tileParameters[row*numCols].getBottomEdgePosInCU())
     337      {
     338        rowIdx = row;
     339        break;
     340      }
     341    }
     342    m_puiTileIdxMap[i] = rowIdx * numCols + columnIdx;
     343  }
    296344}
    297345
     
    441489
    442490TComTile::TComTile()
     491: m_uiTileWidth         (0)
     492, m_uiTileHeight        (0)
     493, m_uiRightEdgePosInCU  (0)
     494, m_uiBottomEdgePosInCU (0)
     495, m_uiFirstCUAddr       (0)
     496
    443497{
    444498}
  • trunk/source/Lib/TLibCommon/TComPicSym.h

    r595 r906  
    4545#include "TComDataCU.h"
    4646class TComSampleAdaptiveOffset;
     47class TComPPS;
    4748
    4849//! \ingroup TLibCommon
     
    102103  Int           m_iNumColumnsMinus1;
    103104  Int           m_iNumRowsMinus1;
    104   TComTile**    m_apcTComTile;
     105  std::vector<TComTile> m_tileParameters;
    105106  UInt*         m_puiCUOrderMap;       //the map of LCU raster scan address relative to LCU encoding order
    106107  UInt*         m_puiTileIdxMap;       //the map of the tile index relative to LCU raster scan address
     
    142143  Int          getNumRowsMinus1()                                    { return m_iNumRowsMinus1; }
    143144  Int          getNumTiles()                                         { return (m_iNumRowsMinus1+1)*(m_iNumColumnsMinus1+1); }
    144   TComTile*    getTComTile  ( UInt tileIdx )                         { return *(m_apcTComTile + tileIdx); }
     145  TComTile*    getTComTile  ( UInt tileIdx )                         { return &(m_tileParameters[tileIdx]); }
    145146  Void         setCUOrderMap( Int encCUOrder, Int cuAddr )           { *(m_puiCUOrderMap + encCUOrder) = cuAddr; }
    146147  UInt         getCUOrderMap( Int encCUOrder )                       { return *(m_puiCUOrderMap + (encCUOrder>=m_uiNumCUsInFrame ? m_uiNumCUsInFrame : encCUOrder)); }
     
    150151  UInt         getPicSCUEncOrder( UInt SCUAddr );
    151152  UInt         getPicSCUAddr( UInt SCUEncOrder );
    152   Void         xCreateTComTileArray();
    153   Void         xInitTiles();
     153  Void         initTiles(TComPPS *pps);
    154154  UInt         xCalculateNxtCUAddr( UInt uiCurrCUAddr );
    155155  SAOBlkParam* getSAOBlkParam() { return m_saoBlkParams;}
     
    160160  UInt        getMaxCUWidth()           { return m_uiMaxCUWidth;                }
    161161  UInt        getMaxCUHeight()          { return m_uiMaxCUHeight;               }
    162 #endif
    163 #if AVC_SYNTAX
    164   UInt        getMaxCUWidth()           { return m_uiMaxCUWidth;                }
    165   UInt        getMaxCUHeight()          { return m_uiMaxCUHeight;               }
    166   UInt        getMaxDepth()             { return m_uhTotalDepth;               }
    167162#endif
    168163#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
  • trunk/source/Lib/TLibCommon/TComPicYuv.cpp

    r815 r906  
    6969
    7070#if SVC_EXTENSION
     71#if R0156_CONF_WINDOW_IN_REP_FORMAT
     72#if AUXILIARY_PICTURES
     73Void TComPicYuv::create( Int iPicWidth, Int iPicHeight, ChromaFormat chromaFormatIDC, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth, Window* conformanceWindow )
     74#else
     75Void TComPicYuv::create( Int iPicWidth, Int iPicHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth, Window* conformanceWindow )
     76#endif
     77#else // R0156_CONF_WINDOW_IN_REP_FORMAT
    7178#if AUXILIARY_PICTURES
    7279Void TComPicYuv::create( Int iPicWidth, Int iPicHeight, ChromaFormat chromaFormatIDC, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth, TComSPS* pcSps )
     
    7481Void TComPicYuv::create( Int iPicWidth, Int iPicHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth, TComSPS* pcSps )
    7582#endif
     83#endif
    7684#else
    7785Void TComPicYuv::create( Int iPicWidth, Int iPicHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth )
     
    8290 
    8391#if SVC_EXTENSION
     92#if R0156_CONF_WINDOW_IN_REP_FORMAT
     93  if(conformanceWindow != NULL)
     94  {
     95    m_conformanceWindow = *conformanceWindow;
     96  }
     97#else
    8498  if(pcSps != NULL)
    8599  {
    86100    m_conformanceWindow = pcSps->getConformanceWindow();
    87101  }
     102#endif
    88103#endif
    89104
     
    366381}
    367382
    368 #if SVC_EXTENSION
    369383Void TComPicYuv::dump( Char* pFileName, Bool bAdd, Int bitDepth )
    370384{
     
    431445}
    432446
    433 #endif
    434 
    435447//! \}
  • trunk/source/Lib/TLibCommon/TComPicYuv.h

    r815 r906  
    111111  // ------------------------------------------------------------------------------------------------
    112112#if SVC_EXTENSION
     113#if R0156_CONF_WINDOW_IN_REP_FORMAT
     114#if AUXILIARY_PICTURES
     115  Void  create      ( Int iPicWidth, Int iPicHeight, ChromaFormat chromaFormatIDC, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth, Window* conformanceWindow = NULL);
     116#else
     117  Void  create      ( Int iPicWidth, Int iPicHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth, Window* conformanceWindow = NULL);
     118#endif
     119#else
    113120#if AUXILIARY_PICTURES
    114121  Void  create      ( Int iPicWidth, Int iPicHeight, ChromaFormat chromaFormatIDC, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth, TComSPS* pcSps = NULL);
    115122#else
    116123  Void  create      ( Int iPicWidth, Int iPicHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth, TComSPS* pcSps = NULL);
     124#endif
    117125#endif
    118126#else
     
    191199  Void convertToMonochrome();
    192200#endif
     201#endif //SVC_EXTENSION
    193202  Void dump( Char* pFileName, Bool bAdd, Int bitDepth );
    194 #endif //SVC_EXTENSION
    195203
    196204};// END CLASS DEFINITION TComPicYuv
  • trunk/source/Lib/TLibCommon/TComPrediction.cpp

    r815 r906  
    796796#else
    797797#if O0194_JOINT_US_BITSHIFT
     798#if REF_REGION_OFFSET
     799Void TComPrediction::upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window, const Window altRefWindow )
     800{
     801  m_cUsf.upsampleBasePic( refLayerIdc, pcUsPic, pcBasePic, pcTempPic, window, altRefWindow );
     802}
     803#else
    798804Void TComPrediction::upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window)
    799805{
    800806  m_cUsf.upsampleBasePic( refLayerIdc, pcUsPic, pcBasePic, pcTempPic, window);
    801807}
     808#endif
    802809#else
    803810Void TComPrediction::upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window)
  • trunk/source/Lib/TLibCommon/TComPrediction.h

    r815 r906  
    126126#else
    127127#if O0194_JOINT_US_BITSHIFT
     128#if REF_REGION_OFFSET
     129  Void upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window, const Window altRefWindow );
     130#else
    128131  Void upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window );
     132#endif
    129133#else
    130134  Void upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window );
  • trunk/source/Lib/TLibCommon/TComSlice.cpp

    r815 r906  
    3636*/
    3737
     38#include <numeric>
    3839#include "CommonDef.h"
    3940#include "TComSlice.h"
     
    4748#if SVC_EXTENSION
    4849ParameterSetMap<TComVPS> ParameterSetManager::m_vpsMap(MAX_NUM_VPS);
     50ParameterSetMap<TComSPS> ParameterSetManager::m_spsMap(MAX_NUM_SPS);
     51ParameterSetMap<TComPPS> ParameterSetManager::m_ppsMap(MAX_NUM_PPS);
    4952Int ParameterSetManager::m_activeVPSId = -1;
    5053#endif
     
    104107, m_temporalLayerNonReferenceFlag ( false )
    105108, m_enableTMVPFlag                ( true )
     109#if R0226_SLICE_TMVP
     110, m_availableForTMVPRefFlag       ( true )
     111#endif
    106112#if SVC_EXTENSION
    107113, m_layerId                     ( 0 )
     
    124130, m_pocMsbValRequiredFlag         ( false )
    125131, m_pocMsbValPresentFlag          ( false )
     132#if P0297_VPS_POC_LSB_ALIGNED_FLAG
     133, m_pocMsbValNeeded               ( false )
     134#endif
    126135#endif
    127136#if POC_RESET_IDC_DECODER || POC_RESET_IDC_ENCODER
     
    215224  m_picOrderCntLsb = 0;
    216225#endif
     226#if P0297_VPS_POC_LSB_ALIGNED_FLAG
     227  m_pocMsbValNeeded  = false;
     228  m_pocResetDeltaPoc = 0;
     229#endif
    217230}
    218231
     
    265278  }
    266279}
     280
    267281Int TComSlice::getCurrMsb( Int currLsb, Int prevLsb, Int prevMsb, Int maxLsbVal )
    268282{
     
    281295}
    282296#endif
     297
    283298/**
    284299 - allocate table to contain substream sizes to be written to the slice header.
     
    516531#endif
    517532
    518 #if SVC_EXTENSION
    519   for( i = 0; i < m_activeNumILRRefIdx; i++ )
    520   {
    521     UInt refLayerIdc = m_interLayerPredLayerIdc[i];
    522     //inter-layer reference picture
    523 #if O0225_MAX_TID_FOR_REF_LAYERS
    524     Int maxTidIlRefPicsPlus1 = ( m_layerId > 0 && m_activeNumILRRefIdx > 0)? m_pcVPS->getMaxTidIlRefPicsPlus1(ilpPic[refLayerIdc]->getSlice(0)->getLayerId(),m_layerId) : 0;
    525 #else
    526     Int maxTidIlRefPicsPlus1 = ( m_layerId > 0 && m_activeNumILRRefIdx > 0)? m_pcVPS->getMaxTidIlRefPicsPlus1(ilpPic[refLayerIdc]->getSlice(0)->getLayerId()) : 0;
    527 #endif
    528     if( m_layerId > 0 && m_activeNumILRRefIdx > 0 && ( ( (Int)(ilpPic[refLayerIdc]->getSlice(0)->getTLayer())<=  maxTidIlRefPicsPlus1-1) || (maxTidIlRefPicsPlus1==0 && ilpPic[refLayerIdc]->getSlice(0)->getRapPicFlag()) )  )
    529     {
    530 #if REF_IDX_MFM
    531       if(!(m_eNalUnitType >= NAL_UNIT_CODED_SLICE_BLA_W_LP && m_eNalUnitType <= NAL_UNIT_CODED_SLICE_CRA) && getMFMEnabledFlag())
    532       {
    533         ilpPic[refLayerIdc]->copyUpsampledMvField( refLayerIdc, m_pcBaseColPic[refLayerIdc] );
    534       }
    535       else
    536       {
    537         ilpPic[refLayerIdc]->initUpsampledMvField();
    538       }
    539 #endif
    540       ilpPic[refLayerIdc]->setIsLongTerm(1);
    541     }
    542   }
    543 #endif
    544533  // ref_pic_list_init
    545534  TComPic*  rpsCurrList0[MAX_NUM_REF+1];
     
    595584        UInt refLayerId = m_pcVPS->getRefLayerId( m_layerId, refLayerIdc );
    596585#if RESAMPLING_CONSTRAINT_BUG_FIX
     586#if MOVE_SCALED_OFFSET_TO_PPS
     587#if O0098_SCALED_REF_LAYER_ID
     588        const Window &scalEL = getPPS()->getScaledRefLayerWindowForLayer(refLayerId);
     589#else
     590        const Window &scalEL = getPPS()->getScaledRefLayerWindow(m_interLayerPredLayerIdc[i]);
     591#endif
     592#else
    597593#if O0098_SCALED_REF_LAYER_ID
    598594        const Window &scalEL = getSPS()->getScaledRefLayerWindowForLayer(refLayerId);
    599595#else
    600596        const Window &scalEL = getSPS()->getScaledRefLayerWindow(m_interLayerPredLayerIdc[i]);
     597#endif
    601598#endif
    602599        Int scalingOffset = ((scalEL.getWindowLeftOffset()   == 0 ) &&
     
    19421939  Int nrOfPositivePictures = 0;
    19431940  TComReferencePictureSet* pcRPS = this->getLocalRPS();
     1941#if P0297_VPS_POC_LSB_ALIGNED_FLAG
     1942  Bool pocsAdjusted = false;
     1943#endif
    19441944
    19451945  // loop through all pictures in the Reference Picture Set
     
    19541954      rpcPic = *(iterPic++);
    19551955
     1956#if P0297_VPS_POC_LSB_ALIGNED_FLAG
     1957      // poc adjustement by poc reset needs to be taken into account here
     1958      Int deltaPOC = pReferencePictureSet->getDeltaPOC(i) - rpcPic->getPicSym()->getSlice(0)->getPocResetDeltaPoc();
     1959      if (rpcPic->getPicSym()->getSlice(0)->getPocResetDeltaPoc() != 0)
     1960      {
     1961        pocsAdjusted = true;
     1962      }
     1963
     1964      if (rpcPic->getPicSym()->getSlice(0)->getPOC() == this->getPOC() + deltaPOC && rpcPic->getSlice(0)->isReferenced())
     1965#else
    19561966      if(rpcPic->getPicSym()->getSlice(0)->getPOC() == this->getPOC() + pReferencePictureSet->getDeltaPOC(i) && rpcPic->getSlice(0)->isReferenced())
     1967#endif
    19571968      {
    19581969        // This picture exists as a reference picture
    19591970        // and should be added to the explicit Reference Picture Set
     1971#if P0297_VPS_POC_LSB_ALIGNED_FLAG
     1972        pcRPS->setDeltaPOC(k, deltaPOC);
     1973#else
    19601974        pcRPS->setDeltaPOC(k, pReferencePictureSet->getDeltaPOC(i));
     1975#endif
    19611976        pcRPS->setUsed(k, pReferencePictureSet->getUsed(i) && (!isRAP));
    19621977#if ALLOW_RECOVERY_POINT_AS_RAP
     1978#if P0297_VPS_POC_LSB_ALIGNED_FLAG
     1979        pcRPS->setUsed(k, pcRPS->getUsed(k) && !(bUseRecoveryPoint && this->getPOC() > pocRandomAccess && this->getPOC() + deltaPOC < pocRandomAccess) );
     1980#else
    19631981        pcRPS->setUsed(k, pcRPS->getUsed(k) && !(bUseRecoveryPoint && this->getPOC() > pocRandomAccess && this->getPOC() + pReferencePictureSet->getDeltaPOC(i) < pocRandomAccess) );
     1982#endif
    19641983#endif
    19651984        if(pcRPS->getDeltaPOC(k) < 0)
     
    20052024    || useNewRPS
    20062025#endif
     2026#if P0297_VPS_POC_LSB_ALIGNED_FLAG
     2027    || pocsAdjusted  // inter RPS prediction does not work if POCs have been adjusted
     2028#endif
    20072029    )
    20082030  {
     
    21392161  UInt retVal, layerId = getLayerId();
    21402162#if O0096_REP_FORMAT_INDEX
     2163#if R0279_REP_FORMAT_INBL
     2164  if ( layerId == 0 || sps->getV1CompatibleSPSFlag() == 1 )
     2165  {
     2166#if VPS_AVC_BL_FLAG_REMOVAL
     2167    if( layerId == 0 && vps->getNonHEVCBaseLayerFlag() )
     2168#else
     2169    if( layerId == 0 && vps->getAvcBaseLayerFlag() )
     2170#endif
     2171#else
    21412172  if ( layerId == 0 )
    21422173  {
    21432174    if( vps->getAvcBaseLayerFlag() )
     2175#endif
    21442176    {
    21452177      retVal = vps->getVpsRepFormat(layerId)->getPicWidthVpsInLumaSamples();
     
    21722204  UInt retVal, layerId = getLayerId();
    21732205#if O0096_REP_FORMAT_INDEX
    2174   if( layerId == 0 )
     2206#if R0279_REP_FORMAT_INBL
     2207  if ( layerId == 0 || sps->getV1CompatibleSPSFlag() == 1 )
     2208  {
     2209#if VPS_AVC_BL_FLAG_REMOVAL
     2210    if( layerId == 0 && vps->getNonHEVCBaseLayerFlag() )
     2211#else
     2212    if( layerId == 0 && vps->getAvcBaseLayerFlag() )
     2213#endif
     2214#else
     2215  if ( layerId == 0 )
    21752216  {
    21762217    if( vps->getAvcBaseLayerFlag() )
     2218#endif
    21772219    {
    21782220      retVal = vps->getVpsRepFormat(layerId)->getPicHeightVpsInLumaSamples();
     
    22142256#endif
    22152257#if O0096_REP_FORMAT_INDEX
    2216   if( layerId == 0 )
     2258#if R0279_REP_FORMAT_INBL
     2259  if ( layerId == 0 || sps->getV1CompatibleSPSFlag() == 1 )
     2260  {
     2261#if VPS_AVC_BL_FLAG_REMOVAL
     2262    if( layerId == 0 && vps->getNonHEVCBaseLayerFlag() )
     2263#else
     2264    if( layerId == 0 && vps->getAvcBaseLayerFlag() )
     2265#endif
     2266#else
     2267  if ( layerId == 0 )
    22172268  {
    22182269    if( vps->getAvcBaseLayerFlag() )
     2270#endif
    22192271    {
    22202272      retVal = vps->getVpsRepFormat(layerId)->getChromaFormatVpsIdc();
     
    22472299  UInt retVal, layerId = getLayerId();
    22482300#if O0096_REP_FORMAT_INDEX
    2249   if( layerId == 0 )
     2301#if R0279_REP_FORMAT_INBL
     2302  if ( layerId == 0 || sps->getV1CompatibleSPSFlag() == 1 )
     2303#else
     2304  if ( layerId == 0 )
     2305#endif
    22502306  {
    22512307    retVal = sps->getBitDepthY();
     
    22732329  UInt retVal, layerId = getLayerId();
    22742330#if O0096_REP_FORMAT_INDEX
    2275   if( layerId == 0 )
     2331#if R0279_REP_FORMAT_INBL
     2332  if ( layerId == 0 || sps->getV1CompatibleSPSFlag() == 1 )
     2333#else
     2334  if ( layerId == 0 )
     2335#endif
    22762336  {
    22772337    retVal = sps->getBitDepthC();
     
    23012361  return (getBitDepthC() - 8) * 6;
    23022362}
     2363
     2364#if R0156_CONF_WINDOW_IN_REP_FORMAT
     2365Window& TComSlice::getConformanceWindow()
     2366{
     2367  TComSPS *sps = getSPS();
     2368  TComVPS *vps = getVPS();
     2369  UInt layerId = getLayerId();
     2370#if O0096_REP_FORMAT_INDEX
     2371#if R0279_REP_FORMAT_INBL
     2372  if ( layerId == 0 || sps->getV1CompatibleSPSFlag() == 1 )
     2373  {
     2374#if VPS_AVC_BL_FLAG_REMOVAL
     2375    if( layerId == 0 && vps->getNonHEVCBaseLayerFlag() )
     2376#else
     2377    if( layerId == 0 && vps->getAvcBaseLayerFlag() )
     2378#endif
     2379#else
     2380  if ( layerId == 0 )
     2381  {
     2382    if( vps->getAvcBaseLayerFlag() )
     2383#endif
     2384    {
     2385      return vps->getVpsRepFormat(layerId)->getConformanceWindowVps();
     2386    }
     2387    else
     2388    {
     2389      return sps->getConformanceWindow();
     2390    }
     2391  }
     2392  else
     2393  {
     2394    return vps->getVpsRepFormat( vps->getVpsRepFormatIdx(sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : layerId) )->getConformanceWindowVps();
     2395  }
     2396#else
     2397  if( ( layerId == 0 ) || sps->getUpdateRepFormatFlag() )
     2398  {
     2399    return sps->getConformanceWindow();
     2400  }
     2401  else
     2402  {
     2403    return vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerId) )->getConformanceWindowVps();
     2404  }
     2405#endif
     2406}
     2407#endif
    23032408
    23042409RepFormat::RepFormat()
     
    23232428  m_bitDepthVpsLuma             = 0;
    23242429  m_bitDepthVpsChroma           = 0;
     2430#if R0156_CONF_WINDOW_IN_REP_FORMAT
     2431  m_conformanceWindowVps.resetWindow();
     2432#endif
    23252433}
    23262434#endif
     
    23332441TComVPS::TComVPS()
    23342442: m_VPSId                     (  0)
     2443#if VPS_RESERVED_FLAGS
     2444, m_baseLayerInternalFlag     (true)
     2445, m_baseLayerAvailableFlag    (true)
     2446#endif
    23352447, m_uiMaxTLayers              (  1)
    23362448, m_uiMaxLayers               (  1)
     
    23842496, m_vpsNonVuiExtLength (0)
    23852497#endif
     2498#if P0297_VPS_POC_LSB_ALIGNED_FLAG
     2499, m_vpsPocLsbAlignedFlag(false)
     2500#endif
    23862501{
    23872502  for( Int i = 0; i < MAX_TLAYER; i++)
     
    23922507  }
    23932508#if VPS_EXTN_MASK_AND_DIM_INFO
     2509#if VPS_AVC_BL_FLAG_REMOVAL
     2510  m_nonHEVCBaseLayerFlag = false;
     2511#else
    23942512  m_avcBaseLayerFlag = false;
     2513#endif
    23952514  m_splittingFlag = false;
    23962515  ::memset(m_scalabilityMask, 0, sizeof(m_scalabilityMask));
     
    24222541  ::memset(m_directDependencyType, 0, sizeof(m_directDependencyType));
    24232542#endif
     2543#if !NECESSARY_LAYER_FLAG
    24242544#if DERIVE_LAYER_ID_LIST_VARIABLES
    24252545  ::memset(m_layerSetLayerIdList,  0, sizeof(m_layerSetLayerIdList));
    24262546  ::memset(m_numLayerInIdList,     0, sizeof(m_numLayerInIdList   ));
    24272547#endif
     2548#endif
     2549#if !PER_LAYER_PTL
    24282550  ::memset(m_profileLevelTierIdx,  0, sizeof(m_profileLevelTierIdx));
     2551#endif
    24292552  m_maxOneActiveRefLayerFlag = true;
    24302553#if O0062_POC_LSB_NOT_PRESENT_FLAG
     
    25422665}
    25432666#if DERIVE_LAYER_ID_LIST_VARIABLES
     2667#if NECESSARY_LAYER_FLAG
     2668Void TComVPS::deriveLayerIdListVariables()
     2669{
     2670  // For layer 0
     2671  m_numLayerInIdList.push_back(1);
     2672  m_layerSetLayerIdList.resize(m_numLayerSets);
     2673  m_layerSetLayerIdList[0].push_back(0);
     2674 
     2675  // For other layers
     2676  for( Int i = 1; i < m_numLayerSets; i++ )
     2677  {
     2678    for( Int m = 0; m <= m_maxLayerId; m++)
     2679    {
     2680      if( m_layerIdIncludedFlag[i][m] )
     2681      {
     2682        m_layerSetLayerIdList[i].push_back(m);
     2683      }
     2684    }
     2685    m_numLayerInIdList.push_back(m_layerSetLayerIdList[i].size());
     2686  }
     2687}
     2688#else
    25442689Void TComVPS::deriveLayerIdListVariables()
    25452690{
     
    25642709}
    25652710#endif
     2711#endif
    25662712#if !RESOLUTION_BASED_DPB
    25672713#if VPS_DPB_SIZE_TABLE
     
    26602806Void TComVPS::setPredictedLayerIds()
    26612807{
    2662   for (UInt i = 0; i < getMaxLayers() - 1; i++)
    2663   {
    2664     UInt iNuhLId = getLayerIdInNuh(i);
     2808  for (UInt i = 0; i < m_uiMaxLayers - 1; i++)
     2809  {
     2810    UInt iNuhLId = m_layerIdInNuh[i];
    26652811    UInt predIdx = 0;
    26662812    for (UInt j = iNuhLId + 1; j < MAX_NUM_LAYER_IDS; j++)
    26672813    {
    2668       if (getRecursiveRefLayerFlag(j, iNuhLId))
    2669       {
    2670         setPredictedLayerId(i, predIdx, j);
     2814      if( m_recursiveRefLayerFlag[j][iNuhLId] )
     2815      {
     2816        m_predictedLayerId[iNuhLId][predIdx] = j;
    26712817        predIdx++;
    26722818      }
    26732819    }
    2674     setNumPredictedLayers(iNuhLId, predIdx);
    2675   }
     2820    m_numPredictedLayers[iNuhLId] = predIdx;
     2821  }
     2822  m_numPredictedLayers[m_layerIdInNuh[m_uiMaxLayers-1]] = 0;
    26762823}
    26772824
     
    26792826{
    26802827  Bool countedLayerIdxFlag[MAX_NUM_LAYER_IDS];
    2681 
    2682   for (UInt i = 0; i <= getMaxLayers() - 1; i++)
    2683   {
    2684     countedLayerIdxFlag[i] = false;
    2685   }
     2828  memset( countedLayerIdxFlag, 0, sizeof(countedLayerIdxFlag) );
    26862829
    26872830  Int numIndependentLayers = 0;
    26882831
    2689   for (UInt i = 0; i <= getMaxLayers() - 1; i++)
    2690   {
    2691     UInt iNuhLId = getLayerIdInNuh(i);
    2692     if (getNumDirectRefLayers(iNuhLId) == 0)
    2693     {
    2694       setTreePartitionLayerId(numIndependentLayers, 0, iNuhLId);
    2695       setNumLayersInTreePartition(numIndependentLayers, 1);
    2696       for (UInt j = 0; j < getNumPredictedLayers(iNuhLId); j++)
    2697       {
    2698         if (!countedLayerIdxFlag[getLayerIdInVps(iNuhLId)])
    2699         {
    2700           setTreePartitionLayerId(numIndependentLayers, getNumLayersInTreePartition(numIndependentLayers), getPredictedLayerId(iNuhLId, j));
    2701           setNumLayersInTreePartition(numIndependentLayers, getNumLayersInTreePartition(numIndependentLayers) + 1);
    2702           countedLayerIdxFlag[getLayerIdInVps(getPredictedLayerId(iNuhLId, j))] = true;
     2832  for (UInt i = 0; i < m_uiMaxLayers; i++)
     2833  {
     2834    UInt iNuhLId = m_layerIdInNuh[i];
     2835    if( m_numDirectRefLayers[iNuhLId] == 0 )
     2836    {
     2837      m_treePartitionLayerIdList[numIndependentLayers][0] = iNuhLId;
     2838      m_numLayersInTreePartition[numIndependentLayers] = 1;
     2839      for( UInt j = 0; j < m_numPredictedLayers[iNuhLId]; j++ )
     2840      {
     2841        if( !countedLayerIdxFlag[m_layerIdInVps[iNuhLId]] )
     2842        {
     2843          m_treePartitionLayerIdList[numIndependentLayers][m_numLayersInTreePartition[numIndependentLayers]] = m_predictedLayerId[iNuhLId][j];
     2844          m_numLayersInTreePartition[numIndependentLayers] = m_numLayersInTreePartition[numIndependentLayers] + 1;
     2845          countedLayerIdxFlag[m_layerIdInVps[m_predictedLayerId[iNuhLId][j]]] = true;
    27032846        }
    27042847      }
     
    27072850  }
    27082851
    2709   setNumIndependentLayers(numIndependentLayers);
     2852  m_numIndependentLayers = numIndependentLayers;
    27102853}
    27112854
    27122855void TComVPS::setLayerIdIncludedFlagsForAddLayerSets()
    27132856{
    2714   for (UInt i = 0; i < getNumAddLayerSets(); i++)
    2715   {
    2716     for (UInt j = 1; j < getNumIndependentLayers(); j++)
     2857  for (UInt i = 0; i < m_numAddLayerSets; i++)
     2858  {
     2859    for (UInt j = 1; j < m_numIndependentLayers; j++)
    27172860    {
    27182861      Int layerNum = 0;
    2719       Int lsIdx = getVpsNumLayerSetsMinus1() + 1 + i;
     2862      Int lsIdx = m_vpsNumLayerSetsMinus1 + 1 + i;
    27202863      for (Int layerId = 0; layerId < MAX_VPS_LAYER_ID_PLUS1; layerId++)
    27212864      {
    2722         setLayerIdIncludedFlag(false, lsIdx, layerId);
    2723       }
    2724       for (Int treeIdx = 1; treeIdx < getNumIndependentLayers(); treeIdx++)
    2725       {
    2726         for (Int layerCnt = 0; layerCnt < getHighestLayerIdxPlus1(i, j); layerCnt++)
    2727         {
    2728           setLayerSetLayerIdList(lsIdx, layerNum, getTreePartitionLayerId(treeIdx, layerCnt));
    2729           setLayerIdIncludedFlag(true, lsIdx, getTreePartitionLayerId(treeIdx, layerCnt));
     2865        m_layerIdIncludedFlag[lsIdx][layerId] = false;
     2866      }
     2867      for (Int treeIdx = 1; treeIdx < m_numIndependentLayers; treeIdx++)
     2868      {
     2869        for (Int layerCnt = 0; layerCnt < m_highestLayerIdxPlus1[i][j]; layerCnt++)
     2870        {
     2871          m_layerSetLayerIdList[lsIdx][layerNum] = m_treePartitionLayerIdList[treeIdx][layerCnt];
     2872          m_layerIdIncludedFlag[lsIdx][m_treePartitionLayerIdList[treeIdx][layerCnt]] = true;
    27302873          layerNum++;
    27312874        }
    27322875      }
    2733       setNumLayersInIdList(lsIdx, layerNum);
     2876      m_numLayerInIdList[lsIdx] = layerNum;
    27342877    }
    27352878  }
     
    29793122}
    29803123#endif
     3124#if NECESSARY_LAYER_FLAG
     3125Void TComVPS::deriveNecessaryLayerFlag()
     3126{
     3127  m_necessaryLayerFlag.empty();
     3128  m_numNecessaryLayers.empty();
     3129  // Assumed that output layer sets and variables RecursiveRefLayer are already derived
     3130  for( Int olsIdx = 0; olsIdx < getNumOutputLayerSets(); olsIdx++)
     3131  {
     3132    deriveNecessaryLayerFlag(olsIdx);
     3133  }
     3134}
     3135Void TComVPS::deriveNecessaryLayerFlag(Int const olsIdx)
     3136{
     3137  Int lsIdx = this->getOutputLayerSetIdx( olsIdx );
     3138  Int numLayersInLs = this->getNumLayersInIdList( lsIdx );
     3139  assert( m_necessaryLayerFlag.size() == olsIdx );   // Function should be called in the correct order.
     3140  m_necessaryLayerFlag.push_back( std::vector<Bool>( numLayersInLs, false ) ); // Initialize to false
     3141  for( Int lsLayerIdx = 0; lsLayerIdx < numLayersInLs; lsLayerIdx++ )
     3142  {
     3143    if( this->m_outputLayerFlag[olsIdx][lsLayerIdx] )
     3144    {
     3145      m_necessaryLayerFlag[olsIdx][lsLayerIdx] = true;
     3146      Int currNuhLayerId = this->m_layerSetLayerIdList[lsIdx][lsLayerIdx];
     3147      for( Int rLsLayerIdx = 0; rLsLayerIdx < lsLayerIdx; rLsLayerIdx++ )
     3148      {
     3149        Int refNuhLayerId = this->m_layerSetLayerIdList[lsIdx][rLsLayerIdx];
     3150        if( this->m_recursiveRefLayerFlag[currNuhLayerId][refNuhLayerId] )
     3151        {
     3152          m_necessaryLayerFlag[olsIdx][rLsLayerIdx] = true;
     3153        }
     3154      }
     3155    }
     3156  }
     3157  m_numNecessaryLayers.push_back(std::accumulate(m_necessaryLayerFlag[olsIdx].begin(), m_necessaryLayerFlag[olsIdx].end(), 0));
     3158}
     3159Void TComVPS::checkNecessaryLayerFlagCondition()
     3160{
     3161  /* It is a requirement of bitstream conformance that for each layer index layerIdx in the range of
     3162  ( vps_base_layer_internal_flag ? 0 : 1 ) to MaxLayersMinus1, inclusive, there shall be at least one OLS with index olsIdx such that
     3163  NecessaryLayerFlag[ olsIdx ][ lsLayerIdx ] is equal to 1 for the value of lsLayerIdx
     3164  for which LayerSetLayerIdList[ OlsIdxToLsIdx[ olsIdx ] ][ lsLayerIdx ] is equal to layer_id_in_nuh[ layerIdx ]. */
     3165  for(Int layerIdx = this->getBaseLayerInternalFlag() ? 0 : 1; layerIdx < this->getMaxLayers(); layerIdx++)
     3166  {
     3167    Bool layerFoundNecessaryLayerFlag = false;
     3168    for(Int olsIdx = 0; olsIdx < this->getNumOutputLayerSets(); olsIdx++)
     3169    {
     3170      Int lsIdx = this->getOutputLayerSetIdx( olsIdx );
     3171      Int currNuhLayerId = this->getLayerIdInNuh( layerIdx );
     3172      std::vector<Int>::iterator iter = std::find( m_layerSetLayerIdList[lsIdx].begin(), m_layerSetLayerIdList[lsIdx].end(), currNuhLayerId );
     3173      if( iter != m_layerSetLayerIdList[lsIdx].end() ) // Layer present in layer set
     3174      {
     3175        size_t positionLayer = iter - m_layerSetLayerIdList[lsIdx].begin();
     3176        if( *(m_necessaryLayerFlag[olsIdx].begin() + positionLayer) == true )
     3177        {
     3178          layerFoundNecessaryLayerFlag = true;
     3179          break;
     3180        }
     3181      }
     3182    }
     3183    assert( layerFoundNecessaryLayerFlag );
     3184  }
     3185}
     3186#endif
     3187#if PER_LAYER_PTL
     3188Int TComVPS::calculateLenOfSyntaxElement( Int const numVal )
     3189{
     3190  Int numBits = 1;
     3191  while((1 << numBits) < numVal)
     3192  {
     3193    numBits++;
     3194  }
     3195  return numBits;
     3196}
     3197#endif
     3198#if SUB_LAYERS_IN_LAYER_SET
     3199Void TComVPS::calculateMaxSLInLayerSets()
     3200{
     3201  for(Int lsIdx = 0; lsIdx < getNumLayerSets(); lsIdx++)
     3202  {
     3203    UInt maxSLMinus1 = 0;
     3204    for(Int k = 0; k < getNumLayersInIdList(lsIdx); k++ ) {
     3205      Int  lId = getLayerSetLayerIdList(lsIdx, k);
     3206      maxSLMinus1 = std::max(maxSLMinus1, getMaxTSLayersMinus1(getLayerIdInVps(lId)));
     3207    }
     3208    setMaxSLayersInLayerSetMinus1(lsIdx,maxSLMinus1);
     3209  }
     3210}
     3211#endif
     3212
    29813213#if RESOLUTION_BASED_DPB
    29823214// RepFormat Assignment operator
     
    29923224    m_bitDepthVpsLuma                 = other.m_bitDepthVpsLuma;
    29933225    m_bitDepthVpsChroma               = other.m_bitDepthVpsChroma;
     3226#if R0156_CONF_WINDOW_IN_REP_FORMAT
     3227    m_conformanceWindowVps            = other.m_conformanceWindowVps;
     3228#endif
    29943229  }
    29953230  return *this;
     
    30163251, m_chromaFormatIdc           (CHROMA_420)
    30173252, m_uiMaxTLayers              (  1)
     3253#if R0279_REP_FORMAT_INBL
     3254, m_bV1CompatibleSPSFlag      (  0)
     3255#endif
    30183256// Structure
    30193257, m_picWidthInLumaSamples     (352)
     
    30523290, m_layerId                   ( 0 )
    30533291, m_extensionFlag             ( false )
     3292#if !MOVE_SCALED_OFFSET_TO_PPS
    30543293, m_numScaledRefLayerOffsets  ( 0 )
     3294#endif
    30553295#if REPN_FORMAT_IN_VPS
    30563296, m_updateRepFormatFlag       (false)
     
    30753315  ::memset(m_usedByCurrPicLtSPSFlag, 0, sizeof(m_usedByCurrPicLtSPSFlag));
    30763316
     3317#if !MOVE_SCALED_OFFSET_TO_PPS
    30773318#if P0312_VERT_PHASE_ADJ
    30783319  ::memset(m_vertPhasePositionEnableFlag, 0, sizeof(m_vertPhasePositionEnableFlag));
     3320#endif
    30793321#endif
    30803322}
     
    32083450const Int TComSPS::m_winUnitY[]={1,2,1,1};
    32093451
     3452#if !MOVE_SCALED_OFFSET_TO_PPS
    32103453#if O0098_SCALED_REF_LAYER_ID
    32113454Window& TComSPS::getScaledRefLayerWindowForLayer(Int layerId)
     
    32243467  return win;
    32253468}
     3469#endif
     3470#if REF_REGION_OFFSET
     3471Window& TComSPS::getRefLayerWindowForLayer(Int layerId)
     3472{
     3473  static Window win;
     3474
     3475  for (Int i = 0; i < m_numRefLayerOffsets; i++)
     3476  {
     3477    if (layerId == m_refLayerId[i])
     3478    {
     3479      return m_refLayerWindow[i];
     3480    }
     3481  }
     3482
     3483  win.resetWindow();  // reference region offsets are inferred to be zero when not present
     3484  return win;
     3485}
     3486#endif
    32263487#endif
    32273488
     
    32463507, m_entropyCodingSyncEnabledFlag   (false)
    32473508, m_loopFilterAcrossTilesEnabledFlag  (true)
    3248 , m_uniformSpacingFlag           (0)
    3249 , m_iNumColumnsMinus1            (0)
    3250 , m_puiColumnWidth               (NULL)
    3251 , m_iNumRowsMinus1               (0)
    3252 , m_puiRowHeight                 (NULL)
    3253 , m_iNumSubstreams             (1)
     3509, m_uniformSpacingFlag           (false)
     3510, m_numTileColumnsMinus1         (0)
     3511, m_numTileRowsMinus1            (0)
     3512, m_numSubstreams               (1)
    32543513, m_signHideFlag(0)
    32553514, m_cabacInitPresentFlag        (false)
     
    32693528, m_pocResetInfoPresentFlag   (false)
    32703529#endif
     3530#if MOVE_SCALED_OFFSET_TO_PPS
     3531, m_numScaledRefLayerOffsets  ( 0 )
     3532#endif
    32713533#if Q0048_CGS_3D_ASYMLUT
    32723534, m_nCGSFlag(0)
     
    32773539{
    32783540  m_scalingList = new TComScalingList;
     3541#if REF_REGION_OFFSET
     3542  ::memset(m_scaledRefLayerOffsetPresentFlag,   0, sizeof(m_scaledRefLayerOffsetPresentFlag));
     3543  ::memset(m_refRegionOffsetPresentFlag,   0, sizeof(m_refRegionOffsetPresentFlag));
     3544#endif
     3545#if R0209_GENERIC_PHASE
     3546  ::memset(m_resamplePhaseSetPresentFlag,   0, sizeof(m_resamplePhaseSetPresentFlag));
     3547  ::memset(m_phaseHorLuma,   0, sizeof(m_phaseHorLuma));
     3548  ::memset(m_phaseVerLuma,   0, sizeof(m_phaseVerLuma));
     3549  ::memset(m_phaseHorChroma, 0, sizeof(m_phaseHorChroma));
     3550  ::memset(m_phaseVerChroma, 0, sizeof(m_phaseVerChroma));
     3551#endif
    32793552}
    32803553
    32813554TComPPS::~TComPPS()
    32823555{
    3283   if( m_iNumColumnsMinus1 > 0 && m_uniformSpacingFlag == 0 )
    3284   {
    3285     if (m_puiColumnWidth) delete [] m_puiColumnWidth;
    3286     m_puiColumnWidth = NULL;
    3287   }
    3288   if( m_iNumRowsMinus1 > 0 && m_uniformSpacingFlag == 0 )
    3289   {
    3290     if (m_puiRowHeight) delete [] m_puiRowHeight;
    3291     m_puiRowHeight = NULL;
    3292   }
    3293 
    32943556#if SCALINGLIST_INFERRING
    32953557  if( !m_inferScalingListFlag )
     
    32973559  delete m_scalingList;
    32983560}
     3561
     3562#if MOVE_SCALED_OFFSET_TO_PPS
     3563#if O0098_SCALED_REF_LAYER_ID
     3564Window& TComPPS::getScaledRefLayerWindowForLayer(Int layerId)
     3565{
     3566  static Window win;
     3567
     3568  for (Int i = 0; i < m_numScaledRefLayerOffsets; i++)
     3569  {
     3570    if (layerId == m_scaledRefLayerId[i])
     3571    {
     3572      return m_scaledRefLayerWindow[i];
     3573    }
     3574  }
     3575
     3576  win.resetWindow();  // scaled reference layer offsets are inferred to be zero when not present
     3577  return win;
     3578}
     3579#endif
     3580#if REF_REGION_OFFSET
     3581Window& TComPPS::getRefLayerWindowForLayer(Int layerId)
     3582{
     3583  static Window win;
     3584
     3585  for (Int i = 0; i < m_numScaledRefLayerOffsets; i++)
     3586  {
     3587    if (layerId == m_scaledRefLayerId[i])
     3588    {
     3589      return m_refLayerWindow[i];
     3590    }
     3591  }
     3592
     3593  win.resetWindow();  // reference region offsets are inferred to be zero when not present
     3594  return win;
     3595}
     3596#endif
     3597
     3598#if RESAMPLING_FIX
     3599#if R0209_GENERIC_PHASE
     3600Bool TComPPS::hasZeroResamplingPhase(Int refLayerIdc)
     3601{
     3602  Int phaseHorLuma   = this->getPhaseHorLuma(refLayerIdc);
     3603  Int phaseVerLuma   = this->getPhaseVerLuma(refLayerIdc);
     3604  Int phaseHorChroma = this->getPhaseHorChroma(refLayerIdc);
     3605  Int phaseVerChroma = this->getPhaseVerChroma(refLayerIdc);
     3606  return ( phaseHorLuma == 0 && phaseHorChroma == 0 && phaseVerLuma == 0 && phaseVerChroma == 0);
     3607}
     3608#endif
     3609#endif
     3610
     3611#endif
    32993612
    33003613TComReferencePictureSet::TComReferencePictureSet()
     
    37184031ParameterSetManager::ParameterSetManager()
    37194032#if SVC_EXTENSION
    3720 : m_spsMap(MAX_NUM_SPS)
    3721 , m_ppsMap(MAX_NUM_PPS)
    3722 , m_activeSPSId(-1)
     4033: m_activeSPSId(-1)
    37234034, m_activePPSId(-1)
    37244035#else
     
    38544165
    38554166#if SVC_EXTENSION
    3856 #if AVC_SYNTAX
    3857 Void TComSlice::initBaseLayerRPL( TComSlice *pcSlice )
    3858 {
    3859 // Assumed that RPL of the base layer is same to the EL, otherwise this information should be also dumped and read from the metadata file
    3860   setPOC( pcSlice->getPOC() );
    3861   if( pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA )
    3862   {
    3863     setSliceType( I_SLICE );
    3864   }
    3865   else
    3866   {
    3867     setSliceType( pcSlice->getSliceType() );
    3868   }
    3869 
    3870   if( this->isIntra() )
    3871   {
    3872     return;
    3873   }
    3874 
    3875   //initialize reference POC of BL
    3876   for( Int iRefPicList = 0; iRefPicList < 2; iRefPicList++ )
    3877   {
    3878     RefPicList eRefPicList = RefPicList( iRefPicList );
    3879 
    3880     assert( pcSlice->getNumRefIdx( eRefPicList) >= 0 );
    3881     setNumRefIdx( eRefPicList, pcSlice->getNumRefIdx( eRefPicList ) - 1 );
    3882     assert( getNumRefIdx( eRefPicList) <= MAX_NUM_REF);
    3883 
    3884     for(Int refIdx = 0; refIdx < getNumRefIdx( eRefPicList ); refIdx++)
    3885     {
    3886       setRefPOC( pcSlice->getRefPic( eRefPicList, refIdx )->getPOC(), eRefPicList, refIdx );
    3887       setRefPic( pcSlice->getRefPic( eRefPicList, refIdx ), eRefPicList, refIdx );
    3888       /*
    3889       // should be set if the base layer has its own instance of the reference picture lists, currently EL RPL is reused.
    3890       getRefPic( eRefPicList, refIdx )->setLayerId( 0 );
    3891       getRefPic( eRefPicList, refIdx )->setIsLongTerm( pcSlice->getRefPic( eRefPicList, refIdx )->getIsLongTerm() );     
    3892       */
    3893 
    3894     }
    3895   } 
    3896   return;
    3897 }
    3898 #endif
    3899 
    39004167Bool TComSlice::setBaseColPic(  TComList<TComPic*>& rcListPic, UInt refLayerIdc )
    39014168
     
    39394206#endif
    39404207
    3941 #if REF_IDX_MFM
    3942 Void TComSlice::setRefPOCListILP( TComPic** ilpPic, TComPic** pcRefPicRL )
    3943 {
    3944   for( UInt i = 0; i < m_activeNumILRRefIdx; i++ )
    3945   {
    3946     UInt refLayerIdc = m_interLayerPredLayerIdc[i];
    3947 
    3948     TComPic* pcRefPicBL = pcRefPicRL[refLayerIdc];
    3949 
    3950     //set reference picture POC of each ILP reference
    3951     Int thePoc = ilpPic[refLayerIdc]->getPOC();
    3952     assert(thePoc == pcRefPicBL->getPOC());
    3953 
    3954     ilpPic[refLayerIdc]->getSlice(0)->setBaseColPic( refLayerIdc, pcRefPicBL );
    3955 
    3956     //copy layer id from the reference layer   
    3957     ilpPic[refLayerIdc]->setLayerId( pcRefPicBL->getLayerId() );
    3958 
    3959     //copy slice type from the reference layer
    3960     ilpPic[refLayerIdc]->getSlice(0)->setSliceType( pcRefPicBL->getSlice(0)->getSliceType() );
    3961 
    3962     //copy "used for reference"
    3963     ilpPic[refLayerIdc]->getSlice(0)->setReferenced( pcRefPicBL->getSlice(0)->isReferenced() );
    3964 
    3965     for( Int refList = 0; refList < 2; refList++ )
    3966     {
    3967       RefPicList refPicList = RefPicList( refList );
    3968 
    3969       //set reference POC of ILP
    3970       ilpPic[refLayerIdc]->getSlice(0)->setNumRefIdx(refPicList, pcRefPicBL->getSlice(0)->getNumRefIdx(refPicList));
    3971       assert(ilpPic[refLayerIdc]->getSlice(0)->getNumRefIdx(refPicList) >= 0);
    3972       assert(ilpPic[refLayerIdc]->getSlice(0)->getNumRefIdx(refPicList) <= MAX_NUM_REF);
    3973 
    3974       //initialize reference POC of ILP
    3975       for(Int refIdx = 0; refIdx < pcRefPicBL->getSlice(0)->getNumRefIdx(refPicList); refIdx++)
    3976       {
    3977         ilpPic[refLayerIdc]->getSlice(0)->setRefPOC(pcRefPicBL->getSlice(0)->getRefPOC(refPicList, refIdx), refPicList, refIdx);
    3978         ilpPic[refLayerIdc]->getSlice(0)->setRefPic(pcRefPicBL->getSlice(0)->getRefPic(refPicList, refIdx), refPicList, refIdx);
    3979       }
    3980 
    3981       for(Int refIdx = pcRefPicBL->getSlice(0)->getNumRefIdx(refPicList); refIdx < MAX_NUM_REF; refIdx++)
    3982       {
    3983         ilpPic[refLayerIdc]->getSlice(0)->setRefPOC(0, refPicList, refIdx);
    3984         ilpPic[refLayerIdc]->getSlice(0)->setRefPic(NULL, refPicList, refIdx);
    3985       }
    3986 
    3987       //copy reference pictures' marking from the reference layer
    3988       for(Int j = 0; j < MAX_NUM_REF + 1; j++)
    3989       {
    3990         ilpPic[refLayerIdc]->getSlice(0)->setIsUsedAsLongTerm(refList, j, pcRefPicBL->getSlice(0)->getIsUsedAsLongTerm(refList, j));
    3991       }
    3992     }
    3993   }
    3994   return;
    3995 }
    3996 #endif
    3997 
    39984208Void TComSlice::setILRPic(TComPic **pcIlpPic)
    39994209{
     
    40044214    if( pcIlpPic[refLayerIdc] )
    40054215    {
    4006       pcIlpPic[refLayerIdc]->copyUpsampledPictureYuv( m_pcPic->getFullPelBaseRec( refLayerIdc ), pcIlpPic[refLayerIdc]->getPicYuvRec() );
     4216      TComPic* pcRefPicBL = m_pcBaseColPic[refLayerIdc];
     4217
     4218      // copy scalability ratio, it is needed to get the correct location for the motion field of the corresponding reference layer block
     4219      pcIlpPic[refLayerIdc]->setSpatialEnhLayerFlag( refLayerIdc, m_pcPic->isSpatialEnhLayer(refLayerIdc) );
     4220
     4221      pcIlpPic[refLayerIdc]->copyUpsampledPictureYuv( m_pcPic->getFullPelBaseRec( refLayerIdc ), pcIlpPic[refLayerIdc]->getPicYuvRec() );     
     4222      pcIlpPic[refLayerIdc]->getSlice(0)->setBaseColPic( refLayerIdc, pcRefPicBL );
     4223
     4224      //set reference picture POC of each ILP reference
    40074225      pcIlpPic[refLayerIdc]->getSlice(0)->setPOC( m_iPOC );
    4008       pcIlpPic[refLayerIdc]->setLayerId( m_pcBaseColPic[refLayerIdc]->getLayerId() ); //set reference layerId
     4226
     4227      //set temporal Id
     4228      pcIlpPic[refLayerIdc]->getSlice(0)->setTLayer( m_uiTLayer );
     4229
     4230      //copy layer id from the reference layer
     4231      pcIlpPic[refLayerIdc]->setLayerId( pcRefPicBL->getLayerId() );
     4232
    40094233      pcIlpPic[refLayerIdc]->getPicYuvRec()->setBorderExtension( false );
    40104234      pcIlpPic[refLayerIdc]->getPicYuvRec()->extendPicBorder();
     
    40134237        pcIlpPic[refLayerIdc]->getPicSym()->getCU(j)->setLayerId( pcIlpPic[refLayerIdc]->getLayerId() );
    40144238      }
    4015     }
    4016   }
    4017 }
    4018 
     4239      pcIlpPic[refLayerIdc]->setIsLongTerm(1);
     4240
     4241#if REF_IDX_MFM
     4242      if( m_bMFMEnabledFlag && !(m_eNalUnitType >= NAL_UNIT_CODED_SLICE_BLA_W_LP && m_eNalUnitType <= NAL_UNIT_CODED_SLICE_CRA) )
     4243      {
     4244        //set reference picture POC of each ILP reference
     4245        assert( pcIlpPic[refLayerIdc]->getPOC() == pcRefPicBL->getPOC() );
     4246
     4247        //copy slice type from the reference layer
     4248        pcIlpPic[refLayerIdc]->getSlice(0)->setSliceType( pcRefPicBL->getSlice(0)->getSliceType() );
     4249
     4250        //copy "used for reference"
     4251        pcIlpPic[refLayerIdc]->getSlice(0)->setReferenced( pcRefPicBL->getSlice(0)->isReferenced() );
     4252
     4253        for( Int refList = 0; refList < 2; refList++ )
     4254        {
     4255          RefPicList refPicList = RefPicList( refList );
     4256
     4257          //set reference POC of ILP
     4258          pcIlpPic[refLayerIdc]->getSlice(0)->setNumRefIdx(refPicList, pcRefPicBL->getSlice(0)->getNumRefIdx(refPicList));
     4259          assert(pcIlpPic[refLayerIdc]->getSlice(0)->getNumRefIdx(refPicList) >= 0);
     4260          assert(pcIlpPic[refLayerIdc]->getSlice(0)->getNumRefIdx(refPicList) <= MAX_NUM_REF);
     4261
     4262          //initialize reference POC of ILP
     4263          for(Int refIdx = 0; refIdx < pcRefPicBL->getSlice(0)->getNumRefIdx(refPicList); refIdx++)
     4264          {
     4265            pcIlpPic[refLayerIdc]->getSlice(0)->setRefPOC(pcRefPicBL->getSlice(0)->getRefPOC(refPicList, refIdx), refPicList, refIdx);
     4266            pcIlpPic[refLayerIdc]->getSlice(0)->setRefPic(pcRefPicBL->getSlice(0)->getRefPic(refPicList, refIdx), refPicList, refIdx);
     4267          }
     4268
     4269          for(Int refIdx = pcRefPicBL->getSlice(0)->getNumRefIdx(refPicList); refIdx < MAX_NUM_REF; refIdx++)
     4270          {
     4271            pcIlpPic[refLayerIdc]->getSlice(0)->setRefPOC(0, refPicList, refIdx);
     4272            pcIlpPic[refLayerIdc]->getSlice(0)->setRefPic(NULL, refPicList, refIdx);
     4273          }
     4274
     4275          //copy reference pictures' marking from the reference layer
     4276          for(Int j = 0; j < MAX_NUM_REF + 1; j++)
     4277          {
     4278            pcIlpPic[refLayerIdc]->getSlice(0)->setIsUsedAsLongTerm(refList, j, pcRefPicBL->getSlice(0)->getIsUsedAsLongTerm(refList, j));
     4279          }
     4280        }
     4281
     4282        pcIlpPic[refLayerIdc]->copyUpsampledMvField( refLayerIdc, m_pcBaseColPic[refLayerIdc] );
     4283      }
     4284      else
     4285      {
     4286        pcIlpPic[refLayerIdc]->initUpsampledMvField();
     4287      }
     4288#endif
     4289
     4290#if O0225_MAX_TID_FOR_REF_LAYERS
     4291      Int maxTidIlRefPicsPlus1 = m_pcVPS->getMaxTidIlRefPicsPlus1( pcIlpPic[refLayerIdc]->getSlice(0)->getLayerId(), m_layerId );
     4292#else
     4293      Int maxTidIlRefPicsPlus1 = m_pcVPS->getMaxTidIlRefPicsPlus1( pcIlpPic[refLayerIdc]->getSlice(0)->getLayerId() );
     4294#endif
     4295      assert( (Int)pcIlpPic[refLayerIdc]->getSlice(0)->getTLayer() < maxTidIlRefPicsPlus1 || ( !maxTidIlRefPicsPlus1 && pcIlpPic[refLayerIdc]->getSlice(0)->getRapPicFlag() ) );
     4296
     4297    }
     4298  }
     4299}
     4300
     4301Int TComSlice::getReferenceLayerIdc( UInt refLayerId )
     4302{
     4303  for( Int i = 0; i < m_activeNumILRRefIdx; i++ )
     4304  {
     4305    if( m_pcVPS->getRefLayerId(m_layerId, m_interLayerPredLayerIdc[i]) == refLayerId )
     4306    {
     4307      return m_interLayerPredLayerIdc[i];
     4308    }
     4309  }
     4310
     4311  return -1;
     4312}
    40194313#endif //SVC_EXTENSION
    40204314
  • trunk/source/Lib/TLibCommon/TComSlice.h

    r815 r906  
    370370  UInt getNumDU                              ( )            { return m_numDU;          }
    371371  Bool getCpbDpbDelaysPresentFlag() { return getNalHrdParametersPresentFlag() || getVclHrdParametersPresentFlag(); }
     372
     373#if VPS_VUI_BSP_HRD_PARAMS
     374Void copyCommonInformation( TComHRD *refHrd )
     375{
     376  m_nalHrdParametersPresentFlag         = refHrd->getNalHrdParametersPresentFlag();
     377  m_vclHrdParametersPresentFlag         = refHrd->getVclHrdParametersPresentFlag();
     378  m_subPicCpbParamsPresentFlag          = refHrd->getSubPicCpbParamsPresentFlag();
     379  m_tickDivisorMinus2                   = refHrd->getTickDivisorMinus2();
     380  m_duCpbRemovalDelayLengthMinus1       = refHrd->getDuCpbRemovalDelayLengthMinus1();
     381  m_subPicCpbParamsInPicTimingSEIFlag   = refHrd->getSubPicCpbParamsInPicTimingSEIFlag();
     382  m_dpbOutputDelayDuLengthMinus1        = refHrd->getDpbOutputDelayDuLengthMinus1();
     383  m_bitRateScale                        = refHrd->getBitRateScale();
     384  m_cpbSizeScale                        = refHrd->getCpbSizeScale();
     385  m_ducpbSizeScale                      = refHrd->getDuCpbSizeScale();
     386  m_initialCpbRemovalDelayLengthMinus1  = refHrd->getInitialCpbRemovalDelayLengthMinus1();
     387  m_cpbRemovalDelayLengthMinus1         = refHrd->getCpbRemovalDelayLengthMinus1();
     388  m_dpbOutputDelayLengthMinus1          = refHrd->getDpbOutputDelayLengthMinus1();
     389}
     390#endif
    372391};
    373392
     
    403422};
    404423
     424class Window
     425{
     426private:
     427  Bool          m_enabledFlag;
     428  Int           m_winLeftOffset;
     429  Int           m_winRightOffset;
     430  Int           m_winTopOffset;
     431  Int           m_winBottomOffset;
     432#if P0312_VERT_PHASE_ADJ
     433  Bool          m_vertPhasePositionEnableFlag;
     434#endif
     435public:
     436  Window()
     437  : m_enabledFlag (false)
     438  , m_winLeftOffset     (0)
     439  , m_winRightOffset    (0)
     440  , m_winTopOffset      (0)
     441  , m_winBottomOffset   (0)
     442#if P0312_VERT_PHASE_ADJ
     443  , m_vertPhasePositionEnableFlag(false) 
     444#endif
     445  { }
     446
     447  Bool          getWindowEnabledFlag() const      { return m_enabledFlag; }
     448#if P0312_VERT_PHASE_ADJ
     449  Void          resetWindow()                     { m_enabledFlag = false; m_winLeftOffset = m_winRightOffset = m_winTopOffset = m_winBottomOffset = 0; m_vertPhasePositionEnableFlag = false; }
     450#else
     451  Void          resetWindow()                     { m_enabledFlag = false; m_winLeftOffset = m_winRightOffset = m_winTopOffset = m_winBottomOffset = 0;}
     452#endif
     453  Int           getWindowLeftOffset() const       { return m_enabledFlag ? m_winLeftOffset : 0; }
     454  Void          setWindowLeftOffset(Int val)      { if(val) {m_winLeftOffset = val; m_enabledFlag = true;} }
     455  Int           getWindowRightOffset() const      { return m_enabledFlag ? m_winRightOffset : 0; }
     456  Void          setWindowRightOffset(Int val)     { if(val) {m_winRightOffset = val; m_enabledFlag = true;} }
     457  Int           getWindowTopOffset() const        { return m_enabledFlag ? m_winTopOffset : 0; }
     458  Void          setWindowTopOffset(Int val)       { if(val) {m_winTopOffset = val; m_enabledFlag = true;} }
     459  Int           getWindowBottomOffset() const     { return m_enabledFlag ? m_winBottomOffset: 0; }
     460  Void          setWindowBottomOffset(Int val)    { if(val) {m_winBottomOffset = val; m_enabledFlag = true;} }
     461#if P0312_VERT_PHASE_ADJ
     462  Bool          getVertPhasePositionEnableFlag() const     { return m_vertPhasePositionEnableFlag;  }
     463  Void          setVertPhasePositionEnableFlag(Bool val)    { m_vertPhasePositionEnableFlag = val;  }
     464#endif
     465#if REF_REGION_OFFSET && RESAMPLING_FIX
     466  Bool          hasEqualOffset(const Window& ref) const
     467  {
     468    return (    this->getWindowLeftOffset()   == ref.getWindowLeftOffset()
     469             && this->getWindowTopOffset()    == ref.getWindowTopOffset()
     470             && this->getWindowRightOffset()  == ref.getWindowRightOffset()
     471             && this->getWindowBottomOffset() == ref.getWindowBottomOffset() );
     472  }
     473#endif
     474
     475#if P0312_VERT_PHASE_ADJ
     476  Void          setWindow(Int offsetLeft, Int offsetLRight, Int offsetLTop, Int offsetLBottom, Bool vertPhasePositionEnableFlag = 0)
     477#else
     478  Void          setWindow(Int offsetLeft, Int offsetLRight, Int offsetLTop, Int offsetLBottom)
     479#endif
     480  {
     481    if(offsetLeft || offsetLRight || offsetLTop || offsetLBottom)
     482    {
     483      m_enabledFlag       = true;
     484      m_winLeftOffset     = offsetLeft;
     485      m_winRightOffset    = offsetLRight;
     486      m_winTopOffset      = offsetLTop;
     487      m_winBottomOffset   = offsetLBottom;
     488    }
     489#if P0312_VERT_PHASE_ADJ
     490    m_vertPhasePositionEnableFlag = vertPhasePositionEnableFlag;   
     491#endif
     492  }
     493};
     494
    405495#if REPN_FORMAT_IN_VPS
    406496class RepFormat
     
    420510  Int  m_bitDepthVpsChroma;             // coded as minus8
    421511
     512#if R0156_CONF_WINDOW_IN_REP_FORMAT
     513  Window m_conformanceWindowVps;
     514#endif
     515
    422516public:
    423517  RepFormat();
     
    454548  Int  getBitDepthVpsChroma()           { return m_bitDepthVpsChroma;   }
    455549  Void setBitDepthVpsChroma(Int x)      { m_bitDepthVpsChroma = x;      }
     550
     551#if R0156_CONF_WINDOW_IN_REP_FORMAT
     552  Window& getConformanceWindowVps()                           { return  m_conformanceWindowVps;             }
     553  Void    setConformanceWindowVps(Window& conformanceWindow ) { m_conformanceWindowVps = conformanceWindow; }
     554#endif
    456555};
    457556#endif
     
    460559private:
    461560  Int         m_VPSId;
     561#if VPS_RESERVED_FLAGS
     562  Bool        m_baseLayerInternalFlag;
     563  Bool        m_baseLayerAvailableFlag;
     564#endif
    462565  UInt        m_uiMaxTLayers;
    463566  UInt        m_uiMaxLayers;
     
    485588#if DERIVE_LAYER_ID_LIST_VARIABLES
    486589#if Q0078_ADD_LAYER_SETS
     590#if NECESSARY_LAYER_FLAG
     591  std::vector< std::vector<Int> >     m_layerSetLayerIdList;
     592  std::vector<Int>                      m_numLayerInIdList;;
     593#else
    487594  Int         m_layerSetLayerIdList[MAX_VPS_LAYER_SETS_PLUS1 + MAX_NUM_ADD_LAYER_SETS][MAX_VPS_LAYER_ID_PLUS1];
    488595  Int         m_numLayerInIdList[MAX_VPS_LAYER_SETS_PLUS1 + MAX_NUM_ADD_LAYER_SETS];
     596#endif
    489597#else
    490598  Int         m_layerSetLayerIdList[MAX_VPS_LAYER_SETS_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
     
    510618  // ------------------------------------------
    511619#if VPS_EXTN_MASK_AND_DIM_INFO
     620#if VPS_AVC_BL_FLAG_REMOVAL
     621  Bool       m_nonHEVCBaseLayerFlag;
     622#else
    512623  Bool       m_avcBaseLayerFlag;                                // For now, always set to true.
     624#endif
    513625  Bool       m_splittingFlag;
    514626  Bool       m_scalabilityMask[MAX_VPS_NUM_SCALABILITY_TYPES];
     
    576688#endif
    577689#endif
     690#if PER_LAYER_PTL
     691  std::vector< std::vector<Int> >  m_profileLevelTierIdx;
     692#else
    578693  Int        m_profileLevelTierIdx[64];     
     694#endif
    579695  Bool       m_maxOneActiveRefLayerFlag;
    580696#if O0062_POC_LSB_NOT_PRESENT_FLAG
     
    717833#if O0164_MULTI_LAYER_HRD
    718834  Bool       m_vpsVuiBspHrdPresentFlag;
     835#if VPS_VUI_BSP_HRD_PARAMS
     836  Int                 m_vpsNumAddHrdParams;
     837  std::vector<Bool>   m_cprmsAddPresentFlag;
     838  std::vector<Int>    m_numSubLayerHrdMinus1;
     839  std::vector<TComHRD> m_bspHrd;
     840  Int    m_numSignalledPartitioningSchemes[MAX_VPS_OUTPUT_LAYER_SETS_PLUS1];
     841  Int    m_numPartitionsInSchemeMinus1    [MAX_VPS_OUTPUT_LAYER_SETS_PLUS1][16];
     842  Int    m_layerIncludedInPartitionFlag   [MAX_VPS_OUTPUT_LAYER_SETS_PLUS1][16][MAX_LAYERS][MAX_LAYERS];
     843  Int    m_numBspSchedulesMinus1          [MAX_VPS_OUTPUT_LAYER_SETS_PLUS1][16][MAX_TLAYER];
     844  Int    m_bspHrdIdx                      [MAX_VPS_OUTPUT_LAYER_SETS_PLUS1][16][MAX_TLAYER][31][MAX_LAYERS];
     845  Int    m_bspSchedIdx                    [MAX_VPS_OUTPUT_LAYER_SETS_PLUS1][16][MAX_TLAYER][31][MAX_LAYERS];
     846#else
    719847  UInt       m_vpsNumBspHrdParametersMinus1;
    720848  Bool       m_bspCprmsPresentFlag[MAX_VPS_LAYER_SETS_PLUS1];
     
    726854  UInt       m_bspCombSchedIdx[MAX_VPS_LAYER_SETS_PLUS1][16][16];
    727855#endif
     856#endif
    728857
    729858#if P0182_VPS_VUI_PS_FLAG
     
    741870  Int        m_vpsNonVuiExtLength;
    742871#endif
     872#if P0297_VPS_POC_LSB_ALIGNED_FLAG
     873  Bool       m_vpsPocLsbAlignedFlag;
     874#endif
    743875#if RESOLUTION_BASED_DPB
    744876  Int        m_subDpbAssigned            [MAX_VPS_LAYER_SETS_PLUS1][MAX_LAYERS];
     877#endif
     878#if NECESSARY_LAYER_FLAG
     879  std::vector< std::vector<Bool> > m_necessaryLayerFlag;
     880  std::vector<Int>               m_numNecessaryLayers;
    745881#endif
    746882#endif //SVC_EXTENSION
     
    748884  TComVPS();
    749885  virtual ~TComVPS();
     886
     887#if VPS_RESERVED_FLAGS
     888  Void        setBaseLayerInternalFlag(Bool x) { m_baseLayerInternalFlag = x; }
     889  Bool        getBaseLayerInternalFlag()         { return m_baseLayerInternalFlag; }
     890  Void        setBaseLayerAvailableFlag(Bool x) { m_baseLayerAvailableFlag = x; }
     891  Bool        getBaseLayerAvailableFlag()         { return m_baseLayerAvailableFlag; }
     892#endif
    750893
    751894  Void    createHrdParamBuffer()
     
    759902  Void    createBspHrdParamBuffer(UInt numHrds)
    760903  {
     904#if VPS_VUI_BSP_HRD_PARAMS
     905    m_bspHrd.resize( numHrds );
     906    m_cprmsAddPresentFlag.resize( numHrds );
     907    m_numSubLayerHrdMinus1.resize( numHrds );
     908#else
    761909    m_bspHrd    = new TComHRD[ numHrds ];
     910#endif
    762911//    m_hrdOpSetIdx      = new UInt   [ getNumHrdParameters() ];
    763912//    m_cprmsPresentFlag = new Bool   [ getNumHrdParameters() ];
     
    767916  Int getBspHrdParamBufferCpbCntMinus1(UInt i, UInt sl)
    768917  {
     918#if VPS_VUI_BSP_HRD_PARAMS
     919    return m_bspHrd[i].getCpbCntMinus1(sl);
     920#else
    769921    return m_bspHrd->getCpbCntMinus1(sl);
     922#endif
    770923  }
    771924#endif
     
    817970#if DERIVE_LAYER_ID_LIST_VARIABLES
    818971  Int     getLayerSetLayerIdList(Int set, Int layerId)          { return m_layerSetLayerIdList[set][layerId]; }
    819   Void    setLayerSetLayerIdList(Int set, Int layerId, Int x)   { m_layerSetLayerIdList[set][layerId] = x   ; }
     972  Void    setLayerSetLayerIdList(Int set, Int layerId, Int x)   { m_layerSetLayerIdList[set][layerId] = x;    }
    820973
    821974  Int     getNumLayersInIdList(Int set)                          { return m_numLayerInIdList[set]; }
    822   Void    setNumLayersInIdList(Int set, Int x)                   { m_numLayerInIdList[set] = x   ; }
     975  Void    setNumLayersInIdList(Int set, Int x)                   { m_numLayerInIdList[set] = x;    }
    823976
    824977  Void    deriveLayerIdListVariables();
     
    8611014  Void    setNumLayerSets(UInt v)                               { m_numLayerSets = v;    }
    8621015#if VPS_EXTN_MASK_AND_DIM_INFO
     1016#if VPS_AVC_BL_FLAG_REMOVAL
     1017  Bool   getNonHEVCBaseLayerFlag()                              { return m_nonHEVCBaseLayerFlag;       }
     1018  Void   setNonHEVCBaseLayerFlag(Bool x)                        { m_nonHEVCBaseLayerFlag = x;          }
     1019#else
    8631020  Bool   getAvcBaseLayerFlag()                                  { return m_avcBaseLayerFlag;       }
    8641021  Void   setAvcBaseLayerFlag(Bool x)                            { m_avcBaseLayerFlag = x;          }
     1022#endif
    8651023
    8661024  Bool   getSplittingFlag()                                     { return m_splittingFlag;          }
     
    9641122#endif
    9651123#endif
     1124#if PER_LAYER_PTL
     1125  Bool getNecessaryLayerFlag(Int const i, Int const j) { return m_necessaryLayerFlag[i][j]; }
     1126  std::vector< std::vector<Int> >* getProfileLevelTierIdx() { return &m_profileLevelTierIdx; }
     1127  std::vector<Int>* getProfileLevelTierIdx(Int const olsIdx) { return &m_profileLevelTierIdx[olsIdx]; }
     1128  Int    getProfileLevelTierIdx(Int const olsIdx, Int const layerIdx)     { return m_profileLevelTierIdx[olsIdx][layerIdx]; }
     1129  Void   setProfileLevelTierIdx(Int const olsIdx, Int const layerIdx, Int const ptlIdx)     { m_profileLevelTierIdx[olsIdx][layerIdx] = ptlIdx; }
     1130  Int calculateLenOfSyntaxElement( Int const numVal );
     1131#else
    9661132  Int    getProfileLevelTierIdx(Int i)                        { return m_profileLevelTierIdx[i]; }
    9671133  Void   setProfileLevelTierIdx(Int i, Int x)                 { m_profileLevelTierIdx[i] = x   ; }
     1134#endif
    9681135  Bool   getMaxOneActiveRefLayerFlag()                                          { return m_maxOneActiveRefLayerFlag;                      }
    9691136  Void   setMaxOneActiveRefLayerFlag(Bool x)                                    { m_maxOneActiveRefLayerFlag = x;                         }
     
    9711138  UInt   getPocLsbNotPresentFlag(Int i)                                         { return m_pocLsbNotPresentFlag[i]; }
    9721139  Void   setPocLsbNotPresentFlag(Int i, Bool x)                                 { m_pocLsbNotPresentFlag[i] = x;    }
     1140#endif
     1141#if P0297_VPS_POC_LSB_ALIGNED_FLAG
     1142  Bool   getVpsPocLsbAlignedFlag()                                              { return m_vpsPocLsbAlignedFlag; }
     1143  Void   setVpsPocLsbAlignedFlag(Bool x)                                        { m_vpsPocLsbAlignedFlag = x; }
    9731144#endif
    9741145#if O0223_PICTURE_TYPES_ALIGN_FLAG
     
    10741245  Bool     getVpsVuiBspHrdPresentFlag()                         { return m_vpsVuiBspHrdPresentFlag;      }
    10751246  Void     setVpsVuiBspHrdPresentFlag(Bool x)                   { m_vpsVuiBspHrdPresentFlag = x;         }
     1247#if VPS_VUI_BSP_HRD_PARAMS
     1248  Int      getVpsNumAddHrdParams()                              { return m_vpsNumAddHrdParams; }
     1249  Void     setVpsNumAddHrdParams(Int  i)                   { m_vpsNumAddHrdParams = i;    }
     1250
     1251  Bool     getCprmsAddPresentFlag(Int i)                        { return m_cprmsAddPresentFlag[i];       }
     1252  Void     setCprmsAddPresentFlag(Int  i, Bool  val)  { m_cprmsAddPresentFlag[i] = val;        }
     1253
     1254  Int      getNumSubLayerHrdMinus1(Int i)           { return m_numSubLayerHrdMinus1[i]; }
     1255  Void     setNumSubLayerHrdMinus1(Int i, Int val)  { m_numSubLayerHrdMinus1[i] = val; }
     1256
     1257  TComHRD*  getBspHrd(Int i)           {return &m_bspHrd[i];}
     1258
     1259  Int      getNumSignalledPartitioningSchemes(Int  i)                    { return m_numSignalledPartitioningSchemes[i];    }
     1260  Void     setNumSignalledPartitioningSchemes(Int  i, Int  val)          { m_numSignalledPartitioningSchemes[i] = val;     }
     1261
     1262  Int      getNumPartitionsInSchemeMinus1(Int  i, Int j)  { return m_numPartitionsInSchemeMinus1[i][j];}
     1263  Void     setNumPartitionsInSchemeMinus1(Int i, Int j, Int val) { m_numPartitionsInSchemeMinus1[i][j] = val; }
     1264
     1265  Int      getLayerIncludedInPartitionFlag(Int  i, Int j, Int k, Int l)  { return m_layerIncludedInPartitionFlag[i][j][k][l];}
     1266  Void     setLayerIncludedInPartitionFlag(Int i, Int j, Int k, Int l, Int val) { m_layerIncludedInPartitionFlag[i][j][k][l] = val; }
     1267
     1268  Int      getNumBspSchedulesMinus1(Int  i, Int j, Int k)         { return m_numBspSchedulesMinus1[i][j][k];}
     1269  Void     setNumBspSchedulesMinus1(Int i, Int j, Int k, Int val) { m_numBspSchedulesMinus1[i][j][k] = val; }
     1270
     1271  Int      getBspSchedIdx(Int  i, Int j, Int k, Int l, Int m)  { return m_bspSchedIdx[i][j][k][l][m];}
     1272  Void     setBspSchedIdx(Int  i, Int j, Int k, Int l, Int m, Int val) { m_bspSchedIdx[i][j][k][l][m] = val; }
     1273
     1274  Int      getBspHrdIdx(Int  i, Int j, Int k, Int l, Int m)  { return m_bspHrdIdx[i][j][k][l][m];}
     1275  Void     setBspHrdIdx(Int  i, Int j, Int k, Int l, Int m, Int val) { m_bspHrdIdx[i][j][k][l][m] = val; }
     1276#else
    10761277  UInt     getVpsNumBspHrdParametersMinus1()                    { return m_vpsNumBspHrdParametersMinus1; }
    10771278  Void     setVpsNumBspHrdParametersMinus1(UInt i)              { m_vpsNumBspHrdParametersMinus1 = i;    }
     
    10901291  Void     setBspCombSchedIdx(UInt h, UInt i, UInt j, UInt val) { m_bspCombSchedIdx[h][i][j] = val;      }
    10911292#endif
     1293#endif
    10921294#if P0182_VPS_VUI_PS_FLAG
    10931295  Int    getSPSId       (Int layer)                   { return m_SPSId[layer];       }
     
    12051407  Void setBspHrdParameters( UInt hrdIdx, UInt frameRate, UInt numDU, UInt bitRate, Bool randomAccess );
    12061408#endif
     1409#if NECESSARY_LAYER_FLAG
     1410  Void  deriveNecessaryLayerFlag();
     1411  Void  deriveNecessaryLayerFlag(Int const olsIdx);
     1412  Void  checkNecessaryLayerFlagCondition();
     1413#endif
     1414#if SUB_LAYERS_IN_LAYER_SET
     1415  Void  calculateMaxSLInLayerSets();
     1416#endif
    12071417#endif //SVC_EXTENSION
    12081418};
    1209 
    1210 class Window
    1211 {
    1212 private:
    1213   Bool          m_enabledFlag;
    1214   Int           m_winLeftOffset;
    1215   Int           m_winRightOffset;
    1216   Int           m_winTopOffset;
    1217   Int           m_winBottomOffset;
    1218 #if P0312_VERT_PHASE_ADJ
    1219   Bool          m_vertPhasePositionEnableFlag;
    1220 #endif
    1221 public:
    1222   Window()
    1223   : m_enabledFlag (false)
    1224   , m_winLeftOffset     (0)
    1225   , m_winRightOffset    (0)
    1226   , m_winTopOffset      (0)
    1227   , m_winBottomOffset   (0)
    1228 #if P0312_VERT_PHASE_ADJ
    1229   , m_vertPhasePositionEnableFlag(false) 
    1230 #endif
    1231   { }
    1232 
    1233   Bool          getWindowEnabledFlag() const      { return m_enabledFlag; }
    1234 #if P0312_VERT_PHASE_ADJ
    1235   Void          resetWindow()                     { m_enabledFlag = false; m_winLeftOffset = m_winRightOffset = m_winTopOffset = m_winBottomOffset = 0; m_vertPhasePositionEnableFlag = false; }
    1236 #else
    1237   Void          resetWindow()                     { m_enabledFlag = false; m_winLeftOffset = m_winRightOffset = m_winTopOffset = m_winBottomOffset = 0;}
    1238 #endif
    1239   Int           getWindowLeftOffset() const       { return m_enabledFlag ? m_winLeftOffset : 0; }
    1240   Void          setWindowLeftOffset(Int val)      { m_winLeftOffset = val; m_enabledFlag = true; }
    1241   Int           getWindowRightOffset() const      { return m_enabledFlag ? m_winRightOffset : 0; }
    1242   Void          setWindowRightOffset(Int val)     { m_winRightOffset = val; m_enabledFlag = true; }
    1243   Int           getWindowTopOffset() const        { return m_enabledFlag ? m_winTopOffset : 0; }
    1244   Void          setWindowTopOffset(Int val)       { m_winTopOffset = val; m_enabledFlag = true; }
    1245   Int           getWindowBottomOffset() const     { return m_enabledFlag ? m_winBottomOffset: 0; }
    1246   Void          setWindowBottomOffset(Int val)    { m_winBottomOffset = val; m_enabledFlag = true; }
    1247 
    1248 #if P0312_VERT_PHASE_ADJ
    1249   Bool          getVertPhasePositionEnableFlag() const     { return m_vertPhasePositionEnableFlag;  }
    1250   Void          setVertPhasePositionEnableFlag(Bool val)    { m_vertPhasePositionEnableFlag = val;  }
    1251   Void          setWindow(Int offsetLeft, Int offsetLRight, Int offsetLTop, Int offsetLBottom, Bool vertPhasePositionEnableFlag = 0)
    1252 #else
    1253   Void          setWindow(Int offsetLeft, Int offsetLRight, Int offsetLTop, Int offsetLBottom)
    1254 #endif
    1255   {
    1256     m_enabledFlag       = true;
    1257     m_winLeftOffset     = offsetLeft;
    1258     m_winRightOffset    = offsetLRight;
    1259     m_winTopOffset      = offsetLTop;
    1260     m_winBottomOffset   = offsetLBottom;
    1261 #if P0312_VERT_PHASE_ADJ
    1262     m_vertPhasePositionEnableFlag = vertPhasePositionEnableFlag;   
    1263 #endif
    1264   }
    1265 };
    1266 
    12671419
    12681420class TComVUI
     
    14451597  UInt        m_uiMaxTLayers;           // maximum number of temporal layers
    14461598
     1599#if R0279_REP_FORMAT_INBL
     1600  Bool        m_bV1CompatibleSPSFlag;
     1601#endif
     1602
    14471603  // Structure
    14481604  UInt        m_picWidthInLumaSamples;
     
    15141670  Bool        m_extensionFlag;
    15151671  UInt        m_numScaledRefLayerOffsets;
     1672#if R0042_PROFILE_INDICATION 
     1673  Int         m_NumDirectRefLayers;
     1674#endif
    15161675#if P0312_VERT_PHASE_ADJ
    15171676 Bool         m_vertPhasePositionEnableFlag[MAX_LAYERS];
    15181677#endif
     1678#if !MOVE_SCALED_OFFSET_TO_PPS
    15191679#if O0098_SCALED_REF_LAYER_ID
    15201680  UInt        m_scaledRefLayerId[MAX_LAYERS];
    15211681#endif
    15221682  Window      m_scaledRefLayerWindow[MAX_LAYERS];
     1683#endif
    15231684#if REPN_FORMAT_IN_VPS
    1524   Bool        m_updateRepFormatFlag;
     1685  Bool m_updateRepFormatFlag;
    15251686#if O0096_REP_FORMAT_INDEX
    15261687  UInt        m_updateRepFormatIndex;
     
    15321693#endif
    15331694#endif //SVC_EXTENSION
     1695
    15341696public:
    15351697  TComSPS();
     
    15541716  static Int getWinUnitY (Int chromaFormatIdc) { assert (chromaFormatIdc > 0 && chromaFormatIdc <= MAX_CHROMA_FORMAT_IDC); return m_winUnitY[chromaFormatIdc];      }
    15551717#endif
    1556  
     1718
     1719#if R0279_REP_FORMAT_INBL //These two functions shall be used / called when the syntax element sps_ext_or_max_sub_layers_minus1 and V1CompatibleSPSFlag are implemented
     1720  Bool getV1CompatibleSPSFlag()        {return m_bV1CompatibleSPSFlag;}
     1721  Void setV1CompatibleSPSFlag(Bool x)       { m_bV1CompatibleSPSFlag = x;}
     1722#endif
     1723
    15571724  // structure
    15581725  Void setPicWidthInLumaSamples       ( UInt u ) { m_picWidthInLumaSamples = u;        }
     
    16731840  Int      getExtensionFlag()                  { return m_extensionFlag;  }
    16741841  Void     setExtensionFlag(Int n)             { m_extensionFlag = n;     }
     1842#if R0042_PROFILE_INDICATION
     1843  Int      getNumDirectRefLayers()                  { return  m_NumDirectRefLayers;  }
     1844  Void     setNumDirectRefLayers(Int n)             {  m_NumDirectRefLayers = n;     }
     1845#endif
     1846#if !MOVE_SCALED_OFFSET_TO_PPS
    16751847  UInt     getNumScaledRefLayerOffsets()       { return m_numScaledRefLayerOffsets; }
    16761848  Void     setNumScaledRefLayerOffsets(Int x)  { m_numScaledRefLayerOffsets = x;    }
     
    16851857#endif
    16861858  Window&  getScaledRefLayerWindow( Int x )   { return m_scaledRefLayerWindow[x]; }
     1859#endif
    16871860#if REPN_FORMAT_IN_VPS
    16881861  Bool     getUpdateRepFormatFlag()       { return m_updateRepFormatFlag; }
     
    17611934 
    17621935  Bool     m_loopFilterAcrossTilesEnabledFlag;
    1763   Int      m_uniformSpacingFlag;
    1764   Int      m_iNumColumnsMinus1;
    1765   UInt*    m_puiColumnWidth;
    1766   Int      m_iNumRowsMinus1;
    1767   UInt*    m_puiRowHeight;
    1768 
    1769   Int      m_iNumSubstreams;
     1936  Bool             m_uniformSpacingFlag;
     1937  Int              m_numTileColumnsMinus1;
     1938  Int              m_numTileRowsMinus1;
     1939  std::vector<Int> m_tileColumnWidth;
     1940  std::vector<Int> m_tileRowHeight;
     1941
     1942  Int      m_numSubstreams;
    17701943
    17711944  Int      m_signHideFlag;
     
    17971970  Bool     m_pocResetInfoPresentFlag;
    17981971#endif
     1972#if MOVE_SCALED_OFFSET_TO_PPS
     1973  UInt     m_numScaledRefLayerOffsets;
     1974#if O0098_SCALED_REF_LAYER_ID
     1975  UInt     m_scaledRefLayerId[MAX_LAYERS];
     1976#endif
     1977  Window   m_scaledRefLayerWindow[MAX_LAYERS];
     1978#if REF_REGION_OFFSET
     1979  Window   m_refLayerWindow[MAX_LAYERS];
     1980  Bool     m_scaledRefLayerOffsetPresentFlag[MAX_LAYERS];
     1981  Bool     m_refRegionOffsetPresentFlag[MAX_LAYERS];
     1982#endif
     1983#if R0209_GENERIC_PHASE
     1984  Int      m_phaseHorLuma[MAX_LAYERS];
     1985  Int      m_phaseVerLuma[MAX_LAYERS];
     1986  Int      m_phaseHorChroma[MAX_LAYERS];
     1987  Int      m_phaseVerChroma[MAX_LAYERS];
     1988  Bool     m_resamplePhaseSetPresentFlag[MAX_LAYERS];
     1989#endif
     1990#endif
    17991991#if Q0048_CGS_3D_ASYMLUT
    18001992  Int      m_nCGSFlag;
     
    18552047  Bool    getDependentSliceSegmentsEnabledFlag() const     { return m_dependentSliceSegmentsEnabledFlag; }
    18562048  Void    setDependentSliceSegmentsEnabledFlag(Bool val)   { m_dependentSliceSegmentsEnabledFlag = val; }
    1857   Bool    getTilesEnabledFlag() const                      { return m_tilesEnabledFlag; }
    1858   Void    setTilesEnabledFlag(Bool val)                    { m_tilesEnabledFlag = val; }
    18592049  Bool    getEntropyCodingSyncEnabledFlag() const          { return m_entropyCodingSyncEnabledFlag; }
    18602050  Void    setEntropyCodingSyncEnabledFlag(Bool val)        { m_entropyCodingSyncEnabledFlag = val; }
    1861   Void     setUniformSpacingFlag            ( Bool b )          { m_uniformSpacingFlag = b; }
    1862   Bool     getUniformSpacingFlag            ()                  { return m_uniformSpacingFlag; }
    1863   Void     setNumColumnsMinus1              ( Int i )           { m_iNumColumnsMinus1 = i; }
    1864   Int      getNumColumnsMinus1              ()                  { return m_iNumColumnsMinus1; }
    1865   Void     setColumnWidth ( UInt* columnWidth )
    1866   {
    1867     if( m_uniformSpacingFlag == 0 && m_iNumColumnsMinus1 > 0 )
    1868     {
    1869       m_puiColumnWidth = new UInt[ m_iNumColumnsMinus1 ];
    1870 
    1871       for(Int i=0; i<m_iNumColumnsMinus1; i++)
    1872       {
    1873         m_puiColumnWidth[i] = columnWidth[i];
    1874       }
    1875     }
    1876   }
    1877   UInt     getColumnWidth  (UInt columnIdx) { return *( m_puiColumnWidth + columnIdx ); }
    1878   Void     setNumRowsMinus1( Int i )        { m_iNumRowsMinus1 = i; }
    1879   Int      getNumRowsMinus1()               { return m_iNumRowsMinus1; }
    1880   Void     setRowHeight    ( UInt* rowHeight )
    1881   {
    1882     if( m_uniformSpacingFlag == 0 && m_iNumRowsMinus1 > 0 )
    1883     {
    1884       m_puiRowHeight = new UInt[ m_iNumRowsMinus1 ];
    1885 
    1886       for(Int i=0; i<m_iNumRowsMinus1; i++)
    1887       {
    1888         m_puiRowHeight[i] = rowHeight[i];
    1889       }
    1890     }
    1891   }
    1892   UInt     getRowHeight           (UInt rowIdx)    { return *( m_puiRowHeight + rowIdx ); }
    1893   Void     setNumSubstreams(Int iNumSubstreams)               { m_iNumSubstreams = iNumSubstreams; }
    1894   Int      getNumSubstreams()                                 { return m_iNumSubstreams; }
     2051
     2052  Void     setTilesEnabledFlag       (Bool val)                             { m_tilesEnabledFlag = val; }
     2053  Bool     getTilesEnabledFlag       () const                               { return m_tilesEnabledFlag; }
     2054  Void     setTileUniformSpacingFlag (Bool b)                               { m_uniformSpacingFlag = b; }
     2055  Bool     getTileUniformSpacingFlag () const                               { return m_uniformSpacingFlag; }
     2056  Void     setNumTileColumnsMinus1   (Int i)                                { m_numTileColumnsMinus1 = i; }
     2057  Int      getNumTileColumnsMinus1   () const                               { return m_numTileColumnsMinus1; }
     2058  Void     setTileColumnWidth        (const std::vector<Int>& columnWidth ) { m_tileColumnWidth = columnWidth; }
     2059  UInt     getTileColumnWidth        (UInt columnIdx) const                 { return  m_tileColumnWidth[columnIdx]; }
     2060  Void     setNumTileRowsMinus1      (Int i)                                { m_numTileRowsMinus1 = i; }
     2061  Int      getTileNumRowsMinus1      () const                               { return m_numTileRowsMinus1; }
     2062  Void     setTileRowHeight          (const std::vector<Int>& rowHeight)    { m_tileRowHeight = rowHeight;  }
     2063  UInt     getTileRowHeight          (UInt rowIdx) const                    { return m_tileRowHeight[rowIdx]; }
     2064
     2065  Void     setNumSubstreams    (Int numSubstreams)                     { m_numSubstreams = numSubstreams; }
     2066  Int      getNumSubstreams    ()                                      { return m_numSubstreams; }
    18952067
    18962068  Void      setSignHideFlag( Int signHideFlag ) { m_signHideFlag = signHideFlag; }
     
    19452117  Void setPocResetInfoPresentFlag   (const Bool val)      { m_pocResetInfoPresentFlag = val; }
    19462118#endif
     2119#if MOVE_SCALED_OFFSET_TO_PPS
     2120  UInt     getNumScaledRefLayerOffsets()       { return m_numScaledRefLayerOffsets; }
     2121  Void     setNumScaledRefLayerOffsets(Int x)  { m_numScaledRefLayerOffsets = x;    }
     2122#if O0098_SCALED_REF_LAYER_ID
     2123  UInt     getScaledRefLayerId(Int x)          { return m_scaledRefLayerId[x]; }
     2124  Void     setScaledRefLayerId(Int x, UInt id) { m_scaledRefLayerId[x] = id;   }
     2125  Window&  getScaledRefLayerWindowForLayer( Int layerId );
     2126#endif
     2127  Window&  getScaledRefLayerWindow( Int x )   { return m_scaledRefLayerWindow[x]; }
     2128#if REF_REGION_OFFSET
     2129  Window&  getRefLayerWindowForLayer( Int layerId );
     2130  Window&  getRefLayerWindow( Int x )   { return m_refLayerWindow[x]; }
     2131  Bool getScaledRefLayerOffsetPresentFlag(Int x) { return m_scaledRefLayerOffsetPresentFlag[x]; }
     2132  Void setScaledRefLayerOffsetPresentFlag(Int x, Bool b) { m_scaledRefLayerOffsetPresentFlag[x] = b; }
     2133  Bool getRefRegionOffsetPresentFlag(Int x) { return m_refRegionOffsetPresentFlag[x]; }
     2134  Void setRefRegionOffsetPresentFlag(Int x, Bool b) { m_refRegionOffsetPresentFlag[x] = b; }
     2135#endif
     2136#if R0209_GENERIC_PHASE
     2137  Int getPhaseHorLuma(Int x) { return m_phaseHorLuma[x]; }
     2138  Int getPhaseVerLuma(Int x) { return m_phaseVerLuma[x]; }
     2139  Int getPhaseHorChroma(Int x) { return m_phaseHorChroma[x]; }
     2140  Int getPhaseVerChroma(Int x) { return m_phaseVerChroma[x]; }
     2141  Void setPhaseHorLuma(Int x, Int val) { m_phaseHorLuma[x] = val; }
     2142  Void setPhaseVerLuma(Int x, Int val) { m_phaseVerLuma[x] = val; }
     2143  Void setPhaseHorChroma(Int x, Int val) { m_phaseHorChroma[x] = val; }
     2144  Void setPhaseVerChroma(Int x, Int val) { m_phaseVerChroma[x] = val; }
     2145  Bool getResamplePhaseSetPresentFlag(Int x) { return m_resamplePhaseSetPresentFlag[x]; }
     2146  Void setResamplePhaseSetPresentFlag(Int x, Bool b) { m_resamplePhaseSetPresentFlag[x] = b; }
     2147#if RESAMPLING_FIX
     2148  Bool hasZeroResamplingPhase(Int layerId);
     2149#endif
     2150#endif
     2151#endif
    19472152#if Q0048_CGS_3D_ASYMLUT
    19482153  Int     getCGSFlag()                { return m_nCGSFlag;  }
     
    19942199  Int         m_associatedIrapPocBeforeReset;
    19952200#endif
    1996 
    19972201  NalUnitType m_iAssociatedIRAPType;
    19982202  static Int  m_prevTid0POC;
     
    20852289
    20862290  Bool       m_enableTMVPFlag;
     2291#if R0226_SLICE_TMVP
     2292  Bool       m_availableForTMVPRefFlag;
     2293#endif
    20872294
    20882295#if SVC_EXTENSION
     
    21202327  Bool        m_pocMsbValRequiredFlag;
    21212328  Bool        m_pocMsbValPresentFlag;
     2329#if P0297_VPS_POC_LSB_ALIGNED_FLAG
     2330  Bool        m_pocMsbValNeeded;
     2331  Int         m_pocResetDeltaPoc;
     2332#endif
    21222333#endif
    21232334#if POC_RESET_IDC_ENCODER
     
    23922603  Bool      getEnableTMVPFlag     ()              { return m_enableTMVPFlag;}
    23932604
     2605#if R0226_SLICE_TMVP
     2606  Void      setAvailableForTMVPRefFlag     ( Bool   b )    { m_availableForTMVPRefFlag = b; }
     2607  Bool      getAvailableForTMVPRefFlag     ()              { return m_availableForTMVPRefFlag;}
     2608#endif
     2609
    23942610#if SVC_EXTENSION
    23952611  Bool      setBaseColPic       ( TComList<TComPic*>& rcListPic , UInt refLayerIdc );
     
    24072623  TComPicYuv* getFullPelBaseRec   (UInt refLayerIdc)               { return  m_pcFullPelBaseRec[refLayerIdc];  }
    24082624
    2409 #if AVC_SYNTAX
    2410   Void      initBaseLayerRPL( TComSlice *pcSlice );
    2411 #endif
    2412 
    24132625  Void      setRefPicListModificationSvc();
    24142626  Int       getNumILRRefIdx     ( )                     { return  m_pcVPS->getNumDirectRefLayers( m_layerId ); }
    2415 
    2416 #if REF_IDX_MFM
    2417   Void      setRefPOCListILP(TComPic** ilpPic, TComPic** pcRefPicRL);
    2418 #endif
    24192627
    24202628  Int       getActiveNumILRRefIdx     ( )               { return  m_activeNumILRRefIdx; }
     
    24442652  Bool     isRASL()   { return (m_eNalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || m_eNalUnitType == NAL_UNIT_CODED_SLICE_RASL_R); }
    24452653
     2654#if POC_RESET_RESTRICTIONS
     2655  Bool     isIDR()    { return (m_eNalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL
     2656                                  || m_eNalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP); }
     2657  Bool     isCRA()    { return m_eNalUnitType == NAL_UNIT_CODED_SLICE_CRA; }
     2658  Bool     isBLA()    { return (m_eNalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_LP
     2659                                  || m_eNalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_RADL
     2660                                  || m_eNalUnitType == NAL_UNIT_CODED_SLICE_BLA_N_LP ); }
     2661  Bool     isSLNR()   { return (m_eNalUnitType == NAL_UNIT_CODED_SLICE_TRAIL_N
     2662                                  || m_eNalUnitType == NAL_UNIT_CODED_SLICE_TSA_N
     2663                                  || m_eNalUnitType == NAL_UNIT_CODED_SLICE_STSA_N
     2664                                  || m_eNalUnitType == NAL_UNIT_CODED_SLICE_RADL_N
     2665                                  || m_eNalUnitType == NAL_UNIT_CODED_SLICE_RASL_N
     2666                                  || m_eNalUnitType == NAL_UNIT_RESERVED_VCL_N10
     2667                                  || m_eNalUnitType == NAL_UNIT_RESERVED_VCL_N12
     2668                                  || m_eNalUnitType == NAL_UNIT_RESERVED_VCL_N14 ); }
     2669#endif
    24462670#if POC_RESET_FLAG
    24472671  Bool      getPocResetFlag  ()                              { return m_bPocResetFlag;       }
     
    24732697  Int  getQpBDOffsetY();
    24742698  Int  getQpBDOffsetC();
     2699
     2700#if R0156_CONF_WINDOW_IN_REP_FORMAT
     2701  Window& getConformanceWindow();
     2702#endif
    24752703#endif
    24762704
     
    24852713  Int       getPocLsbVal         ()                              { return m_pocLsbVal;       }
    24862714  Void      setPocLsbVal       (Int b)                           { m_pocLsbVal = b;          }
     2715#if P0297_VPS_POC_LSB_ALIGNED_FLAG
     2716  Void      setPocMsbNeeded      (Bool x)                        { m_pocMsbValNeeded = x; }
     2717  Bool      getPocMsbNeeded      ()                              { return m_pocMsbValNeeded; }
     2718  Int       getPocResetDeltaPoc  ()                              { return m_pocResetDeltaPoc; }
     2719  Void      setPocResetDeltaPoc  (Int x)                         { m_pocResetDeltaPoc = x; }
     2720#endif
    24872721  Int       getPocMsbVal         ()                              { return m_pocMsbVal;       }
    24882722  Void      setPocMsbVal       (Int b)                           { m_pocMsbVal = b;          }
     
    25122746  Int       getCurrMsb( Int currLsb, Int prevLsb, Int prevMsb, Int maxLsbVal );
    25132747#endif
    2514 
     2748  Int       getReferenceLayerIdc( UInt refLayerId );
    25152749
    25162750#endif //SVC_EXTENSION
     
    25672801  }
    25682802
    2569 #if Q0078_ADD_LAYER_SETS
    2570   Void removePS(Int psId)
    2571   {
    2572     assert(psId < m_maxId);
    2573     if (m_paramsetMap.find(psId) != m_paramsetMap.end())
    2574     {
    2575       m_paramsetMap.erase(psId);
    2576     }
    2577   }
    2578 #endif
    2579 
    2580 
    25812803private:
    25822804  std::map<Int,T *> m_paramsetMap;
     
    26012823  TComSPS* getSPS(Int spsId)  { return m_spsMap.getPS(spsId); };
    26022824  TComSPS* getFirstSPS()      { return m_spsMap.getFirstPS(); };
    2603 #if Q0078_ADD_LAYER_SETS
    2604   Void     removeSPS(Int spsId) { m_spsMap.removePS(spsId); };
    2605 #endif
    26062825
    26072826  //! store picture parameter set and take ownership of it
     
    26102829  TComPPS* getPPS(Int ppsId)  { return m_ppsMap.getPS(ppsId); };
    26112830  TComPPS* getFirstPPS()      { return m_ppsMap.getFirstPS(); };
    2612 #if Q0078_ADD_LAYER_SETS
    2613   Void     removePPS(Int ppsId) { m_ppsMap.removePS(ppsId); };
    2614 #endif
    26152831
    26162832  //! activate a SPS from a active parameter sets SEI message
     
    26302846#if SVC_EXTENSION
    26312847  static ParameterSetMap<TComVPS> m_vpsMap;
     2848  static ParameterSetMap<TComSPS> m_spsMap;
     2849  static ParameterSetMap<TComPPS> m_ppsMap;
    26322850#else
    26332851  ParameterSetMap<TComVPS> m_vpsMap;
    2634 #endif
    26352852  ParameterSetMap<TComSPS> m_spsMap;
    26362853  ParameterSetMap<TComPPS> m_ppsMap;
     2854#endif
    26372855
    26382856#if SVC_EXTENSION
     
    26482866
    26492867#endif // __TCOMSLICE__
     2868
  • trunk/source/Lib/TLibCommon/TComUpsampleFilter.cpp

    r815 r906  
    5959#else
    6060#if O0194_JOINT_US_BITSHIFT
     61#if REF_REGION_OFFSET
     62Void TComUpsampleFilter::upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window, const Window altRefWindow )
     63#else
    6164Void TComUpsampleFilter::upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window )
     65#endif
    6266#else
    6367Void TComUpsampleFilter::upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window )
     
    7579#endif
    7680
     81#if MOVE_SCALED_OFFSET_TO_PPS
     82#if O0098_SCALED_REF_LAYER_ID
     83  const Window &scalEL = currSlice->getPPS()->getScaledRefLayerWindowForLayer(refLayerId);
     84#else
     85  const Window &scalEL = currSlice->getPPS()->getScaledRefLayerWindow(refLayerIdc);
     86#endif
     87#if REF_REGION_OFFSET
     88  const Window &windowRL = currSlice->getPPS()->getRefLayerWindow(refLayerIdc);
     89#endif
     90#else
    7791#if O0098_SCALED_REF_LAYER_ID
    7892  const Window &scalEL = currSlice->getSPS()->getScaledRefLayerWindowForLayer(refLayerId);
    7993#else
    8094  const Window &scalEL = currSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc);
     95#endif
    8196#endif
    8297
     
    91106
    92107#if Q0200_CONFORMANCE_BL_SIZE
     108  const Window &confBL = currSlice->getBaseColPic(refLayerIdc)->getConformanceWindow();
     109#endif
     110#if Q0200_CONFORMANCE_BL_SIZE || REF_REGION_OFFSET
    93111  Int chromaFormatIdc = currSlice->getBaseColPic(refLayerIdc)->getSlice(0)->getChromaFormatIdc();
    94   const Window &confBL = currSlice->getBaseColPic(refLayerIdc)->getConformanceWindow();
    95112  Int xScal = TComSPS::getWinUnitX( chromaFormatIdc );
    96113  Int yScal = TComSPS::getWinUnitY( chromaFormatIdc );
     114#endif
     115#if R0209_GENERIC_PHASE
     116  Int phaseHorLuma   = currSlice->getPPS()->getPhaseHorLuma(refLayerIdc);
     117  Int phaseVerLuma   = currSlice->getPPS()->getPhaseVerLuma(refLayerIdc);
     118  Int phaseHorChroma = currSlice->getPPS()->getPhaseHorChroma(refLayerIdc);
     119  Int phaseVerChroma;
     120  if (currSlice->getPPS()->getResamplePhaseSetPresentFlag(refLayerIdc))
     121  {
     122    phaseVerChroma = currSlice->getPPS()->getPhaseVerChroma(refLayerIdc);
     123  }
     124  else
     125  {
     126    Int refRegionHeight = heightBL - windowRL.getWindowTopOffset() - windowRL.getWindowBottomOffset();
     127    phaseVerChroma = (4 * heightEL + (refRegionHeight >> 1)) / refRegionHeight - 4;
     128  }
    97129#endif
    98130#if P0312_VERT_PHASE_ADJ
     
    223255    Int   shiftY = 16;
    224256
     257#if R0209_GENERIC_PHASE
     258    Int phaseX = phaseHorLuma;
     259    Int phaseY = phaseVerLuma;
     260    Int addX = ( ( phaseX * scaleX + 8 ) >> 4 ) -  (1 << ( shiftX - 5 ));
     261    Int addY = ( ( phaseY * scaleY + 8 ) >> 4 ) -  (1 << ( shiftX - 5 ));
     262#if REF_REGION_OFFSET
     263    Int refOffsetX = windowRL.getWindowLeftOffset() << 4;
     264    Int refOffsetY = windowRL.getWindowTopOffset()  << 4;
     265#else
     266#if Q0200_CONFORMANCE_BL_SIZE
     267    Int refOffsetX = ( confBL.getWindowLeftOffset() * xScal ) << 4;
     268    Int refOffsetY = ( confBL.getWindowTopOffset()  * yScal ) << 4;
     269#endif
     270#endif
     271#else
    225272#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
    226273    Int   phaseX = 2*phaseAlignFlag;
     
    258305#endif
    259306
     307#if REF_REGION_OFFSET
     308    Int refOffsetX = windowRL.getWindowLeftOffset() << 4;
     309    Int refOffsetY = windowRL.getWindowTopOffset() << 4;
     310#else
    260311#if Q0200_CONFORMANCE_BL_SIZE
    261312    deltaX -= ( confBL.getWindowLeftOffset() * xScal ) << 4;
    262313    deltaY -= ( confBL.getWindowTopOffset() * yScal ) << 4;
    263314#endif
     315#endif
     316#endif
    264317
    265318    Int shiftXM4 = shiftX - 4;
     
    272325    heightBL = min<Int>( pcBasePic->getHeight(), heightEL );
    273326
     327#if R0220_REMOVE_EL_CLIP
     328    Int phaseXL = scalEL.getWindowLeftOffset();
     329    Int phaseYL = scalEL.getWindowTopOffset();
     330    Int rlClipL = -(NTAPS_US_LUMA>>1);
     331    Int rlClipR = widthBL -1 + (NTAPS_US_LUMA>>1);
     332    Int rlClipT = -(NTAPS_US_LUMA>>1);
     333    Int rlClipB = heightBL - 1 + (NTAPS_US_LUMA>>1);
     334#else
    274335    Int leftStartL = scalEL.getWindowLeftOffset();
    275336    Int rightEndL  = pcUsPic->getWidth() - scalEL.getWindowRightOffset();
     
    277338    Int bottomEndL = pcUsPic->getHeight() - scalEL.getWindowBottomOffset();
    278339    Int leftOffset = leftStartL > 0 ? leftStartL : 0;
     340#endif
    279341#if O0194_JOINT_US_BITSHIFT
    280342    // g_bitDepthY was set to EL bit-depth, but shift1 should be calculated using BL bit-depth
     
    293355    for( i = 0; i < widthEL; i++ )
    294356    {
     357#if R0220_REMOVE_EL_CLIP
     358      Int x = i;
     359#if R0209_GENERIC_PHASE
     360      refPos16 = (((x - phaseXL)*scaleX - addX) >> shiftXM4) + refOffsetX;
     361#else
     362#if REF_REGION_OFFSET
     363      refPos16 = (((x - phaseXL)*scaleX + addX) >> shiftXM4) - deltaX + refOffsetX;
     364#else
     365      refPos16 = (((x - phaseXL)*scaleX + addX) >> shiftXM4) - deltaX;
     366#endif
     367#endif
     368#else
    295369      Int x = Clip3( leftStartL, rightEndL - 1, i );
     370#if REF_REGION_OFFSET
     371      refPos16 = (((x - leftStartL)*scaleX + addX) >> shiftXM4) - deltaX + refOffsetX;
     372#else
    296373      refPos16 = (((x - leftStartL)*scaleX + addX) >> shiftXM4) - deltaX;
     374#endif
     375#endif
    297376      phase    = refPos16 & 15;
    298377      refPos   = refPos16 >> 4;
     378#if R0220_REMOVE_EL_CLIP
     379      refPos   = Clip3( rlClipL, rlClipR, refPos );
     380#endif
    299381      coeff = m_lumaFilter[phase];
    300382
     
    325407    for( j = 0; j < pcTempPic->getHeight(); j++ )
    326408    {
     409#if R0220_REMOVE_EL_CLIP
     410      Int y = j;
     411#if R0209_GENERIC_PHASE
     412      refPos16 = ((( y - phaseYL )*scaleY - addY) >> shiftYM4) + refOffsetY;
     413#else
     414#if REF_REGION_OFFSET
     415      refPos16 = ((( y - phaseYL )*scaleY + addY) >> shiftYM4) - deltaY + refOffsetY;
     416#else
     417      refPos16 = ((( y - pahseYL )*scaleY + addY) >> shiftYM4) - deltaY;
     418#endif
     419#endif
     420#else
    327421      Int y = Clip3(topStartL, bottomEndL - 1, j);
     422#if REF_REGION_OFFSET
     423      refPos16 = ((( y - topStartL )*scaleY + addY) >> shiftYM4) - deltaY + refOffsetY;
     424#else
    328425      refPos16 = ((( y - topStartL )*scaleY + addY) >> shiftYM4) - deltaY;
     426#endif
     427#endif
    329428      phase    = refPos16 & 15;
    330429      refPos   = refPos16 >> 4;
     430#if R0220_REMOVE_EL_CLIP
     431      refPos = Clip3( rlClipT, rlClipB, refPos );
     432#endif
    331433      coeff = m_lumaFilter[phase];
    332434
    333435      piSrcY = piTempBufY + (refPos -((NTAPS_US_LUMA>>1) - 1))*strideEL;
    334436      Pel* piDstY0 = piDstBufY + j * strideEL;
    335       piDstY = piDstY0 + leftOffset;
    336       piSrcY += leftOffset;
    337 
    338       for( i = min<Int>(rightEndL, pcTempPic->getWidth()) - max<Int>(0, leftStartL); i > 0; i-- )
     437
     438#if R0220_REMOVE_EL_CLIP
     439      piDstY = piDstY0;
     440
     441      for( i = pcTempPic->getWidth(); i > 0; i-- )
    339442      {
    340443        *piDstY = ClipY( (sumLumaVer(piSrcY, coeff, strideEL) + iOffset) >> (nShift));
     
    342445        piDstY++;
    343446      }
     447#else
     448      piDstY = piDstY0 + leftOffset;
     449      piSrcY += leftOffset;
     450
     451      for( i = min<Int>(rightEndL, pcTempPic->getWidth()) - max<Int>(0, leftStartL); i > 0; i-- )
     452      {
     453        *piDstY = ClipY( (sumLumaVer(piSrcY, coeff, strideEL) + iOffset) >> (nShift));
     454        piSrcY++;
     455        piDstY++;
     456      }
    344457
    345458      for( i = rightEndL; i < pcTempPic->getWidth(); i++ )
     
    355468        piDstY++;
    356469      }
    357 
     470#endif
    358471    }
    359472
     
    374487    strideEL  = pcUsPic->getCStride();
    375488
     489#if R0220_REMOVE_EL_CLIP
     490    Int srlLOffsetC = scalEL.getWindowLeftOffset() >> 1;
     491    Int srlTOffsetC = scalEL.getWindowTopOffset() >> 1;
     492    rlClipL = -(NTAPS_US_CHROMA>>1);
     493    rlClipR = widthBL -1 + (NTAPS_US_CHROMA>>1);
     494    rlClipT = -(NTAPS_US_CHROMA>>1);
     495    rlClipB = heightBL - 1 + (NTAPS_US_CHROMA>>1);
     496#else
    376497    Int leftStartC = scalEL.getWindowLeftOffset() >> 1;
    377498    Int rightEndC  = (pcUsPic->getWidth() >> 1) - (scalEL.getWindowRightOffset() >> 1);
     
    379500    Int bottomEndC = (pcUsPic->getHeight() >> 1) - (scalEL.getWindowBottomOffset() >> 1);
    380501    leftOffset = leftStartC > 0 ? leftStartC : 0;
     502#endif
    381503    shiftX = 16;
    382504    shiftY = 16;
    383505
     506#if R0209_GENERIC_PHASE
     507    addX = ( ( phaseHorChroma * scaleX + 8 ) >> 4 ) -  (1 << ( shiftX - 5 ));
     508    addY = ( ( phaseVerChroma * scaleY + 8 ) >> 4 ) -  (1 << ( shiftX - 5 ));
     509    Int refOffsetXC = (windowRL.getWindowLeftOffset() / xScal) << 4;
     510    Int refOffsetYC = (windowRL.getWindowTopOffset()  / yScal) << 4;
     511#else
    384512#if O0215_PHASE_ALIGNMENT
    385513    Int phaseXC = phaseAlignFlag;
     
    417545#endif
    418546
     547#if REF_REGION_OFFSET
     548    Int refOffsetXC = (windowRL.getWindowLeftOffset() / xScal) << 4;
     549    Int refOffsetYC  = (windowRL.getWindowTopOffset()  / yScal) << 4;
     550#else
    419551#if Q0200_CONFORMANCE_BL_SIZE
    420552    deltaX -= ( ( confBL.getWindowLeftOffset() * xScal ) >> 1 ) << 4;
    421553    deltaY  -= ( ( confBL.getWindowTopOffset() * yScal ) >> 1 ) << 4;
     554#endif
     555#endif
    422556#endif
    423557
     
    447581    for( i = 0; i < widthEL; i++ )
    448582    {
     583#if R0220_REMOVE_EL_CLIP
     584      Int x = i;
     585#if R0209_GENERIC_PHASE
     586      refPos16 = (((x - srlLOffsetC)*scaleX - addX) >> shiftXM4) + refOffsetXC;
     587#else
     588#if REF_REGION_OFFSET
     589      refPos16 = (((x - srlLOffsetC)*scaleX + addX) >> shiftXM4) - deltaX + refOffsetXC;
     590#else
     591      refPos16 = (((x - srlLOffsetC)*scaleX + addX) >> shiftXM4) - deltaX;
     592#endif
     593#endif
     594#else
    449595      Int x = Clip3(leftStartC, rightEndC - 1, i);
     596#if REF_REGION_OFFSET
     597      refPos16 = (((x - leftStartC)*scaleX + addX) >> shiftXM4) - deltaX + refOffsetXC;
     598#else
    450599      refPos16 = (((x - leftStartC)*scaleX + addX) >> shiftXM4) - deltaX;
     600#endif
     601#endif
    451602      phase    = refPos16 & 15;
    452603      refPos   = refPos16 >> 4;
     604#if R0220_REMOVE_EL_CLIP
     605      refPos   = Clip3(rlClipL, rlClipR, refPos);
     606#endif
    453607      coeff = m_chromaFilter[phase];
    454608
     
    485639    for( j = 0; j < pcTempPic->getHeight() >> 1; j++ )
    486640    {
     641#if R0220_REMOVE_EL_CLIP
     642      Int y = j;
     643#if R0209_GENERIC_PHASE
     644      refPos16 = (((y - srlTOffsetC)*scaleX - addY) >> shiftYM4) + refOffsetYC;
     645#else
     646#if REF_REGION_OFFSET
     647      refPos16 = (((y - srlTOffsetC)*scaleY + addY) >> shiftYM4) - deltaY + refOffsetYC;
     648#else
     649      refPos16 = (((y - srlTOffsetC)*scaleY + addY) >> shiftYM4) - deltaY;
     650#endif
     651#endif
     652#else
    487653      Int y = Clip3(topStartC, bottomEndC - 1, j);
     654#if REF_REGION_OFFSET
     655      refPos16 = (((y - topStartC)*scaleY + addY) >> shiftYM4) - deltaY + refOffsetYC;
     656#else
    488657      refPos16 = (((y - topStartC)*scaleY + addY) >> shiftYM4) - deltaY;
     658#endif
     659#endif
    489660      phase    = refPos16 & 15;
    490661      refPos   = refPos16 >> 4;
     662#if R0220_REMOVE_EL_CLIP
     663      refPos = Clip3(rlClipT, rlClipB, refPos);
     664#endif
    491665      coeff = m_chromaFilter[phase];
    492666
     
    496670      Pel* piDstU0 = piDstBufU + j*strideEL;
    497671      Pel* piDstV0 = piDstBufV + j*strideEL;
    498       piDstU = piDstU0 + leftOffset;
    499       piDstV = piDstV0 + leftOffset;
    500       piSrcU += leftOffset;
    501       piSrcV += leftOffset;
    502 
    503       for( i = min<Int>(rightEndC, pcTempPic->getWidth() >> 1) - max<Int>(0, leftStartC); i > 0; i-- )
     672
     673#if R0220_REMOVE_EL_CLIP
     674      piDstU = piDstU0;
     675      piDstV = piDstV0;
     676
     677      for( i = pcTempPic->getWidth() >> 1; i > 0; i-- )
    504678      {
    505679        *piDstU = ClipC( (sumChromaVer(piSrcU, coeff, strideEL) + iOffset) >> (nShift));
     
    510684        piDstV++;
    511685      }
     686#else
     687      piDstU = piDstU0 + leftOffset;
     688      piDstV = piDstV0 + leftOffset;
     689      piSrcU += leftOffset;
     690      piSrcV += leftOffset;
     691
     692      for( i = min<Int>(rightEndC, pcTempPic->getWidth() >> 1) - max<Int>(0, leftStartC); i > 0; i-- )
     693      {
     694        *piDstU = ClipC( (sumChromaVer(piSrcU, coeff, strideEL) + iOffset) >> (nShift));
     695        *piDstV = ClipC( (sumChromaVer(piSrcV, coeff, strideEL) + iOffset) >> (nShift));
     696        piSrcU++;
     697        piSrcV++;
     698        piDstU++;
     699        piDstV++;
     700      }
    512701
    513702      for( i = rightEndC; i < pcTempPic->getWidth() >> 1; i++ )
     
    528717        piDstV++;
    529718      }
     719#endif
    530720
    531721    }
  • trunk/source/Lib/TLibCommon/TComUpsampleFilter.h

    r713 r906  
    5151#else
    5252#if O0194_JOINT_US_BITSHIFT
     53#if REF_REGION_OFFSET
     54  Void upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window, const Window altRefWindow );
     55#else
    5356  Void upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window );
     57#endif
    5458#else
    5559  Void upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window );
  • trunk/source/Lib/TLibCommon/TypeDef.h

    r815 r906  
    4141#define SVC_EXTENSION                    1
    4242
    43 #define SYNTAX_BYTES                     10     ///< number of bytes taken by syntaxes per 4x4 block [RefIdxL0(1byte), RefIdxL1(1byte), MVxL0(2bytes), MVyL0(2bytes), MVxL1(2bytes), MVyL1(2bytes)]
    4443#if SVC_EXTENSION
    4544#define MAX_LAYERS                       8      ///< max number of layers the codec is supposed to handle
    4645
     46#define SIGNALLING_BITRATE_PICRATE_FIX   1      ///< Fix for signalling of bitrate and picture rate info in VPS VUI to be more aligned to JCTVC-R1008
     47#define INFERENCE_POC_MSB_VAL_PRESENT    1      ///< JCTVC-Q0146 -- poc_msb_val_present_flag shall be equal to 0 when slice_header_extension_length is (inferred to be ) equal to 0
     48#define CROSS_LAYER_BLA_FLAG_FIX         1      ///< Fix for earlier implementation mistake that omit the signalling of cross_layer_bla_flag
     49#define NON_REF_NAL_TYPE_DISCARDABLE     1      ///< JCTVC-P0041 -- If discardable picture is a non-IRAP, it must be a non-referenced sub-layer picture
     50#define VPS_AVC_BL_FLAG_REMOVAL          1      ///< remove avc_base_layer_flag and direct the function its offer to vps_base_layer_internal_flag and vps_base_layer_available_flag
     51#define VPS_RESERVED_FLAGS               1      ///< vps_base_layer_internal_flag and vps_base_layer_available_flag
     52#define VPS_VUI_VST_PARAMS               1      ///< JCTVC-R0227: Related to signalling of VST parameters of the base layer.
    4753#define VPS_VUI_OFFSET                   1      ///< N0085: Signal VPS VUI offset in the VPS extension
     54#define REMOVE_BSP_HRD_SEI               1      ///< R0010: Remove bitstream partition HRD SEI message.
     55#define NESTING_SEI_EXTENSIBILITY        1      ///< R0221: Signalling the number of SEI messages in bitstream partition nesting SEI message
     56#define POC_RESET_RESTRICTIONS           1      ///< Restrictions on semantics of POC reset-related syntax elements, including one item from R0223
     57#define POC_RESET_VALUE_RESTRICTION      1      ///< R0223: Restriction on the value of full_poc_reset_flag
     58#define OUTPUT_LAYER_SETS_CONFIG         1
     59#define MOVE_ADDN_LS_SIGNALLING          1      ///< JCTVC-R0238: (Ed.) Move additional layer set signalling in VPS extn.
     60#define PTL_SIGNALLING                   1      ///< Overall macro for all PTL-related signalling
     61#if PTL_SIGNALLING
     62#define LIST_OF_PTL                      1      ///< JCTVC-R0272: Signalling the PTL for the 0-th OLS
     63#define NECESSARY_LAYER_FLAG             1      ////< Derivation of NecessaryLayerFlag
     64#define PER_LAYER_PTL                    1      ///< Signal profile-tier-level information for each layer.
     65#endif
     66#define BSP_INIT_ARRIVAL_SEI             1      ///< JCTVC-R0231: Make signalling of vcl_initial_arrival_delay independent of NalHrdBpPresentFlag
     67#define SUB_LAYERS_IN_LAYER_SET          1      ///< Move calculation of MaxSubLayerInLayerSets to a separate function
     68#define VPS_VUI_BSP_HRD_PARAMS           1      ///< JCTVC-R0231: Define the VPS VUI BSP hrd_params() as a separate function, and apply changes adopted.
    4869#define O0137_MAX_LAYERID                1      ///< JCTVC-O0137, JCTVC-O0200, JCTVC-O0223: restrict nuh_layer_id and vps_max_layers_minus1
    4970
    50 #define Q0108_TSA_STSA                   0      ///< JCTVC-Q0108, Remove cross-layer alignment constraints of TSA and STSA pictures, enable to have different prediction structures in different layers
     71#define R0226_CONSTRAINT_TMVP_SEI        1      ///< JCTVC-R0226, Modification to semantics in temporal motion vector prediction constraints SEI message
     72#define R0226_SLICE_TMVP                 1      ///< JCTVC-R0226, Regarding slice_temporal_mvp_enabled_flag
     73#define R0279_REP_FORMAT_INBL            1      ///< JCTVC-R0279, For any independent non-base layer the used representation format is the one that is signalled in the active SPS for the layer
     74#define R0227_VUI_BSP_HRD_FLAG           1      ///< JCTVC-R0227, Conformance checking such that VPS VUI HRD only present if VPS timing info is signalled
     75#define R0227_REP_FORMAT_CONSTRAINT      1      ///< JCTVC-R0227, Conformance checking such that representation format of a particular layer shall not be greater than the one defined in VPS for that layer
     76#define R0227_BR_PR_ADD_LAYER_SET        1      ///< JCTVC-R0227, Signalling of bit-rate and picture rate for additional layer set
     77#define R0042_PROFILE_INDICATION         1      ///< JCTVC-R0042, Profile indication for additional layer sets
     78
     79#define Q0108_TSA_STSA                   1      ///< JCTVC-Q0108, Remove cross-layer alignment constraints of TSA and STSA pictures, enable to have different prediction structures in different layers
    5180#define Q0177_SPS_TEMP_NESTING_FIX       1      ///< JCTVC-Q0177; Fix the inference value of sps_temporal_id_nesting_flag when it is not present
    5281#define Q0177_EOS_CHECKS                 1      ///< JCTVC-Q0177; Put checks on handling EOS
     
    5483#define Q0146_SSH_EXT_DATA_BIT           1      ///< JCTVC-Q0146; Bug-fix -- the SSH_EXT_DATA_BIT can have any value -- not required to be 1
    5584
    56 #define Q0200_CONFORMANCE_BL_SIZE        1      ///< JCTVC-Q0200; use conformance picture size in re-sampling processs
    57 #define P0312_VERT_PHASE_ADJ             1      ///< JCTVC-P0312: vertical phase adjustment in re-sampling process (BoG report)
    58 #if P0312_VERT_PHASE_ADJ
    59 #define Q0120_PHASE_CALCULATION          1      ///< JCTVC-Q0120 phase offset derivation for combination of spatial scalibility and field coding.
    60 #endif
    6185#define P0130_EOB                        1      ///< JCTVC-P0130, set layer Id of EOB NALU to be fixed to 0
     86#define T_ID_EOB_BUG_FIX                 1      ///< Bug fix for the value of temporal id of EOB NALU. It must be set to 0
    6287#define P0307_REMOVE_VPS_VUI_OFFSET      1      ///< JCTVC-P0307, remove implementation related to VPS VUI offset signalling
    6388#define P0307_VPS_NON_VUI_EXTENSION      1      ///< JCTVC-P0307, implementation related to NON VUI VPS Extension signalling
     
    94119#if Q0048_CGS_3D_ASYMLUT
    95120#define CGS_GCC_NO_VECTORIZATION         1
    96 #define O0194_WEIGHTED_PREDICTION_CGS    0
    97 #else
    98 #define O0194_WEIGHTED_PREDICTION_CGS    1      ///< JCTVC-O0194: Weighted prediciton for color gamut scalability
    99 #endif
     121#define R0150_CGS_SIGNAL_CONSTRAINTS     1      ///< JCTVC-R0150: CGS signaling improvement and constraints
     122#define R0151_CGS_3D_ASYMLUT_IMPROVE     1      ///< JCTVC-R0151: Non-uniform chroma partitioning and improved LUT coefficient coding
     123#define R0164_CGS_LUT_BUGFIX             1      ///< JCTVC-R0164: Bug fix with LUT syntax
     124#define R0164_CGS_LUT_BUGFIX_CHECK       0      ///< JCTVC-R0164: Add traces explicitly/non-explicitly encoded vertices and check if 3DLUT is correctly filled
     125#define R0179_CGS_SIZE_8x1x1             1      ///< JCTVC-R0179: allow CGS LUT size to be 8x1x1 as well
     126#define R0300_CGS_RES_COEFF_CODING       1      ///< JCTVC-R0300: improved residual coefficient coding for R0151
     127#define R0179_ENC_OPT_3DLUT_SIZE         0      ///< JCTVC-R0179: RD decision based LUT size selection
     128#endif
     129#define O0194_WEIGHTED_PREDICTION_CGS    1      ///< JCTVC-O0194: Weighted prediction for colour gamut scalability
    100130#define POC_RESET_FLAG                   0      ///< JCTVC-N0244: POC reset flag for  layer pictures.
    101131#define POC_RESET_IDC                    1      ///< JCTVC-P0041: Include poc_reset_idc and related derivation - eventually will replace POC_RESET_FLAG
     
    107137#define UNAVAILABLE_PIC_BUGFIX           1
    108138#endif
     139#if INFERENCE_POC_MSB_VAL_PRESENT
     140#define POC_MSB_VAL_PRESENT_FLAG_SEM     0      ///< JCTVC-Q0146: Inference of poc_msb_val_present_flag
     141#else
    109142#define POC_MSB_VAL_PRESENT_FLAG_SEM     1      ///< JCTVC-Q0146: Inference of poc_msb_val_present_flag
     143#endif
    110144#define POC_RESET_INFO_INFERENCE         1      ///< JCTVC-Q0146: Infer the value of poc_reset_info_present_flag when not present
    111145#define NO_OUTPUT_OF_PRIOR_PICS          1      ///< Use no_output_of_prior_pics_flag
     
    123157#endif
    124158
     159#define P0297_VPS_POC_LSB_ALIGNED_FLAG   1      ///< JCTVC-P0297: vps_poc_lsb_aligned_flag for cross-layer POC anchor picture derivation
     160
    125161#define VPS_EXTN_MASK_AND_DIM_INFO       1      ///< Include avc_base_layer_flag, splitting_flag, scalability mask and dimension related info
    126162#if VPS_EXTN_MASK_AND_DIM_INFO
     
    152188
    153189#define AVC_BASE                         1      ///< YUV BL reading for AVC base SVC
    154 #if AVC_BASE
    155 #define AVC_SYNTAX                       0      ///< Syntax reading for AVC base
    156 #endif
    157190
    158191#define REF_IDX_MFM                      1      ///< JCTVC-L0336: motion vector mapping of inter-layer reference picture
     
    193226#define REP_FORMAT_FIX                   1      ///< update_rep_format_flag should be inferred to be equal to 0
    194227
     228#define R0156_CONF_WINDOW_IN_REP_FORMAT  O0096_REP_FORMAT_INDEX ///< JCTVC-R0156: add conformance window cropping offsets to rep_format()
     229
    195230#define RESAMPLING_CONSTRAINT_BUG_FIX    1
    196231#define O0098_SCALED_REF_LAYER_ID        1      ///< JCTVC-O0098: signal scaled reference id
     
    226261#define HRD_BPB                          1      ///< JCTVC-Q0101 Bitstream Partition Buffering Proposals
    227262#define DPB_CONSTRAINTS                  1      ///< JCTVC-Q0100 RPS DPB constraints
     263#define DPB_INTERNAL_BL_SIG              1      ///< JCTVC-R0153: external base layer
     264#define ALT_OPT_LAYER_FLAG               1      ///< JCTVC-R0154: proposal1 - alt_output_layer_flag[i] inference
     265#define DEF_OPT_LAYER_IDC                1      ///< JCTVC-R0154: proposal2 - default_output_layer_idc and output_layer_flag[i][j]
     266#define ISLICE_TYPE_NUMDIR               1      ///< JCTVC-R0155: Proposal 1 I slice_type
     267#define OLS_IDX_CHK                      1      ///< JCTVC-R0155: Proposal 2 valid range for output_layer_set_idx_to_vps[i]
     268#define R0340_RESAMPLING_MODIFICATION    1      ///< JCTVC-R0340: set of changes regarding resampling (as listed below)
     269#if R0340_RESAMPLING_MODIFICATION
     270#define MOVE_SCALED_OFFSET_TO_PPS        1      ///< JCTVC-R0013: move scaled reference layer offset from SPS to PPS
     271#if MOVE_SCALED_OFFSET_TO_PPS
     272#define REF_REGION_OFFSET                1      ///< JCTVC-Q0159/R0220: reference region offset
     273#define R0209_GENERIC_PHASE              1      ///< JCTVC-R0209: resampling with generic phase
     274#define R0220_REMOVE_EL_CLIP             1      ///< JCTVC-R0220: remove clip to scaled ref window in resampling process
     275#define RESAMPLING_FIX                   1      ///< Resampling fix -- equal offset check and conformance check
     276#endif
     277#else
     278#define Q0200_CONFORMANCE_BL_SIZE        1      ///< JCTVC-Q0200; use conformance picture size in re-sampling processs
     279#define P0312_VERT_PHASE_ADJ             1      ///< JCTVC-P0312: vertical phase adjustment in re-sampling process (BoG report)
     280#if P0312_VERT_PHASE_ADJ
     281#define Q0120_PHASE_CALCULATION          1      ///< JCTVC-Q0120 phase offset derivation for combination of spatial scalibility and field coding.
     282#endif
     283#endif
    228284
    229285/// scalability types
     
    234290  AUX_ID            = 3,
    235291};
     292
     293#define WPP_FIX                          1
    236294
    237295/// normative encoder constraints --------
     
    255313#define MAX_SUB_STREAMS                  1024
    256314#endif
    257 #define Q0074_SEI_COLOR_MAPPING          1      ///< JCTVC-Q0074, SEI Color Mapping
    258315#define LAYERS_NOT_PRESENT_SEI           1      ///< JCTVC-M0043: add layers not present SEI.
    259316#define N0383_IL_CONSTRAINED_TILE_SETS_SEI  1
    260317#define Q0189_TMVP_CONSTRAINTS           1      ///< JCTVC-Q0189: indicate constraints on TMVP
    261318#define Q0247_FRAME_FIELD_INFO           1      ///< JCTVC-Q0247: field_frame_info SEI message
    262 
    263 
    264 #else
    265 #define SYNTAX_OUTPUT                    0
     319#define R0247_SEI_ACTIVE                 1      ///< JCTVC-R0247: active parameter sets SEI message
     320
    266321#endif // SVC_EXTENSION
     322#define Q0074_COLOUR_REMAPPING_SEI       1      ///< JCTVC-Q0074, JCTVC-R0344: SEI Colour Remapping Information
    267323
    268324
     
    278334#define SAO_SGN_FUNC 1
    279335
     336#define TILE_SIZE_CHECK 1
     337
    280338#define FIX1172 1 ///< fix ticket #1172
    281339
     
    292350#define MAX_NESTING_NUM_OPS         1024
    293351#define MAX_NESTING_NUM_LAYER       64
    294 
     352#if NESTING_SEI_EXTENSIBILITY
     353#define MAX_SEIS_IN_BSP_NESTING     64
     354#endif
    295355#if SVC_EXTENSION
    296356#define MAX_VPS_OP_LAYER_SETS_PLUS1               (MAX_LAYERS+1)
    297357#define MAX_VPS_LAYER_SETS_PLUS1                  1024
     358#define MAX_VPS_OUTPUT_LAYER_SETS_PLUS1           1024
    298359#define MAX_VPS_LAYER_ID_PLUS1                    MAX_LAYERS
    299360#else
     
    438499typedef       double              Double;
    439500typedef       float               Float;
    440 
    441501// ====================================================================================================================
    442502// 64-bit integer type
Note: See TracChangeset for help on using the changeset viewer.