Changeset 133 in SHVCSoftware for branches/SHM-2.0-dev/source/Lib/TLibCommon


Ignore:
Timestamp:
28 Apr 2013, 08:49:16 (12 years ago)
Author:
seregin
Message:

update to HM10.1

Location:
branches/SHM-2.0-dev/source/Lib/TLibCommon
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-2.0-dev/source/Lib/TLibCommon/CommonDef.h

    r125 r133  
    5656// ====================================================================================================================
    5757
    58 #define NV_VERSION        "1.2"                 ///< Current software version
     58#define NV_VERSION        "2.0"                 ///< Current software version
    5959
    6060// ====================================================================================================================
     
    110110#define MAX_NUM_REF_PICS            16          ///< max. number of pictures used for reference
    111111#define MAX_NUM_REF                 16          ///< max. number of entries in picture reference list
     112#if !L0034_COMBINED_LIST_CLEANUP
    112113#define MAX_NUM_REF_LC              MAX_NUM_REF_PICS  // TODO: remove this macro definition (leftover from combined list concept)
     114#endif
    113115
    114116#define MAX_UINT                    0xFFFFFFFFU ///< max. value of unsigned 32-bit integer
     
    197199 
    198200  NAL_UNIT_CODED_SLICE_TSA_N,     // 2
    199   NAL_UNIT_CODED_SLICE_TLA,       // 3   // Current name in the spec: TSA_R
     201  NAL_UNIT_CODED_SLICE_TLA_R,       // 3
    200202 
    201203  NAL_UNIT_CODED_SLICE_STSA_N,    // 4
     
    203205
    204206  NAL_UNIT_CODED_SLICE_RADL_N,    // 6
    205   NAL_UNIT_CODED_SLICE_DLP,       // 7 // Current name in the spec: RADL_R
     207  NAL_UNIT_CODED_SLICE_RADL_R,      // 7
    206208 
    207209  NAL_UNIT_CODED_SLICE_RASL_N,    // 8
    208   NAL_UNIT_CODED_SLICE_TFD,       // 9 // Current name in the spec: RASL_R
    209 
    210   NAL_UNIT_RESERVED_10,
    211   NAL_UNIT_RESERVED_11,
    212   NAL_UNIT_RESERVED_12,
    213   NAL_UNIT_RESERVED_13,
    214   NAL_UNIT_RESERVED_14,
    215   NAL_UNIT_RESERVED_15,
    216 
    217   NAL_UNIT_CODED_SLICE_BLA,       // 16   // Current name in the spec: BLA_W_LP
    218   NAL_UNIT_CODED_SLICE_BLANT,     // 17   // Current name in the spec: BLA_W_DLP
     210  NAL_UNIT_CODED_SLICE_RASL_R,      // 9
     211
     212  NAL_UNIT_RESERVED_VCL_N10,
     213  NAL_UNIT_RESERVED_VCL_R11,
     214  NAL_UNIT_RESERVED_VCL_N12,
     215  NAL_UNIT_RESERVED_VCL_R13,
     216  NAL_UNIT_RESERVED_VCL_N14,
     217  NAL_UNIT_RESERVED_VCL_R15,
     218
     219  NAL_UNIT_CODED_SLICE_BLA_W_LP,    // 16
     220  NAL_UNIT_CODED_SLICE_BLA_W_RADL,  // 17
    219221  NAL_UNIT_CODED_SLICE_BLA_N_LP,  // 18
    220   NAL_UNIT_CODED_SLICE_IDR,       // 19  // Current name in the spec: IDR_W_DLP
     222  NAL_UNIT_CODED_SLICE_IDR_W_RADL,  // 19
    221223  NAL_UNIT_CODED_SLICE_IDR_N_LP,  // 20
    222224  NAL_UNIT_CODED_SLICE_CRA,       // 21
    223   NAL_UNIT_RESERVED_22,
    224   NAL_UNIT_RESERVED_23,
    225 
    226   NAL_UNIT_RESERVED_24,
    227   NAL_UNIT_RESERVED_25,
    228   NAL_UNIT_RESERVED_26,
    229   NAL_UNIT_RESERVED_27,
    230   NAL_UNIT_RESERVED_28,
    231   NAL_UNIT_RESERVED_29,
    232   NAL_UNIT_RESERVED_30,
    233   NAL_UNIT_RESERVED_31,
     225  NAL_UNIT_RESERVED_IRAP_VCL22,
     226  NAL_UNIT_RESERVED_IRAP_VCL23,
     227
     228  NAL_UNIT_RESERVED_VCL24,
     229  NAL_UNIT_RESERVED_VCL25,
     230  NAL_UNIT_RESERVED_VCL26,
     231  NAL_UNIT_RESERVED_VCL27,
     232  NAL_UNIT_RESERVED_VCL28,
     233  NAL_UNIT_RESERVED_VCL29,
     234  NAL_UNIT_RESERVED_VCL30,
     235  NAL_UNIT_RESERVED_VCL31,
    234236
    235237  NAL_UNIT_VPS,                   // 32
     
    240242  NAL_UNIT_EOB,                   // 37
    241243  NAL_UNIT_FILLER_DATA,           // 38
    242   NAL_UNIT_SEI,                   // 39 Prefix SEI
    243   NAL_UNIT_SEI_SUFFIX,            // 40 Suffix SEI
    244   NAL_UNIT_RESERVED_41,
    245   NAL_UNIT_RESERVED_42,
    246   NAL_UNIT_RESERVED_43,
    247   NAL_UNIT_RESERVED_44,
    248   NAL_UNIT_RESERVED_45,
    249   NAL_UNIT_RESERVED_46,
    250   NAL_UNIT_RESERVED_47,
     244  NAL_UNIT_PREFIX_SEI,              // 39
     245  NAL_UNIT_SUFFIX_SEI,              // 40
     246  NAL_UNIT_RESERVED_NVCL41,
     247  NAL_UNIT_RESERVED_NVCL42,
     248  NAL_UNIT_RESERVED_NVCL43,
     249  NAL_UNIT_RESERVED_NVCL44,
     250  NAL_UNIT_RESERVED_NVCL45,
     251  NAL_UNIT_RESERVED_NVCL46,
     252  NAL_UNIT_RESERVED_NVCL47,
    251253  NAL_UNIT_UNSPECIFIED_48,
    252254  NAL_UNIT_UNSPECIFIED_49,
  • branches/SHM-2.0-dev/source/Lib/TLibCommon/NAL.h

    r125 r133  
    7676    return m_nalUnitType == NAL_UNIT_CODED_SLICE_TRAIL_R
    7777        || m_nalUnitType == NAL_UNIT_CODED_SLICE_TRAIL_N
    78         || m_nalUnitType == NAL_UNIT_CODED_SLICE_TLA
     78        || m_nalUnitType == NAL_UNIT_CODED_SLICE_TLA_R
    7979        || m_nalUnitType == NAL_UNIT_CODED_SLICE_TSA_N
    8080        || m_nalUnitType == NAL_UNIT_CODED_SLICE_STSA_R
    8181        || m_nalUnitType == NAL_UNIT_CODED_SLICE_STSA_N
    82         || m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA
    83         || m_nalUnitType == NAL_UNIT_CODED_SLICE_BLANT
     82        || m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_LP
     83        || m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_RADL
    8484        || m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_N_LP
    85         || m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR
     85        || m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL
    8686        || m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP
    8787        || m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA
    8888        || m_nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N
    89         || m_nalUnitType == NAL_UNIT_CODED_SLICE_DLP
     89        || m_nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R
    9090        || m_nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N
    91         || m_nalUnitType == NAL_UNIT_CODED_SLICE_TFD;
     91        || m_nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R;
    9292  }
    9393#if L0045_NON_NESTED_SEI_RESTRICTIONS
    9494  Bool isSei()
    9595  {
    96     return m_nalUnitType == NAL_UNIT_SEI
    97         || m_nalUnitType == NAL_UNIT_SEI_SUFFIX;
     96    return m_nalUnitType == NAL_UNIT_PREFIX_SEI
     97        || m_nalUnitType == NAL_UNIT_SUFFIX_SEI;
    9898  }
    9999
  • branches/SHM-2.0-dev/source/Lib/TLibCommon/SEI.cpp

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

    r125 r133  
    355355};
    356356
     357#if L0208_SOP_DESCRIPTION_SEI
     358class SEISOPDescription : public SEI
     359{
     360public:
     361  PayloadType payloadType() const { return SOP_DESCRIPTION; }
     362
     363  SEISOPDescription() {}
     364  virtual ~SEISOPDescription() {}
     365
     366  UInt m_sopSeqParameterSetId;
     367  UInt m_numPicsInSopMinus1;
     368
     369  UInt m_sopDescVclNaluType[MAX_NUM_PICS_IN_SOP];
     370  UInt m_sopDescTemporalId[MAX_NUM_PICS_IN_SOP];
     371  UInt m_sopDescStRpsIdx[MAX_NUM_PICS_IN_SOP];
     372  Int m_sopDescPocDelta[MAX_NUM_PICS_IN_SOP];
     373};
     374#endif
     375
     376#if J0149_TONE_MAPPING_SEI
     377class SEIToneMappingInfo : public SEI
     378{
     379public:
     380  PayloadType payloadType() const { return TONE_MAPPING_INFO; }
     381  SEIToneMappingInfo() {}
     382  virtual ~SEIToneMappingInfo() {}
     383
     384  Int    m_toneMapId;
     385  Bool   m_toneMapCancelFlag;
     386  Bool   m_toneMapPersistenceFlag;
     387  Int    m_codedDataBitDepth;
     388  Int    m_targetBitDepth;
     389  Int    m_modelId;
     390  Int    m_minValue;
     391  Int    m_maxValue;
     392  Int    m_sigmoidMidpoint;
     393  Int    m_sigmoidWidth;
     394  std::vector<Int> m_startOfCodedInterval;
     395  Int    m_numPivots;
     396  std::vector<Int> m_codedPivotValue;
     397  std::vector<Int> m_targetPivotValue;
     398  Int    m_cameraIsoSpeedIdc;
     399  Int    m_cameraIsoSpeedValue;
     400  Int    m_exposureCompensationValueSignFlag;
     401  Int    m_exposureCompensationValueNumerator;
     402  Int    m_exposureCompensationValueDenomIdc;
     403  Int    m_refScreenLuminanceWhite;
     404  Int    m_extendedRangeWhiteLevel;
     405  Int    m_nominalBlackLevelLumaCodeValue;
     406  Int    m_nominalWhiteLevelLumaCodeValue;
     407  Int    m_extendedWhiteLevelLumaCodeValue;
     408};
     409#endif
     410
    357411typedef std::list<SEI*> SEIMessages;
    358412
     
    366420Void deleteSEIs (SEIMessages &seiList);
    367421
     422#if K0180_SCALABLE_NESTING_SEI
     423class SEIScalableNesting : public SEI
     424{
     425public:
     426  PayloadType payloadType() const { return SCALABLE_NESTING; }
     427
     428  SEIScalableNesting() {}
     429  virtual ~SEIScalableNesting()
     430  {
     431    if (!m_callerOwnsSEIs)
     432    {
     433      deleteSEIs(m_nestedSEIs);
     434    }
     435  }
     436
     437  Bool  m_bitStreamSubsetFlag;
     438  Bool  m_nestingOpFlag;
     439  Bool  m_defaultOpFlag;                             //value valid if m_nestingOpFlag != 0
     440  UInt  m_nestingNumOpsMinus1;                       // -"-
     441  UInt  m_nestingMaxTemporalIdPlus1[MAX_TLAYER];     // -"-
     442  UInt  m_nestingOpIdx[MAX_NESTING_NUM_OPS];         // -"-
     443
     444  Bool  m_allLayersFlag;                             //value valid if m_nestingOpFlag == 0
     445  UInt  m_nestingNoOpMaxTemporalIdPlus1;             //value valid if m_nestingOpFlag == 0 and m_allLayersFlag == 0
     446  UInt  m_nestingNumLayersMinus1;                    //value valid if m_nestingOpFlag == 0 and m_allLayersFlag == 0
     447  UChar m_nestingLayerId[MAX_NESTING_NUM_LAYER];     //value valid if m_nestingOpFlag == 0 and m_allLayersFlag == 0. This can e.g. be a static array of 64 unsigned char values
     448
     449  Bool  m_callerOwnsSEIs;
     450  SEIMessages m_nestedSEIs;
     451};
     452#endif
     453
    368454//! \}
  • branches/SHM-2.0-dev/source/Lib/TLibCommon/TComBitStream.cpp

    r125 r133  
    177177  }
    178178}
     179
    179180Void TComOutputBitstream::writeByteAlignment()
    180181{
     
    182183  writeAlignZero();
    183184}
     185
     186Int TComOutputBitstream::countStartCodeEmulations()
     187{
     188  UInt cnt = 0;
     189  vector<uint8_t>& rbsp   = getFIFO();
     190  for (vector<uint8_t>::iterator it = rbsp.begin(); it != rbsp.end();)
     191  {
     192    vector<uint8_t>::iterator found = it;
     193    do
     194    {
     195      // find the next emulated 00 00 {00,01,02,03}
     196      // NB, end()-1, prevents finding a trailing two byte sequence
     197      found = search_n(found, rbsp.end()-1, 2, 0);
     198      found++;
     199      // if not found, found == end, otherwise found = second zero byte
     200      if (found == rbsp.end())
     201      {
     202        break;
     203      }
     204      if (*(++found) <= 3)
     205      {
     206        break;
     207      }
     208    } while (true);
     209    it = found;
     210    if (found != rbsp.end())
     211    {
     212      cnt++;
     213    }
     214  }
     215  return cnt;
     216}
     217
    184218/**
    185219 * read #uiNumberOfBits# from bitstream without updating the bitstream
  • branches/SHM-2.0-dev/source/Lib/TLibCommon/TComBitStream.h

    r125 r133  
    154154  Void          addSubstream    ( TComOutputBitstream* pcSubstream );
    155155  Void writeByteAlignment();
     156
     157  //! returns the number of start code emulations contained in the current buffer
     158  Int countStartCodeEmulations();
    156159};
    157160
     
    163166{
    164167  std::vector<uint8_t> *m_fifo; /// FIFO for storage of complete bytes
     168  std::vector<UInt> m_emulationPreventionByteLocation;
    165169
    166170protected:
     
    206210  UInt  getNumBitsRead() { return m_numBitsRead; }
    207211  Void readByteAlignment();
     212
     213  Void      pushEmulationPreventionByteLocation ( UInt pos )                  { m_emulationPreventionByteLocation.push_back( pos ); }
     214  UInt      numEmulationPreventionBytesRead     ()                            { return (UInt) m_emulationPreventionByteLocation.size();    }
     215  std::vector<UInt>  getEmulationPreventionByteLocation  ()                   { return m_emulationPreventionByteLocation;           }
     216  UInt      getEmulationPreventionByteLocation  ( UInt idx )                  { return m_emulationPreventionByteLocation[ idx ];    }
     217  Void      clearEmulationPreventionByteLocation()                            { m_emulationPreventionByteLocation.clear();          }
     218  Void      setEmulationPreventionByteLocation  ( std::vector<UInt> vec )     { m_emulationPreventionByteLocation = vec;            }
    208219};
    209220
  • branches/SHM-2.0-dev/source/Lib/TLibCommon/TComLoopFilter.cpp

    r125 r133  
    5757// ====================================================================================================================
    5858
    59 const UChar tctable_8x8[54] =
     59const UChar TComLoopFilter::sm_tcTable[54] =
    6060{
    6161  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,5,5,6,6,7,8,9,10,11,13,14,16,18,20,22,24
    6262};
    6363
    64 const UChar betatable_8x8[52] =
     64const UChar TComLoopFilter::sm_betaTable[52] =
    6565{
    6666  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,8,9,10,11,12,13,14,15,16,17,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64
     
    585585      Int iIndexB = Clip3(0, MAX_QP, iQP + (betaOffsetDiv2 << 1));
    586586     
    587       Int iTc =  tctable_8x8[iIndexTC]*iBitdepthScale;
    588       Int iBeta = betatable_8x8[iIndexB]*iBitdepthScale;
     587      Int iTc =  sm_tcTable[iIndexTC]*iBitdepthScale;
     588      Int iBeta = sm_betaTable[iIndexB]*iBitdepthScale;
    589589      Int iSideThreshold = (iBeta+(iBeta>>1))>>3;
    590590      Int iThrCut = iTc*10;
     
    735735
    736736        Int iIndexTC = Clip3(0, MAX_QP+DEFAULT_INTRA_TC_OFFSET, iQP + DEFAULT_INTRA_TC_OFFSET*(ucBs - 1) + (tcOffsetDiv2 << 1));
    737         Int iTc =  tctable_8x8[iIndexTC]*iBitdepthScale;
     737        Int iTc =  sm_tcTable[iIndexTC]*iBitdepthScale;
    738738
    739739        for ( UInt uiStep = 0; uiStep < uiPelsInPartChroma; uiStep++ )
  • branches/SHM-2.0-dev/source/Lib/TLibCommon/TComLoopFilter.h

    r125 r133  
    9999  __inline Int xCalcDQ( Pel* piSrc, Int iOffset);
    100100 
     101  static const UChar sm_tcTable[54];
     102  static const UChar sm_betaTable[52];
     103
    101104public:
    102105  TComLoopFilter();
     
    111114  /// picture-level deblocking filter
    112115  Void loopFilterPic( TComPic* pcPic );
     116
     117  static Int getBeta( Int qp )
     118  {
     119    Int indexB = Clip3( 0, MAX_QP, qp );
     120    return sm_betaTable[ indexB ];
     121  }
    113122};
    114123
  • branches/SHM-2.0-dev/source/Lib/TLibCommon/TComPic.cpp

    r125 r133  
    559559}
    560560
    561 Void TComPic:: copyUpsampledPictureYuv(TComPicYuv*   pcPicYuvIn, TComPicYuv*   pcPicYuvOut)
     561Void TComPic::copyUpsampledPictureYuv(TComPicYuv*   pcPicYuvIn, TComPicYuv*   pcPicYuvOut)
    562562{
    563563  Int upsampledRowWidthLuma = pcPicYuvOut->getStride(); // 2 * pcPicYuvOut->getLumaMargin() + pcPicYuvOut->getWidth();
  • branches/SHM-2.0-dev/source/Lib/TLibCommon/TComPicYuv.cpp

    r125 r133  
    6060  m_piPicOrgU       = NULL;
    6161  m_piPicOrgV       = NULL;
     62 
    6263  m_bIsBorderExtended = false;
    6364}
  • branches/SHM-2.0-dev/source/Lib/TLibCommon/TComPrediction.cpp

    r125 r133  
    8383  if( m_piYuvExt == NULL )
    8484  {
    85     Int extWidth  = g_uiMaxCUWidth + 16;
    86     Int extHeight = g_uiMaxCUHeight + 1;
     85    Int extWidth  = MAX_CU_SIZE + 16;
     86    Int extHeight = MAX_CU_SIZE + 1;
    8787    Int i, j;
    8888    for (i = 0; i < 4; i++)
     
    9494      }
    9595    }
    96     m_iYuvExtHeight  = ((g_uiMaxCUHeight + 2) << 4);
    97     m_iYuvExtStride = ((g_uiMaxCUWidth  + 8) << 4);
     96    m_iYuvExtHeight  = ((MAX_CU_SIZE + 2) << 4);
     97    m_iYuvExtStride = ((MAX_CU_SIZE  + 8) << 4);
    9898    m_piYuvExt = new Int[ m_iYuvExtStride * m_iYuvExtHeight ];
    9999
    100100    // new structure
    101     m_acYuvPred[0] .create( g_uiMaxCUWidth, g_uiMaxCUHeight );
    102     m_acYuvPred[1] .create( g_uiMaxCUWidth, g_uiMaxCUHeight );
    103 
    104     m_cYuvPredTemp.create( g_uiMaxCUWidth, g_uiMaxCUHeight );
    105   }
    106 
    107   if (m_iLumaRecStride != (g_uiMaxCUWidth>>1) + 1)
    108   {
    109     m_iLumaRecStride =  (g_uiMaxCUWidth>>1) + 1;
     101    m_acYuvPred[0] .create( MAX_CU_SIZE, MAX_CU_SIZE );
     102    m_acYuvPred[1] .create( MAX_CU_SIZE, MAX_CU_SIZE );
     103
     104    m_cYuvPredTemp.create( MAX_CU_SIZE, MAX_CU_SIZE );
     105  }
     106
     107  if (m_iLumaRecStride != (MAX_CU_SIZE>>1) + 1)
     108  {
     109    m_iLumaRecStride =  (MAX_CU_SIZE>>1) + 1;
    110110    if (!m_pLumaRecBuffer)
    111111    {
  • branches/SHM-2.0-dev/source/Lib/TLibCommon/TComRom.cpp

    r125 r133  
    6262  g_aucConvertToBit[ i ] = c;
    6363 
    64   // g_auiFrameScanXY[ g_aucConvertToBit[ transformSize ] ]: zigzag scan array for transformSize
    6564  c=2;
    6665  for ( i=0; i<MAX_CU_DEPTH; i++ )
     
    7776Void destroyROM()
    7877{
    79   Int i;
    80  
    81   for ( i=0; i<MAX_CU_DEPTH; i++ )
     78  for (Int i=0; i<MAX_CU_DEPTH; i++ )
    8279  {
    8380    delete[] g_auiSigLastScan[0][i];
  • branches/SHM-2.0-dev/source/Lib/TLibCommon/TComSlice.cpp

    r125 r133  
    5454, m_iPOC                          ( 0 )
    5555, m_iLastIDR                      ( 0 )
    56 , m_eNalUnitType                  ( NAL_UNIT_CODED_SLICE_IDR )
     56, m_eNalUnitType                  ( NAL_UNIT_CODED_SLICE_IDR_W_RADL )
    5757, m_eSliceType                    ( I_SLICE )
    5858, m_iSliceQp                      ( 0 )
     
    6565, m_deblockingFilterBetaOffsetDiv2 ( 0 )
    6666, m_deblockingFilterTcOffsetDiv2   ( 0 )
     67#if !L0034_COMBINED_LIST_CLEANUP
    6768, m_bRefPicListModificationFlagLC ( false )
    6869, m_bRefPicListCombinationFlag    ( false )
     70#endif
    6971, m_bCheckLDC                     ( false )
    7072, m_iSliceQpDelta                 ( 0 )
     
    8486, m_dLambda                       ( 0.0 )
    8587#endif
    86 , m_bNoBackPredFlag               ( false )
     88#if !L0034_COMBINED_LIST_CLEANUP
     89, m_bNoBackPredFlag             ( false )
     90#endif
    8791, m_uiTLayer                      ( 0 )
    8892#if SVC_EXTENSION
     
    113117, m_enableTMVPFlag                ( true )
    114118{
     119#if L0034_COMBINED_LIST_CLEANUP
     120  m_aiNumRefIdx[0] = m_aiNumRefIdx[1] = 0;
     121#else
    115122  m_aiNumRefIdx[0] = m_aiNumRefIdx[1] = m_aiNumRefIdx[2] = 0;
     123#endif
    116124 
    117125#if REF_LIST_BUGFIX
     
    120128  initEqualRef();
    121129 
     130#if L0034_COMBINED_LIST_CLEANUP
     131  for ( Int idx = 0; idx < MAX_NUM_REF; idx++ )
     132  {
     133    m_list1IdxToList0Idx[idx] = -1;
     134  }
     135#else
    122136  for(Int iNumCount = 0; iNumCount < MAX_NUM_REF_LC; iNumCount++)
    123137  {
     
    129143    m_iRefIdxOfL1FromRefIdxOfL0[iNumCount] = -1;
    130144  }   
     145#endif
    131146  for(Int iNumCount = 0; iNumCount < MAX_NUM_REF; iNumCount++)
    132147  {
     
    136151    m_aiRefPOCList  [1][iNumCount] = 0;
    137152  }
    138   resetWpScaling(m_weightPredTable);
     153  resetWpScaling();
    139154  initWpAcDcParam();
    140155  m_saoEnabledFlag = false;
     
    173188  m_colRefIdx = 0;
    174189  initEqualRef();
     190#if !L0034_COMBINED_LIST_CLEANUP
    175191  m_bNoBackPredFlag = false;
    176192  m_bRefPicListCombinationFlag = false;
    177193  m_bRefPicListModificationFlagLC = false;
     194#endif
    178195  m_bCheckLDC = false;
    179196  m_iSliceQpDeltaCb = 0;
    180197  m_iSliceQpDeltaCr = 0;
    181198
     199#if !L0034_COMBINED_LIST_CLEANUP
    182200  m_aiNumRefIdx[REF_PIC_LIST_C]      = 0;
     201#endif
    183202
    184203  m_maxNumMergeCand = MRG_MAX_NUM_CANDS;
     
    194213Bool TComSlice::getRapPicFlag()
    195214{
    196   return getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR
     215  return getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL
    197216      || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP
    198217      || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP
    199       || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLANT
    200       || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA
     218      || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL
     219      || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP
    201220      || getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA;
    202221}
     
    213232}
    214233
    215 Void  TComSlice::sortPicList        (TComList<TComPic*>& rcListPic)
     234Void  TComSlice::sortPicList(TComList<TComPic*>& rcListPic)
    216235{
    217236  TComPic*    pcPicExtract;
     
    268287
    269288
    270 TComPic* TComSlice::xGetLongTermRefPic (TComList<TComPic*>& rcListPic,
    271                                         Int                 poc)
     289TComPic* TComSlice::xGetLongTermRefPic(TComList<TComPic*>& rcListPic, Int poc, Bool pocHasMsb)
    272290{
    273291  TComList<TComPic*>::iterator  iterPic = rcListPic.begin(); 
    274292  TComPic*                      pcPic = *(iterPic);
    275293  TComPic*                      pcStPic = pcPic;
     294 
     295  Int pocCycle = 1 << getSPS()->getBitsForPOC();
     296  if (!pocHasMsb)
     297  {
     298    poc = poc % pocCycle;
     299  }
     300 
    276301  while ( iterPic != rcListPic.end() )
    277302  {
    278303    pcPic = *(iterPic);
    279     if(pcPic && (pcPic->getPOC()%(1<<getSPS()->getBitsForPOC())) == (poc%(1<<getSPS()->getBitsForPOC())))
    280     {
    281       if(pcPic->getIsLongTerm())
     304    if (pcPic && pcPic->getPOC()!=this->getPOC() && pcPic->getSlice( 0 )->isReferenced())
     305    {
     306      Int picPoc = pcPic->getPOC();
     307      if (!pocHasMsb)
     308      {
     309        picPoc = picPoc % pocCycle;
     310      }
     311     
     312      if (poc == picPoc)
     313      {
     314       if (pcPic->getIsLongTerm())
    282315      {
    283316        return pcPic;
     
    289322      break;
    290323    }
     324    }
    291325
    292326    iterPic++;
    293327  }
     328 
    294329  return  pcStPic;
    295330}
    296331
    297 Void TComSlice::setRefPOCList       ()
     332Void TComSlice::setRefPOCList()
    298333{
    299334  for (Int iDir = 0; iDir < 2; iDir++)
     
    307342}
    308343
     344#if L0034_COMBINED_LIST_CLEANUP
     345Void TComSlice::setList1IdxToList0Idx()
     346{
     347  Int idxL0, idxL1;
     348  for ( idxL1 = 0; idxL1 < getNumRefIdx( REF_PIC_LIST_1 ); idxL1++ )
     349  {
     350    m_list1IdxToList0Idx[idxL1] = -1;
     351    for ( idxL0 = 0; idxL0 < getNumRefIdx( REF_PIC_LIST_0 ); idxL0++ )
     352    {
     353      if ( m_apcRefPicList[REF_PIC_LIST_0][idxL0]->getPOC() == m_apcRefPicList[REF_PIC_LIST_1][idxL1]->getPOC() )
     354      {
     355        m_list1IdxToList0Idx[idxL1] = idxL0;
     356        break;
     357      }
     358    }
     359  }
     360}
     361#else
    309362Void TComSlice::generateCombinedList()
    310363{
     
    369422  }
    370423}
    371 
    372 Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic)
    373 {
     424#endif
     425
     426#if FIX1071
     427Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic, Bool checkNumPocTotalCurr )
     428#else
     429Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic )
     430#endif
     431{
     432#if FIX1071
     433  if (!checkNumPocTotalCurr)
     434#endif
     435  {
    374436#if REF_IDX_FRAMEWORK
    375437  if( m_eSliceType == I_SLICE || ( getSPS()->getLayerId() &&
    376       (getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA) &&
     438      (getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP) &&
    377439      (getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA) ) )
    378440#else
     
    388450  m_aiNumRefIdx[0] = getNumRefIdx(REF_PIC_LIST_0);
    389451  m_aiNumRefIdx[1] = getNumRefIdx(REF_PIC_LIST_1);
     452  }
    390453
    391454  TComPic*  pcRefPic= NULL;
     
    410473    }
    411474  }
     475 
    412476  for(; i < m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures(); i++)
    413477  {
     
    422486    }
    423487  }
     488 
    424489  for(i = m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures()+m_pcRPS->getNumberOfLongtermPictures()-1; i > m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures()-1 ; i--)
    425490  {
    426491    if(m_pcRPS->getUsed(i))
    427492    {
    428       pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i));
     493      pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i), m_pcRPS->getCheckLTMSBPresent(i));
    429494      pcRefPic->setIsLongTerm(1);
    430495      pcRefPic->getPicYuvRec()->extendPicBorder();
     
    434499    if(pcRefPic==NULL)
    435500    {
    436       pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i));
     501      pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i), m_pcRPS->getCheckLTMSBPresent(i));
    437502    }
    438503    pcRefPic->setCheckLTMSBPresent(m_pcRPS->getCheckLTMSBPresent(i)); 
     
    443508  TComPic*  rpsCurrList1[MAX_NUM_REF+1];
    444509  Int numPocTotalCurr = NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr;
    445 
    446   {
     510#if FIX1071
     511  if (checkNumPocTotalCurr)
     512  {
     513    // The variable NumPocTotalCurr is derived as specified in subclause 7.4.7.2. It is a requirement of bitstream conformance that the following applies to the value of NumPocTotalCurr:
     514    // – If the current picture is a BLA or CRA picture, the value of NumPocTotalCurr shall be equal to 0.
     515    // – Otherwise, when the current picture contains a P or B slice, the value of NumPocTotalCurr shall not be equal to 0.
     516    if (getRapPicFlag())
     517    {
     518      assert(numPocTotalCurr == 0);
     519    }
     520
     521    if (m_eSliceType == I_SLICE)
     522  {
     523      ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList));
     524      ::memset( m_aiNumRefIdx,   0, sizeof ( m_aiNumRefIdx ));
     525     
     526      return;
     527    }
     528   
     529    assert(numPocTotalCurr != 0);
     530   
     531    m_aiNumRefIdx[0] = getNumRefIdx(REF_PIC_LIST_0);
     532    m_aiNumRefIdx[1] = getNumRefIdx(REF_PIC_LIST_1);
     533  }
     534#endif
     535 
    447536    Int cIdx = 0;
    448537    for ( i=0; i<NumPocStCurr0; i++, cIdx++)
     
    458547      rpsCurrList0[cIdx] = RefPicSetLtCurr[i];
    459548    }
    460   }
    461549
    462550  if (m_eSliceType==B_SLICE)
    463551  {
    464     Int cIdx = 0;
     552    cIdx = 0;
    465553    for ( i=0; i<NumPocStCurr1; i++, cIdx++)
    466554    {
     
    509597  }
    510598
    511   if(this->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA && this->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA)
     599  if(this->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && this->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA)
     600  {
    512601    return;
     602  }
    513603
    514604  TComRefPicListModification* refPicListModification = this->getRefPicListModification();
     
    589679
    590680  //temporal reference pictures
    591   if( !(getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA && getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA) )
     681  if( !(getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA) )
    592682  {
    593683    for(i=0; i < m_pcRPS->getNumberOfNegativePictures(); i++)
     
    619709      if(m_pcRPS->getUsed(i))
    620710      {
    621         pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i));
     711        pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i), m_pcRPS->getCheckLTMSBPresent(i));
    622712        pcRefPic->setIsLongTerm(1);
    623713        pcRefPic->getPicYuvRec()->extendPicBorder();
     
    627717      if(pcRefPic==NULL)
    628718      {
    629         pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i));
     719        pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i), m_pcRPS->getCheckLTMSBPresent(i));
    630720      }
    631721      pcRefPic->setCheckLTMSBPresent(m_pcRPS->getCheckLTMSBPresent(i)); 
     
    636726#if REF_IDX_MFM
    637727  assert(m_aiNumILRRefIdx == 1);
    638   if(!(getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA && getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA) && getSPS()->getMFMEnabledFlag())
     728  if(!(getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA) && getSPS()->getMFMEnabledFlag())
    639729  {
    640730    ilpPic[0]->copyUpsampledMvField(getBaseColPic());
     
    672762  {
    673763    for ( i=0; i<NumPocStCurr0 && cIdx<numRpsCurrTempList0; cIdx++,i++)
    674       refPicListTemp0[cIdx] = RefPicSetStCurr0[ i ];   
    675     for ( i=0; i<NumPocStCurr1 && cIdx<numRpsCurrTempList0; cIdx++,i++)
    676       refPicListTemp0[cIdx] = RefPicSetStCurr1[ i ];
    677     for ( i=0; i<NumPocLtCurr && cIdx<numRpsCurrTempList0; cIdx++,i++)
     764    {
     765      refPicListTemp0[cIdx] = RefPicSetStCurr0[ i ];
     766    }
     767    for ( i=0; i<NumPocStCurr1 && cIdx<numRpsCurrTempList0; cIdx++,i++)
     768    {
     769      refPicListTemp0[cIdx] = RefPicSetStCurr1[ i ];
     770    }
     771    for ( i=0; i<NumPocLtCurr && cIdx<numRpsCurrTempList0; cIdx++,i++)
     772    {
    678773      refPicListTemp0[cIdx] = RefPicSetLtCurr[ i ];
     774    }
    679775    for ( i=0; i<m_aiNumILRRefIdx && cIdx<numRpsCurrTempList0; cIdx++,i++)
     776    {
    680777      refPicListTemp0[cIdx] = ilpPic[ i ];
     778    }
    681779  }
    682780  cIdx = 0;
    683781  while (cIdx<numRpsCurrTempList1 && m_eSliceType==B_SLICE)
    684782  {
    685     for ( i=0; i<NumPocStCurr1 && cIdx<numRpsCurrTempList1; cIdx++,i++)
     783    for ( i=0; i<NumPocStCurr1 && cIdx<numRpsCurrTempList1; cIdx++,i++)
     784    {
    686785      refPicListTemp1[cIdx] = RefPicSetStCurr1[ i ];
    687     for ( i=0; i<NumPocStCurr0 && cIdx<numRpsCurrTempList1; cIdx++,i++)
    688       refPicListTemp1[cIdx] = RefPicSetStCurr0[ i ];
    689     for ( i=0; i<NumPocLtCurr && cIdx<numRpsCurrTempList1; cIdx++,i++)
     786    }
     787    for ( i=0; i<NumPocStCurr0 && cIdx<numRpsCurrTempList1; cIdx++,i++)
     788    {
     789      refPicListTemp1[cIdx] = RefPicSetStCurr0[ i ];
     790    }
     791    for ( i=0; i<NumPocLtCurr && cIdx<numRpsCurrTempList1; cIdx++,i++)
     792    {
    690793      refPicListTemp1[cIdx] = RefPicSetLtCurr[ i ];
     794    }
    691795    for ( i=0; i<m_aiNumILRRefIdx && cIdx<numRpsCurrTempList1; cIdx++,i++)
     796    {
    692797      refPicListTemp1[cIdx] = ilpPic[ i ];
     798    }
    693799  }
    694800  ::memset(m_bIsUsedAsLongTerm, 0, sizeof(m_bIsUsedAsLongTerm));
     
    724830#if REF_IDX_FRAMEWORK
    725831  if( m_eSliceType == I_SLICE || ( getSPS()->getLayerId() &&
    726     (getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA) &&
     832    (getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP) &&
    727833    (getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA) ) )
    728834#else
     
    793899}
    794900
    795 Void TComSlice::checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, Bool& prevRAPisBLA)
     901Void TComSlice::checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, Bool& prevRAPisBLA, TComList<TComPic *>& rcListPic)
    796902{
    797903  for(Int i = 0; i < pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures(); i++)
     
    806912    if(pocCRA < MAX_UINT && getPOC() > pocCRA)
    807913    {
     914      if (!pReferencePictureSet->getCheckLTMSBPresent(i))
     915      {
     916        assert(xGetLongTermRefPic(rcListPic, pReferencePictureSet->getPOC(i), false)->getPOC() >= pocCRA);
     917      }
     918      else
     919      {
    808920      assert(pReferencePictureSet->getPOC(i) >= pocCRA);
    809921    }
    810922  }
    811   if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP ) // IDR picture found
     923  }
     924  if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP ) // IDR picture found
    812925  {
    813926    pocCRA = getPOC();
     
    819932    prevRAPisBLA = false;
    820933  }
    821   else if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA
    822          || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLANT
     934  else if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP
     935         || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL
    823936         || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) // BLA picture found
    824937  {
     
    851964  Int pocCurr = getPOC();
    852965
    853   if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA
    854     || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLANT
     966  if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP
     967    || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL
    855968    || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP
    856     || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR
     969    || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL
    857970    || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP )  // IDR or BLA picture
    858971  {
     
    866979      iterPic++;
    867980    }
    868     if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA
    869       || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLANT
     981    if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP
     982      || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL
    870983      || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP )
    871984    {
     
    881994      {
    882995        rpcPic = *(iterPic);
    883         if (rpcPic->getPOC() != pocCurr && rpcPic->getPOC() != pocCRA) rpcPic->getSlice(0)->setReferenced(false);
     996        if (rpcPic->getPOC() != pocCurr && rpcPic->getPOC() != pocCRA)
     997        {
     998          rpcPic->getSlice(0)->setReferenced(false);
     999        }
    8841000        iterPic++;
    8851001      }
     
    9121028  m_deblockingFilterTcOffsetDiv2 = pSrc->m_deblockingFilterTcOffsetDiv2;
    9131029 
     1030#if L0034_COMBINED_LIST_CLEANUP
     1031  for (i = 0; i < 2; i++)
     1032#else
    9141033  for (i = 0; i < 3; i++)
     1034#endif
    9151035  {
    9161036    m_aiNumRefIdx[i]     = pSrc->m_aiNumRefIdx[i];
    9171037  }
    9181038
     1039#if L0034_COMBINED_LIST_CLEANUP
     1040  for (i = 0; i < MAX_NUM_REF; i++)
     1041  {
     1042    m_list1IdxToList0Idx[i] = pSrc->m_list1IdxToList0Idx[i];
     1043  }
     1044#else
    9191045  for (i = 0; i < 2; i++)
    9201046  {
     
    9331059  m_bRefPicListModificationFlagLC = pSrc->m_bRefPicListModificationFlagLC;
    9341060  m_bRefPicListCombinationFlag    = pSrc->m_bRefPicListCombinationFlag;
     1061#endif
    9351062  m_bCheckLDC             = pSrc->m_bCheckLDC;
    9361063  m_iSliceQpDelta        = pSrc->m_iSliceQpDelta;
     
    9841111  }
    9851112
     1113#if !L0034_COMBINED_LIST_CLEANUP
    9861114  m_bNoBackPredFlag      = pSrc->m_bNoBackPredFlag;
     1115#endif
    9871116  m_uiTLayer                      = pSrc->m_uiTLayer;
    9881117  m_bTLayerSwitchingFlag          = pSrc->m_bTLayerSwitchingFlag;
     
    10181147
    10191148Int TComSlice::m_prevPOC = 0;
     1149
    10201150/** Function for setting the slice's temporal layer ID and corresponding temporal_layer_switching_point_flag.
    10211151 * \param uiTLayer Temporal layer ID of the current slice
     
    10781208  Int i, isReference;
    10791209
    1080   Int j = 0;
    10811210  // loop through all pictures in the reference picture buffer
    10821211  TComList<TComPic*>::iterator iterPic = rcListPic.begin();
    10831212  while ( iterPic != rcListPic.end())
    10841213  {
    1085     j++;
    10861214    rpcPic = *(iterPic++);
     1215
     1216    if(!rpcPic->getSlice( 0 )->isReferenced())
     1217    {
     1218      continue;
     1219    }
    10871220
    10881221    isReference = 0;
     
    11231256    {           
    11241257      rpcPic->getSlice( 0 )->setReferenced( false );   
     1258      rpcPic->setUsedByCurr(0);
    11251259      rpcPic->setIsLongTerm(0);
    11261260    }
     
    11281262    assert(rpcPic->getSlice( 0 )->isReferenced()==0||rpcPic->getUsedByCurr()==0||rpcPic->getTLayer()<=this->getTLayer());
    11291263    //check that pictures of higher or equal temporal layer are not in the RPS if the current picture is a TSA picture
    1130     if(this->getNalUnitType() == NAL_UNIT_CODED_SLICE_TLA || this->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N)
     1264    if(this->getNalUnitType() == NAL_UNIT_CODED_SLICE_TLA_R || this->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N)
    11311265    {
    11321266      assert(rpcPic->getSlice( 0 )->isReferenced()==0||rpcPic->getTLayer()<this->getTLayer());
     
    11451279{
    11461280  TComPic* rpcPic;
    1147   Int i, isAvailable, j;
     1281  Int i, isAvailable;
    11481282  Int atLeastOneLost = 0;
    11491283  Int atLeastOneRemoved = 0;
     
    11541288  for(i=pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures();i<pReferencePictureSet->getNumberOfPictures();i++)
    11551289  {
    1156     j = 0;
    11571290    isAvailable = 0;
    11581291    // loop through all pictures in the reference picture buffer
     
    11601293    while ( iterPic != rcListPic.end())
    11611294    {
    1162       j++;
    11631295      rpcPic = *(iterPic++);
    11641296      if(pReferencePictureSet->getCheckLTMSBPresent(i)==true)
     
    11831315      while ( iterPic != rcListPic.end())
    11841316      {
    1185         j++;
    11861317        rpcPic = *(iterPic++);
    11871318
    1188         if((rpcPic->getPicSym()->getSlice(0)->getPOC()%(1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC())) == (this->getPOC() + pReferencePictureSet->getDeltaPOC(i))%(1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC()) && rpcPic->getSlice(0)->isReferenced())
     1319        Int pocCycle = 1 << rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC();
     1320        Int curPoc = rpcPic->getPicSym()->getSlice(0)->getPOC();
     1321        Int refPoc = pReferencePictureSet->getPOC(i);
     1322        if (!pReferencePictureSet->getCheckLTMSBPresent(i))
     1323        {
     1324          curPoc = curPoc % pocCycle;
     1325          refPoc = refPoc % pocCycle;
     1326        }
     1327       
     1328        if (rpcPic->getSlice(0)->isReferenced() && curPoc == refPoc)
    11891329        {
    11901330          isAvailable = 1;
     
    12241364  for(i=0;i<pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures();i++)
    12251365  {
    1226     j = 0;
    12271366    isAvailable = 0;
    12281367    // loop through all pictures in the reference picture buffer
     
    12301369    while ( iterPic != rcListPic.end())
    12311370    {
    1232       j++;
    12331371      rpcPic = *(iterPic++);
    12341372
     
    12471385        {
    12481386          if(printErrors)
     1387          {
    12491388            printf("\nShort-term reference picture with POC = %3d seems to have been removed or not correctly decoded.", this->getPOC() + pReferencePictureSet->getDeltaPOC(i));
     1389          }
    12501390          atLeastOneRemoved = 1;
    12511391        }
     
    12531393        {
    12541394          if(printErrors)
     1395          {
    12551396            printf("\nShort-term reference picture with POC = %3d is lost or not correctly decoded!", this->getPOC() + pReferencePictureSet->getDeltaPOC(i));
     1397          }
    12561398          atLeastOneLost = 1;
    12571399          iPocLost=this->getPOC() + pReferencePictureSet->getDeltaPOC(i);
     
    13991541 * \returns Void
    14001542 */
    1401 Void  TComSlice::resetWpScaling(wpScalingParam  wp[2][MAX_NUM_REF][3])
     1543Void  TComSlice::resetWpScaling()
    14021544{
    14031545  for ( Int e=0 ; e<2 ; e++ )
     
    14071549      for ( Int yuv=0 ; yuv<3 ; yuv++ )
    14081550      {
    1409         wpScalingParam  *pwp = &(wp[e][i][yuv]);
     1551        wpScalingParam  *pwp = &(m_weightPredTable[e][i][yuv]);
    14101552        pwp->bPresentFlag      = false;
    14111553        pwp->uiLog2WeightDenom = 0;
     
    14231565Void  TComSlice::initWpScaling()
    14241566{
    1425   initWpScaling(m_weightPredTable);
    1426 }
    1427 
    1428 /** set WP tables
    1429  * \param wpScalingParam
    1430  * \returns Void
    1431  */
    1432 Void  TComSlice::initWpScaling(wpScalingParam  wp[2][MAX_NUM_REF][3])
    1433 {
    14341567  for ( Int e=0 ; e<2 ; e++ )
    14351568  {
     
    14381571      for ( Int yuv=0 ; yuv<3 ; yuv++ )
    14391572      {
    1440         wpScalingParam  *pwp = &(wp[e][i][yuv]);
    1441         if ( !pwp->bPresentFlag ) {
     1573        wpScalingParam  *pwp = &(m_weightPredTable[e][i][yuv]);
     1574        if ( !pwp->bPresentFlag )
     1575        {
    14421576          // Inferring values not present :
    14431577          pwp->iWeight = (1 << pwp->uiLog2WeightDenom);
     
    14821616  {
    14831617    m_numReorderPics[i] = 0;
     1618#if L0323_DPB
     1619    m_uiMaxDecPicBuffering[i] = 1;
     1620#else
    14841621    m_uiMaxDecPicBuffering[i] = 0;
     1622#endif
    14851623    m_uiMaxLatencyIncrease[i] = 0;
    14861624  }
     
    15161654TComVPS::~TComVPS()
    15171655{
    1518   if( m_hrdParameters    != NULL )     delete m_hrdParameters;
    1519   if( m_hrdOpSetIdx      != NULL )     delete m_hrdOpSetIdx;
    1520   if( m_cprmsPresentFlag != NULL )     delete m_cprmsPresentFlag;
     1656  if( m_hrdParameters    != NULL )     delete[] m_hrdParameters;
     1657  if( m_hrdOpSetIdx      != NULL )     delete[] m_hrdOpSetIdx;
     1658  if( m_cprmsPresentFlag != NULL )     delete[] m_cprmsPresentFlag;
    15211659}
    15221660
     
    15331671, m_picWidthInLumaSamples     (352)
    15341672, m_picHeightInLumaSamples    (288)
     1673, m_log2MinCodingBlockSize    (  0)
     1674, m_log2DiffMaxMinCodingBlockSize (0)
    15351675, m_uiMaxCUWidth              ( 32)
    15361676, m_uiMaxCUHeight             ( 32)
    15371677, m_uiMaxCUDepth              (  3)
    1538 , m_uiMinTrDepth              (  0)
    1539 , m_uiMaxTrDepth              (  1)
    15401678, m_bLongTermRefsPresent      (false)
    15411679, m_uiQuadtreeTULog2MaxSize   (  0)
     
    15471685, m_pcmLog2MaxSize            (  5)
    15481686, m_uiPCMLog2MinSize          (  7)
     1687#if !L0034_COMBINED_LIST_CLEANUP
    15491688, m_bUseLComb                 (false)
     1689#endif
    15501690, m_bitDepthY                 (  8)
    15511691, m_bitDepthC                 (  8)
     
    15721712  {
    15731713    m_uiMaxLatencyIncrease[i] = 0;
     1714#if L0323_DPB
     1715    m_uiMaxDecPicBuffering[i] = 1;
     1716#else
    15741717    m_uiMaxDecPicBuffering[i] = 0;
     1718#endif
    15751719    m_numReorderPics[i]       = 0;
    15761720  }
     
    15911735  m_RPSList.create(numRPS);
    15921736}
     1737
    15931738Void TComSPS::setHrdParameters( UInt frameRate, UInt numDU, UInt bitRate, Bool randomAccess )
    15941739{
     
    18351980  return m_POC[bufferNum];
    18361981}
     1982
    18371983Void TComReferencePictureSet::setPOC(Int bufferNum, Int POC)
    18381984{
    18391985  m_POC[bufferNum] = POC;
    18401986}
     1987
    18411988Bool TComReferencePictureSet::getCheckLTMSBPresent(Int bufferNum)
    18421989{
    18431990  return m_bCheckLTMSB[bufferNum];
    18441991}
     1992
    18451993Void TComReferencePictureSet::setCheckLTMSBPresent(Int bufferNum, Bool b)
    18461994{
     
    20222170  return (defaultCounter == (SCALING_LIST_NUM * SCALING_LIST_SIZE_NUM - 4)) ? false : true; // -4 for 32x32
    20232171}
     2172
    20242173/** get scaling matrix from RefMatrixID
    20252174 * \param sizeId size index
     
    20312180  ::memcpy(getScalingListAddress(sizeId, listId),((listId == refListId)? getScalingListDefaultAddress(sizeId, refListId): getScalingListAddress(sizeId, refListId)),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId]));
    20322181}
     2182
    20332183/** parse syntax infomation
    20342184 *  \param pchFile syntax infomation
     
    21232273  m_scalingListCoef[SCALING_LIST_32x32][3] = m_scalingListCoef[SCALING_LIST_32x32][1]; // copy address for 32x32
    21242274}
     2275
    21252276/** destroy quantization matrix array
    21262277 */
     
    21352286  }
    21362287}
     2288
    21372289/** get default address of quantization matrix
    21382290 * \param sizeId size index
     
    21642316  return src;
    21652317}
     2318
    21662319/** process of default matrix
    21672320 * \param sizeId size index
     
    21732326  setScalingListDC(sizeId,listId,SCALING_LIST_DC);
    21742327}
     2328
    21752329/** check DC value of matrix for default matrix signaling
    21762330 */
     
    22402394//! activate a PPS and depending on isIDR parameter also SPS and VPS
    22412395//! \returns true, if activation is successful
    2242 Bool ParameterSetManager::activatePPS(Int ppsId, Bool isIDR)
     2396Bool ParameterSetManager::activatePPS(Int ppsId, Bool isIRAP)
    22432397{
    22442398  TComPPS *pps = m_ppsMap.getPS(ppsId);
     
    22462400  {
    22472401    Int spsId = pps->getSPSId();
    2248     if (!isIDR && (spsId != m_activeSPSId))
    2249     {
    2250       printf("Warning: tried to activate PPS referring to a inactive SPS at non-IDR.");
     2402    if (!isIRAP && (spsId != m_activeSPSId))
     2403    {
     2404      printf("Warning: tried to activate PPS referring to a inactive SPS at non-IRAP.");
    22512405      return false;
    22522406    }
     
    22552409    {
    22562410      Int vpsId = sps->getVPSId();
    2257       if (!isIDR && (vpsId != m_activeVPSId))
    2258       {
    2259         printf("Warning: tried to activate PPS referring to a inactive VPS at non-IDR.");
     2411      if (!isIRAP && (vpsId != m_activeVPSId))
     2412      {
     2413        printf("Warning: tried to activate PPS referring to a inactive VPS at non-IRAP.");
    22602414        return false;
    22612415      }
     
    24032557    assert(iRefPicNum == 1);
    24042558#if RAP_MFM_INIT
    2405     if(!(getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA && getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA) && getSPS()->getMFMEnabledFlag())
     2559    if(!(getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA) && getSPS()->getMFMEnabledFlag())
    24062560#else
    24072561    if( getPOC() != 0 )
  • branches/SHM-2.0-dev/source/Lib/TLibCommon/TComSlice.h

    r125 r133  
    908908  UInt        m_picHeightInLumaSamples;
    909909 
    910   Window      m_conformanceWindow;
    911 
     910  Int         m_log2MinCodingBlockSize;
     911  Int         m_log2DiffMaxMinCodingBlockSize;
    912912  UInt        m_uiMaxCUWidth;
    913913  UInt        m_uiMaxCUHeight;
    914914  UInt        m_uiMaxCUDepth;
    915   UInt        m_uiMinTrDepth;
    916   UInt        m_uiMaxTrDepth;
     915
     916  Window      m_conformanceWindow;
     917
    917918  TComRPSList m_RPSList;
    918919  Bool        m_bLongTermRefsPresent;
     
    930931  Bool        m_useAMP;
    931932
     933#if !L0034_COMBINED_LIST_CLEANUP
    932934  Bool        m_bUseLComb;
     935#endif
    933936 
    934937  // Parameter
     
    10091012  Bool getUsedByCurrPicLtSPSFlag(Int i)        {return m_usedByCurrPicLtSPSFlag[i];}
    10101013  Void setUsedByCurrPicLtSPSFlag(Int i, Bool x)      { m_usedByCurrPicLtSPSFlag[i] = x;}
     1014
     1015  Int  getLog2MinCodingBlockSize() const           { return m_log2MinCodingBlockSize; }
     1016  Void setLog2MinCodingBlockSize(Int val)          { m_log2MinCodingBlockSize = val; }
     1017  Int  getLog2DiffMaxMinCodingBlockSize() const    { return m_log2DiffMaxMinCodingBlockSize; }
     1018  Void setLog2DiffMaxMinCodingBlockSize(Int val)   { m_log2DiffMaxMinCodingBlockSize = val; }
     1019
    10111020  Void setMaxCUWidth  ( UInt u ) { m_uiMaxCUWidth = u;      }
    10121021  UInt getMaxCUWidth  ()         { return  m_uiMaxCUWidth;  }
     
    10251034  Bool getUseAMP() { return m_useAMP; }
    10261035  Void setUseAMP( Bool b ) { m_useAMP = b; }
    1027   Void setMinTrDepth  ( UInt u ) { m_uiMinTrDepth = u;      }
    1028   UInt getMinTrDepth  ()         { return  m_uiMinTrDepth;  }
    1029   Void setMaxTrDepth  ( UInt u ) { m_uiMaxTrDepth = u;      }
    1030   UInt getMaxTrDepth  ()         { return  m_uiMaxTrDepth;  }
    10311036  Void setQuadtreeTULog2MaxSize( UInt u ) { m_uiQuadtreeTULog2MaxSize = u;    }
    10321037  UInt getQuadtreeTULog2MaxSize()         { return m_uiQuadtreeTULog2MaxSize; }
     
    10501055 
    10511056  // Tool list
     1057#if !L0034_COMBINED_LIST_CLEANUP
    10521058  Void setUseLComb    (Bool b)   { m_bUseLComb = b;         }
    10531059  Bool getUseLComb    ()         { return m_bUseLComb;      }
     1060#endif
    10541061
    10551062  Bool getUseLossless ()         { return m_useLossless; }
     
    13701377  Int         m_deblockingFilterBetaOffsetDiv2;    //< beta offset for deblocking filter
    13711378  Int         m_deblockingFilterTcOffsetDiv2;      //< tc offset for deblocking filter
    1372  
    1373   Int         m_aiNumRefIdx   [3];    //  for multiple reference of current slice
    1374 
    13751379#if REF_LIST_BUGFIX
    13761380  Int         m_aiNumILRRefIdx;       //< for inter-layer reference picture ser
    13771381#endif
    1378 
     1382#if L0034_COMBINED_LIST_CLEANUP
     1383  Int         m_list1IdxToList0Idx[MAX_NUM_REF];
     1384  Int         m_aiNumRefIdx   [2];    //  for multiple reference of current slice
     1385#else
     1386  Int         m_aiNumRefIdx   [3];    //  for multiple reference of current slice
    13791387  Int         m_iRefIdxOfLC[2][MAX_NUM_REF_LC];
    13801388  Int         m_eListIdFromIdxOfLC[MAX_NUM_REF_LC];
     
    13841392  Bool        m_bRefPicListModificationFlagLC;
    13851393  Bool        m_bRefPicListCombinationFlag;
     1394#endif
    13861395
    13871396  Bool        m_bCheckLDC;
     
    14211430
    14221431  Bool        m_abEqualRef  [2][MAX_NUM_REF][MAX_NUM_REF];
    1423  
     1432#if !L0034_COMBINED_LIST_CLEANUP
    14241433  Bool        m_bNoBackPredFlag;
     1434#endif
    14251435  UInt        m_uiTLayer;
    14261436#if SVC_EXTENSION
     
    15331543  Bool      getMvdL1ZeroFlag ()                                  { return m_bLMvdL1Zero;    }
    15341544  Int       getNumRpsCurrTempList();
     1545#if L0034_COMBINED_LIST_CLEANUP
     1546  Int       getList1IdxToList0Idx ( Int list1Idx )               { return m_list1IdxToList0Idx[list1Idx]; }
     1547#else
    15351548  Int       getRefIdxOfLC       (RefPicList e, Int iRefIdx)     { return m_iRefIdxOfLC[e][iRefIdx];           }
    15361549  Int       getListIdFromIdxOfLC(Int iRefIdx)                   { return m_eListIdFromIdxOfLC[iRefIdx];       }
     
    15421555  Bool      getRefPicListCombinationFlag()                      {return m_bRefPicListCombinationFlag;}
    15431556  Void      setRefPicListCombinationFlag(Bool bflag)            {m_bRefPicListCombinationFlag=bflag;}   
     1557#endif
    15441558  Void      setReferenced(Bool b)                               { m_bRefenced = b; }
    15451559  Bool      isReferenced()                                      { return m_bRefenced; }
    15461560  Void      setPOC              ( Int i )                       { m_iPOC              = i; if(getTLayer()==0) m_prevPOC=i; }
    15471561  Void      setNalUnitType      ( NalUnitType e )               { m_eNalUnitType      = e;      }
    1548   NalUnitType getNalUnitType    ()                              { return m_eNalUnitType;        }
     1562  NalUnitType getNalUnitType    () const                        { return m_eNalUnitType;        }
    15491563  Bool      getRapPicFlag       (); 
    1550   Bool      getIdrPicFlag       ()                              { return getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP; }
    1551   Void      checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, Bool& prevRAPisBLA);
     1564  Bool      getIdrPicFlag       ()                              { return getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP; }
     1565  Bool      isIRAP              () const                        { return (getNalUnitType() >= 16) && (getNalUnitType() <= 23); } 
     1566  Void      checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, Bool& prevRAPisBLA, TComList<TComPic *>& rcListPic);
    15521567  Void      decodingRefreshMarking(Int& pocCRA, Bool& bRefreshPending, TComList<TComPic*>& rcListPic);
    15531568  Void      setSliceType        ( SliceType e )                 { m_eSliceType        = e;      }
     
    15901605#endif
    15911606
     1607#if FIX1071
     1608  Void      setRefPicList       ( TComList<TComPic*>& rcListPic, Bool checkNumPocTotalCurr = false );
     1609#else
    15921610  Void      setRefPicList       ( TComList<TComPic*>& rcListPic );
     1611#endif
    15931612  Void      setRefPOCList       ();
    15941613  Void      setColFromL0Flag    ( UInt colFromL0 ) { m_colFromL0Flag = colFromL0; }
     
    16281647 
    16291648  static Void      sortPicList         ( TComList<TComPic*>& rcListPic );
    1630  
     1649#if L0034_COMBINED_LIST_CLEANUP
     1650  Void setList1IdxToList0Idx();
     1651#else
    16311652  Bool getNoBackPredFlag() { return m_bNoBackPredFlag; }
    16321653  Void setNoBackPredFlag( Bool b ) { m_bNoBackPredFlag = b; }
    16331654  Void generateCombinedList       ();
     1655#endif
    16341656
    16351657  UInt getTLayer             ()                            { return m_uiTLayer;                      }
     
    16791701  Void  getWpScaling    ( RefPicList e, Int iRefIdx, wpScalingParam *&wp);
    16801702
    1681   Void  resetWpScaling  (wpScalingParam  wp[2][MAX_NUM_REF][3]);
    1682   Void  initWpScaling    (wpScalingParam  wp[2][MAX_NUM_REF][3]);
     1703  Void  resetWpScaling  ();
    16831704  Void  initWpScaling   ();
    16841705  inline Bool applyWP   () { return( (m_eSliceType==P_SLICE && m_pcPPS->getUseWP()) || (m_eSliceType==B_SLICE && m_pcPPS->getWPBiPred()) ); }
     
    17201741  TComPic*  xGetRefPic  (TComList<TComPic*>& rcListPic,
    17211742                         Int                 poc);
    1722   TComPic*  xGetLongTermRefPic  (TComList<TComPic*>& rcListPic,
    1723                          Int                 poc);
     1743  TComPic*  xGetLongTermRefPic(TComList<TComPic*>& rcListPic, Int poc, Bool pocHasMsb);
    17241744};// END CLASS DEFINITION TComSlice
    17251745
     
    18051825  //! activate a PPS and depending on isIDR parameter also SPS and VPS
    18061826  //! \returns true, if activation is successful
    1807   Bool activatePPS(Int ppsId, Bool isIDR);
     1827  Bool activatePPS(Int ppsId, Bool isIRAP);
    18081828
    18091829  TComVPS* getActiveVPS(){ return m_vpsMap.getPS(m_activeVPSId); };
  • branches/SHM-2.0-dev/source/Lib/TLibCommon/TComTrQuant.cpp

    r125 r133  
    20072007          }
    20082008         
    2009           if(piQCoef[minPos] == 32767 || piQCoef[minPos] == -32768)
     2009          if(piDstCoeff[minPos] == 32767 || piDstCoeff[minPos] == -32768)
    20102010          {
    20112011            finalChange = -1;
  • branches/SHM-2.0-dev/source/Lib/TLibCommon/TypeDef.h

    r125 r133  
    6565
    6666#define AVC_BASE                         0      ///< YUV BL reading for AVC base SVC
    67 #define REF_IDX_FRAMEWORK                0      ///< inter-layer reference framework
     67#define REF_IDX_FRAMEWORK                1      ///< inter-layer reference framework
    6868
    6969#if SVC_UPSAMPLING
     
    114114//! \ingroup TLibCommon
    115115//! \{
     116
     117#define FIX1071 1 ///< Temporary fix for issue #1071
     118
     119#define L0208_SOP_DESCRIPTION_SEI     1 ///< L0208: add SOP descrioption SEI
     120#define MAX_NUM_PICS_IN_SOP           1024
     121
     122#define K0180_SCALABLE_NESTING_SEI  1   ///JCTVC-K0180 scalable nesting sei message
     123#define MAX_NESTING_NUM_OPS         1024
     124#define MAX_NESTING_NUM_LAYER       64
     125
     126#define J0149_TONE_MAPPING_SEI        1 ///< J0149: Tone mapping information SEI
    116127#define L0363_DU_BIT_RATE             1 ///< L0363: add bit_rate_du_value_minus1 to HRD parameters
    117128#define L0328_SPLICING                1 ///< L0328: splicing support in HRD
     
    138149#define SIGNAL_BITRATE_PICRATE_IN_VPS               0  ///< K0125: Signal bit_rate and pic_rate in VPS
    139150#define L0232_RD_PENALTY           1  ///< L0232: RD-penalty for 32x32 TU for intra in non-intra slices
     151#define L0386_DB_METRIC            1  ///< L0386: non-normative blockiness metric (automatically configures deblocking parameters in bitstream)
     152#define L0323_DPB                     1 ///< L0323: Specification of active reference indices and decoded picture buffer
     153
     154#define L0034_COMBINED_LIST_CLEANUP 1
    140155
    141156#if VPS_EXTN_MASK_AND_DIM_INFO
     
    477492  REF_PIC_LIST_0 = 0,   ///< reference list 0
    478493  REF_PIC_LIST_1 = 1,   ///< reference list 1
     494#if !L0034_COMBINED_LIST_CLEANUP
    479495  REF_PIC_LIST_C = 2,   ///< combined reference list for uni-prediction in B-Slices
     496#endif
    480497  REF_PIC_LIST_X = 100  ///< special mark
    481498};
Note: See TracChangeset for help on using the changeset viewer.