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


Ignore:
Timestamp:
13 May 2013, 16:58:44 (12 years ago)
Author:
seregin
Message:

merge with SHM-2.0-dev branch

Location:
trunk/source
Files:
24 edited

Legend:

Unmodified
Added
Removed
  • trunk/source

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

    r125 r189  
    5656// ====================================================================================================================
    5757
    58 #define NV_VERSION        "1.2"                 ///< Current software version
     58#define NV_VERSION        "2.0rc1"                 ///< 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,
  • trunk/source/Lib/TLibCommon/NAL.h

    r125 r189  
    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
  • trunk/source/Lib/TLibCommon/SEI.cpp

    r127 r189  
    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)
  • trunk/source/Lib/TLibCommon/SEI.h

    r125 r189  
    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//! \}
  • trunk/source/Lib/TLibCommon/TComBitStream.cpp

    r125 r189  
    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
  • trunk/source/Lib/TLibCommon/TComBitStream.h

    r125 r189  
    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
  • trunk/source/Lib/TLibCommon/TComDataCU.cpp

    r125 r189  
    18021802UInt TComDataCU::getCtxIntraBLFlag( UInt uiAbsPartIdx )
    18031803{
     1804#if INTRA_BL_CTX_CHANGE
     1805  Int cuDepth = getDepth(uiAbsPartIdx);
     1806  Int maxCuDepth = g_uiMaxCUDepth - g_uiAddCUDepth;
     1807  UInt uiCtx = (maxCuDepth==3 && cuDepth > 0) ? (cuDepth - 1) : cuDepth;
     1808  return uiCtx;
     1809#else
    18041810  TComDataCU* pcTempCU;
    18051811  UInt        uiTempPartIdx;
     
    18241830 
    18251831  return uiCtx;
     1832#endif
    18261833}
    18271834#endif
     
    18351842  {
    18361843    Int refIdxL0 = cMvFieldL0.getRefIdx();
    1837     if(getSlice()->getRefPic(REF_PIC_LIST_0, refIdxL0)->isILR())
     1844    if(getSlice()->getRefPic(REF_PIC_LIST_0, refIdxL0)->isILR(m_layerId))
    18381845    {
    18391846      checkZeroMVILR &= (cMvFieldL0.getHor() == 0 && cMvFieldL0.getVer() == 0);
     
    18431850  {
    18441851    Int refIdxL1  = cMvFieldL1.getRefIdx();
    1845     if(getSlice()->getRefPic(REF_PIC_LIST_1, refIdxL1)->isILR())
     1852    if(getSlice()->getRefPic(REF_PIC_LIST_1, refIdxL1)->isILR(m_layerId))
    18461853    {
    18471854      checkZeroMVILR &= (cMvFieldL1.getHor() == 0 && cMvFieldL1.getVer() == 0);
     
    18591866  Bool checkZeroMVILR = true;
    18601867
    1861   if(getSlice()->getRefPic(eRefPicList, iRefIdx)->isILR())
     1868  if(getSlice()->getRefPic(eRefPicList, iRefIdx)->isILR(m_layerId))
    18621869  {
    18631870    AMVPInfo* pcAMVPInfo = getCUMvField(eRefPicList)->getAMVPInfo();
     
    25302537  if(m_layerId) 
    25312538  {
    2532 #if MV_SCALING_POS_FIX
    25332539    pcColCU = getBaseColCU( xP + nPSW/2, yP + nPSH/2, uiCUAddrBase, uiAbsPartAddrBase );
    2534 #else
    2535     UInt uiPartIdxCenter;
    2536     xDeriveCenterIdx( cCurPS, uiPUIdx, uiPartIdxCenter );
    2537     uiPartIdxCenter -= m_uiAbsIdxInLCU;
    2538     pcColCU = getBaseColCU( uiPartIdxCenter, uiCUAddrBase, uiAbsPartAddrBase );
    2539 #endif
    25402540   
    25412541#if INTRA_BL
     
    26712671#endif
    26722672  Bool isAvailableB0 = pcCUAboveRight &&
    2673 #if SVC_MVP
     2673#if SVC_MVP && !IL_MRG_SIMPLIFIED_PRUNING
    26742674  ( !pcColCU || pcColCU->isIntra( uiAbsPartAddrBase ) || !pcCUAboveRight->hasEqualMotion( uiAboveRightPartIdx, puhInterDirNeighbours[0], &pcMvFieldNeighbours[0] )) &&
    26752675#endif
     
    27152715  Bool isAvailableA0 = pcCULeftBottom &&
    27162716  pcCULeftBottom->isDiffMER(xP-1, yP+nPSH, xP, yP) &&
    2717 #if SVC_MVP
     2717#if SVC_MVP && !IL_MRG_SIMPLIFIED_PRUNING
    27182718  ( !pcColCU || pcColCU->isIntra( uiAbsPartAddrBase ) || !pcCULeftBottom->hasEqualMotion( uiLeftBottomPartIdx, puhInterDirNeighbours[0], &pcMvFieldNeighbours[0])) &&
    27192719#endif
     
    27592759    Bool isAvailableB2 = pcCUAboveLeft &&
    27602760    pcCUAboveLeft->isDiffMER(xP-1, yP-1, xP, yP) &&
    2761 #if SVC_MVP
     2761#if SVC_MVP && !IL_MRG_SIMPLIFIED_PRUNING
    27622762    ( !pcColCU || pcColCU->isIntra( uiAbsPartAddrBase ) || !pcCUAboveLeft->hasEqualMotion( uiAboveLeftPartIdx, puhInterDirNeighbours[0], &pcMvFieldNeighbours[0] )) &&
    27632763#endif
     
    41754175  TComPic* cBaseColPic = m_pcSlice->getBaseColPic();
    41764176
    4177 #if SVC_UPSAMPLING
     4177#if !SIMPLIFIED_MV_POS_SCALING
     4178#if SVC_UPSAMPLING && !ILP_DECODED_PICTURE
    41784179  const Window &confBL = cBaseColPic->getPicYuvRec()->getConformanceWindow();
    41794180  const Window &confEL = m_pcPic->getPicYuvRec()->getConformanceWindow();
     
    41914192  Int heightEL  = m_pcPic->getPicYuvRec()->getHeight();
    41924193#endif
     4194#endif
    41934195
    41944196  uiPelX = (UInt)Clip3<UInt>(0, m_pcPic->getPicYuvRec()->getWidth() - 1, uiPelX);
     
    41974199  UInt uiMinUnitSize = m_pcPic->getMinCUWidth();
    41984200
     4201#if SIMPLIFIED_MV_POS_SCALING
     4202#if SCALED_REF_LAYER_OFFSETS
     4203  Int leftStartL = this->getSlice()->getSPS()->getScaledRefLayerWindow().getWindowLeftOffset();
     4204  Int topStartL  = this->getSlice()->getSPS()->getScaledRefLayerWindow().getWindowTopOffset();
     4205  Int iBX = ((uiPelX - leftStartL)*g_posScalingFactor[m_layerId][0] + (1<<15)) >> 16;
     4206  Int iBY = ((uiPelY - topStartL )*g_posScalingFactor[m_layerId][1] + (1<<15)) >> 16;
     4207#else
     4208  Int iBX = (uiPelX*g_posScalingFactor[m_layerId][0] + (1<<15)) >> 16;
     4209  Int iBY = (uiPelY*g_posScalingFactor[m_layerId][1] + (1<<15)) >> 16;
     4210#endif
     4211#else
    41994212  Int iBX = (uiPelX*widthBL + widthEL/2)/widthEL;
    42004213  Int iBY = (uiPelY*heightBL+ heightEL/2)/heightEL;
    4201 
     4214#endif
     4215
     4216#if SCALED_REF_LAYER_OFFSETS
     4217  if ( iBX >= cBaseColPic->getPicYuvRec()->getWidth() || iBY >= cBaseColPic->getPicYuvRec()->getHeight() ||
     4218       iBX < 0                                        || iBY < 0                                           )
     4219#else
    42024220  if ( iBX >= cBaseColPic->getPicYuvRec()->getWidth() || iBY >= cBaseColPic->getPicYuvRec()->getHeight())
     4221#endif
    42034222  {
    42044223    return NULL;
    42054224  }
    42064225
    4207 #if AVC_SYNTAX
     4226#if AVC_SYNTAX && !ILP_DECODED_PICTURE
     4227#if !ILP_DECODED_PICTURE
     4228  const Window &confBL = cBaseColPic->getPicYuvRec()->getConformanceWindow();
     4229  const Window &confEL = m_pcPic->getPicYuvRec()->getConformanceWindow();
     4230
     4231  Int widthBL   = m_pcSlice->getBaseColPic()->getPicYuvRec()->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset();
     4232  Int heightBL  = m_pcSlice->getBaseColPic()->getPicYuvRec()->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset();
     4233#endif
    42084234  if( iBX >= widthBL || iBY >= heightBL ) //outside of the reference layer cropped picture
    42094235  {
     
    42284254  TComMvField cMvFieldBase;
    42294255  TComMv cMv;
    4230 
    4231 #if MV_SCALING_FIX
     4256#if SIMPLIFIED_MV_POS_SCALING
     4257  cMv = rcMvFieldBase.getMv().scaleMv( g_mvScalingFactor[m_layerId][0], g_mvScalingFactor[m_layerId][1] );
     4258#else
    42324259  const Window &confBL = m_pcSlice->getBaseColPic()->getPicYuvRec()->getConformanceWindow();
    42334260  const Window &confEL = m_pcPic->getPicYuvRec()->getConformanceWindow();
     
    42384265  Int widthEL   = m_pcPic->getPicYuvRec()->getWidth() - confEL.getWindowLeftOffset() - confEL.getWindowRightOffset();
    42394266  Int heightEL  = m_pcPic->getPicYuvRec()->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset();
    4240 #else
    4241   Int widthBL   = m_pcSlice->getBaseColPic()->getPicYuvRec()->getWidth();
    4242   Int heightBL  = m_pcSlice->getBaseColPic()->getPicYuvRec()->getHeight();
    4243 
    4244   Int widthEL   = m_pcPic->getPicYuvRec()->getWidth();
    4245   Int heightEL  = m_pcPic->getPicYuvRec()->getHeight();
    4246 #endif
    42474267
    42484268  Int iMvX = (rcMvFieldBase.getHor()*widthEL + (widthBL/2 -1) * (rcMvFieldBase.getHor() > 0 ? 1: -1) )/widthBL;
     
    42504270
    42514271  cMv.set(iMvX, iMvY);
     4272#endif
    42524273
    42534274  rcMvFieldEnhance.setMvField( cMv, rcMvFieldBase.getRefIdx() );
  • trunk/source/Lib/TLibCommon/TComLoopFilter.cpp

    r125 r189  
    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++ )
  • trunk/source/Lib/TLibCommon/TComLoopFilter.h

    r125 r189  
    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
  • trunk/source/Lib/TLibCommon/TComMv.h

    r125 r189  
    149149    return TComMv( mvx, mvy );
    150150  }
     151#if SIMPLIFIED_MV_POS_SCALING
     152  const TComMv scaleMv( Int iScaleX, Int iScaleY ) const
     153  {
     154    Int mvx = Clip3( -32768, 32767, (iScaleX * getHor() + 127 + (iScaleX * getHor() < 0)) >> 8 );
     155    Int mvy = Clip3( -32768, 32767, (iScaleY * getVer() + 127 + (iScaleY * getVer() < 0)) >> 8 );
     156    return TComMv( mvx, mvy );
     157  }
     158#endif
    151159};// END CLASS DEFINITION TComMV
    152160
  • trunk/source/Lib/TLibCommon/TComPic.cpp

    r125 r189  
    116116  return;
    117117}
    118 #if REF_IDX_FRAMEWORK
    119 Void TComPic::createWithOutYuv( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, TComSPS* pcSps,  Bool bIsVirtual)
    120 {
    121   m_apcPicSym     = new TComPicSym;  m_apcPicSym   ->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth );
    122   if (!bIsVirtual)
    123   {
    124     m_apcPicYuv[0]  = new TComPicYuv;  m_apcPicYuv[0]->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth, pcSps );
    125   }
    126   m_apcPicYuv[1]  = NULL;
    127  
    128 #if SVC_UPSAMPLING
    129   if (m_bSpatialEnhLayer)
    130   {
    131     m_pcFullPelBaseRec = new TComPicYuv;  m_pcFullPelBaseRec->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth, pcSps );
    132   }
    133 #endif
    134 
    135   /* there are no SEI messages associated with this picture initially */
    136   m_SEIs.clear();
    137   m_bUsedByCurr = false;
    138   return;
    139 }
    140 #endif
    141118#else
    142119Void TComPic::create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, Window &conformanceWindow, Window &defaultDisplayWindow,
     
    559536}
    560537
    561 Void TComPic:: copyUpsampledPictureYuv(TComPicYuv*   pcPicYuvIn, TComPicYuv*   pcPicYuvOut)
     538Void TComPic::copyUpsampledPictureYuv(TComPicYuv*   pcPicYuvIn, TComPicYuv*   pcPicYuvOut)
    562539{
    563540  Int upsampledRowWidthLuma = pcPicYuvOut->getStride(); // 2 * pcPicYuvOut->getLumaMargin() + pcPicYuvOut->getWidth();
     
    585562
    586563#if REF_IDX_MFM
    587 #if !REUSE_BLKMAPPING
    588 Void TComPic::deriveUnitIdxBase( UInt upsamplePelX, UInt upsamplePelY, UInt ratio, UInt& baseCUAddr, UInt& baseAbsPartIdx )
    589 {
    590   //pixel in the base layer
    591 
    592   UInt pelX       = (upsamplePelX<<1)/ratio;
    593   UInt pelY       = (upsamplePelY<<1)/ratio;
    594   UInt baseWidth  = getPicYuvRec()->getWidth();
    595   UInt baseHeight = getPicYuvRec()->getHeight();
    596  
    597   UInt widthInCU       = ( baseWidth % g_uiMaxCUWidth  ) ? baseWidth /g_uiMaxCUWidth  + 1 : baseWidth /g_uiMaxCUWidth;
    598 
    599 #if MFM_CLIPPING_FIX
    600   pelX     = (UInt)Clip3<UInt>(0, getPicYuvRec()->getWidth() - 1, pelX);
    601   pelY     = (UInt)Clip3<UInt>(0, getPicYuvRec()->getHeight() - 1, pelY);
    602 #else
    603   UInt heightInCU      = ( baseHeight% g_uiMaxCUHeight ) ? baseHeight/ g_uiMaxCUHeight + 1 : baseHeight/ g_uiMaxCUHeight;
    604 
    605   pelX     = (UInt)Clip3<UInt>(0, widthInCU * g_uiMaxCUWidth - 1, pelX);
    606   pelY     = (UInt)Clip3<UInt>(0, heightInCU * g_uiMaxCUHeight - 1, pelY);
    607 #endif
    608  
    609   baseCUAddr = pelY / g_uiMaxCUHeight * widthInCU + pelX / g_uiMaxCUWidth;
    610 
    611   UInt widthMinPU = g_uiMaxCUWidth / (1<<g_uiMaxCUDepth);
    612   UInt heightMinPU = g_uiMaxCUHeight/(1<<g_uiMaxCUDepth);
    613  
    614   UInt absPelX = pelX - (pelX / g_uiMaxCUWidth) * g_uiMaxCUWidth;
    615   UInt absPelY = pelY - (pelY / g_uiMaxCUHeight) * g_uiMaxCUHeight;
    616 
    617   UInt rasterIdx = absPelY / heightMinPU * (g_uiMaxCUWidth/widthMinPU) + absPelX / widthMinPU;
    618   baseAbsPartIdx = g_auiRasterToZscan[rasterIdx];
    619 
    620   return;
    621 }
    622 #endif
    623 
    624564Void TComPic::copyUpsampledMvField(TComPic* pcPicBase)
    625565{
    626 #if !REUSE_MVSCALE || !REUSE_BLKMAPPING || AVC_SYNTAX
     566#if AVC_SYNTAX && !ILP_DECODED_PICTURE
    627567  const Window &confBL = pcPicBase->getConformanceWindow();
    628568  const Window &confEL = getPicYuvRec()->getConformanceWindow();
     
    633573  Int widthEL   = getPicYuvRec()->getWidth() - confEL.getWindowLeftOffset() - confEL.getWindowRightOffset();
    634574  Int heightEL  = getPicYuvRec()->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset();
    635 #endif
    636  
    637 #if !REUSE_MVSCALE  || !REUSE_BLKMAPPING
    638   UInt upSampleRatio = 0;
    639   if(widthEL == widthBL && heightEL == heightBL)
    640   {
    641     upSampleRatio = 2;
    642   }
    643   else if(2*widthEL == 3*widthBL && 2*heightEL == 3*heightBL)
    644   {
    645     upSampleRatio = 3;
    646   }
    647   else if(widthEL == 2*widthBL && heightEL == 2*heightBL)
    648   {
    649     upSampleRatio = 4;
    650   }
    651   else
    652   {
    653     assert(0);
    654   }
    655575#endif
    656576
     
    671591      UInt baseCUAddr, baseAbsPartIdx;
    672592
    673 #if REUSE_BLKMAPPING
    674593      TComDataCU *pcColCU = 0;
    675594      pcColCU = pcCUDes->getBaseColCU(pelX + 8, pelY + 8, baseCUAddr, baseAbsPartIdx);
    676 #else
    677       pcPicBase->deriveUnitIdxBase(pelX + 8, pelY + 8, upSampleRatio, baseCUAddr, baseAbsPartIdx);
    678 #endif
    679 
    680 #if AVC_SYNTAX
     595
     596#if AVC_SYNTAX && !ILP_DECODED_PICTURE
    681597      Int xBL = ( (pelX + 8) * widthBL + widthEL/2 ) / widthEL;
    682598      Int yBL = ( (pelY + 8) * heightBL+ heightEL/2 ) / heightEL;
    683599
    684 #if REUSE_BLKMAPPING
    685600      if( ( xBL < widthBL && yBL < heightBL ) && pcColCU && (pcColCU->getPredictionMode(baseAbsPartIdx) != MODE_NONE) && (pcColCU->getPredictionMode(baseAbsPartIdx) != MODE_INTRA) )  //base layer unit not skip and invalid mode
    686601#else
    687       if( ( xBL < widthBL && yBL < heightBL ) && (pcPicBase->getCU(baseCUAddr)->getPredictionMode(baseAbsPartIdx) != MODE_NONE) && (pcPicBase->getCU(baseCUAddr)->getPredictionMode(baseAbsPartIdx) != MODE_INTRA) )  //base layer unit not skip and invalid mode
    688 #endif
    689 #else
    690 #if REUSE_BLKMAPPING
    691602      if( pcColCU && (pcColCU->getPredictionMode(baseAbsPartIdx) != MODE_NONE) && (pcColCU->getPredictionMode(baseAbsPartIdx) != MODE_INTRA) )  //base layer unit not skip and invalid mode
    692 #else
    693       if( (pcPicBase->getCU(baseCUAddr)->getPredictionMode(baseAbsPartIdx) != MODE_NONE) && (pcPicBase->getCU(baseCUAddr)->getPredictionMode(baseAbsPartIdx) != MODE_INTRA) )  //base layer unit not skip and invalid mode
    694 #endif
    695603#endif
    696604      {
    697605        for(UInt refPicList = 0; refPicList < 2; refPicList++)  //for each reference list
    698606        {
    699 #if REUSE_MVSCALE
    700607          TComMvField sMvFieldBase, sMvField;
    701 #if REUSE_BLKMAPPING
    702608          pcColCU->getMvField( pcColCU, baseAbsPartIdx, (RefPicList)refPicList, sMvFieldBase);
    703 #else
    704           pcPicBase->getCU(baseCUAddr)->getMvField( pcPicBase->getCU(baseCUAddr), baseAbsPartIdx, (RefPicList)refPicList, sMvFieldBase);
    705 #endif
    706609          pcCUDes->scaleBaseMV( sMvField, sMvFieldBase );
    707 #else
    708           TComMv cMv = pcPicBase->getCU(baseCUAddr)->getCUMvField((RefPicList)refPicList)->getMv(baseAbsPartIdx);
    709           Int refIdx = pcPicBase->getCU(baseCUAddr)->getCUMvField((RefPicList)refPicList)->getRefIdx(baseAbsPartIdx);
    710 
    711           Int hor =  ((Int)upSampleRatio * cMv.getHor())/2 ;
    712           Int ver =  ((Int)upSampleRatio * cMv.getVer())/2 ;
    713 
    714           TComMv cScaledMv(hor, ver);
    715           TComMvField sMvField;
    716           sMvField.setMvField(cScaledMv, refIdx);
    717 #endif
    718610
    719611          pcCUDes->getCUMvField((RefPicList)refPicList)->setMvField(sMvField, absPartIdx);
     
    739631  }
    740632}
    741 #endif
    742 
    743 #if RAP_MFM_INIT
     633
    744634Void TComPic::initUpsampledMvField()
    745635{
     
    774664  }
    775665
     666#if ILP_DECODED_PICTURE
     667  UInt   width      = this->getPicYuvRec()->getWidth();
     668  UInt   height     = this->getPicYuvRec()->getHeight();
     669#else
    776670  const Window &conf = this->getPicYuvRec()->getConformanceWindow();
    777671  UInt   width      = this->getPicYuvRec()->getWidth() - conf.getWindowLeftOffset() - conf.getWindowRightOffset();
    778672  UInt   height     = this->getPicYuvRec()->getHeight() - conf.getWindowTopOffset() - conf.getWindowBottomOffset();
     673#endif
    779674  UInt64 poc        = (UInt64)this->getPOC();
    780675  UInt   partWidth  = width / 4;
     
    853748  }
    854749
     750#if ILP_DECODED_PICTURE
     751  UInt   width       = this->getPicYuvRec()->getWidth();
     752  UInt   height      = this->getPicYuvRec()->getHeight();
     753#else
    855754  const Window &conf = this->getConformanceWindow();
    856755  UInt   width       = this->getPicYuvRec()->getWidth() - conf.getWindowLeftOffset() - conf.getWindowRightOffset();
    857756  UInt   height      = this->getPicYuvRec()->getHeight() - conf.getWindowTopOffset() - conf.getWindowBottomOffset();
     757#endif
    858758
    859759  UInt64 poc        = (UInt64)this->getPOC();
  • trunk/source/Lib/TLibCommon/TComPic.h

    r125 r189  
    103103  Void          create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, Window &conformanceWindow, Window &defaultDisplayWindow,
    104104                        Int *numReorderPics, TComSPS* pcSps = NULL, Bool bIsVirtual = false );
    105 #if REF_IDX_FRAMEWORK
    106   Void          createWithOutYuv( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, TComSPS* pcSps = NULL, Bool bIsVirtual = false ); 
    107   Void          setPicYuvRec(TComPicYuv *pPicYuv) { m_apcPicYuv[1]=pPicYuv; }
    108 #endif
    109105#else
    110106  Void          create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, Window &conformanceWindow, Window &defaultDisplayWindow,
     
    124120#endif
    125121#if REF_IDX_ME_ZEROMV || ENCODER_FAST_MODE || REF_IDX_MFM
    126   Bool          isILR( UInt refLayer = 0 )   {return (getIsLongTerm() && m_layerId == refLayer);}
     122  Bool          isILR( UInt currLayerId )   { return ( getIsLongTerm() && m_layerId < currLayerId ); }
    127123#endif
    128124
    129125#if REF_IDX_MFM
    130126  Void          copyUpsampledMvField  (  TComPic* pcPicBase );
    131 #if !REUSE_BLKMAPPING
    132   Void          deriveUnitIdxBase     (  UInt upsamplePelX, UInt upsamplePelY, UInt ratio, UInt& baseCUAddr, UInt& baseAbsPartIdx );
    133 #endif
    134 #if RAP_MFM_INIT
    135127  Void          initUpsampledMvField  ();
    136 #endif
    137128#endif
    138129
  • trunk/source/Lib/TLibCommon/TComPicYuv.cpp

    r125 r189  
    6060  m_piPicOrgU       = NULL;
    6161  m_piPicOrgV       = NULL;
     62 
    6263  m_bIsBorderExtended = false;
    6364}
  • trunk/source/Lib/TLibCommon/TComPrediction.cpp

    r125 r189  
    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    {
     
    495495
    496496#if REF_IDX_ME_ZEROMV
    497   assert( ( pcCU->getSlice()->getRefPic(eRefPicList, iRefIdx)->isILR() && cMv.getHor() == 0 && cMv.getVer() == 0 ) || pcCU->getSlice()->getRefPic(eRefPicList, iRefIdx)->isILR() == false );
     497  assert( ( pcCU->getSlice()->getRefPic(eRefPicList, iRefIdx)->isILR(pcCU->getLayerId()) && cMv.getHor() == 0 && cMv.getVer() == 0 ) || pcCU->getSlice()->getRefPic(eRefPicList, iRefIdx)->isILR(pcCU->getLayerId()) == false );
    498498#endif
    499499
     
    773773
    774774#if SVC_UPSAMPLING
     775#if SCALED_REF_LAYER_OFFSETS
     776Void TComPrediction::upsampleBasePic( TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window)
     777{
     778  m_cUsf.upsampleBasePic( pcUsPic, pcBasePic, pcTempPic, window);
     779}
     780#else
    775781Void TComPrediction::upsampleBasePic( TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic)
    776782{
    777783  m_cUsf.upsampleBasePic( pcUsPic, pcBasePic, pcTempPic);
    778784}
     785#endif
    779786#endif
    780787//! \}
  • trunk/source/Lib/TLibCommon/TComPrediction.h

    r125 r189  
    122122
    123123#if SVC_UPSAMPLING
     124#if SCALED_REF_LAYER_OFFSETS
     125  Void upsampleBasePic( TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window );
     126#else
    124127  Void upsampleBasePic( TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic );
     128#endif
    125129#endif
    126130};
  • trunk/source/Lib/TLibCommon/TComRom.cpp

    r125 r189  
    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];
     
    521518Int  g_eTTable[4] = {0,3,1,2};
    522519
     520#if SIMPLIFIED_MV_POS_SCALING
     521Int g_mvScalingFactor  [MAX_LAYERS][2] = {{0,0}, {0,0}};
     522Int g_posScalingFactor [MAX_LAYERS][2] = {{0,0}, {0,0}};
     523#endif
     524
    523525//! \}
  • trunk/source/Lib/TLibCommon/TComRom.h

    r125 r189  
    273273extern UInt g_scalingListNum  [SCALING_LIST_SIZE_NUM];
    274274extern Int  g_eTTable[4];
     275
     276#if SIMPLIFIED_MV_POS_SCALING
     277extern Int g_mvScalingFactor  [MAX_LAYERS][2];
     278extern Int g_posScalingFactor [MAX_LAYERS][2];
     279#endif
     280
    275281//! \}
    276282
  • trunk/source/Lib/TLibCommon/TComSlice.cpp

    r125 r189  
    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 
    117 #if REF_LIST_BUGFIX
    118   m_aiNumILRRefIdx = 0;
    119 #endif
     125#if REF_IDX_FRAMEWORK
     126#if JCTVC_M0458_INTERLAYER_RPS_SIG
     127  m_activeNumILRRefIdx        = 0;
     128  m_interLayerPredEnabledFlag = 0;
     129  ::memset( m_interLayerPredLayerIdc, 0, sizeof(m_interLayerPredLayerIdc) );
     130#else
     131  m_numILRRefIdx = 0;
     132#endif
     133#endif
     134
    120135  initEqualRef();
    121136 
     137#if L0034_COMBINED_LIST_CLEANUP
     138  for ( Int idx = 0; idx < MAX_NUM_REF; idx++ )
     139  {
     140    m_list1IdxToList0Idx[idx] = -1;
     141  }
     142#else
    122143  for(Int iNumCount = 0; iNumCount < MAX_NUM_REF_LC; iNumCount++)
    123144  {
     
    129150    m_iRefIdxOfL1FromRefIdxOfL0[iNumCount] = -1;
    130151  }   
     152#endif
    131153  for(Int iNumCount = 0; iNumCount < MAX_NUM_REF; iNumCount++)
    132154  {
     
    136158    m_aiRefPOCList  [1][iNumCount] = 0;
    137159  }
    138   resetWpScaling(m_weightPredTable);
     160  resetWpScaling();
    139161  initWpAcDcParam();
    140162  m_saoEnabledFlag = false;
     
    159181  m_aiNumRefIdx[0]      = 0;
    160182  m_aiNumRefIdx[1]      = 0;
    161 #if REF_LIST_BUGFIX
    162   if(layerId)
    163   {
    164     m_aiNumILRRefIdx      = 1;  // to be set to NumDirectRefLayers[LayerIdInVps[nuh_layer_id]]
    165   }
    166   else
    167   {
    168     m_aiNumILRRefIdx = 0;
    169   }
     183#if REF_IDX_FRAMEWORK
     184#if JCTVC_M0458_INTERLAYER_RPS_SIG
     185  m_activeNumILRRefIdx        = 0;
     186  m_interLayerPredEnabledFlag = 0;
     187#else
     188  m_numILRRefIdx              = 0;
     189#endif 
     190
    170191#endif
    171192  m_colFromL0Flag = 1;
     
    173194  m_colRefIdx = 0;
    174195  initEqualRef();
     196#if !L0034_COMBINED_LIST_CLEANUP
    175197  m_bNoBackPredFlag = false;
    176198  m_bRefPicListCombinationFlag = false;
    177199  m_bRefPicListModificationFlagLC = false;
     200#endif
    178201  m_bCheckLDC = false;
    179202  m_iSliceQpDeltaCb = 0;
    180203  m_iSliceQpDeltaCr = 0;
    181204
     205#if !L0034_COMBINED_LIST_CLEANUP
    182206  m_aiNumRefIdx[REF_PIC_LIST_C]      = 0;
     207#endif
    183208
    184209  m_maxNumMergeCand = MRG_MAX_NUM_CANDS;
     
    194219Bool TComSlice::getRapPicFlag()
    195220{
    196   return getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR
     221  return getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL
    197222      || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP
    198223      || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP
    199       || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLANT
    200       || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA
     224      || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL
     225      || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP
    201226      || getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA;
    202227}
     
    213238}
    214239
    215 Void  TComSlice::sortPicList        (TComList<TComPic*>& rcListPic)
     240Void  TComSlice::sortPicList(TComList<TComPic*>& rcListPic)
    216241{
    217242  TComPic*    pcPicExtract;
     
    268293
    269294
    270 TComPic* TComSlice::xGetLongTermRefPic (TComList<TComPic*>& rcListPic,
    271                                         Int                 poc)
     295TComPic* TComSlice::xGetLongTermRefPic(TComList<TComPic*>& rcListPic, Int poc, Bool pocHasMsb)
    272296{
    273297  TComList<TComPic*>::iterator  iterPic = rcListPic.begin(); 
    274298  TComPic*                      pcPic = *(iterPic);
    275299  TComPic*                      pcStPic = pcPic;
     300 
     301  Int pocCycle = 1 << getSPS()->getBitsForPOC();
     302  if (!pocHasMsb)
     303  {
     304    poc = poc % pocCycle;
     305  }
     306 
    276307  while ( iterPic != rcListPic.end() )
    277308  {
    278309    pcPic = *(iterPic);
    279     if(pcPic && (pcPic->getPOC()%(1<<getSPS()->getBitsForPOC())) == (poc%(1<<getSPS()->getBitsForPOC())))
    280     {
    281       if(pcPic->getIsLongTerm())
     310    if (pcPic && pcPic->getPOC()!=this->getPOC() && pcPic->getSlice( 0 )->isReferenced())
     311    {
     312      Int picPoc = pcPic->getPOC();
     313      if (!pocHasMsb)
     314      {
     315        picPoc = picPoc % pocCycle;
     316      }
     317     
     318      if (poc == picPoc)
     319      {
     320       if (pcPic->getIsLongTerm())
    282321      {
    283322        return pcPic;
     
    289328      break;
    290329    }
     330    }
    291331
    292332    iterPic++;
    293333  }
     334 
    294335  return  pcStPic;
    295336}
    296337
    297 Void TComSlice::setRefPOCList       ()
     338Void TComSlice::setRefPOCList()
    298339{
    299340  for (Int iDir = 0; iDir < 2; iDir++)
     
    307348}
    308349
     350#if L0034_COMBINED_LIST_CLEANUP
     351Void TComSlice::setList1IdxToList0Idx()
     352{
     353  Int idxL0, idxL1;
     354  for ( idxL1 = 0; idxL1 < getNumRefIdx( REF_PIC_LIST_1 ); idxL1++ )
     355  {
     356    m_list1IdxToList0Idx[idxL1] = -1;
     357    for ( idxL0 = 0; idxL0 < getNumRefIdx( REF_PIC_LIST_0 ); idxL0++ )
     358    {
     359      if ( m_apcRefPicList[REF_PIC_LIST_0][idxL0]->getPOC() == m_apcRefPicList[REF_PIC_LIST_1][idxL1]->getPOC() )
     360      {
     361        m_list1IdxToList0Idx[idxL1] = idxL0;
     362        break;
     363      }
     364    }
     365  }
     366}
     367#else
    309368Void TComSlice::generateCombinedList()
    310369{
     
    369428  }
    370429}
    371 
    372 Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic)
    373 {
    374 #if REF_IDX_FRAMEWORK
    375   if( m_eSliceType == I_SLICE || ( getSPS()->getLayerId() &&
    376       (getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA) &&
    377       (getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA) ) )
    378 #else
    379   if (m_eSliceType == I_SLICE)
    380 #endif
    381   {
    382     ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList));
    383     ::memset( m_aiNumRefIdx,   0, sizeof ( m_aiNumRefIdx ));
    384    
    385     return;
    386   }
     430#endif
     431
     432#if FIX1071
     433Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic, Bool checkNumPocTotalCurr, TComPic** ilpPic)
     434#else
     435Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic )
     436#endif
     437{
     438#if FIX1071
     439  if (!checkNumPocTotalCurr)
     440#endif
     441  {
     442    if( m_eSliceType == I_SLICE )
     443    {
     444      ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList));
     445      ::memset( m_aiNumRefIdx,   0, sizeof ( m_aiNumRefIdx ));
     446      return;
     447    }
    387448 
    388   m_aiNumRefIdx[0] = getNumRefIdx(REF_PIC_LIST_0);
    389   m_aiNumRefIdx[1] = getNumRefIdx(REF_PIC_LIST_1);
     449    m_aiNumRefIdx[0] = getNumRefIdx(REF_PIC_LIST_0);
     450    m_aiNumRefIdx[1] = getNumRefIdx(REF_PIC_LIST_1);
     451  }
    390452
    391453  TComPic*  pcRefPic= NULL;
     
    398460  Int i;
    399461
     462#if REF_IDX_FRAMEWORK
     463#if ZERO_NUM_DIRECT_LAYERS
     464  if( m_layerId == 0 || ( m_layerId > 0 && ( m_activeNumILRRefIdx == 0 || !((getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP) && (getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA)) ) ) )
     465#else
     466  if ((getLayerId() == 0) ||
     467      ((getSPS()->getLayerId()) &&  !((getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP) &&
     468       (getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA)) )
     469     )
     470#endif
     471  {
     472#endif
    400473  for(i=0; i < m_pcRPS->getNumberOfNegativePictures(); i++)
    401474  {
     
    410483    }
    411484  }
     485 
    412486  for(; i < m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures(); i++)
    413487  {
     
    422496    }
    423497  }
     498 
    424499  for(i = m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures()+m_pcRPS->getNumberOfLongtermPictures()-1; i > m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures()-1 ; i--)
    425500  {
    426501    if(m_pcRPS->getUsed(i))
    427502    {
    428       pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i));
     503      pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i), m_pcRPS->getCheckLTMSBPresent(i));
    429504      pcRefPic->setIsLongTerm(1);
    430505      pcRefPic->getPicYuvRec()->extendPicBorder();
     
    434509    if(pcRefPic==NULL)
    435510    {
    436       pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i));
     511      pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i), m_pcRPS->getCheckLTMSBPresent(i));
    437512    }
    438513    pcRefPic->setCheckLTMSBPresent(m_pcRPS->getCheckLTMSBPresent(i)); 
    439514  }
    440 
     515#if REF_IDX_FRAMEWORK
     516  }
     517#endif
     518
     519#if REF_IDX_FRAMEWORK
     520  //inter-layer reference picture
     521#if REF_IDX_MFM
     522#if ZERO_NUM_DIRECT_LAYERS
     523  if( m_layerId > 0 && m_activeNumILRRefIdx > 0 )
     524#else
     525  if (getLayerId())
     526#endif
     527  {
     528    if(!(getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA) && getSPS()->getMFMEnabledFlag())
     529    {
     530      ilpPic[0]->copyUpsampledMvField(getBaseColPic());
     531    }
     532    else
     533    {
     534      ilpPic[0]->initUpsampledMvField();
     535    }
     536  #endif
     537    ilpPic[0]->setIsLongTerm(1);
     538  }
     539#endif
    441540  // ref_pic_list_init
    442541  TComPic*  rpsCurrList0[MAX_NUM_REF+1];
    443542  TComPic*  rpsCurrList1[MAX_NUM_REF+1];
     543#if REF_IDX_FRAMEWORK
     544#if JCTVC_M0458_INTERLAYER_RPS_SIG
     545  Int numPocTotalCurr = NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr + m_activeNumILRRefIdx;
     546#else
     547  Int numPocTotalCurr = NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr + m_numILRRefIdx;
     548#endif
     549#else
    444550  Int numPocTotalCurr = NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr;
    445 
    446   {
     551#endif
     552#if FIX1071
     553  if (checkNumPocTotalCurr)
     554  {
     555    // 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:
     556    // – If the current picture is a BLA or CRA picture, the value of NumPocTotalCurr shall be equal to 0.
     557    // – Otherwise, when the current picture contains a P or B slice, the value of NumPocTotalCurr shall not be equal to 0.
     558    if (getRapPicFlag())
     559    {
     560      assert(numPocTotalCurr == 0);
     561    }
     562
     563    if (m_eSliceType == I_SLICE)
     564  {
     565      ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList));
     566      ::memset( m_aiNumRefIdx,   0, sizeof ( m_aiNumRefIdx ));
     567     
     568      return;
     569    }
     570   
     571    assert(numPocTotalCurr != 0);
     572   
     573    m_aiNumRefIdx[0] = getNumRefIdx(REF_PIC_LIST_0);
     574    m_aiNumRefIdx[1] = getNumRefIdx(REF_PIC_LIST_1);
     575  }
     576#endif
     577 
    447578    Int cIdx = 0;
    448579    for ( i=0; i<NumPocStCurr0; i++, cIdx++)
     
    458589      rpsCurrList0[cIdx] = RefPicSetLtCurr[i];
    459590    }
    460   }
    461 
     591#if REF_IDX_FRAMEWORK
     592    if(getLayerId())
     593    {
     594#if JCTVC_M0458_INTERLAYER_RPS_SIG
     595      for( i = 0; i < m_activeNumILRRefIdx && cIdx < numPocTotalCurr; cIdx ++, i ++)     
     596#else
     597      for( i = 0; i < m_numILRRefIdx && cIdx < numPocTotalCurr; cIdx ++, i ++)
     598#endif
     599      {
     600        rpsCurrList0[cIdx] = ilpPic[i];
     601      }
     602    }
     603#endif
    462604  if (m_eSliceType==B_SLICE)
    463605  {
    464     Int cIdx = 0;
     606    cIdx = 0;
    465607    for ( i=0; i<NumPocStCurr1; i++, cIdx++)
    466608    {
     
    475617      rpsCurrList1[cIdx] = RefPicSetLtCurr[i];
    476618    }
     619#if REF_IDX_FRAMEWORK
     620    if(getLayerId())
     621    {
     622#if JCTVC_M0458_INTERLAYER_RPS_SIG
     623      for( i = 0; i < m_activeNumILRRefIdx && cIdx < numPocTotalCurr; cIdx ++, i ++)
     624#else
     625      for( i = 0; i < m_numILRRefIdx && cIdx < numPocTotalCurr; cIdx ++, i ++)
     626#endif
     627      {
     628        rpsCurrList1[cIdx] = ilpPic[i];
     629      }
     630    }
     631#endif
    477632  }
    478633
     
    501656}
    502657
    503 #if REF_LIST_BUGFIX
     658#if REF_IDX_FRAMEWORK
    504659Void TComSlice::setRefPicListModificationSvc()
    505660{
     
    509664  }
    510665
    511   if(this->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA && this->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA)
     666  if(this->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && this->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA)
     667  {
    512668    return;
     669  }
    513670
    514671  TComRefPicListModification* refPicListModification = this->getRefPicListModification();
     
    537694    else
    538695    {
    539       for(Int i = m_aiNumILRRefIdx; i > 0; i-- )
     696#if JCTVC_M0458_INTERLAYER_RPS_SIG
     697      for(Int i = m_activeNumILRRefIdx; i > 0; i-- )
     698#else
     699      for(Int i = m_numILRRefIdx; i > 0; i-- )
     700#endif
    540701      {
    541702        refPicListModification->setRefPicSetIdxL0(m_aiNumRefIdx[REF_PIC_LIST_0] - i, numberOfRpsCurrTempList - i);
     
    563724    else
    564725    {
    565       for(Int i = m_aiNumILRRefIdx; i > 0; i-- )
     726#if JCTVC_M0458_INTERLAYER_RPS_SIG
     727      for(Int i = m_activeNumILRRefIdx; i > 0; i-- )
     728#else
     729      for(Int i = m_numILRRefIdx; i > 0; i-- )
     730#endif
    566731      {
    567732        refPicListModification->setRefPicSetIdxL1(m_aiNumRefIdx[REF_PIC_LIST_1] - i, numberOfRpsCurrTempList - i);
     
    569734    }
    570735  }
    571   return;
    572 }
    573 
    574 Void TComSlice::setRefPicListSvc( TComList<TComPic*>& rcListPic, TComPic** ilpPic )
    575 {
    576   assert(getLayerId() > 0);
    577 
    578   m_aiNumRefIdx[0] = getNumRefIdx(REF_PIC_LIST_0);
    579   m_aiNumRefIdx[1] = getNumRefIdx(REF_PIC_LIST_1);
    580 
    581   TComPic*  pcRefPic= NULL;
    582   TComPic*  RefPicSetStCurr0[16];
    583   TComPic*  RefPicSetStCurr1[16];
    584   TComPic*  RefPicSetLtCurr[16];
    585   UInt NumPocStCurr0 = 0;
    586   UInt NumPocStCurr1 = 0;
    587   UInt NumPocLtCurr = 0;
    588   Int i;
    589 
    590   //temporal reference pictures
    591   if( !(getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA && getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA) )
    592   {
    593     for(i=0; i < m_pcRPS->getNumberOfNegativePictures(); i++)
    594     {
    595       if(m_pcRPS->getUsed(i))
    596       {
    597         pcRefPic = xGetRefPic(rcListPic, getPOC()+m_pcRPS->getDeltaPOC(i));
    598         pcRefPic->setIsLongTerm(0);
    599         pcRefPic->getPicYuvRec()->extendPicBorder();
    600         RefPicSetStCurr0[NumPocStCurr0] = pcRefPic;
    601         NumPocStCurr0++;
    602         pcRefPic->setCheckLTMSBPresent(false); 
    603       }
    604     }
    605     for(; i < m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures(); i++)
    606     {
    607       if(m_pcRPS->getUsed(i))
    608       {
    609         pcRefPic = xGetRefPic(rcListPic, getPOC()+m_pcRPS->getDeltaPOC(i));
    610         pcRefPic->setIsLongTerm(0);
    611         pcRefPic->getPicYuvRec()->extendPicBorder();
    612         RefPicSetStCurr1[NumPocStCurr1] = pcRefPic;
    613         NumPocStCurr1++;
    614         pcRefPic->setCheckLTMSBPresent(false); 
    615       }
    616     }
    617     for(i = m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures()+m_pcRPS->getNumberOfLongtermPictures()-1; i > m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures()-1 ; i--)
    618     {
    619       if(m_pcRPS->getUsed(i))
    620       {
    621         pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i));
    622         pcRefPic->setIsLongTerm(1);
    623         pcRefPic->getPicYuvRec()->extendPicBorder();
    624         RefPicSetLtCurr[NumPocLtCurr] = pcRefPic;
    625         NumPocLtCurr++;
    626       }
    627       if(pcRefPic==NULL)
    628       {
    629         pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i));
    630       }
    631       pcRefPic->setCheckLTMSBPresent(m_pcRPS->getCheckLTMSBPresent(i)); 
    632     }
    633   }
    634 
    635   //inter-layer reference picture
    636 #if REF_IDX_MFM
    637   assert(m_aiNumILRRefIdx == 1);
    638   if(!(getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA && getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA) && getSPS()->getMFMEnabledFlag())
    639   {
    640     ilpPic[0]->copyUpsampledMvField(getBaseColPic());
    641   }
    642   else
    643   {
    644     ilpPic[0]->initUpsampledMvField();
    645   }
    646 #endif
    647   ilpPic[0]->setIsLongTerm(1);
    648 
    649   // ref_pic_list_init
    650   UInt cIdx = 0;
    651   UInt num_ref_idx_l0_active_minus1 = m_aiNumRefIdx[0] - 1;
    652   UInt num_ref_idx_l1_active_minus1 = m_aiNumRefIdx[1] - 1;
    653   TComPic*  refPicListTemp0[MAX_NUM_REF+1];
    654   TComPic*  refPicListTemp1[MAX_NUM_REF+1];
    655   Int  numRpsCurrTempList0, numRpsCurrTempList1;
    656 
    657   numRpsCurrTempList0 = numRpsCurrTempList1 = NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr + m_aiNumILRRefIdx;
    658   if (numRpsCurrTempList0 <= num_ref_idx_l0_active_minus1)
    659   {
    660     numRpsCurrTempList0 = num_ref_idx_l0_active_minus1 + 1;
    661   }
    662   if (numRpsCurrTempList1 <= num_ref_idx_l1_active_minus1)
    663   {
    664     numRpsCurrTempList1 = num_ref_idx_l1_active_minus1 + 1;
    665   }
    666 
    667   assert(numRpsCurrTempList0 <= MAX_NUM_REF);
    668   assert(numRpsCurrTempList1 <= MAX_NUM_REF);
    669 
    670   cIdx = 0;
    671   while (cIdx < numRpsCurrTempList0)
    672   {
    673     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++)
    678       refPicListTemp0[cIdx] = RefPicSetLtCurr[ i ];
    679     for ( i=0; i<m_aiNumILRRefIdx && cIdx<numRpsCurrTempList0; cIdx++,i++)
    680       refPicListTemp0[cIdx] = ilpPic[ i ];
    681   }
    682   cIdx = 0;
    683   while (cIdx<numRpsCurrTempList1 && m_eSliceType==B_SLICE)
    684   {
    685     for ( i=0; i<NumPocStCurr1 && cIdx<numRpsCurrTempList1; cIdx++,i++)
    686       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++)
    690       refPicListTemp1[cIdx] = RefPicSetLtCurr[ i ];
    691     for ( i=0; i<m_aiNumILRRefIdx && cIdx<numRpsCurrTempList1; cIdx++,i++)
    692       refPicListTemp1[cIdx] = ilpPic[ i ];
    693   }
    694   ::memset(m_bIsUsedAsLongTerm, 0, sizeof(m_bIsUsedAsLongTerm));
    695   for (Int rIdx = 0; rIdx <= (m_aiNumRefIdx[0]-1); rIdx ++)
    696   {
    697     m_apcRefPicList[0][rIdx] = m_RefPicListModification.getRefPicListModificationFlagL0() ? refPicListTemp0[ m_RefPicListModification.getRefPicSetIdxL0(rIdx) ] : refPicListTemp0[rIdx % numRpsCurrTempList0];
    698     m_bIsUsedAsLongTerm[0][rIdx] = m_RefPicListModification.getRefPicListModificationFlagL0() ? (m_RefPicListModification.getRefPicSetIdxL0(rIdx) >= (NumPocStCurr0 + NumPocStCurr1))
    699       : ((rIdx % numRpsCurrTempList0) >= (NumPocStCurr0 + NumPocStCurr1));
    700   }
    701   if ( m_eSliceType == P_SLICE )
    702   {
    703     m_aiNumRefIdx[1] = 0;
    704     ::memset( m_apcRefPicList[1], 0, sizeof(m_apcRefPicList[1]));
    705   }
    706   else
    707   {
    708     for (Int rIdx = 0; rIdx <= (m_aiNumRefIdx[1]-1); rIdx ++)
    709     {
    710       m_apcRefPicList[1][rIdx] = m_RefPicListModification.getRefPicListModificationFlagL1() ? refPicListTemp1[ m_RefPicListModification.getRefPicSetIdxL1(rIdx) ] : refPicListTemp1[rIdx % numRpsCurrTempList1];
    711       m_bIsUsedAsLongTerm[1][rIdx] = m_RefPicListModification.getRefPicListModificationFlagL1() ?
    712         (m_RefPicListModification.getRefPicSetIdxL1(rIdx) >= (NumPocStCurr0 + NumPocStCurr1)): ((rIdx % numRpsCurrTempList1) >= (NumPocStCurr0 + NumPocStCurr1));
    713     }
    714   }
    715 
    716736  return;
    717737}
     
    724744#if REF_IDX_FRAMEWORK
    725745  if( m_eSliceType == I_SLICE || ( getSPS()->getLayerId() &&
    726     (getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA) &&
     746    (getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP) &&
    727747    (getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA) ) )
    728748#else
     
    730750#endif
    731751  {
    732 #if REF_LIST_BUGFIX
    733     return m_aiNumILRRefIdx;
     752#if REF_IDX_FRAMEWORK
     753#if JCTVC_M0458_INTERLAYER_RPS_SIG
     754    return m_activeNumILRRefIdx;
     755#else
     756    return getNumILRRefIdx();
     757#endif
    734758#else
    735759    return 0;
     
    743767    }
    744768  }
    745 #if REF_LIST_BUGFIX
     769#if REF_IDX_FRAMEWORK
    746770  if(getLayerId())
    747771  {
     772#if JCTVC_M0458_INTERLAYER_RPS_SIG
     773    numRpsCurrTempList += m_activeNumILRRefIdx;
     774#else
    748775    numRpsCurrTempList += getNumILRRefIdx();
     776#endif
    749777  }
    750778#endif
     
    793821}
    794822
    795 Void TComSlice::checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, Bool& prevRAPisBLA)
     823Void TComSlice::checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, Bool& prevRAPisBLA, TComList<TComPic *>& rcListPic)
    796824{
    797825  for(Int i = 0; i < pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures(); i++)
     
    806834    if(pocCRA < MAX_UINT && getPOC() > pocCRA)
    807835    {
     836      if (!pReferencePictureSet->getCheckLTMSBPresent(i))
     837      {
     838        assert(xGetLongTermRefPic(rcListPic, pReferencePictureSet->getPOC(i), false)->getPOC() >= pocCRA);
     839      }
     840      else
     841      {
    808842      assert(pReferencePictureSet->getPOC(i) >= pocCRA);
    809843    }
    810844  }
    811   if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP ) // IDR picture found
     845  }
     846  if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP ) // IDR picture found
    812847  {
    813848    pocCRA = getPOC();
     
    819854    prevRAPisBLA = false;
    820855  }
    821   else if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA
    822          || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLANT
     856  else if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP
     857         || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL
    823858         || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) // BLA picture found
    824859  {
     
    851886  Int pocCurr = getPOC();
    852887
    853   if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA
    854     || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLANT
     888  if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP
     889    || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL
    855890    || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP
    856     || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR
     891    || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL
    857892    || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP )  // IDR or BLA picture
    858893  {
     
    866901      iterPic++;
    867902    }
    868     if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA
    869       || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLANT
     903    if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP
     904      || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL
    870905      || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP )
    871906    {
     
    881916      {
    882917        rpcPic = *(iterPic);
    883         if (rpcPic->getPOC() != pocCurr && rpcPic->getPOC() != pocCRA) rpcPic->getSlice(0)->setReferenced(false);
     918        if (rpcPic->getPOC() != pocCurr && rpcPic->getPOC() != pocCRA)
     919        {
     920          rpcPic->getSlice(0)->setReferenced(false);
     921        }
    884922        iterPic++;
    885923      }
     
    912950  m_deblockingFilterTcOffsetDiv2 = pSrc->m_deblockingFilterTcOffsetDiv2;
    913951 
     952#if L0034_COMBINED_LIST_CLEANUP
     953  for (i = 0; i < 2; i++)
     954#else
    914955  for (i = 0; i < 3; i++)
     956#endif
    915957  {
    916958    m_aiNumRefIdx[i]     = pSrc->m_aiNumRefIdx[i];
    917959  }
    918960
     961#if L0034_COMBINED_LIST_CLEANUP
     962  for (i = 0; i < MAX_NUM_REF; i++)
     963  {
     964    m_list1IdxToList0Idx[i] = pSrc->m_list1IdxToList0Idx[i];
     965  }
     966#else
    919967  for (i = 0; i < 2; i++)
    920968  {
     
    933981  m_bRefPicListModificationFlagLC = pSrc->m_bRefPicListModificationFlagLC;
    934982  m_bRefPicListCombinationFlag    = pSrc->m_bRefPicListCombinationFlag;
     983#endif
    935984  m_bCheckLDC             = pSrc->m_bCheckLDC;
    936985  m_iSliceQpDelta        = pSrc->m_iSliceQpDelta;
     
    9581007
    9591008  // access channel
     1009#if SVC_EXTENSION
     1010  m_pcVPS                = pSrc->m_pcVPS;
     1011#if JCTVC_M0458_INTERLAYER_RPS_SIG
     1012  m_activeNumILRRefIdx         = pSrc->m_activeNumILRRefIdx;
     1013  m_interLayerPredEnabledFlag  = pSrc->m_interLayerPredEnabledFlag;
     1014  m_numInterLayerRefPics       = pSrc->m_numInterLayerRefPics;
     1015  memcpy( m_interLayerPredLayerIdc, pSrc->m_interLayerPredLayerIdc, sizeof( m_interLayerPredLayerIdc ) );
     1016#elif REF_IDX_FRAMEWORK
     1017  m_numILRRefIdx               = pSrc->m_numILRRefIdx;
     1018#endif
     1019#endif
    9601020  m_pcSPS                = pSrc->m_pcSPS;
    9611021  m_pcPPS                = pSrc->m_pcPPS;
     
    9841044  }
    9851045
     1046#if !L0034_COMBINED_LIST_CLEANUP
    9861047  m_bNoBackPredFlag      = pSrc->m_bNoBackPredFlag;
     1048#endif
    9871049  m_uiTLayer                      = pSrc->m_uiTLayer;
    9881050  m_bTLayerSwitchingFlag          = pSrc->m_bTLayerSwitchingFlag;
     
    10181080
    10191081Int TComSlice::m_prevPOC = 0;
     1082
    10201083/** Function for setting the slice's temporal layer ID and corresponding temporal_layer_switching_point_flag.
    10211084 * \param uiTLayer Temporal layer ID of the current slice
     
    10781141  Int i, isReference;
    10791142
    1080   Int j = 0;
    10811143  // loop through all pictures in the reference picture buffer
    10821144  TComList<TComPic*>::iterator iterPic = rcListPic.begin();
    10831145  while ( iterPic != rcListPic.end())
    10841146  {
    1085     j++;
    10861147    rpcPic = *(iterPic++);
     1148
     1149    if(!rpcPic->getSlice( 0 )->isReferenced())
     1150    {
     1151      continue;
     1152    }
    10871153
    10881154    isReference = 0;
     
    11231189    {           
    11241190      rpcPic->getSlice( 0 )->setReferenced( false );   
     1191      rpcPic->setUsedByCurr(0);
    11251192      rpcPic->setIsLongTerm(0);
    11261193    }
     
    11281195    assert(rpcPic->getSlice( 0 )->isReferenced()==0||rpcPic->getUsedByCurr()==0||rpcPic->getTLayer()<=this->getTLayer());
    11291196    //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)
     1197    if(this->getNalUnitType() == NAL_UNIT_CODED_SLICE_TLA_R || this->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N)
    11311198    {
    11321199      assert(rpcPic->getSlice( 0 )->isReferenced()==0||rpcPic->getTLayer()<this->getTLayer());
     
    11451212{
    11461213  TComPic* rpcPic;
    1147   Int i, isAvailable, j;
     1214  Int i, isAvailable;
    11481215  Int atLeastOneLost = 0;
    11491216  Int atLeastOneRemoved = 0;
     
    11541221  for(i=pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures();i<pReferencePictureSet->getNumberOfPictures();i++)
    11551222  {
    1156     j = 0;
    11571223    isAvailable = 0;
    11581224    // loop through all pictures in the reference picture buffer
     
    11601226    while ( iterPic != rcListPic.end())
    11611227    {
    1162       j++;
    11631228      rpcPic = *(iterPic++);
    11641229      if(pReferencePictureSet->getCheckLTMSBPresent(i)==true)
     
    11831248      while ( iterPic != rcListPic.end())
    11841249      {
    1185         j++;
    11861250        rpcPic = *(iterPic++);
    11871251
    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())
     1252        Int pocCycle = 1 << rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC();
     1253        Int curPoc = rpcPic->getPicSym()->getSlice(0)->getPOC();
     1254        Int refPoc = pReferencePictureSet->getPOC(i);
     1255        if (!pReferencePictureSet->getCheckLTMSBPresent(i))
     1256        {
     1257          curPoc = curPoc % pocCycle;
     1258          refPoc = refPoc % pocCycle;
     1259        }
     1260       
     1261        if (rpcPic->getSlice(0)->isReferenced() && curPoc == refPoc)
    11891262        {
    11901263          isAvailable = 1;
     
    12241297  for(i=0;i<pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures();i++)
    12251298  {
    1226     j = 0;
    12271299    isAvailable = 0;
    12281300    // loop through all pictures in the reference picture buffer
     
    12301302    while ( iterPic != rcListPic.end())
    12311303    {
    1232       j++;
    12331304      rpcPic = *(iterPic++);
    12341305
     
    12471318        {
    12481319          if(printErrors)
     1320          {
    12491321            printf("\nShort-term reference picture with POC = %3d seems to have been removed or not correctly decoded.", this->getPOC() + pReferencePictureSet->getDeltaPOC(i));
     1322          }
    12501323          atLeastOneRemoved = 1;
    12511324        }
     
    12531326        {
    12541327          if(printErrors)
     1328          {
    12551329            printf("\nShort-term reference picture with POC = %3d is lost or not correctly decoded!", this->getPOC() + pReferencePictureSet->getDeltaPOC(i));
     1330          }
    12561331          atLeastOneLost = 1;
    12571332          iPocLost=this->getPOC() + pReferencePictureSet->getDeltaPOC(i);
     
    13991474 * \returns Void
    14001475 */
    1401 Void  TComSlice::resetWpScaling(wpScalingParam  wp[2][MAX_NUM_REF][3])
     1476Void  TComSlice::resetWpScaling()
    14021477{
    14031478  for ( Int e=0 ; e<2 ; e++ )
     
    14071482      for ( Int yuv=0 ; yuv<3 ; yuv++ )
    14081483      {
    1409         wpScalingParam  *pwp = &(wp[e][i][yuv]);
     1484        wpScalingParam  *pwp = &(m_weightPredTable[e][i][yuv]);
    14101485        pwp->bPresentFlag      = false;
    14111486        pwp->uiLog2WeightDenom = 0;
     
    14231498Void  TComSlice::initWpScaling()
    14241499{
    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 {
    14341500  for ( Int e=0 ; e<2 ; e++ )
    14351501  {
     
    14381504      for ( Int yuv=0 ; yuv<3 ; yuv++ )
    14391505      {
    1440         wpScalingParam  *pwp = &(wp[e][i][yuv]);
    1441         if ( !pwp->bPresentFlag ) {
     1506        wpScalingParam  *pwp = &(m_weightPredTable[e][i][yuv]);
     1507        if ( !pwp->bPresentFlag )
     1508        {
    14421509          // Inferring values not present :
    14431510          pwp->iWeight = (1 << pwp->uiLog2WeightDenom);
     
    14771544, m_numOutputLayerSets        (0) 
    14781545#endif
    1479 {
    1480 
     1546#if VPS_PROFILE_OUTPUT_LAYERS
     1547, m_numProfileTierLevel       (0)
     1548, m_moreOutputLayerSetsThanDefaultFlag (false)
     1549, m_numAddOutputLayerSets     (0)
     1550, m_defaultOneTargetOutputLayerFlag    (false)
     1551#endif
     1552{
    14811553  for( Int i = 0; i < MAX_TLAYER; i++)
    14821554  {
    14831555    m_numReorderPics[i] = 0;
     1556#if L0323_DPB
     1557    m_uiMaxDecPicBuffering[i] = 1;
     1558#else
    14841559    m_uiMaxDecPicBuffering[i] = 0;
     1560#endif
    14851561    m_uiMaxLatencyIncrease[i] = 0;
    14861562  }
     
    15121588  ::memset(m_refLayerId,           0, sizeof(m_refLayerId          ));
    15131589#endif
     1590#if DERIVE_LAYER_ID_LIST_VARIABLES
     1591  ::memset(m_layerSetLayerIdList,  0, sizeof(m_layerSetLayerIdList));
     1592  ::memset(m_numLayerInIdList,     0, sizeof(m_numLayerInIdList   ));
     1593#endif
     1594#if VPS_PROFILE_OUTPUT_LAYERS
     1595  ::memset(m_profileLevelTierIdx,  0, sizeof(m_profileLevelTierIdx));
     1596#endif
     1597#if JCTVC_M0458_INTERLAYER_RPS_SIG
     1598  m_maxOneActiveRefLayerFlag = true;
     1599#endif
    15141600}
    15151601
    15161602TComVPS::~TComVPS()
    15171603{
    1518   if( m_hrdParameters    != NULL )     delete m_hrdParameters;
    1519   if( m_hrdOpSetIdx      != NULL )     delete m_hrdOpSetIdx;
    1520   if( m_cprmsPresentFlag != NULL )     delete m_cprmsPresentFlag;
    1521 }
    1522 
     1604  if( m_hrdParameters    != NULL )     delete[] m_hrdParameters;
     1605  if( m_hrdOpSetIdx      != NULL )     delete[] m_hrdOpSetIdx;
     1606  if( m_cprmsPresentFlag != NULL )     delete[] m_cprmsPresentFlag;
     1607}
     1608#if DERIVE_LAYER_ID_LIST_VARIABLES
     1609Void TComVPS::deriveLayerIdListVariables()
     1610{
     1611  // For layer 0
     1612  setNumLayersInIdList(0, 1);
     1613  setLayerSetLayerIdList(0, 0, 0);
     1614
     1615  // For other layers
     1616  Int i, m, n;
     1617  for( i = 1; i <= getNumLayerSets() - 1; i++ )
     1618  {
     1619    n = 0;
     1620    for( m = 0; m <= this->getMaxLayerId(); m++)
     1621    {
     1622      if(this->getLayerIdIncludedFlag(i, m))
     1623      {
     1624        setLayerSetLayerIdList(i, n, m);
     1625        n++;
     1626      }
     1627    }
     1628    setNumLayersInIdList(i, n);
     1629  }
     1630}
     1631#endif
    15231632// ------------------------------------------------------------------------------------------------
    15241633// Sequence parameter set (SPS)
     
    15331642, m_picWidthInLumaSamples     (352)
    15341643, m_picHeightInLumaSamples    (288)
     1644, m_log2MinCodingBlockSize    (  0)
     1645, m_log2DiffMaxMinCodingBlockSize (0)
    15351646, m_uiMaxCUWidth              ( 32)
    15361647, m_uiMaxCUHeight             ( 32)
    15371648, m_uiMaxCUDepth              (  3)
    1538 , m_uiMinTrDepth              (  0)
    1539 , m_uiMaxTrDepth              (  1)
    15401649, m_bLongTermRefsPresent      (false)
    15411650, m_uiQuadtreeTULog2MaxSize   (  0)
     
    15471656, m_pcmLog2MaxSize            (  5)
    15481657, m_uiPCMLog2MinSize          (  7)
     1658#if !L0034_COMBINED_LIST_CLEANUP
    15491659, m_bUseLComb                 (false)
     1660#endif
    15501661, m_bitDepthY                 (  8)
    15511662, m_bitDepthC                 (  8)
     
    15721683  {
    15731684    m_uiMaxLatencyIncrease[i] = 0;
     1685#if L0323_DPB
     1686    m_uiMaxDecPicBuffering[i] = 1;
     1687#else
    15741688    m_uiMaxDecPicBuffering[i] = 0;
     1689#endif
    15751690    m_numReorderPics[i]       = 0;
    15761691  }
     
    15911706  m_RPSList.create(numRPS);
    15921707}
     1708
    15931709Void TComSPS::setHrdParameters( UInt frameRate, UInt numDU, UInt bitRate, Bool randomAccess )
    15941710{
     
    18351951  return m_POC[bufferNum];
    18361952}
     1953
    18371954Void TComReferencePictureSet::setPOC(Int bufferNum, Int POC)
    18381955{
    18391956  m_POC[bufferNum] = POC;
    18401957}
     1958
    18411959Bool TComReferencePictureSet::getCheckLTMSBPresent(Int bufferNum)
    18421960{
    18431961  return m_bCheckLTMSB[bufferNum];
    18441962}
     1963
    18451964Void TComReferencePictureSet::setCheckLTMSBPresent(Int bufferNum, Bool b)
    18461965{
     
    20222141  return (defaultCounter == (SCALING_LIST_NUM * SCALING_LIST_SIZE_NUM - 4)) ? false : true; // -4 for 32x32
    20232142}
     2143
    20242144/** get scaling matrix from RefMatrixID
    20252145 * \param sizeId size index
     
    20312151  ::memcpy(getScalingListAddress(sizeId, listId),((listId == refListId)? getScalingListDefaultAddress(sizeId, refListId): getScalingListAddress(sizeId, refListId)),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId]));
    20322152}
     2153
    20332154/** parse syntax infomation
    20342155 *  \param pchFile syntax infomation
     
    21232244  m_scalingListCoef[SCALING_LIST_32x32][3] = m_scalingListCoef[SCALING_LIST_32x32][1]; // copy address for 32x32
    21242245}
     2246
    21252247/** destroy quantization matrix array
    21262248 */
     
    21352257  }
    21362258}
     2259
    21372260/** get default address of quantization matrix
    21382261 * \param sizeId size index
     
    21642287  return src;
    21652288}
     2289
    21662290/** process of default matrix
    21672291 * \param sizeId size index
     
    21732297  setScalingListDC(sizeId,listId,SCALING_LIST_DC);
    21742298}
     2299
    21752300/** check DC value of matrix for default matrix signaling
    21762301 */
     
    22402365//! activate a PPS and depending on isIDR parameter also SPS and VPS
    22412366//! \returns true, if activation is successful
    2242 Bool ParameterSetManager::activatePPS(Int ppsId, Bool isIDR)
     2367Bool ParameterSetManager::activatePPS(Int ppsId, Bool isIRAP)
    22432368{
    22442369  TComPPS *pps = m_ppsMap.getPS(ppsId);
     
    22462371  {
    22472372    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.");
     2373    if (!isIRAP && (spsId != m_activeSPSId))
     2374    {
     2375      printf("Warning: tried to activate PPS referring to a inactive SPS at non-IRAP.");
    22512376      return false;
    22522377    }
     
    22552380    {
    22562381      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.");
     2382      if (!isIRAP && (vpsId != m_activeVPSId))
     2383      {
     2384        printf("Warning: tried to activate PPS referring to a inactive VPS at non-IRAP.");
    22602385        return false;
    22612386      }
     
    23452470// 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
    23462471  setPOC( pcSlice->getPOC() );
    2347   if( pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA && pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA )
     2472  if( pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA )
    23482473  {
    23492474    setSliceType( I_SLICE );
     
    23952520#endif
    23962521
    2397 #if REF_IDX_FRAMEWORK
    2398 Void TComSlice::addRefPicList( TComPic **pIlpPicList, Int iRefPicNum, Int iInsertOffset )
    2399 {
    2400   if(getSPS()->getLayerId() && m_eSliceType != I_SLICE)
    2401   {
    2402 #if REF_IDX_MFM
    2403     assert(iRefPicNum == 1);
    2404 #if RAP_MFM_INIT
    2405     if(!(getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA && getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA) && getSPS()->getMFMEnabledFlag())
    2406 #else
    2407     if( getPOC() != 0 )
    2408 #endif
    2409     {
    2410       pIlpPicList[0]->copyUpsampledMvField(getBaseColPic());
    2411     }
    2412 #if RAP_MFM_INIT
    2413     else
    2414     {
    2415       pIlpPicList[0]->initUpsampledMvField();
    2416     }
    2417 #endif
    2418 #endif
    2419     //add to list 0;
    2420     Int iOffset;
    2421     m_aiNumRefIdx[REF_PIC_LIST_0] += iInsertOffset;
    2422     iOffset = m_aiNumRefIdx[REF_PIC_LIST_0];
    2423     for (Int i=0; i<iRefPicNum; i++)
    2424     {
    2425       pIlpPicList[i]->setIsLongTerm(1);  //mark ilp as long-term reference
    2426       m_bIsUsedAsLongTerm[REF_PIC_LIST_0][iOffset + i] = 1; //mark ilp as long-term reference
    2427       m_apcRefPicList[REF_PIC_LIST_0][iOffset + i] = pIlpPicList[i];
    2428       m_aiNumRefIdx[REF_PIC_LIST_0]++;
    2429       //m_aiNumRefIdx[REF_PIC_LIST_C]++;
    2430     }
    2431     if(m_eSliceType == B_SLICE)
    2432     {
    2433       m_aiNumRefIdx[REF_PIC_LIST_1] += iInsertOffset;
    2434       iOffset = m_aiNumRefIdx[REF_PIC_LIST_1];
    2435       for (Int i=0; i<iRefPicNum; i++)
    2436       {
    2437         pIlpPicList[i]->setIsLongTerm(1);  //mark ilp as long-term reference
    2438         m_bIsUsedAsLongTerm[REF_PIC_LIST_1][iOffset + i] = 1; //mark ilp as long-term reference
    2439         m_apcRefPicList[REF_PIC_LIST_1][iOffset + i] = pIlpPicList[i];
    2440         m_aiNumRefIdx[REF_PIC_LIST_1]++;
    2441         //m_aiNumRefIdx[REF_PIC_LIST_C]++;
    2442       }
    2443     }
    2444   }
    2445 }
    2446 
    24472522#if REF_IDX_MFM
    24482523Void TComSlice::setRefPOCListILP( TComPic** ilpPic, TComPic *pcRefPicBL )
     
    24532528  assert(thePoc == pcRefPicBL->getPOC());
    24542529
    2455 #if REUSE_MVSCALE || REUSE_BLKMAPPING
    24562530  ilpPic[0]->getSlice(0)->setBaseColPic( pcRefPicBL );
    2457 #endif
    24582531
    24592532  //copy reference pictures marking from the reference layer
     
    24862559#endif
    24872560
    2488 
    2489 #endif
    24902561//! \}
  • trunk/source/Lib/TLibCommon/TComSlice.h

    r125 r189  
    504504  Bool        m_layerIdIncludedFlag[MAX_VPS_OP_SETS_PLUS1][MAX_VPS_NUH_RESERVED_ZERO_LAYER_ID_PLUS1];
    505505#endif
    506 
     506#if DERIVE_LAYER_ID_LIST_VARIABLES
     507  Int         m_layerSetLayerIdList[MAX_VPS_LAYER_SETS_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
     508  Int         m_numLayerInIdList[MAX_VPS_LAYER_SETS_PLUS1];
     509#endif
    507510  TComPTL     m_pcPTL;
    508511#if SIGNAL_BITRATE_PICRATE_IN_VPS
     
    547550  UInt       m_refLayerId[MAX_VPS_LAYER_ID_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
    548551#endif
    549 
     552#if VPS_PROFILE_OUTPUT_LAYERS
     553  UInt       m_numProfileTierLevel;
     554  Bool       m_moreOutputLayerSetsThanDefaultFlag;
     555  Int        m_numAddOutputLayerSets;
     556  Bool       m_defaultOneTargetOutputLayerFlag;
     557  Int        m_profileLevelTierIdx[64];     
     558#endif
     559#if JCTVC_M0458_INTERLAYER_RPS_SIG
     560  Bool       m_maxOneActiveRefLayerFlag;
     561#endif
    550562public:
    551563  TComVPS();
     
    604616  Bool    getLayerIdIncludedFlag(UInt opsIdx, UInt id)          { return m_layerIdIncludedFlag[opsIdx][id]; }
    605617  Void    setLayerIdIncludedFlag(Bool v, UInt opsIdx, UInt id)  { m_layerIdIncludedFlag[opsIdx][id] = v;    }
    606 
     618#if DERIVE_LAYER_ID_LIST_VARIABLES
     619  Int     getLayerSetLayerIdList(Int set, Int layerId)          { return m_layerSetLayerIdList[set][layerId]; }
     620  Void    setLayerSetLayerIdList(Int set, Int layerId, Int x)   { m_layerSetLayerIdList[set][layerId] = x   ; }
     621
     622  Int     getNumLayersInIdList(Int set)                          { return m_numLayerInIdList[set]; }
     623  Void    setNumLayersInIdList(Int set, Int x)                   { m_numLayerInIdList[set] = x   ; }
     624
     625  Void    deriveLayerIdListVariables();
     626#endif
    607627  TComPTL* getPTL() { return &m_pcPTL; }
    608628#if SIGNAL_BITRATE_PICRATE_IN_VPS
     
    663683#if VPS_EXTN_DIRECT_REF_LAYERS
    664684  // Direct dependency of layers
    665   Bool   getDirectDependencyFlag(Int i, Int j)                  { return m_directDependencyFlag[i][j]; }
    666   Void   setDirectDependencyFlag(Int i, Int j, Bool x)          { m_directDependencyFlag[i][j] = x;    }
    667  
    668   UInt   getNumDirectRefLayers(Int i)                                { return m_numDirectRefLayers[i];         }
    669   Void   setNumDirectRefLayers(Int i, UInt x)                        { m_numDirectRefLayers[i] = x;            }
    670 
    671   UInt   getRefLayerId(Int i, Int j)                            { return m_refLayerId[i][j];           }
    672   Void   setRefLayerId(Int i, Int j, UInt x)                    { m_refLayerId[i][j] = x;              }
    673 #endif
     685  Bool   getDirectDependencyFlag(Int currLayerId, Int refLayerId)               { return m_directDependencyFlag[currLayerId][refLayerId]; }
     686  Void   setDirectDependencyFlag(Int currLayerId, Int refLayerId, Bool x)       { m_directDependencyFlag[currLayerId][refLayerId] = x;    }
     687 
     688  UInt   getNumDirectRefLayers(Int layerId)                                     { return m_numDirectRefLayers[layerId];                   }
     689  Void   setNumDirectRefLayers(Int layerId, UInt refLayerNum)                   { m_numDirectRefLayers[layerId] = refLayerNum;            }
     690
     691  UInt   getRefLayerId(Int layerId, Int refLayerIdx)                            { return m_refLayerId[layerId][refLayerIdx];              }
     692  Void   setRefLayerId(Int layerId, Int refLayerIdx, UInt refLayerId)           { m_refLayerId[layerId][refLayerIdx] = refLayerId;        }
     693#endif
     694#if VPS_PROFILE_OUTPUT_LAYERS
     695  UInt   getNumProfileTierLevel()                                { return m_numProfileTierLevel; }
     696  Void   setNumProfileTierLevel(Int x)                           { m_numProfileTierLevel = x;    }
     697
     698  Bool   getMoreOutputLayerSetsThanDefaultFlag()                 { return m_moreOutputLayerSetsThanDefaultFlag;}
     699  Void   setMoreOutputLayerSetsThanDefaultFlag(Bool x)           { m_moreOutputLayerSetsThanDefaultFlag = x   ;}
     700
     701  Int    getNumAddOutputLayerSets()                              { return m_numAddOutputLayerSets; }
     702  Void   setNumAddOutputLayerSets(Int x)                         { m_numAddOutputLayerSets = x   ; }
     703
     704  Bool   getDefaultOneTargetOutputLayerFlag()                 { return m_defaultOneTargetOutputLayerFlag;}
     705  Void   setDefaultOneTargetOutputLayerFlag(Bool x)           { m_defaultOneTargetOutputLayerFlag= x    ;}
     706
     707  Int    getProfileLevelTierIdx(Int i)                        { return m_profileLevelTierIdx[i]; }
     708  Void   setProfileLevelTierIdx(Int i, Int x)                 { m_profileLevelTierIdx[i] = x   ; }
     709#endif
     710#if JCTVC_M0458_INTERLAYER_RPS_SIG
     711  Bool   getMaxOneActiveRefLayerFlag()                                          { return m_maxOneActiveRefLayerFlag;                      }
     712  Void   setMaxOneActiveRefLayerFlag(Bool x)                                    { m_maxOneActiveRefLayerFlag = x;                         }
     713#endif
    674714};
    675715
     
    908948  UInt        m_picHeightInLumaSamples;
    909949 
    910   Window      m_conformanceWindow;
    911 
     950  Int         m_log2MinCodingBlockSize;
     951  Int         m_log2DiffMaxMinCodingBlockSize;
    912952  UInt        m_uiMaxCUWidth;
    913953  UInt        m_uiMaxCUHeight;
    914954  UInt        m_uiMaxCUDepth;
    915   UInt        m_uiMinTrDepth;
    916   UInt        m_uiMaxTrDepth;
     955
     956  Window      m_conformanceWindow;
     957
    917958  TComRPSList m_RPSList;
    918959  Bool        m_bLongTermRefsPresent;
     
    930971  Bool        m_useAMP;
    931972
     973#if !L0034_COMBINED_LIST_CLEANUP
    932974  Bool        m_bUseLComb;
     975#endif
    933976 
    934977  // Parameter
     
    9781021  Bool m_bMFMEnabledFlag;
    9791022#endif
     1023#if SCALED_REF_LAYER_OFFSETS
     1024  Window      m_scaledRefLayerWindow;
     1025#endif
    9801026public:
    9811027  TComSPS();
     
    10091055  Bool getUsedByCurrPicLtSPSFlag(Int i)        {return m_usedByCurrPicLtSPSFlag[i];}
    10101056  Void setUsedByCurrPicLtSPSFlag(Int i, Bool x)      { m_usedByCurrPicLtSPSFlag[i] = x;}
     1057
     1058  Int  getLog2MinCodingBlockSize() const           { return m_log2MinCodingBlockSize; }
     1059  Void setLog2MinCodingBlockSize(Int val)          { m_log2MinCodingBlockSize = val; }
     1060  Int  getLog2DiffMaxMinCodingBlockSize() const    { return m_log2DiffMaxMinCodingBlockSize; }
     1061  Void setLog2DiffMaxMinCodingBlockSize(Int val)   { m_log2DiffMaxMinCodingBlockSize = val; }
     1062
    10111063  Void setMaxCUWidth  ( UInt u ) { m_uiMaxCUWidth = u;      }
    10121064  UInt getMaxCUWidth  ()         { return  m_uiMaxCUWidth;  }
     
    10251077  Bool getUseAMP() { return m_useAMP; }
    10261078  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;  }
    10311079  Void setQuadtreeTULog2MaxSize( UInt u ) { m_uiQuadtreeTULog2MaxSize = u;    }
    10321080  UInt getQuadtreeTULog2MaxSize()         { return m_uiQuadtreeTULog2MaxSize; }
     
    10501098 
    10511099  // Tool list
     1100#if !L0034_COMBINED_LIST_CLEANUP
    10521101  Void setUseLComb    (Bool b)   { m_bUseLComb = b;         }
    10531102  Bool getUseLComb    ()         { return m_bUseLComb;      }
     1103#endif
    10541104
    10551105  Bool getUseLossless ()         { return m_useLossless; }
     
    11121162  Void     setMFMEnabledFlag(Bool flag) {m_bMFMEnabledFlag = flag;}
    11131163  Bool     getMFMEnabledFlag()          {return m_bMFMEnabledFlag;}
     1164#endif
     1165#if SCALED_REF_LAYER_OFFSETS
     1166  Window&  getScaledRefLayerWindow(     )   { return m_scaledRefLayerWindow; }
    11141167#endif
    11151168};
     
    13701423  Int         m_deblockingFilterBetaOffsetDiv2;    //< beta offset for deblocking filter
    13711424  Int         m_deblockingFilterTcOffsetDiv2;      //< tc offset for deblocking filter
    1372  
     1425#if JCTVC_M0458_INTERLAYER_RPS_SIG
     1426  Int         m_activeNumILRRefIdx;        //< Active inter-layer reference pictures
     1427  Int         m_interLayerPredLayerIdc  [MAX_VPS_LAYER_ID_PLUS1];
     1428#else
     1429#if REF_IDX_FRAMEWORK
     1430  Int         m_numILRRefIdx;       //< for inter-layer reference picture ser
     1431#endif
     1432#endif
     1433#if L0034_COMBINED_LIST_CLEANUP
     1434  Int         m_list1IdxToList0Idx[MAX_NUM_REF];
     1435  Int         m_aiNumRefIdx   [2];    //  for multiple reference of current slice
     1436#else
    13731437  Int         m_aiNumRefIdx   [3];    //  for multiple reference of current slice
    1374 
    1375 #if REF_LIST_BUGFIX
    1376   Int         m_aiNumILRRefIdx;       //< for inter-layer reference picture ser
    1377 #endif
    1378 
    13791438  Int         m_iRefIdxOfLC[2][MAX_NUM_REF_LC];
    13801439  Int         m_eListIdFromIdxOfLC[MAX_NUM_REF_LC];
     
    13841443  Bool        m_bRefPicListModificationFlagLC;
    13851444  Bool        m_bRefPicListCombinationFlag;
     1445#endif
    13861446
    13871447  Bool        m_bCheckLDC;
     
    14211481
    14221482  Bool        m_abEqualRef  [2][MAX_NUM_REF][MAX_NUM_REF];
    1423  
     1483#if !L0034_COMBINED_LIST_CLEANUP
    14241484  Bool        m_bNoBackPredFlag;
     1485#endif
    14251486  UInt        m_uiTLayer;
    14261487#if SVC_EXTENSION
     
    14621523
    14631524  Bool       m_enableTMVPFlag;
     1525#if JCTVC_M0458_INTERLAYER_RPS_SIG
     1526  Bool       m_interLayerPredEnabledFlag;
     1527  Int        m_numInterLayerRefPics;
     1528#endif
    14641529public:
    14651530  TComSlice();
     
    15171582  Int       getDeblockingFilterBetaOffsetDiv2()         { return  m_deblockingFilterBetaOffsetDiv2; }
    15181583  Int       getDeblockingFilterTcOffsetDiv2()           { return  m_deblockingFilterTcOffsetDiv2; }
    1519 #if REF_LIST_BUGFIX
    1520   Int       getNumILRRefIdx     ( )                     { return  m_aiNumILRRefIdx; }
    1521   Void      setNumILRRefIdx     ( Int i )                     { m_aiNumILRRefIdx = i; }
    1522 #endif
     1584
    15231585  Int       getNumRefIdx        ( RefPicList e )                { return  m_aiNumRefIdx[e];             }
    15241586  TComPic*  getPic              ()                              { return  m_pcPic;                      }
     
    15331595  Bool      getMvdL1ZeroFlag ()                                  { return m_bLMvdL1Zero;    }
    15341596  Int       getNumRpsCurrTempList();
     1597#if L0034_COMBINED_LIST_CLEANUP
     1598  Int       getList1IdxToList0Idx ( Int list1Idx )               { return m_list1IdxToList0Idx[list1Idx]; }
     1599#else
    15351600  Int       getRefIdxOfLC       (RefPicList e, Int iRefIdx)     { return m_iRefIdxOfLC[e][iRefIdx];           }
    15361601  Int       getListIdFromIdxOfLC(Int iRefIdx)                   { return m_eListIdFromIdxOfLC[iRefIdx];       }
     
    15421607  Bool      getRefPicListCombinationFlag()                      {return m_bRefPicListCombinationFlag;}
    15431608  Void      setRefPicListCombinationFlag(Bool bflag)            {m_bRefPicListCombinationFlag=bflag;}   
     1609#endif
    15441610  Void      setReferenced(Bool b)                               { m_bRefenced = b; }
    15451611  Bool      isReferenced()                                      { return m_bRefenced; }
    15461612  Void      setPOC              ( Int i )                       { m_iPOC              = i; if(getTLayer()==0) m_prevPOC=i; }
    15471613  Void      setNalUnitType      ( NalUnitType e )               { m_eNalUnitType      = e;      }
    1548   NalUnitType getNalUnitType    ()                              { return m_eNalUnitType;        }
     1614  NalUnitType getNalUnitType    () const                        { return m_eNalUnitType;        }
    15491615  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);
     1616  Bool      getIdrPicFlag       ()                              { return getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP; }
     1617  Bool      isIRAP              () const                        { return (getNalUnitType() >= 16) && (getNalUnitType() <= 23); } 
     1618  Void      checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, Bool& prevRAPisBLA, TComList<TComPic *>& rcListPic);
    15521619  Void      decodingRefreshMarking(Int& pocCRA, Bool& bRefreshPending, TComList<TComPic*>& rcListPic);
    15531620  Void      setSliceType        ( SliceType e )                 { m_eSliceType        = e;      }
     
    15691636  Void      setPic              ( TComPic* p )                  { m_pcPic             = p;      }
    15701637  Void      setDepth            ( Int iDepth )                  { m_iDepth            = iDepth; }
    1571  
    1572 #if SVC_EXTENSION 
    1573   Void      setBaseColPic       ( TComPic* p)                   { m_pcBaseColPic = p; }
    1574   Void      setBaseColPic       ( TComList<TComPic*>& rcListPic , UInt layerID );
    1575   TComPic*  getBaseColPic       ()  { return m_pcBaseColPic; }
    1576 
    1577   Void      setLayerId (UInt layerId) { m_layerId = layerId; }
    1578   UInt      getLayerId ()               { return m_layerId; }
    1579 
    1580   Void        setFullPelBaseRec   ( TComPicYuv* p) { m_pcFullPelBaseRec = p; }
    1581   TComPicYuv* getFullPelBaseRec   ()  { return  m_pcFullPelBaseRec;  }
    1582 
    1583 #if AVC_SYNTAX
    1584   Void      initBaseLayerRPL( TComSlice *pcSlice );
    1585 #endif
    1586 #endif
    1587 
    1588 #if REF_IDX_MFM
    1589   Void      setRefPOCListILP(TComPic** ilpPic, TComPic *pcRefPicBL);
    1590 #endif
    1591 
     1638
     1639#if FIX1071
     1640  Void      setRefPicList       ( TComList<TComPic*>& rcListPic, Bool checkNumPocTotalCurr = false, TComPic** ilpPic = NULL );
     1641#else
    15921642  Void      setRefPicList       ( TComList<TComPic*>& rcListPic );
     1643#endif
    15931644  Void      setRefPOCList       ();
    15941645  Void      setColFromL0Flag    ( UInt colFromL0 ) { m_colFromL0Flag = colFromL0; }
     
    15961647  Void      setCheckLDC         ( Bool b )                      { m_bCheckLDC = b; }
    15971648  Void      setMvdL1ZeroFlag     ( Bool b)                       { m_bLMvdL1Zero = b; }
    1598 
    1599 #if REF_LIST_BUGFIX
    1600   Void      setRefPicListModificationSvc();
    1601   Void      setRefPicListSvc    ( TComList<TComPic*>& rcListPic, TComPic** ilpPic );
    1602 #endif
    16031649
    16041650  Bool      isIntra         ()                          { return  m_eSliceType == I_SLICE;  }
     
    16281674 
    16291675  static Void      sortPicList         ( TComList<TComPic*>& rcListPic );
    1630  
     1676#if L0034_COMBINED_LIST_CLEANUP
     1677  Void setList1IdxToList0Idx();
     1678#else
    16311679  Bool getNoBackPredFlag() { return m_bNoBackPredFlag; }
    16321680  Void setNoBackPredFlag( Bool b ) { m_bNoBackPredFlag = b; }
    16331681  Void generateCombinedList       ();
     1682#endif
    16341683
    16351684  UInt getTLayer             ()                            { return m_uiTLayer;                      }
     
    16791728  Void  getWpScaling    ( RefPicList e, Int iRefIdx, wpScalingParam *&wp);
    16801729
    1681   Void  resetWpScaling  (wpScalingParam  wp[2][MAX_NUM_REF][3]);
    1682   Void  initWpScaling    (wpScalingParam  wp[2][MAX_NUM_REF][3]);
     1730  Void  resetWpScaling  ();
    16831731  Void  initWpScaling   ();
    16841732  inline Bool applyWP   () { return( (m_eSliceType==P_SLICE && m_pcPPS->getUseWP()) || (m_eSliceType==B_SLICE && m_pcPPS->getWPBiPred()) ); }
     
    17141762  Void      setEnableTMVPFlag     ( Bool   b )    { m_enableTMVPFlag = b; }
    17151763  Bool      getEnableTMVPFlag     ()              { return m_enableTMVPFlag;}
     1764
     1765#if SVC_EXTENSION
     1766  Void      setBaseColPic       ( TComList<TComPic*>& rcListPic , UInt layerID );
     1767  Void      setBaseColPic       ( TComPic* p)     { m_pcBaseColPic = p; }
     1768  TComPic*  getBaseColPic       ()                { return m_pcBaseColPic; }
     1769
     1770  Void      setLayerId (UInt layerId)   { m_layerId = layerId; }
     1771  UInt      getLayerId ()               { return m_layerId;    }
     1772
     1773  Void        setFullPelBaseRec   ( TComPicYuv* p) { m_pcFullPelBaseRec = p; }
     1774  TComPicYuv* getFullPelBaseRec   ()               { return  m_pcFullPelBaseRec;  }
     1775
     1776#if AVC_SYNTAX
     1777  Void      initBaseLayerRPL( TComSlice *pcSlice );
     1778#endif
     1779
    17161780#if REF_IDX_FRAMEWORK
    1717   Void      addRefPicList( TComPic **pIlpPicList, Int iRefPicNum, Int iInsertOffset=0 );
    1718 #endif
     1781  Void      setRefPicListModificationSvc();
     1782  Int       getNumILRRefIdx     ( )                     { return  m_pcVPS->getNumDirectRefLayers( m_layerId ); }
     1783
     1784#if REF_IDX_MFM
     1785  Void      setRefPOCListILP(TComPic** ilpPic, TComPic *pcRefPicBL);
     1786#endif
     1787
     1788#if JCTVC_M0458_INTERLAYER_RPS_SIG
     1789  Int       getActiveNumILRRefIdx     ( )               { return  m_activeNumILRRefIdx; }
     1790  Void      setActiveNumILRRefIdx     ( Int i )         { m_activeNumILRRefIdx = i;     } 
     1791
     1792  Int       getInterLayerPredLayerIdc (UInt Idx )               { return  m_interLayerPredLayerIdc[Idx];}
     1793  Void      setInterLayerPredLayerIdc (UInt val, UInt Idx)      { m_interLayerPredLayerIdc[Idx] = val;  }
     1794
     1795  Void      setInterLayerPredEnabledFlag     ( Bool   val )    { m_interLayerPredEnabledFlag = val; }
     1796  Bool      getInterLayerPredEnabledFlag     ()                { return m_interLayerPredEnabledFlag;}
     1797
     1798  Void      setNumInterLayerRefPics          ( UInt   val )    { m_numInterLayerRefPics = val; }
     1799  UInt      getNumInterLayerRefPics          ()                { return m_numInterLayerRefPics;} 
     1800#else
     1801  Void      setNumILRRefIdx     ( Int i )               { m_numILRRefIdx = i;     }
     1802#endif
     1803#endif
     1804
     1805#endif //SVC_EXTENSION
     1806
    17191807protected:
    17201808  TComPic*  xGetRefPic  (TComList<TComPic*>& rcListPic,
    17211809                         Int                 poc);
    1722   TComPic*  xGetLongTermRefPic  (TComList<TComPic*>& rcListPic,
    1723                          Int                 poc);
     1810  TComPic*  xGetLongTermRefPic(TComList<TComPic*>& rcListPic, Int poc, Bool pocHasMsb);
    17241811};// END CLASS DEFINITION TComSlice
    17251812
     
    18051892  //! activate a PPS and depending on isIDR parameter also SPS and VPS
    18061893  //! \returns true, if activation is successful
    1807   Bool activatePPS(Int ppsId, Bool isIDR);
     1894  Bool activatePPS(Int ppsId, Bool isIRAP);
    18081895
    18091896  TComVPS* getActiveVPS(){ return m_vpsMap.getPS(m_activeVPSId); };
  • trunk/source/Lib/TLibCommon/TComTrQuant.cpp

    r125 r189  
    20072007          }
    20082008         
    2009           if(piQCoef[minPos] == 32767 || piQCoef[minPos] == -32768)
     2009          if(piDstCoeff[minPos] == 32767 || piDstCoeff[minPos] == -32768)
    20102010          {
    20112011            finalChange = -1;
  • trunk/source/Lib/TLibCommon/TComUpsampleFilter.cpp

    r125 r189  
    128128}
    129129
     130#if SCALED_REF_LAYER_OFFSETS
     131Void TComUpsampleFilter::upsampleBasePic( TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window )
     132#else
    130133Void TComUpsampleFilter::upsampleBasePic( TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic )
     134#endif
    131135{
    132136  assert ( NTAPS_US_LUMA == 8 );
     
    136140
    137141  //========== Y component upsampling ===========
     142#if SCALED_REF_LAYER_OFFSETS
     143  const Window &scalEL = window;
     144
     145  Int widthBL   = pcBasePic->getWidth ();
     146  Int heightBL  = pcBasePic->getHeight();
     147  Int strideBL  = pcBasePic->getStride();
     148
     149  Int widthEL   = pcUsPic->getWidth () - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset();
     150  Int heightEL  = pcUsPic->getHeight() - scalEL.getWindowTopOffset()  - scalEL.getWindowBottomOffset();
     151  Int strideEL  = pcUsPic->getStride();
     152#else
    138153  const Window &confBL = pcBasePic->getConformanceWindow();
    139154  const Window &confEL = pcUsPic->getConformanceWindow();
     
    146161  Int heightEL  = pcUsPic->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset();
    147162  Int strideEL  = pcUsPic->getStride();
    148  
     163#endif
    149164  Pel* piTempBufY = pcTempPic->getLumaAddr();
    150165  Pel* piSrcBufY  = pcBasePic->getLumaAddr();
     
    329344  const Double sFactor12 = sFactor * 12;
    330345#endif
     346#if ILP_DECODED_PICTURE
     347  widthBL   = pcBasePic->getWidth ();
     348  heightBL  = pcBasePic->getHeight();
     349
     350  widthEL   = pcUsPic->getWidth ();
     351  heightEL  = pcUsPic->getHeight();
     352#endif
     353#if SCALED_REF_LAYER_OFFSETS
     354  Int leftStartL = scalEL.getWindowLeftOffset();
     355  Int rightEndL  = pcUsPic->getWidth() - scalEL.getWindowRightOffset();
     356  Int topStartL  = scalEL.getWindowTopOffset();
     357  Int bottomEndL = pcUsPic->getHeight() - scalEL.getWindowBottomOffset();
     358#endif
    331359
    332360  //========== horizontal upsampling ===========
    333361  for( i = 0; i < widthEL; i++ )
    334362  {
     363#if SCALED_REF_LAYER_OFFSETS
     364    Int x = Clip3( leftStartL, rightEndL - 1, i );
     365#endif
    335366#if PHASE_DERIVATION_IN_INTEGER
     367#if SCALED_REF_LAYER_OFFSETS
     368    refPos16 = (((x - leftStartL)*scaleX + addX) >> shiftXM4) - deltaX;
     369#else
    336370    refPos16 = ((i*scaleX + addX) >> shiftXM4) - deltaX;
     371#endif
    337372    phase    = refPos16 & 15;
    338373    refPos   = refPos16 >> 4;
     
    366401  Int iOffset = 1 << (nShift - 1);
    367402
     403#if SCALED_REF_LAYER_OFFSETS
     404  for( j = 0; j < pcTempPic->getHeight(); j++ )
     405#else
    368406  for( j = 0; j < heightEL; j++ )
    369   {
     407#endif
     408  {
     409#if SCALED_REF_LAYER_OFFSETS
     410    Int y = Clip3(topStartL, bottomEndL - 1, j);
     411#endif
    370412#if PHASE_DERIVATION_IN_INTEGER
     413#if SCALED_REF_LAYER_OFFSETS
     414    refPos16 = ((( y - topStartL )*scaleY + addY) >> shiftYM4) - deltaY;
     415#else
    371416    refPos16 = ((j*scaleY + addY) >> shiftYM4) - deltaY;
     417#endif
    372418    phase    = refPos16 & 15;
    373419    refPos   = refPos16 >> 4;
     
    382428    piSrcY = piTempBufY + (refPos -((NTAPS_US_LUMA>>1) - 1))*strideEL;
    383429    piDstY = piDstBufY + j * strideEL;
    384 
     430#if SCALED_REF_LAYER_OFFSETS
     431    for( i = 0; i < pcTempPic->getWidth(); i++ )
     432#else
    385433    for( i = 0; i < widthEL; i++ )
     434#endif
    386435    {
    387436      *piDstY = ClipY( (sumLumaVer(piSrcY, coeff, strideEL) + iOffset) >> (nShift));
     437#if SCALED_REF_LAYER_OFFSETS
     438      // Only increase the x position of reference upsample picture when within the window
     439      // "-2" to ensure that pointer doesn't go beyond the boundary rightEndL-1
     440      if( (i >= leftStartL) && (i <= rightEndL-2) )
     441      {
     442        piSrcY++;
     443      }
     444#else
    388445      piSrcY++;
     446#endif
    389447      piDstY++;
    390448    }
    391449  }
     450
     451#if ILP_DECODED_PICTURE
     452#if SCALED_REF_LAYER_OFFSETS
     453  widthBL   = pcBasePic->getWidth ();
     454  heightBL  = pcBasePic->getHeight();
     455
     456  widthEL   = pcUsPic->getWidth () - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset();
     457  heightEL  = pcUsPic->getHeight() - scalEL.getWindowTopOffset()  - scalEL.getWindowBottomOffset();
     458#else
     459  widthBL   = pcBasePic->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset();
     460  heightBL  = pcBasePic->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset();
     461
     462  widthEL   = pcUsPic->getWidth () - confEL.getWindowLeftOffset() - confEL.getWindowRightOffset();
     463  heightEL  = pcUsPic->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset();
     464#endif
     465#endif
    392466
    393467  //========== UV component upsampling ===========
     
    401475  strideBL  = pcBasePic->getCStride();
    402476  strideEL  = pcUsPic->getCStride();
     477#if SCALED_REF_LAYER_OFFSETS
     478  Int leftStartC = scalEL.getWindowLeftOffset() >> 1;
     479  Int rightEndC  = (pcUsPic->getWidth() >> 1) - (scalEL.getWindowRightOffset() >> 1);
     480  Int topStartC  = scalEL.getWindowTopOffset() >> 1;
     481  Int bottomEndC = (pcUsPic->getHeight() >> 1) - (scalEL.getWindowBottomOffset() >> 1);
     482#endif
    403483
    404484#if PHASE_DERIVATION_IN_INTEGER
     
    422502#endif
    423503
     504#if ILP_DECODED_PICTURE
     505  widthBL   = pcBasePic->getWidth () >> 1;
     506  heightBL  = pcBasePic->getHeight() >> 1;
     507
     508  widthEL   = pcUsPic->getWidth () >> 1;
     509  heightEL  = pcUsPic->getHeight() >> 1;
     510#endif
     511
    424512  //========== horizontal upsampling ===========
    425513  for( i = 0; i < widthEL; i++ )
    426514  {
     515#if SCALED_REF_LAYER_OFFSETS
     516    Int x = Clip3(leftStartC, rightEndC - 1, i);
     517#endif
    427518#if PHASE_DERIVATION_IN_INTEGER
     519#if SCALED_REF_LAYER_OFFSETS
     520    refPos16 = (((x - leftStartC)*scaleX + addX) >> shiftXM4) - deltaX;
     521#else
    428522    refPos16 = ((i*scaleX + addX) >> shiftXM4) - deltaX;
     523#endif
    429524    phase    = refPos16 & 15;
    430525    refPos   = refPos16 >> 4;
     
    460555  pcTempPic->setHeight(heightEL << 1);
    461556
    462   for( j = 0; j < heightEL; j++ )
    463   {
     557#if SCALED_REF_LAYER_OFFSETS
     558  for( j = 0; j < pcTempPic->getHeight() >> 1; j++ )
     559#else
     560    for( j = 0; j < heightEL; j++ )
     561#endif
     562  {
     563#if SCALED_REF_LAYER_OFFSETS
     564    Int y = Clip3(topStartC, bottomEndC - 1, j);
     565#endif
    464566#if PHASE_DERIVATION_IN_INTEGER
     567#if SCALED_REF_LAYER_OFFSETS
     568    refPos16 = (((y - topStartC)*scaleY + addY) >> shiftYM4) - deltaY;
     569#else
    465570    refPos16 = ((j*scaleY + addY) >> shiftYM4) - deltaY;
     571#endif
    466572    phase    = refPos16 & 15;
    467573    refPos   = refPos16 >> 4;
     
    488594    piDstV = piDstBufV + j*strideEL;
    489595
     596#if SCALED_REF_LAYER_OFFSETS
     597    for( i = 0; i < pcTempPic->getWidth() >> 1; i++ )
     598#else
    490599    for( i = 0; i < widthEL; i++ )
     600#endif
    491601    {
    492602      *piDstU = ClipC( (sumChromaVer(piSrcU, coeff, strideEL) + iOffset) >> (nShift));
    493603      *piDstV = ClipC( (sumChromaVer(piSrcV, coeff, strideEL) + iOffset) >> (nShift));
    494604
     605#if SCALED_REF_LAYER_OFFSETS
     606      // Only increase the x position of reference upsample picture when within the window
     607      // "-2" to ensure that pointer doesn't go beyond the boundary rightEndC-1
     608      if( (i >= leftStartC) && (i <= rightEndC-2) )
     609      {
     610        piSrcU++;
     611        piSrcV++;
     612      }
     613#else
    495614      piSrcU++;
    496615      piSrcV++;
     616#endif
    497617      piDstU++;
    498618      piDstV++;
  • trunk/source/Lib/TLibCommon/TComUpsampleFilter.h

    r2 r189  
    5252  ~TComUpsampleFilter(void);
    5353
     54#if SCALED_REF_LAYER_OFFSETS
     55  Void upsampleBasePic( TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window );
     56#else
    5457 Void upsampleBasePic( TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic );
     58#endif
    5559};
    5660
  • trunk/source/Lib/TLibCommon/TypeDef.h

    r125 r189  
    4444
    4545#if SVC_EXTENSION
     46#define SCALED_REF_LAYER_OFFSETS         1      ///< M0309: Signal scaled reference layer offsets in SPS
     47#define MAX_LAYERS                       2      ///< max number of layers the codec is supposed to handle
     48
    4649#define VPS_RENAME                       1      ///< Rename variables max_layer_id and num_layer_sets_minus1 in VPS
    4750#define VPS_EXTNS                        1      ///< Include function structure for VPS extensions
     
    5154#define VPS_EXTN_PROFILE_INFO            1      ///< Include profile information for layer sets in VPS extension
    5255#define VPS_EXTN_DIRECT_REF_LAYERS       1      ///< Include indication of direct dependency of layers in VPS extension
    53 #endif
    54 #define MAX_LAYERS                       2      ///< max number of layers the codec is supposed to handle
     56#define VPS_EXTN_DIRECT_REF_LAYERS_CONTINUE   1
     57#define VPS_OUTPUT_LAYER_SET_IDX         1      ///< M0268: Signal output_layer_set_idx[i] as output_layer_set_idx_minus1[i]
     58#define VPS_MOVE_DIR_DEPENDENCY_FLAG     1      ///< M0268: Move the syntax element direct_dependency_flag to follow the syntax element dimension_id
     59#define VPS_PROFILE_OUTPUT_LAYERS        1      ///< M0268: Signal profile information and output layer information as in Sec. 3 of M0268v2
     60#endif
     61
     62#define DERIVE_LAYER_ID_LIST_VARIABLES   1      ///< Derived variables based on the variables in VPS - for use in syntax table parsing
    5563
    5664#define SVC_COL_BLK                      1      ///< get co-located block
     
    6068#define CHROMA_UPSAMPLING                1      ///< L0335: Chroma upsampling with 5 bits coefficients
    6169
    62 #define MV_SCALING_FIX                   1      ///< fixing the base layer MV scaling
    63 #define MV_SCALING_POS_FIX               1      ///< use center pixels to get co-located base layer block
    64 #define MFM_CLIPPING_FIX                 1      ///< set the right picture size for the clipping
    65 
    66 #define AVC_BASE                         0      ///< YUV BL reading for AVC base SVC
    67 #define REF_IDX_FRAMEWORK                0      ///< inter-layer reference framework
    68 
    69 #if SVC_UPSAMPLING
     70#define SIMPLIFIED_MV_POS_SCALING        1      ///< M0133/M0449: inter-layer MV scaling and pixel mapping position calculation
     71#define ILP_DECODED_PICTURE              1      ///< M0274: use decoded picture for inter-layer prediction
     72#define JCTVC_M0259_LAMBDAREFINEMENT     1      ///< JCTVC-M0259: lambda refinement (encoder only optimization)
     73
     74#define REF_IDX_FRAMEWORK                1      ///< inter-layer reference framework
     75
     76#if SVC_UPSAMPLING && !ILP_DECODED_PICTURE
    7077#define JCTVC_L0178                      1      ///< implementation of JCTVC-L0178 (code only supports right and bottom croppping offsets)
    7178#endif
     
    7380#define IDR_ALIGNMENT                    1      ///< align IDR picures across layers
    7481
     82#define AVC_BASE                         1      ///< YUV BL reading for AVC base SVC
    7583#if AVC_BASE
    76 #define AVC_SYNTAX                       1      ///< Syntax reading for AVC base
     84#define AVC_SYNTAX                       0      ///< Syntax reading for AVC base
    7785#endif
    7886
     
    8088#define REF_IDX_ME_ZEROMV                1      ///< L0051: use zero motion for inter-layer reference picture (without fractional ME)
    8189#define ENCODER_FAST_MODE                1      ///< L0174: enable encoder fast mode. TestMethod 1 is enabled by setting to 1 and TestMethod 2 is enable by setting to 2. By default it is set to 1.
    82 #if !AVC_BASE || AVC_SYNTAX
    8390#define REF_IDX_MFM                      1      ///< L0336: motion vector mapping of inter-layer reference picture
    84 #endif
    85 
    86 #if REF_IDX_MFM
    87 #define REUSE_MVSCALE                    1      ///< using the base layer MV scaling function
    88 #define REUSE_BLKMAPPING                 1      ///< using the base layer get co-located block function
    89 #define RAP_MFM_INIT                     1      ///< initilizing MFM when base layer is RAP picture
    90 #define REF_LIST_BUGFIX                  1
    91 #endif
    92 
     91#define JCTVC_M0458_INTERLAYER_RPS_SIG   1      ///< implementation of JCTVC-L0178 (currently only one reference layer is supported )
     92#if JCTVC_M0458_INTERLAYER_RPS_SIG
     93#define ZERO_NUM_DIRECT_LAYERS           1      ///< support of zero direct reference layers
     94#endif
    9395#else
    9496#define INTRA_BL                         1      ///< inter-layer texture prediction
     
    9799#define INTRA_BL_DST4x4                  1      ///< L0067/L0204: DST4x4 for Intra BL
    98100#define NO_RESIDUAL_FLAG_FOR_BLPRED      1      ///< L0437: Root cbf for Intra_BL
     101#define IL_MRG_SIMPLIFIED_PRUNING        1      ///< M0124: simplified pruning, Only the left and above candidates are checked with BL-C candidate for redundancy removal
     102#define INTRA_BL_CTX_CHANGE              1      ///< M0075: spatial dependency removal for IntraBL flag context derivation
    99103
    100104// Hooks
     
    109113#endif
    110114#else
     115#define ILP_DECODED_PICTURE              0
    111116#define SYNTAX_OUTPUT                    0
    112117#endif
     
    114119//! \ingroup TLibCommon
    115120//! \{
     121
     122#define FIX1071 1 ///< Temporary fix for issue #1071
     123
     124#define L0208_SOP_DESCRIPTION_SEI     1 ///< L0208: add SOP descrioption SEI
     125#define MAX_NUM_PICS_IN_SOP           1024
     126
     127#define K0180_SCALABLE_NESTING_SEI  1   ///JCTVC-K0180 scalable nesting sei message
     128#define MAX_NESTING_NUM_OPS         1024
     129#define MAX_NESTING_NUM_LAYER       64
     130
     131#define J0149_TONE_MAPPING_SEI        1 ///< J0149: Tone mapping information SEI
    116132#define L0363_DU_BIT_RATE             1 ///< L0363: add bit_rate_du_value_minus1 to HRD parameters
    117133#define L0328_SPLICING                1 ///< L0328: splicing support in HRD
     
    138154#define SIGNAL_BITRATE_PICRATE_IN_VPS               0  ///< K0125: Signal bit_rate and pic_rate in VPS
    139155#define L0232_RD_PENALTY           1  ///< L0232: RD-penalty for 32x32 TU for intra in non-intra slices
     156#define L0386_DB_METRIC            1  ///< L0386: non-normative blockiness metric (automatically configures deblocking parameters in bitstream)
     157#define L0323_DPB                     1 ///< L0323: Specification of active reference indices and decoded picture buffer
     158
     159#define L0034_COMBINED_LIST_CLEANUP 1
    140160
    141161#if VPS_EXTN_MASK_AND_DIM_INFO
     
    144164#if VPS_RENAME
    145165#define MAX_VPS_LAYER_SETS_PLUS1                  1024
    146 #define MAX_VPS_LAYER_ID_PLUS1                    2
     166#define MAX_VPS_LAYER_ID_PLUS1                    MAX_LAYERS
    147167#else
    148168#define MAX_VPS_NUM_HRD_PARAMETERS                1
     
    477497  REF_PIC_LIST_0 = 0,   ///< reference list 0
    478498  REF_PIC_LIST_1 = 1,   ///< reference list 1
     499#if !L0034_COMBINED_LIST_CLEANUP
    479500  REF_PIC_LIST_C = 2,   ///< combined reference list for uni-prediction in B-Slices
     501#endif
    480502  REF_PIC_LIST_X = 100  ///< special mark
    481503};
Note: See TracChangeset for help on using the changeset viewer.