Changeset 362 in 3DVCSoftware for branches/HTM-DEV-0.1-dev


Ignore:
Timestamp:
3 May 2013, 15:34:11 (11 years ago)
Author:
tech
Message:

Update to HM-10.1.

Location:
branches/HTM-DEV-0.1-dev
Files:
42 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-DEV-0.1-dev/doc/Doxyfile

    r324 r362  
    3333# if some version control system is used.
    3434
    35 PROJECT_NUMBER         = HM-10.0
     35PROJECT_NUMBER         = HM-10.1
    3636
    3737# Using the PROJECT_BRIEF tag one can provide an optional one line description
  • branches/HTM-DEV-0.1-dev/source/App/TAppDecoder/TAppDecTop.cpp

    r324 r362  
    296296      }
    297297      if ( bNewPicture &&
    298 #endif
    299            (   nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR
     298           (   nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL
    300299            || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP
    301300            || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_N_LP
    302             || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLANT
    303             || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA ) )
     301            || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_RADL
     302            || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_LP ) )
    304303      {
    305304#if H_MV
  • branches/HTM-DEV-0.1-dev/source/App/TAppEncoder/TAppEncCfg.cpp

    r324 r362  
    7878#if !H_MV
    7979  m_aidQP = NULL;
     80#if J0149_TONE_MAPPING_SEI
     81  m_startOfCodedInterval = NULL;
     82  m_codedPivotValue = NULL;
     83  m_targetPivotValue = NULL;
    8084#endif
    8185}
     
    104108  free(m_pchInputFile);
    105109#endif
    106 
     110#if J0149_TONE_MAPPING_SEI
     111  if ( m_startOfCodedInterval )
     112  {
     113    delete[] m_startOfCodedInterval;
     114    m_startOfCodedInterval = NULL;
     115  }
     116   if ( m_codedPivotValue )
     117  {
     118    delete[] m_codedPivotValue;
     119    m_codedPivotValue = NULL;
     120  }
     121  if ( m_targetPivotValue )
     122  {
     123    delete[] m_targetPivotValue;
     124    m_targetPivotValue = NULL;
     125  }
     126#endif
    107127  free(m_pchBitstreamFile);
    108128
     
    321341  string cfg_RowHeight;
    322342  string cfg_ScalingListFile;
     343#if J0149_TONE_MAPPING_SEI
     344  string cfg_startOfCodedInterval;
     345  string cfg_codedPivotValue;
     346  string cfg_targetPivotValue;
     347#endif
    323348#if SIGNAL_BITRATE_PICRATE_IN_VPS
    324349  string cfg_bitRateInfoPresentFlag;
     
    417442  ("DecodingRefreshType,-dr", m_iDecodingRefreshType,       0, "Intra refresh type (0:none 1:CRA 2:IDR)")
    418443  ("GOPSize,g",               m_iGOPSize,                   1, "GOP size of temporal structure")
     444#if !L0034_COMBINED_LIST_CLEANUP
    419445  ("ListCombination,-lc",     m_bUseLComb,               true, "Combined reference list for uni-prediction estimation in B-slices")
     446#endif
    420447  // motion options
    421448  ("FastSearch",              m_iFastSearch,                1, "0:Full search  1:Diamond  2:PMVFAST")
     
    473500  ("LoopFilterTcOffset_div2",        m_loopFilterTcOffsetDiv2,             0 )
    474501  ("DeblockingFilterControlPresent", m_DeblockingFilterControlPresent, false )
     502#if L0386_DB_METRIC
     503  ("DeblockingFilterMetric",         m_DeblockingFilterMetric,         false )
     504#endif
    475505
    476506  // Coding tools
     
    591621  ("SEIBufferingPeriod",             m_bufferingPeriodSEIEnabled,              0, "Control generation of buffering period SEI messages")
    592622  ("SEIPictureTiming",               m_pictureTimingSEIEnabled,                0, "Control generation of picture timing SEI messages")
     623#if J0149_TONE_MAPPING_SEI
     624  ("SEIToneMappingInfo",                       m_toneMappingInfoSEIEnabled,    false, "Control generation of Tone Mapping SEI messages")
     625  ("SEIToneMapId",                             m_toneMapId,                        0, "Specifies Id of Tone Mapping SEI message for a given session")
     626  ("SEIToneMapCancelFlag",                     m_toneMapCancelFlag,            false, "Indicates that Tone Mapping SEI message cancels the persistance or follows")
     627  ("SEIToneMapPersistenceFlag",                m_toneMapPersistenceFlag,        true, "Specifies the persistence of the Tone Mapping SEI message")
     628  ("SEIToneMapCodedDataBitDepth",              m_toneMapCodedDataBitDepth,         8, "Specifies Coded Data BitDepth of Tone Mapping SEI messages")
     629  ("SEIToneMapTargetBitDepth",                 m_toneMapTargetBitDepth,            8, "Specifies Output BitDepth of Tome mapping function")
     630  ("SEIToneMapModelId",                        m_toneMapModelId,                   0, "Specifies Model utilized for mapping coded data into target_bit_depth range\n"
     631                                                                                      "\t0:  linear mapping with clipping\n"
     632                                                                                      "\t1:  sigmoidal mapping\n"
     633                                                                                      "\t2:  user-defined table mapping\n"
     634                                                                                      "\t3:  piece-wise linear mapping\n"
     635                                                                                      "\t4:  luminance dynamic range information ")
     636  ("SEIToneMapMinValue",                              m_toneMapMinValue,                          0, "Specifies the minimum value in mode 0")
     637  ("SEIToneMapMaxValue",                              m_toneMapMaxValue,                       1023, "Specifies the maxmum value in mode 0")
     638  ("SEIToneMapSigmoidMidpoint",                       m_sigmoidMidpoint,                        512, "Specifies the centre point in mode 1")
     639  ("SEIToneMapSigmoidWidth",                          m_sigmoidWidth,                           960, "Specifies the distance between 5% and 95% values of the target_bit_depth in mode 1")
     640  ("SEIToneMapStartOfCodedInterval",                  cfg_startOfCodedInterval,          string(""), "Array of user-defined mapping table")
     641  ("SEIToneMapNumPivots",                             m_numPivots,                                0, "Specifies the number of pivot points in mode 3")
     642  ("SEIToneMapCodedPivotValue",                       cfg_codedPivotValue,               string(""), "Array of pivot point")
     643  ("SEIToneMapTargetPivotValue",                      cfg_targetPivotValue,              string(""), "Array of pivot point")
     644  ("SEIToneMapCameraIsoSpeedIdc",                     m_cameraIsoSpeedIdc,                        0, "Indicates the camera ISO speed for daylight illumination")
     645  ("SEIToneMapCameraIsoSpeedValue",                   m_cameraIsoSpeedValue,                    400, "Specifies the camera ISO speed for daylight illumination of Extended_ISO")
     646  ("SEIToneMapExposureCompensationValueSignFlag",     m_exposureCompensationValueSignFlag,        0, "Specifies the sign of ExposureCompensationValue")
     647  ("SEIToneMapExposureCompensationValueNumerator",    m_exposureCompensationValueNumerator,       0, "Specifies the numerator of ExposureCompensationValue")
     648  ("SEIToneMapExposureCompensationValueDenomIdc",     m_exposureCompensationValueDenomIdc,        2, "Specifies the denominator of ExposureCompensationValue")
     649  ("SEIToneMapRefScreenLuminanceWhite",               m_refScreenLuminanceWhite,                350, "Specifies reference screen brightness setting in units of candela per square metre")
     650  ("SEIToneMapExtendedRangeWhiteLevel",               m_extendedRangeWhiteLevel,                800, "Indicates the luminance dynamic range")
     651  ("SEIToneMapNominalBlackLevelLumaCodeValue",        m_nominalBlackLevelLumaCodeValue,          16, "Specifies luma sample value of the nominal black level assigned decoded pictures")
     652  ("SEIToneMapNominalWhiteLevelLumaCodeValue",        m_nominalWhiteLevelLumaCodeValue,         235, "Specifies luma sample value of the nominal white level assigned decoded pictures")
     653  ("SEIToneMapExtendedWhiteLevelLumaCodeValue",       m_extendedWhiteLevelLumaCodeValue,        300, "Specifies luma sample value of the extended dynamic range assigned decoded pictures")
     654#endif
    593655  ("SEIFramePacking",                m_framePackingSEIEnabled,                 0, "Control generation of frame packing SEI messages")
    594656  ("SEIFramePackingType",            m_framePackingSEIType,                    0, "Define frame packing arrangement\n"
     
    611673  ("SEIGradualDecodingRefreshInfo",  m_gradualDecodingRefreshInfoEnabled,      0, "Control generation of gradual decoding refresh information SEI message")
    612674  ("SEIDecodingUnitInfo",             m_decodingUnitInfoSEIEnabled,                       0, "Control generation of decoding unit information SEI message.")
     675#if L0208_SOP_DESCRIPTION_SEI
     676  ("SEISOPDescription",              m_SOPDescriptionSEIEnabled,              0, "Control generation of SOP description SEI messages")
     677#endif
     678#if K0180_SCALABLE_NESTING_SEI
     679  ("SEIScalableNesting",             m_scalableNestingSEIEnabled,              0, "Control generation of scalable nesting SEI messages")
     680#endif
    613681#if SIGNAL_BITRATE_PICRATE_IN_VPS
    614682  ("BitRatePicRateMaxTLayers",   m_bitRatePicRateMaxTLayers,           0, "Maximum number of sub-layers signalled; can be inferred otherwise; here for easy parsing of config. file")
     
    914982  m_iWaveFrontSubstreams = m_iWaveFrontSynchro ? (m_iSourceHeight + m_uiMaxCUHeight - 1) / m_uiMaxCUHeight : 1;
    915983
     984#if J0149_TONE_MAPPING_SEI
     985  if( m_toneMappingInfoSEIEnabled && !m_toneMapCancelFlag )
     986  {
     987    Char* pcStartOfCodedInterval = cfg_startOfCodedInterval.empty() ? NULL: strdup(cfg_startOfCodedInterval.c_str());
     988    Char* pcCodedPivotValue = cfg_codedPivotValue.empty() ? NULL: strdup(cfg_codedPivotValue.c_str());
     989    Char* pcTargetPivotValue = cfg_targetPivotValue.empty() ? NULL: strdup(cfg_targetPivotValue.c_str());
     990    if( m_toneMapModelId == 2 && pcStartOfCodedInterval )
     991    {
     992      char *startOfCodedInterval;
     993      UInt num = 1u<< m_toneMapTargetBitDepth;
     994      m_startOfCodedInterval = new Int[num];
     995      ::memset( m_startOfCodedInterval, 0, sizeof(Int)*num );
     996      startOfCodedInterval = strtok(pcStartOfCodedInterval, " .");
     997      int i = 0;
     998      while( startOfCodedInterval && ( i < num ) )
     999      {
     1000        m_startOfCodedInterval[i] = atoi( startOfCodedInterval );
     1001        startOfCodedInterval = strtok(NULL, " .");
     1002        i++;
     1003      }
     1004    }
     1005    else
     1006    {
     1007      m_startOfCodedInterval = NULL;
     1008    }
     1009    if( ( m_toneMapModelId == 3 ) && ( m_numPivots > 0 ) )
     1010    {
     1011      if( pcCodedPivotValue && pcTargetPivotValue )
     1012      {
     1013        char *codedPivotValue;
     1014        char *targetPivotValue;
     1015        m_codedPivotValue = new Int[m_numPivots];
     1016        m_targetPivotValue = new Int[m_numPivots];
     1017        ::memset( m_codedPivotValue, 0, sizeof(Int)*( m_numPivots ) );
     1018        ::memset( m_targetPivotValue, 0, sizeof(Int)*( m_numPivots ) );
     1019        codedPivotValue = strtok(pcCodedPivotValue, " .");
     1020        int i=0;
     1021        while(codedPivotValue&&i<m_numPivots)
     1022        {
     1023          m_codedPivotValue[i] = atoi( codedPivotValue );
     1024          codedPivotValue = strtok(NULL, " .");
     1025          i++;
     1026        }
     1027        i=0;
     1028        targetPivotValue = strtok(pcTargetPivotValue, " .");
     1029        while(targetPivotValue&&i<m_numPivots)
     1030        {
     1031          m_targetPivotValue[i]= atoi( targetPivotValue );
     1032          targetPivotValue = strtok(NULL, " .");
     1033          i++;
     1034        }
     1035      }
     1036    }
     1037    else
     1038    {
     1039      m_codedPivotValue = NULL;
     1040      m_targetPivotValue = NULL;
     1041    }
     1042  }
     1043#endif
    9161044  // check validity of input parameters
    9171045  xCheckParameter();
     
    16091737  {
    16101738    m_numReorderPics[i] = 0;
     1739#if L0323_DPB
     1740    m_maxDecPicBuffering[i] = 1;
     1741#else
    16111742    m_maxDecPicBuffering[i] = 0;
     1743#endif
    16121744  }
    16131745  for(Int i=0; i<m_iGOPSize; i++)
    16141746  {
     1747#if L0323_DPB
     1748    if(m_GOPList[i].m_numRefPics+1 > m_maxDecPicBuffering[m_GOPList[i].m_temporalId])
     1749#else
    16151750    if(m_GOPList[i].m_numRefPics > m_maxDecPicBuffering[m_GOPList[i].m_temporalId])
    1616     {
     1751#endif
     1752    {
     1753#if L0323_DPB
     1754      m_maxDecPicBuffering[m_GOPList[i].m_temporalId] = m_GOPList[i].m_numRefPics + 1;
     1755#else
    16171756      m_maxDecPicBuffering[m_GOPList[i].m_temporalId] = m_GOPList[i].m_numRefPics;
     1757#endif
    16181758    }
    16191759    Int highestDecodingNumberWithLowerPOC = 0;
     
    16461786      m_numReorderPics[i+1] = m_numReorderPics[i];
    16471787    }
     1788#if L0323_DPB
     1789    // the value of num_reorder_pics[ i ] shall be in the range of 0 to max_dec_pic_buffering[ i ] - 1, inclusive
     1790    if(m_numReorderPics[i] > m_maxDecPicBuffering[i] - 1)
     1791    {
     1792      m_maxDecPicBuffering[i] = m_numReorderPics[i] + 1;
     1793    }
     1794#else
    16481795    // the value of num_reorder_pics[ i ] shall be in the range of 0 to max_dec_pic_buffering[ i ], inclusive
    16491796    if(m_numReorderPics[i] > m_maxDecPicBuffering[i])
     
    16511798      m_maxDecPicBuffering[i] = m_numReorderPics[i];
    16521799    }
     1800#endif
    16531801    // a lower layer can not have higher value of m_uiMaxDecPicBuffering than a higher layer
    16541802    if(m_maxDecPicBuffering[i+1] < m_maxDecPicBuffering[i])
     
    16571805    }
    16581806  }
     1807
     1808
     1809#if L0323_DPB
     1810  // the value of num_reorder_pics[ i ] shall be in the range of 0 to max_dec_pic_buffering[ i ] -  1, inclusive
     1811  if(m_numReorderPics[MAX_TLAYER-1] > m_maxDecPicBuffering[MAX_TLAYER-1] - 1)
     1812  {
     1813    m_maxDecPicBuffering[MAX_TLAYER-1] = m_numReorderPics[MAX_TLAYER-1] + 1;
     1814  }
     1815#else
    16591816  // the value of num_reorder_pics[ i ] shall be in the range of 0 to max_dec_pic_buffering[ i ], inclusive
    16601817  if(m_numReorderPics[MAX_TLAYER-1] > m_maxDecPicBuffering[MAX_TLAYER-1])
     
    16621819    m_maxDecPicBuffering[MAX_TLAYER-1] = m_numReorderPics[MAX_TLAYER-1];
    16631820  }
     1821#endif
    16641822
    16651823  if(m_vuiParametersPresentFlag && m_bitstreamRestrictionFlag)
     
    17361894    }
    17371895  }
     1896#if !L0034_COMBINED_LIST_CLEANUP
    17381897  xConfirmPara( m_bUseLComb==false && m_numReorderPics[MAX_TLAYER-1]!=0, "ListCombination can only be 0 in low delay coding (more precisely when L0 and L1 are identical)" );  // Note however this is not the full necessary condition as ref_pic_list_combination_flag can only be 0 if L0 == L1.
     1898#endif
    17391899  xConfirmPara( m_iWaveFrontSynchro < 0, "WaveFrontSynchro cannot be negative" );
    17401900  xConfirmPara( m_iWaveFrontSubstreams <= 0, "WaveFrontSubstreams must be positive" );
     
    17421902
    17431903  xConfirmPara( m_decodedPictureHashSEIEnabled<0 || m_decodedPictureHashSEIEnabled>3, "this hash type is not correct!\n");
     1904
     1905#if J0149_TONE_MAPPING_SEI
     1906  if (m_toneMappingInfoSEIEnabled)
     1907  {
     1908    xConfirmPara( m_toneMapCodedDataBitDepth < 8 || m_toneMapCodedDataBitDepth > 14 , "SEIToneMapCodedDataBitDepth must be in rage 8 to 14");
     1909    xConfirmPara( m_toneMapTargetBitDepth < 1 || (m_toneMapTargetBitDepth > 16 && m_toneMapTargetBitDepth < 255) , "SEIToneMapTargetBitDepth must be in rage 1 to 16 or equal to 255");
     1910    xConfirmPara( m_toneMapModelId < 0 || m_toneMapModelId > 4 , "SEIToneMapModelId must be in rage 0 to 4");
     1911    xConfirmPara( m_cameraIsoSpeedValue == 0, "SEIToneMapCameraIsoSpeedValue shall not be equal to 0");
     1912    xConfirmPara( m_extendedRangeWhiteLevel < 100, "SEIToneMapExtendedRangeWhiteLevel should be greater than or equal to 100");
     1913    xConfirmPara( m_nominalBlackLevelLumaCodeValue >= m_nominalWhiteLevelLumaCodeValue, "SEIToneMapNominalWhiteLevelLumaCodeValue shall be greater than SEIToneMapNominalBlackLevelLumaCodeValue");
     1914    xConfirmPara( m_extendedWhiteLevelLumaCodeValue < m_nominalWhiteLevelLumaCodeValue, "SEIToneMapExtendedWhiteLevelLumaCodeValue shall be greater than or equal to SEIToneMapNominalWhiteLevelLumaCodeValue");
     1915  }
     1916#endif
    17441917
    17451918#if RATE_CONTROL_LAMBDA_DOMAIN
     
    19082081  printf("SQP:%d ", m_uiDeltaQpRD         );
    19092082  printf("ASR:%d ", m_bUseASR             );
     2083#if !L0034_COMBINED_LIST_CLEANUP
    19102084  printf("LComb:%d ", m_bUseLComb         );
     2085#endif
    19112086  printf("FEN:%d ", m_bUseFastEnc         );
    19122087  printf("ECU:%d ", m_bUseEarlyCU         );
  • branches/HTM-DEV-0.1-dev/source/App/TAppEncoder/TAppEncCfg.h

    r324 r362  
    124124  GOPEntry  m_GOPList[MAX_GOP];                               ///< the coding structure entries from the config file
    125125  Int       m_numReorderPics[MAX_TLAYER];                     ///< total number of reorder pictures
     126#if L0323_DPB
     127  Int       m_maxDecPicBuffering[MAX_TLAYER];                 ///< total number of pictures in the decoded picture buffer
     128#else
    126129  Int       m_maxDecPicBuffering[MAX_TLAYER];                 ///< total number of reference pictures needed for decoding
    127130#endif
     131#if !L0034_COMBINED_LIST_CLEANUP
    128132  Bool      m_bUseLComb;                                      ///< flag for using combined reference list for uni-prediction in B-slices (JCTVC-D421)
     133#endif
    129134  Bool      m_useTransformSkip;                               ///< flag for enabling intra transform skipping
    130135  Bool      m_useTransformSkipFast;                           ///< flag for enabling fast intra transform skipping
     
    207212  Int       m_loopFilterTcOffsetDiv2;                       ///< tc offset for deblocking filter
    208213  Bool      m_DeblockingFilterControlPresent;                 ///< deblocking filter control present flag in PPS
     214#if L0386_DB_METRIC
     215  Bool      m_DeblockingFilterMetric;                         ///< blockiness metric in encoder
     216#endif
    209217 
    210218  // coding tools (PCM)
     
    256264  Int       m_bufferingPeriodSEIEnabled;
    257265  Int       m_pictureTimingSEIEnabled;
     266#if J0149_TONE_MAPPING_SEI
     267  Bool      m_toneMappingInfoSEIEnabled;
     268  Int       m_toneMapId;
     269  Bool      m_toneMapCancelFlag;
     270  Bool      m_toneMapPersistenceFlag;
     271  Int       m_toneMapCodedDataBitDepth;
     272  Int       m_toneMapTargetBitDepth;
     273  Int       m_toneMapModelId;
     274  Int       m_toneMapMinValue;
     275  Int       m_toneMapMaxValue;
     276  Int       m_sigmoidMidpoint;
     277  Int       m_sigmoidWidth;
     278  Int       m_numPivots;
     279  Int       m_cameraIsoSpeedIdc;
     280  Int       m_cameraIsoSpeedValue;
     281  Int       m_exposureCompensationValueSignFlag;
     282  Int       m_exposureCompensationValueNumerator;
     283  Int       m_exposureCompensationValueDenomIdc;
     284  Int       m_refScreenLuminanceWhite;
     285  Int       m_extendedRangeWhiteLevel;
     286  Int       m_nominalBlackLevelLumaCodeValue;
     287  Int       m_nominalWhiteLevelLumaCodeValue;
     288  Int       m_extendedWhiteLevelLumaCodeValue;
     289  Int*      m_startOfCodedInterval;
     290  Int*      m_codedPivotValue;
     291  Int*      m_targetPivotValue;
     292#endif
    258293  Int       m_framePackingSEIEnabled;
    259294  Int       m_framePackingSEIType;
     
    265300  Int       m_gradualDecodingRefreshInfoEnabled;
    266301  Int       m_decodingUnitInfoSEIEnabled;
     302#if L0208_SOP_DESCRIPTION_SEI
     303  Int       m_SOPDescriptionSEIEnabled;
     304#endif
     305#if K0180_SCALABLE_NESTING_SEI
     306  Int       m_scalableNestingSEIEnabled;
     307#endif
    267308  // weighted prediction
    268309  Bool      m_useWeightedPred;                    ///< Use of weighted prediction in P slices
  • branches/HTM-DEV-0.1-dev/source/App/TAppEncoder/TAppEncTop.cpp

    r324 r362  
    207207  m_cTEncTop.setLoopFilterTcOffset           ( m_loopFilterTcOffsetDiv2    );
    208208  m_cTEncTop.setDeblockingFilterControlPresent( m_DeblockingFilterControlPresent);
     209#if L0386_DB_METRIC
     210  m_cTEncTop.setDeblockingFilterMetric       ( m_DeblockingFilterMetric );
     211#endif
    209212
    210213  //====== Motion search ========
     
    243246  m_cTEncTop.setUseHADME                     ( m_bUseHADME    );
    244247  m_cTEncTop.setUseLossless                  ( m_useLossless );
     248#if !L0034_COMBINED_LIST_CLEANUP
    245249  m_cTEncTop.setUseLComb                     ( m_bUseLComb    );
     250#endif
    246251#if H_MV
    247252  m_cTEncTop.setdQPs                         ( m_aidQP[layer]   );
     
    321326  m_cTEncTop.setBufferingPeriodSEIEnabled( m_bufferingPeriodSEIEnabled );
    322327  m_cTEncTop.setPictureTimingSEIEnabled( m_pictureTimingSEIEnabled );
     328#if J0149_TONE_MAPPING_SEI
     329  m_cTEncTop.setToneMappingInfoSEIEnabled                 ( m_toneMappingInfoSEIEnabled );
     330  m_cTEncTop.setTMISEIToneMapId                           ( m_toneMapId );
     331  m_cTEncTop.setTMISEIToneMapCancelFlag                   ( m_toneMapCancelFlag );
     332  m_cTEncTop.setTMISEIToneMapPersistenceFlag              ( m_toneMapPersistenceFlag );
     333  m_cTEncTop.setTMISEICodedDataBitDepth                   ( m_toneMapCodedDataBitDepth );
     334  m_cTEncTop.setTMISEITargetBitDepth                      ( m_toneMapTargetBitDepth );
     335  m_cTEncTop.setTMISEIModelID                             ( m_toneMapModelId );
     336  m_cTEncTop.setTMISEIMinValue                            ( m_toneMapMinValue );
     337  m_cTEncTop.setTMISEIMaxValue                            ( m_toneMapMaxValue );
     338  m_cTEncTop.setTMISEISigmoidMidpoint                     ( m_sigmoidMidpoint );
     339  m_cTEncTop.setTMISEISigmoidWidth                        ( m_sigmoidWidth );
     340  m_cTEncTop.setTMISEIStartOfCodedInterva                 ( m_startOfCodedInterval );
     341  m_cTEncTop.setTMISEINumPivots                           ( m_numPivots );
     342  m_cTEncTop.setTMISEICodedPivotValue                     ( m_codedPivotValue );
     343  m_cTEncTop.setTMISEITargetPivotValue                    ( m_targetPivotValue );
     344  m_cTEncTop.setTMISEICameraIsoSpeedIdc                   ( m_cameraIsoSpeedIdc );
     345  m_cTEncTop.setTMISEICameraIsoSpeedValue                 ( m_cameraIsoSpeedValue );
     346  m_cTEncTop.setTMISEIExposureCompensationValueSignFlag   ( m_exposureCompensationValueSignFlag );
     347  m_cTEncTop.setTMISEIExposureCompensationValueNumerator  ( m_exposureCompensationValueNumerator );
     348  m_cTEncTop.setTMISEIExposureCompensationValueDenomIdc   ( m_exposureCompensationValueDenomIdc );
     349  m_cTEncTop.setTMISEIRefScreenLuminanceWhite             ( m_refScreenLuminanceWhite );
     350  m_cTEncTop.setTMISEIExtendedRangeWhiteLevel             ( m_extendedRangeWhiteLevel );
     351  m_cTEncTop.setTMISEINominalBlackLevelLumaCodeValue      ( m_nominalBlackLevelLumaCodeValue );
     352  m_cTEncTop.setTMISEINominalWhiteLevelLumaCodeValue      ( m_nominalWhiteLevelLumaCodeValue );
     353  m_cTEncTop.setTMISEIExtendedWhiteLevelLumaCodeValue     ( m_extendedWhiteLevelLumaCodeValue );
     354#endif
    323355  m_cTEncTop.setFramePackingArrangementSEIEnabled( m_framePackingSEIEnabled );
    324356  m_cTEncTop.setFramePackingArrangementSEIType( m_framePackingSEIType );
     
    330362  m_cTEncTop.setGradualDecodingRefreshInfoEnabled( m_gradualDecodingRefreshInfoEnabled );
    331363  m_cTEncTop.setDecodingUnitInfoSEIEnabled( m_decodingUnitInfoSEIEnabled );
     364#if L0208_SOP_DESCRIPTION_SEI
     365  m_cTEncTop.setSOPDescriptionSEIEnabled( m_SOPDescriptionSEIEnabled );
     366#endif
     367#if K0180_SCALABLE_NESTING_SEI
     368  m_cTEncTop.setScalableNestingSEIEnabled( m_scalableNestingSEIEnabled );
     369#endif
    332370  m_cTEncTop.setUniformSpacingIdr          ( m_iUniformSpacingIdr );
    333371  m_cTEncTop.setNumColumnsMinus1           ( m_iNumColumnsMinus1 );
     
    832870    case NAL_UNIT_CODED_SLICE_TRAIL_R:
    833871    case NAL_UNIT_CODED_SLICE_TRAIL_N:
    834     case NAL_UNIT_CODED_SLICE_TLA:
     872    case NAL_UNIT_CODED_SLICE_TLA_R:
    835873    case NAL_UNIT_CODED_SLICE_TSA_N:
    836874    case NAL_UNIT_CODED_SLICE_STSA_R:
    837875    case NAL_UNIT_CODED_SLICE_STSA_N:
    838     case NAL_UNIT_CODED_SLICE_BLA:
    839     case NAL_UNIT_CODED_SLICE_BLANT:
     876    case NAL_UNIT_CODED_SLICE_BLA_W_LP:
     877    case NAL_UNIT_CODED_SLICE_BLA_W_RADL:
    840878    case NAL_UNIT_CODED_SLICE_BLA_N_LP:
    841     case NAL_UNIT_CODED_SLICE_IDR:
     879    case NAL_UNIT_CODED_SLICE_IDR_W_RADL:
    842880    case NAL_UNIT_CODED_SLICE_IDR_N_LP:
    843881    case NAL_UNIT_CODED_SLICE_CRA:
    844882    case NAL_UNIT_CODED_SLICE_RADL_N:
    845     case NAL_UNIT_CODED_SLICE_DLP:
     883    case NAL_UNIT_CODED_SLICE_RADL_R:
    846884    case NAL_UNIT_CODED_SLICE_RASL_N:
    847     case NAL_UNIT_CODED_SLICE_TFD:
     885    case NAL_UNIT_CODED_SLICE_RASL_R:
    848886    case NAL_UNIT_VPS:
    849887    case NAL_UNIT_SPS:
  • branches/HTM-DEV-0.1-dev/source/Lib/TLibCommon/CommonDef.h

    r324 r362  
    5858#if H_MV
    5959#define NV_VERSION        "0.1"                 ///< Current software version
    60 #define HM_VERSION        "10.0"                ///<
    61 #else
    62 #define NV_VERSION        "10.0"                 ///< Current software version
     60#define HM_VERSION        "10.1"                ///<
     61#else
     62#define NV_VERSION        "10.1"                 ///< Current software version
    6363#endif
    6464
     
    115115#define MAX_NUM_REF_PICS            16          ///< max. number of pictures used for reference
    116116#define MAX_NUM_REF                 16          ///< max. number of entries in picture reference list
     117#if !L0034_COMBINED_LIST_CLEANUP
    117118#define MAX_NUM_REF_LC              MAX_NUM_REF_PICS  // TODO: remove this macro definition (leftover from combined list concept)
     119#endif
    118120
    119121#define MAX_UINT                    0xFFFFFFFFU ///< max. value of unsigned 32-bit integer
     
    214216 
    215217  NAL_UNIT_CODED_SLICE_TSA_N,     // 2
    216   NAL_UNIT_CODED_SLICE_TLA,       // 3   // Current name in the spec: TSA_R
     218  NAL_UNIT_CODED_SLICE_TLA_R,       // 3
    217219 
    218220  NAL_UNIT_CODED_SLICE_STSA_N,    // 4
     
    220222
    221223  NAL_UNIT_CODED_SLICE_RADL_N,    // 6
    222   NAL_UNIT_CODED_SLICE_DLP,       // 7 // Current name in the spec: RADL_R
     224  NAL_UNIT_CODED_SLICE_RADL_R,      // 7
    223225 
    224226  NAL_UNIT_CODED_SLICE_RASL_N,    // 8
    225   NAL_UNIT_CODED_SLICE_TFD,       // 9 // Current name in the spec: RASL_R
    226 
    227   NAL_UNIT_RESERVED_10,
    228   NAL_UNIT_RESERVED_11,
    229   NAL_UNIT_RESERVED_12,
    230   NAL_UNIT_RESERVED_13,
    231   NAL_UNIT_RESERVED_14,
    232   NAL_UNIT_RESERVED_15,
    233 
    234   NAL_UNIT_CODED_SLICE_BLA,       // 16   // Current name in the spec: BLA_W_LP
    235   NAL_UNIT_CODED_SLICE_BLANT,     // 17   // Current name in the spec: BLA_W_DLP
     227  NAL_UNIT_CODED_SLICE_RASL_R,      // 9
     228
     229  NAL_UNIT_RESERVED_VCL_N10,
     230  NAL_UNIT_RESERVED_VCL_R11,
     231  NAL_UNIT_RESERVED_VCL_N12,
     232  NAL_UNIT_RESERVED_VCL_R13,
     233  NAL_UNIT_RESERVED_VCL_N14,
     234  NAL_UNIT_RESERVED_VCL_R15,
     235
     236  NAL_UNIT_CODED_SLICE_BLA_W_LP,    // 16
     237  NAL_UNIT_CODED_SLICE_BLA_W_RADL,  // 17
    236238  NAL_UNIT_CODED_SLICE_BLA_N_LP,  // 18
    237   NAL_UNIT_CODED_SLICE_IDR,       // 19  // Current name in the spec: IDR_W_DLP
     239  NAL_UNIT_CODED_SLICE_IDR_W_RADL,  // 19
    238240  NAL_UNIT_CODED_SLICE_IDR_N_LP,  // 20
    239241  NAL_UNIT_CODED_SLICE_CRA,       // 21
    240   NAL_UNIT_RESERVED_22,
    241   NAL_UNIT_RESERVED_23,
    242 
    243   NAL_UNIT_RESERVED_24,
    244   NAL_UNIT_RESERVED_25,
    245   NAL_UNIT_RESERVED_26,
    246   NAL_UNIT_RESERVED_27,
    247   NAL_UNIT_RESERVED_28,
    248   NAL_UNIT_RESERVED_29,
    249   NAL_UNIT_RESERVED_30,
    250   NAL_UNIT_RESERVED_31,
     242  NAL_UNIT_RESERVED_IRAP_VCL22,
     243  NAL_UNIT_RESERVED_IRAP_VCL23,
     244
     245  NAL_UNIT_RESERVED_VCL24,
     246  NAL_UNIT_RESERVED_VCL25,
     247  NAL_UNIT_RESERVED_VCL26,
     248  NAL_UNIT_RESERVED_VCL27,
     249  NAL_UNIT_RESERVED_VCL28,
     250  NAL_UNIT_RESERVED_VCL29,
     251  NAL_UNIT_RESERVED_VCL30,
     252  NAL_UNIT_RESERVED_VCL31,
    251253
    252254  NAL_UNIT_VPS,                   // 32
     
    257259  NAL_UNIT_EOB,                   // 37
    258260  NAL_UNIT_FILLER_DATA,           // 38
    259   NAL_UNIT_SEI,                   // 39 Prefix SEI
    260   NAL_UNIT_SEI_SUFFIX,            // 40 Suffix SEI
    261   NAL_UNIT_RESERVED_41,
    262   NAL_UNIT_RESERVED_42,
    263   NAL_UNIT_RESERVED_43,
    264   NAL_UNIT_RESERVED_44,
    265   NAL_UNIT_RESERVED_45,
    266   NAL_UNIT_RESERVED_46,
    267   NAL_UNIT_RESERVED_47,
     261  NAL_UNIT_PREFIX_SEI,              // 39
     262  NAL_UNIT_SUFFIX_SEI,              // 40
     263  NAL_UNIT_RESERVED_NVCL41,
     264  NAL_UNIT_RESERVED_NVCL42,
     265  NAL_UNIT_RESERVED_NVCL43,
     266  NAL_UNIT_RESERVED_NVCL44,
     267  NAL_UNIT_RESERVED_NVCL45,
     268  NAL_UNIT_RESERVED_NVCL46,
     269  NAL_UNIT_RESERVED_NVCL47,
    268270  NAL_UNIT_UNSPECIFIED_48,
    269271  NAL_UNIT_UNSPECIFIED_49,
  • branches/HTM-DEV-0.1-dev/source/Lib/TLibCommon/NAL.h

    r324 r362  
    8080    return m_nalUnitType == NAL_UNIT_CODED_SLICE_TRAIL_R
    8181        || m_nalUnitType == NAL_UNIT_CODED_SLICE_TRAIL_N
    82         || m_nalUnitType == NAL_UNIT_CODED_SLICE_TLA
     82        || m_nalUnitType == NAL_UNIT_CODED_SLICE_TLA_R
    8383        || m_nalUnitType == NAL_UNIT_CODED_SLICE_TSA_N
    8484        || m_nalUnitType == NAL_UNIT_CODED_SLICE_STSA_R
    8585        || m_nalUnitType == NAL_UNIT_CODED_SLICE_STSA_N
    86         || m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA
    87         || m_nalUnitType == NAL_UNIT_CODED_SLICE_BLANT
     86        || m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_LP
     87        || m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_RADL
    8888        || m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_N_LP
    89         || m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR
     89        || m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL
    9090        || m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP
    9191        || m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA
    9292        || m_nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N
    93         || m_nalUnitType == NAL_UNIT_CODED_SLICE_DLP
     93        || m_nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R
    9494        || m_nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N
    95         || m_nalUnitType == NAL_UNIT_CODED_SLICE_TFD;
     95        || m_nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R;
    9696  }
    9797#if L0045_NON_NESTED_SEI_RESTRICTIONS
    9898  Bool isSei()
    9999  {
    100     return m_nalUnitType == NAL_UNIT_SEI
    101         || m_nalUnitType == NAL_UNIT_SEI_SUFFIX;
     100    return m_nalUnitType == NAL_UNIT_PREFIX_SEI
     101        || m_nalUnitType == NAL_UNIT_SUFFIX_SEI;
    102102  }
    103103
  • branches/HTM-DEV-0.1-dev/source/Lib/TLibCommon/SEI.cpp

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

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

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

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

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

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

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

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

    r331 r362  
    4949, m_iPOC                          ( 0 )
    5050, m_iLastIDR                      ( 0 )
    51 , m_eNalUnitType                  ( NAL_UNIT_CODED_SLICE_IDR )
     51, m_eNalUnitType                  ( NAL_UNIT_CODED_SLICE_IDR_W_RADL )
    5252, m_eSliceType                    ( I_SLICE )
    5353, m_iSliceQp                      ( 0 )
     
    6060, m_deblockingFilterBetaOffsetDiv2 ( 0 )
    6161, m_deblockingFilterTcOffsetDiv2   ( 0 )
     62#if !L0034_COMBINED_LIST_CLEANUP
    6263, m_bRefPicListModificationFlagLC ( false )
    6364, m_bRefPicListCombinationFlag    ( false )
     65#endif
    6466, m_bCheckLDC                     ( false )
    6567, m_iSliceQpDelta                 ( 0 )
     
    7981, m_dLambda                       ( 0.0 )
    8082#endif
     83#if !L0034_COMBINED_LIST_CLEANUP
    8184, m_bNoBackPredFlag               ( false )
     85#endif
    8286, m_uiTLayer                      ( 0 )
    8387, m_bTLayerSwitchingFlag          ( false )
     
    111115#endif
    112116{
     117#if L0034_COMBINED_LIST_CLEANUP
     118  m_aiNumRefIdx[0] = m_aiNumRefIdx[1] = 0;
     119#else
    113120  m_aiNumRefIdx[0] = m_aiNumRefIdx[1] = m_aiNumRefIdx[2] = 0;
     121#endif
    114122 
    115123  initEqualRef();
    116124 
     125#if L0034_COMBINED_LIST_CLEANUP
     126  for ( Int idx = 0; idx < MAX_NUM_REF; idx++ )
     127  {
     128    m_list1IdxToList0Idx[idx] = -1;
     129  }
     130#else
    117131  for(Int iNumCount = 0; iNumCount < MAX_NUM_REF_LC; iNumCount++)
    118132  {
     
    124138    m_iRefIdxOfL1FromRefIdxOfL0[iNumCount] = -1;
    125139  }   
     140#endif
    126141  for(Int iNumCount = 0; iNumCount < MAX_NUM_REF; iNumCount++)
    127142  {
     
    135150#endif
    136151  }
    137   resetWpScaling(m_weightPredTable);
     152  resetWpScaling();
    138153  initWpAcDcParam();
    139154  m_saoEnabledFlag = false;
     
    156171  m_colRefIdx = 0;
    157172  initEqualRef();
     173#if !L0034_COMBINED_LIST_CLEANUP
    158174  m_bNoBackPredFlag = false;
    159175  m_bRefPicListCombinationFlag = false;
    160176  m_bRefPicListModificationFlagLC = false;
     177#endif
    161178  m_bCheckLDC = false;
    162179  m_iSliceQpDeltaCb = 0;
    163180  m_iSliceQpDeltaCr = 0;
    164181
     182#if !L0034_COMBINED_LIST_CLEANUP
    165183  m_aiNumRefIdx[REF_PIC_LIST_C]      = 0;
     184#endif
    166185
    167186  m_maxNumMergeCand = MRG_MAX_NUM_CANDS;
     
    177196Bool TComSlice::getRapPicFlag()
    178197{
    179   return getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR
     198  return getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL
    180199      || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP
    181200      || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP
    182       || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLANT
    183       || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA
     201      || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL
     202      || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP
    184203      || getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA;
    185204}
     
    251270
    252271
    253 TComPic* TComSlice::xGetLongTermRefPic (TComList<TComPic*>& rcListPic,
    254                                         Int                 poc)
     272TComPic* TComSlice::xGetLongTermRefPic(TComList<TComPic*>& rcListPic, Int poc, Bool pocHasMsb)
    255273{
    256274  TComList<TComPic*>::iterator  iterPic = rcListPic.begin(); 
    257275  TComPic*                      pcPic = *(iterPic);
    258276  TComPic*                      pcStPic = pcPic;
     277 
     278  Int pocCycle = 1 << getSPS()->getBitsForPOC();
     279  if (!pocHasMsb)
     280  {
     281    poc = poc % pocCycle;
     282  }
     283 
    259284  while ( iterPic != rcListPic.end() )
    260285  {
    261286    pcPic = *(iterPic);
    262     if(pcPic && (pcPic->getPOC()%(1<<getSPS()->getBitsForPOC())) == (poc%(1<<getSPS()->getBitsForPOC())))
     287    if (pcPic && pcPic->getPOC()!=this->getPOC() && pcPic->getSlice( 0 )->isReferenced())
     288    {
     289      Int picPoc = pcPic->getPOC();
     290      if (!pocHasMsb)
     291      {
     292        picPoc = picPoc % pocCycle;
     293      }
     294     
     295      if (poc == picPoc)
    263296    {
    264297      if(pcPic->getIsLongTerm())
     
    272305      break;
    273306    }
     307    }
    274308
    275309    iterPic++;
    276310  }
     311 
    277312  return  pcStPic;
    278313}
     
    293328}
    294329
     330#if L0034_COMBINED_LIST_CLEANUP
     331Void TComSlice::setList1IdxToList0Idx()
     332{
     333  Int idxL0, idxL1;
     334  for ( idxL1 = 0; idxL1 < getNumRefIdx( REF_PIC_LIST_1 ); idxL1++ )
     335  {
     336    m_list1IdxToList0Idx[idxL1] = -1;
     337    for ( idxL0 = 0; idxL0 < getNumRefIdx( REF_PIC_LIST_0 ); idxL0++ )
     338    {
     339      if ( m_apcRefPicList[REF_PIC_LIST_0][idxL0]->getPOC() == m_apcRefPicList[REF_PIC_LIST_1][idxL1]->getPOC() )
     340      {
     341        m_list1IdxToList0Idx[idxL1] = idxL0;
     342        break;
     343      }
     344    }
     345  }
     346}
     347#else
    295348Void TComSlice::generateCombinedList()
    296349{
     
    365418  }
    366419}
     420#endif
    367421
    368422#if H_MV
    369 Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic, std::vector<TComPic*>& refPicSetInterLayer )
     423Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic, Bool checkNumPocTotalCurr,std::vector<TComPic*>& refPicSetInterLayer )
     424#else
     425#if FIX1071
     426Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic, Bool checkNumPocTotalCurr )
    370427#else
    371428Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic )
    372429#endif
    373 {
    374   if (m_eSliceType == I_SLICE)
    375   {
    376     ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList));
    377     ::memset( m_aiNumRefIdx,   0, sizeof ( m_aiNumRefIdx ));
     430#endif
     431{
     432#if FIX1071
     433  if (!checkNumPocTotalCurr)
     434#endif
     435  {
     436    if (m_eSliceType == I_SLICE)
     437    {
     438      ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList));
     439      ::memset( m_aiNumRefIdx,   0, sizeof ( m_aiNumRefIdx ));
     440     
     441      return;
     442    }
    378443   
    379     return;
    380   }
    381  
    382444#if !H_MV
    383   m_aiNumRefIdx[0] = getNumRefIdx(REF_PIC_LIST_0);
    384   m_aiNumRefIdx[1] = getNumRefIdx(REF_PIC_LIST_1);
    385 #endif
     445    m_aiNumRefIdx[0] = getNumRefIdx(REF_PIC_LIST_0);
     446    m_aiNumRefIdx[1] = getNumRefIdx(REF_PIC_LIST_1);
     447#endif
     448  }
    386449
    387450  TComPic*  pcRefPic= NULL;
     
    410473    }
    411474  }
     475 
    412476  for(; i < m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures(); i++)
    413477  {
     
    422486    }
    423487  }
     488 
    424489  for(i = m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures()+m_pcRPS->getNumberOfLongtermPictures()-1; i > m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures()-1 ; i--)
    425490  {
    426491    if(m_pcRPS->getUsed(i))
    427492    {
    428       pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i));
     493      pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i), m_pcRPS->getCheckLTMSBPresent(i));
    429494      pcRefPic->setIsLongTerm(1);
    430495      pcRefPic->getPicYuvRec()->extendPicBorder();
     
    434499    if(pcRefPic==NULL)
    435500    {
    436       pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i));
     501      pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i), m_pcRPS->getCheckLTMSBPresent(i));
    437502    }
    438503    pcRefPic->setCheckLTMSBPresent(m_pcRPS->getCheckLTMSBPresent(i)); 
     
    448513  Int numPocTotalCurr = NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr;
    449514#endif
    450 
    451   {
    452     Int cIdx = 0;
    453     for ( i=0; i<NumPocStCurr0; i++, cIdx++)
    454     {
    455       rpsCurrList0[cIdx] = RefPicSetStCurr0[i];
    456     }
    457     for ( i=0; i<NumPocStCurr1; i++, cIdx++)
    458     {
    459       rpsCurrList0[cIdx] = RefPicSetStCurr1[i];
    460     }
    461     for ( i=0; i<NumPocLtCurr;  i++, cIdx++)
    462     {
    463       rpsCurrList0[cIdx] = RefPicSetLtCurr[i];
    464     }
     515#if FIX1071
     516  if (checkNumPocTotalCurr)
     517  {
     518    // 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:
     519    // – If the current picture is a BLA or CRA picture, the value of NumPocTotalCurr shall be equal to 0.
     520    // – Otherwise, when the current picture contains a P or B slice, the value of NumPocTotalCurr shall not be equal to 0.
     521    if (getRapPicFlag())
     522    {
     523      assert(numPocTotalCurr == 0);
     524    }
     525
     526    if (m_eSliceType == I_SLICE)
     527    {
     528      ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList));
     529      ::memset( m_aiNumRefIdx,   0, sizeof ( m_aiNumRefIdx ));
     530     
     531      return;
     532    }
     533   
     534    assert(numPocTotalCurr != 0);
     535   
     536    m_aiNumRefIdx[0] = getNumRefIdx(REF_PIC_LIST_0);
     537    m_aiNumRefIdx[1] = getNumRefIdx(REF_PIC_LIST_1);
     538  }
     539#endif
     540
     541  Int cIdx = 0;
     542  for ( i=0; i<NumPocStCurr0; i++, cIdx++)
     543  {
     544    rpsCurrList0[cIdx] = RefPicSetStCurr0[i];
     545  }
     546  for ( i=0; i<NumPocStCurr1; i++, cIdx++)
     547  {
     548    rpsCurrList0[cIdx] = RefPicSetStCurr1[i];
     549  }
     550  for ( i=0; i<NumPocLtCurr;  i++, cIdx++)
     551  {
     552    rpsCurrList0[cIdx] = RefPicSetLtCurr[i];
     553  }
    465554#if H_MV
    466     for ( i=0; i<numDirectRefLayers;  i++, cIdx++)
    467     {
    468       if( cIdx <= MAX_NUM_REF )
    469       {
    470         rpsCurrList0[cIdx] = refPicSetInterLayer[i];
    471       }
    472     }
    473 #endif
    474   }
     555  for ( i=0; i<numDirectRefLayers;  i++, cIdx++)
     556  {
     557    if( cIdx <= MAX_NUM_REF )
     558    {
     559      rpsCurrList0[cIdx] = refPicSetInterLayer[i];
     560    }
     561  }
     562#endif
    475563
    476564  if (m_eSliceType==B_SLICE)
    477565  {
    478     Int cIdx = 0;
     566    cIdx = 0;
    479567    for ( i=0; i<NumPocStCurr1; i++, cIdx++)
    480568    {
     
    585673}
    586674
    587 Void TComSlice::checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, Bool& prevRAPisBLA)
     675Void TComSlice::checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, Bool& prevRAPisBLA, TComList<TComPic *>& rcListPic)
    588676{
    589677  for(Int i = 0; i < pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures(); i++)
     
    598686    if(pocCRA < MAX_UINT && getPOC() > pocCRA)
    599687    {
     688      if (!pReferencePictureSet->getCheckLTMSBPresent(i))
     689      {
     690        assert(xGetLongTermRefPic(rcListPic, pReferencePictureSet->getPOC(i), false)->getPOC() >= pocCRA);
     691      }
     692      else
     693      {
    600694      assert(pReferencePictureSet->getPOC(i) >= pocCRA);
    601695    }
    602696  }
    603   if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP ) // IDR picture found
     697  }
     698  if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP ) // IDR picture found
    604699  {
    605700    pocCRA = getPOC();
     
    611706    prevRAPisBLA = false;
    612707  }
    613   else if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA
    614          || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLANT
     708  else if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP
     709         || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL
    615710         || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) // BLA picture found
    616711  {
     
    643738  Int pocCurr = getPOC();
    644739
    645   if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA
    646     || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLANT
     740  if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP
     741    || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL
    647742    || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP
    648     || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR
     743    || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL
    649744    || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP )  // IDR or BLA picture
    650745  {
     
    658753      iterPic++;
    659754    }
    660     if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA
    661       || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLANT
     755    if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP
     756      || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL
    662757      || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP )
    663758    {
     
    673768      {
    674769        rpcPic = *(iterPic);
    675         if (rpcPic->getPOC() != pocCurr && rpcPic->getPOC() != pocCRA) rpcPic->getSlice(0)->setReferenced(false);
     770        if (rpcPic->getPOC() != pocCurr && rpcPic->getPOC() != pocCRA)
     771        {
     772          rpcPic->getSlice(0)->setReferenced(false);
     773        }
    676774        iterPic++;
    677775      }
     
    707805  m_deblockingFilterTcOffsetDiv2 = pSrc->m_deblockingFilterTcOffsetDiv2;
    708806 
     807#if L0034_COMBINED_LIST_CLEANUP
     808  for (i = 0; i < 2; i++)
     809#else
    709810  for (i = 0; i < 3; i++)
     811#endif
    710812  {
    711813    m_aiNumRefIdx[i]     = pSrc->m_aiNumRefIdx[i];
    712814  }
    713815
     816#if L0034_COMBINED_LIST_CLEANUP
     817  for (i = 0; i < MAX_NUM_REF; i++)
     818  {
     819    m_list1IdxToList0Idx[i] = pSrc->m_list1IdxToList0Idx[i];
     820  }
     821#else
    714822  for (i = 0; i < 2; i++)
    715823  {
     
    728836  m_bRefPicListModificationFlagLC = pSrc->m_bRefPicListModificationFlagLC;
    729837  m_bRefPicListCombinationFlag    = pSrc->m_bRefPicListCombinationFlag;
     838#endif
    730839  m_bCheckLDC             = pSrc->m_bCheckLDC;
    731840  m_iSliceQpDelta        = pSrc->m_iSliceQpDelta;
     
    785894  }
    786895
     896#if !L0034_COMBINED_LIST_CLEANUP
    787897  m_bNoBackPredFlag      = pSrc->m_bNoBackPredFlag;
     898#endif
    788899  m_uiTLayer                      = pSrc->m_uiTLayer;
    789900  m_bTLayerSwitchingFlag          = pSrc->m_bTLayerSwitchingFlag;
     
    819930
    820931Int TComSlice::m_prevPOC = 0;
     932
    821933/** Function for setting the slice's temporal layer ID and corresponding temporal_layer_switching_point_flag.
    822934 * \param uiTLayer Temporal layer ID of the current slice
     
    879991  Int i, isReference;
    880992
    881   Int j = 0;
    882993  // loop through all pictures in the reference picture buffer
    883994  TComList<TComPic*>::iterator iterPic = rcListPic.begin();
    884995  while ( iterPic != rcListPic.end())
    885996  {
    886     j++;
    887997    rpcPic = *(iterPic++);
     998
     999    if(!rpcPic->getSlice( 0 )->isReferenced())
     1000    {
     1001      continue;
     1002    }
    8881003
    8891004    isReference = 0;
     
    9241039    {           
    9251040      rpcPic->getSlice( 0 )->setReferenced( false );   
     1041      rpcPic->setUsedByCurr(0);
    9261042      rpcPic->setIsLongTerm(0);
    9271043    }
     
    9291045    assert(rpcPic->getSlice( 0 )->isReferenced()==0||rpcPic->getUsedByCurr()==0||rpcPic->getTLayer()<=this->getTLayer());
    9301046    //check that pictures of higher or equal temporal layer are not in the RPS if the current picture is a TSA picture
    931     if(this->getNalUnitType() == NAL_UNIT_CODED_SLICE_TLA || this->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N)
     1047    if(this->getNalUnitType() == NAL_UNIT_CODED_SLICE_TLA_R || this->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N)
    9321048    {
    9331049      assert(rpcPic->getSlice( 0 )->isReferenced()==0||rpcPic->getTLayer()<this->getTLayer());
    9341050    }
    935 
    9361051    //check that pictures marked as temporal layer non-reference pictures are not used for reference
    9371052    if(rpcPic->getPicSym()->getSlice(0)->getPOC() != this->getPOC() && rpcPic->getTLayer()==this->getTLayer())
     
    9471062{
    9481063  TComPic* rpcPic;
    949   Int i, isAvailable, j;
     1064  Int i, isAvailable;
    9501065  Int atLeastOneLost = 0;
    9511066  Int atLeastOneRemoved = 0;
     
    9561071  for(i=pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures();i<pReferencePictureSet->getNumberOfPictures();i++)
    9571072  {
    958     j = 0;
    9591073    isAvailable = 0;
    9601074    // loop through all pictures in the reference picture buffer
     
    9621076    while ( iterPic != rcListPic.end())
    9631077    {
    964       j++;
    9651078      rpcPic = *(iterPic++);
    9661079      if(pReferencePictureSet->getCheckLTMSBPresent(i)==true)
     
    9851098      while ( iterPic != rcListPic.end())
    9861099      {
    987         j++;
    9881100        rpcPic = *(iterPic++);
    9891101
    990         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())
     1102        Int pocCycle = 1 << rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC();
     1103        Int curPoc = rpcPic->getPicSym()->getSlice(0)->getPOC();
     1104        Int refPoc = pReferencePictureSet->getPOC(i);
     1105        if (!pReferencePictureSet->getCheckLTMSBPresent(i))
     1106        {
     1107          curPoc = curPoc % pocCycle;
     1108          refPoc = refPoc % pocCycle;
     1109        }
     1110       
     1111        if (rpcPic->getSlice(0)->isReferenced() && curPoc == refPoc)
    9911112        {
    9921113          isAvailable = 1;
     
    10261147  for(i=0;i<pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures();i++)
    10271148  {
    1028     j = 0;
    10291149    isAvailable = 0;
    10301150    // loop through all pictures in the reference picture buffer
     
    10321152    while ( iterPic != rcListPic.end())
    10331153    {
    1034       j++;
    10351154      rpcPic = *(iterPic++);
    10361155
     
    10491168        {
    10501169          if(printErrors)
     1170          {
    10511171            printf("\nShort-term reference picture with POC = %3d seems to have been removed or not correctly decoded.", this->getPOC() + pReferencePictureSet->getDeltaPOC(i));
     1172          }
    10521173          atLeastOneRemoved = 1;
    10531174        }
     
    10551176        {
    10561177          if(printErrors)
     1178          {
    10571179            printf("\nShort-term reference picture with POC = %3d is lost or not correctly decoded!", this->getPOC() + pReferencePictureSet->getDeltaPOC(i));
     1180          }
    10581181          atLeastOneLost = 1;
    10591182          iPocLost=this->getPOC() + pReferencePictureSet->getDeltaPOC(i);
     
    12011324 * \returns Void
    12021325 */
    1203 Void  TComSlice::resetWpScaling(wpScalingParam  wp[2][MAX_NUM_REF][3])
     1326Void  TComSlice::resetWpScaling()
    12041327{
    12051328  for ( Int e=0 ; e<2 ; e++ )
     
    12091332      for ( Int yuv=0 ; yuv<3 ; yuv++ )
    12101333      {
    1211         wpScalingParam  *pwp = &(wp[e][i][yuv]);
     1334        wpScalingParam  *pwp = &(m_weightPredTable[e][i][yuv]);
    12121335        pwp->bPresentFlag      = false;
    12131336        pwp->uiLog2WeightDenom = 0;
     
    12251348Void  TComSlice::initWpScaling()
    12261349{
    1227   initWpScaling(m_weightPredTable);
    1228 }
    1229 
    1230 /** set WP tables
    1231  * \param wpScalingParam
    1232  * \returns Void
    1233  */
    1234 Void  TComSlice::initWpScaling(wpScalingParam  wp[2][MAX_NUM_REF][3])
    1235 {
    12361350  for ( Int e=0 ; e<2 ; e++ )
    12371351  {
     
    12401354      for ( Int yuv=0 ; yuv<3 ; yuv++ )
    12411355      {
    1242         wpScalingParam  *pwp = &(wp[e][i][yuv]);
    1243         if ( !pwp->bPresentFlag ) {
     1356        wpScalingParam  *pwp = &(m_weightPredTable[e][i][yuv]);
     1357        if ( !pwp->bPresentFlag )
     1358        {
    12441359          // Inferring values not present :
    12451360          pwp->iWeight = (1 << pwp->uiLog2WeightDenom);
     
    12751390, m_cprmsPresentFlag          (NULL)
    12761391{
    1277 
    12781392  for( Int i = 0; i < MAX_TLAYER; i++)
    12791393  {
    12801394    m_numReorderPics[i] = 0;
     1395#if L0323_DPB
     1396    m_uiMaxDecPicBuffering[i] = 1;
     1397#else
    12811398    m_uiMaxDecPicBuffering[i] = 0;
     1399#endif
    12821400    m_uiMaxLatencyIncrease[i] = 0;
    12831401  }
     
    13331451TComVPS::~TComVPS()
    13341452{
    1335   if( m_hrdParameters    != NULL )     delete m_hrdParameters;
    1336   if( m_hrdOpSetIdx      != NULL )     delete m_hrdOpSetIdx;
    1337   if( m_cprmsPresentFlag != NULL )     delete m_cprmsPresentFlag;
     1453if( m_hrdParameters    != NULL )     delete[] m_hrdParameters;
     1454  if( m_hrdOpSetIdx      != NULL )     delete[] m_hrdOpSetIdx;
     1455  if( m_cprmsPresentFlag != NULL )     delete[] m_cprmsPresentFlag;
    13381456}
    13391457
     
    14381556, m_picWidthInLumaSamples     (352)
    14391557, m_picHeightInLumaSamples    (288)
     1558, m_log2MinCodingBlockSize    (  0)
     1559, m_log2DiffMaxMinCodingBlockSize (0)
    14401560, m_uiMaxCUWidth              ( 32)
    14411561, m_uiMaxCUHeight             ( 32)
    14421562, m_uiMaxCUDepth              (  3)
    1443 , m_uiMinTrDepth              (  0)
    1444 , m_uiMaxTrDepth              (  1)
    14451563, m_bLongTermRefsPresent      (false)
    14461564, m_uiQuadtreeTULog2MaxSize   (  0)
     
    14521570, m_pcmLog2MaxSize            (  5)
    14531571, m_uiPCMLog2MinSize          (  7)
     1572#if !L0034_COMBINED_LIST_CLEANUP
    14541573, m_bUseLComb                 (false)
     1574#endif
    14551575, m_bitDepthY                 (  8)
    14561576, m_bitDepthC                 (  8)
     
    14771597  {
    14781598    m_uiMaxLatencyIncrease[i] = 0;
     1599#if L0323_DPB
     1600    m_uiMaxDecPicBuffering[i] = 1;
     1601#else
    14791602    m_uiMaxDecPicBuffering[i] = 0;
     1603#endif
    14801604    m_numReorderPics[i]       = 0;
    14811605  }
     
    14961620  m_RPSList.create(numRPS);
    14971621}
     1622
    14981623Void TComSPS::setHrdParameters( UInt frameRate, UInt numDU, UInt bitRate, Bool randomAccess )
    14991624{
     
    17401865  return m_POC[bufferNum];
    17411866}
     1867
    17421868Void TComReferencePictureSet::setPOC(Int bufferNum, Int POC)
    17431869{
    17441870  m_POC[bufferNum] = POC;
    17451871}
     1872
    17461873Bool TComReferencePictureSet::getCheckLTMSBPresent(Int bufferNum)
    17471874{
    17481875  return m_bCheckLTMSB[bufferNum];
    17491876}
     1877
    17501878Void TComReferencePictureSet::setCheckLTMSBPresent(Int bufferNum, Bool b)
    17511879{
     
    20252153  ::memcpy(getScalingListAddress(sizeId, listId),((listId == refListId)? getScalingListDefaultAddress(sizeId, refListId): getScalingListAddress(sizeId, refListId)),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId]));
    20262154}
     2155
    20272156/** parse syntax infomation
    20282157 *  \param pchFile syntax infomation
     
    21172246  m_scalingListCoef[SCALING_LIST_32x32][3] = m_scalingListCoef[SCALING_LIST_32x32][1]; // copy address for 32x32
    21182247}
     2248
    21192249/** destroy quantization matrix array
    21202250 */
     
    21292259  }
    21302260}
     2261
    21312262/** get default address of quantization matrix
    21322263 * \param sizeId size index
     
    21582289  return src;
    21592290}
     2291
    21602292/** process of default matrix
    21612293 * \param sizeId size index
     
    21672299  setScalingListDC(sizeId,listId,SCALING_LIST_DC);
    21682300}
     2301
    21692302/** check DC value of matrix for default matrix signaling
    21702303 */
     
    22272360//! activate a PPS and depending on isIDR parameter also SPS and VPS
    22282361//! \returns true, if activation is successful
    2229 Bool ParameterSetManager::activatePPS(Int ppsId, Bool isIDR)
     2362Bool ParameterSetManager::activatePPS(Int ppsId, Bool isIRAP)
    22302363{
    22312364  TComPPS *pps = m_ppsMap.getPS(ppsId);
     
    22362369    // active parameter sets per layer should be used here
    22372370#else
    2238     if (!isIDR && (spsId != m_activeSPSId))
    2239     {
    2240       printf("Warning: tried to activate PPS referring to a inactive SPS at non-IDR.");
     2371    if (!isIRAP && (spsId != m_activeSPSId))
     2372    {
     2373      printf("Warning: tried to activate PPS referring to a inactive SPS at non-IRAP.");
    22412374      return false;
    22422375    }
     
    22462379    {
    22472380      Int vpsId = sps->getVPSId();
    2248       if (!isIDR && (vpsId != m_activeVPSId))
    2249       {
    2250         printf("Warning: tried to activate PPS referring to a inactive VPS at non-IDR.");
     2381      if (!isIRAP && (vpsId != m_activeVPSId))
     2382      {
     2383        printf("Warning: tried to activate PPS referring to a inactive VPS at non-IRAP.");
    22512384        return false;
    22522385      }
     
    23072440}
    23082441#endif
    2309 
    23102442#if SIGNAL_BITRATE_PICRATE_IN_VPS
    23112443TComBitRatePicRateInfo::TComBitRatePicRateInfo()
  • branches/HTM-DEV-0.1-dev/source/Lib/TLibCommon/TComSlice.h

    r331 r362  
    905905  UInt        m_picHeightInLumaSamples;
    906906 
    907   Window      m_conformanceWindow;
    908 
     907  Int         m_log2MinCodingBlockSize;
     908  Int         m_log2DiffMaxMinCodingBlockSize;
    909909  UInt        m_uiMaxCUWidth;
    910910  UInt        m_uiMaxCUHeight;
    911911  UInt        m_uiMaxCUDepth;
    912   UInt        m_uiMinTrDepth;
    913   UInt        m_uiMaxTrDepth;
     912
     913  Window      m_conformanceWindow;
     914
    914915  TComRPSList m_RPSList;
    915916  Bool        m_bLongTermRefsPresent;
     
    927928  Bool        m_useAMP;
    928929
     930#if !L0034_COMBINED_LIST_CLEANUP
    929931  Bool        m_bUseLComb;
     932#endif
    930933 
    931934  // Parameter
     
    10041007  Bool getUsedByCurrPicLtSPSFlag(Int i)        {return m_usedByCurrPicLtSPSFlag[i];}
    10051008  Void setUsedByCurrPicLtSPSFlag(Int i, Bool x)      { m_usedByCurrPicLtSPSFlag[i] = x;}
     1009
     1010  Int  getLog2MinCodingBlockSize() const           { return m_log2MinCodingBlockSize; }
     1011  Void setLog2MinCodingBlockSize(Int val)          { m_log2MinCodingBlockSize = val; }
     1012  Int  getLog2DiffMaxMinCodingBlockSize() const    { return m_log2DiffMaxMinCodingBlockSize; }
     1013  Void setLog2DiffMaxMinCodingBlockSize(Int val)   { m_log2DiffMaxMinCodingBlockSize = val; }
     1014
    10061015  Void setMaxCUWidth  ( UInt u ) { m_uiMaxCUWidth = u;      }
    10071016  UInt getMaxCUWidth  ()         { return  m_uiMaxCUWidth;  }
     
    10201029  Bool getUseAMP() { return m_useAMP; }
    10211030  Void setUseAMP( Bool b ) { m_useAMP = b; }
    1022   Void setMinTrDepth  ( UInt u ) { m_uiMinTrDepth = u;      }
    1023   UInt getMinTrDepth  ()         { return  m_uiMinTrDepth;  }
    1024   Void setMaxTrDepth  ( UInt u ) { m_uiMaxTrDepth = u;      }
    1025   UInt getMaxTrDepth  ()         { return  m_uiMaxTrDepth;  }
    10261031  Void setQuadtreeTULog2MaxSize( UInt u ) { m_uiQuadtreeTULog2MaxSize = u;    }
    10271032  UInt getQuadtreeTULog2MaxSize()         { return m_uiQuadtreeTULog2MaxSize; }
     
    10451050 
    10461051  // Tool list
     1052#if !L0034_COMBINED_LIST_CLEANUP
    10471053  Void setUseLComb    (Bool b)   { m_bUseLComb = b;         }
    10481054  Bool getUseLComb    ()         { return m_bUseLComb;      }
     1055#endif
    10491056
    10501057  Bool getUseLossless ()         { return m_useLossless; }
     
    11301137  Void       setRefPicSetIdxL1(UInt idx, UInt refPicSetIdx) { m_RefPicSetIdxL1[idx] = refPicSetIdx; }
    11311138  UInt       getRefPicSetIdxL1(UInt idx) { return m_RefPicSetIdxL1[idx]; }
    1132 
    11331139#if H_MV
    11341140  // Why not an listIdx for all members, would avoid code duplication??
     
    13671373  Int         m_deblockingFilterBetaOffsetDiv2;    //< beta offset for deblocking filter
    13681374  Int         m_deblockingFilterTcOffsetDiv2;      //< tc offset for deblocking filter
    1369  
     1375#if L0034_COMBINED_LIST_CLEANUP
     1376  Int         m_list1IdxToList0Idx[MAX_NUM_REF];
     1377  Int         m_aiNumRefIdx   [2];    //  for multiple reference of current slice
     1378#else
    13701379  Int         m_aiNumRefIdx   [3];    //  for multiple reference of current slice
    13711380
     
    13771386  Bool        m_bRefPicListModificationFlagLC;
    13781387  Bool        m_bRefPicListCombinationFlag;
     1388#endif
    13791389
    13801390  Bool        m_bCheckLDC;
     
    14171427
    14181428  Bool        m_abEqualRef  [2][MAX_NUM_REF][MAX_NUM_REF];
    1419  
     1429#if !L0034_COMBINED_LIST_CLEANUP
    14201430  Bool        m_bNoBackPredFlag;
     1431#endif
    14211432  UInt        m_uiTLayer;
    14221433  Bool        m_bTLayerSwitchingFlag;
     
    15261537  Bool      getMvdL1ZeroFlag ()                                  { return m_bLMvdL1Zero;    }
    15271538  Int       getNumRpsCurrTempList();
     1539#if L0034_COMBINED_LIST_CLEANUP
     1540  Int       getList1IdxToList0Idx ( Int list1Idx )               { return m_list1IdxToList0Idx[list1Idx]; }
     1541#else
    15281542  Int       getRefIdxOfLC       (RefPicList e, Int iRefIdx)     { return m_iRefIdxOfLC[e][iRefIdx];           }
    15291543  Int       getListIdFromIdxOfLC(Int iRefIdx)                   { return m_eListIdFromIdxOfLC[iRefIdx];       }
     
    15351549  Bool      getRefPicListCombinationFlag()                      {return m_bRefPicListCombinationFlag;}
    15361550  Void      setRefPicListCombinationFlag(Bool bflag)            {m_bRefPicListCombinationFlag=bflag;}   
     1551#endif
    15371552  Void      setReferenced(Bool b)                               { m_bRefenced = b; }
    15381553  Bool      isReferenced()                                      { return m_bRefenced; }
    15391554  Void      setPOC              ( Int i )                       { m_iPOC              = i; if(getTLayer()==0) m_prevPOC=i; }
    15401555  Void      setNalUnitType      ( NalUnitType e )               { m_eNalUnitType      = e;      }
    1541   NalUnitType getNalUnitType    ()                              { return m_eNalUnitType;        }
     1556  NalUnitType getNalUnitType    () const                        { return m_eNalUnitType;        }
    15421557  Bool      getRapPicFlag       (); 
    1543   Bool      getIdrPicFlag       ()                              { return getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP; }
    1544   Void      checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, Bool& prevRAPisBLA);
     1558  Bool      getIdrPicFlag       ()                              { return getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP; }
     1559  Bool      isIRAP              () const                        { return (getNalUnitType() >= 16) && (getNalUnitType() <= 23); } 
     1560  Void      checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, Bool& prevRAPisBLA, TComList<TComPic *>& rcListPic);
    15451561  Void      decodingRefreshMarking(Int& pocCRA, Bool& bRefreshPending, TComList<TComPic*>& rcListPic);
    15461562  Void      setSliceType        ( SliceType e )                 { m_eSliceType        = e;      }
     
    15681584#endif
    15691585#if H_MV
    1570   Void      setRefPicList       ( TComList<TComPic*>& rcListPic, std::vector<TComPic*>& interLayerRefPicSet );
     1586  Void      setRefPicList       ( TComList<TComPic*>& rcListPic, Bool checkNumPocTotalCurr = false , std::vector<TComPic*>& interLayerRefPicSet );
     1587#else
     1588#if FIX1071
     1589  Void      setRefPicList       ( TComList<TComPic*>& rcListPic, Bool checkNumPocTotalCurr = false );
    15711590#else
    15721591  Void      setRefPicList       ( TComList<TComPic*>& rcListPic );
     1592#endif
     1593
    15731594#endif
    15741595  Void      setRefPOCList       ();
     
    16041625 
    16051626  static Void      sortPicList         ( TComList<TComPic*>& rcListPic );
    1606  
     1627#if L0034_COMBINED_LIST_CLEANUP
     1628  Void setList1IdxToList0Idx();
     1629#else
    16071630  Bool getNoBackPredFlag() { return m_bNoBackPredFlag; }
    16081631  Void setNoBackPredFlag( Bool b ) { m_bNoBackPredFlag = b; }
    16091632  Void generateCombinedList       ();
     1633#endif
    16101634
    16111635  UInt getTLayer             ()                            { return m_uiTLayer;                      }
     
    16651689  Void  getWpScaling    ( RefPicList e, Int iRefIdx, wpScalingParam *&wp);
    16661690
    1667   Void  resetWpScaling  (wpScalingParam  wp[2][MAX_NUM_REF][3]);
    1668   Void  initWpScaling    (wpScalingParam  wp[2][MAX_NUM_REF][3]);
     1691  Void  resetWpScaling  ();
    16691692  Void  initWpScaling   ();
    16701693  inline Bool applyWP   () { return( (m_eSliceType==P_SLICE && m_pcPPS->getUseWP()) || (m_eSliceType==B_SLICE && m_pcPPS->getWPBiPred()) ); }
     
    17121735#endif
    17131736#endif
    1714 
    17151737protected:
    17161738  TComPic*  xGetRefPic  (TComList<TComPic*>& rcListPic,
    17171739                         Int                 poc);
    1718   TComPic*  xGetLongTermRefPic  (TComList<TComPic*>& rcListPic,
    1719                          Int                 poc);
     1740TComPic*  xGetLongTermRefPic(TComList<TComPic*>& rcListPic, Int poc, Bool pocHasMsb);
    17201741#if H_MV
    17211742  TComPic*  xGetInterLayerRefPic( std::vector<TComPic*>& rcListIlPic, Int layerId );
     
    18041825  //! activate a PPS and depending on isIDR parameter also SPS and VPS
    18051826  //! \returns true, if activation is successful
    1806   Bool activatePPS(Int ppsId, Bool isIDR);
     1827  Bool activatePPS(Int ppsId, Bool isIRAP);
    18071828
    18081829  TComVPS* getActiveVPS(){ return m_vpsMap.getPS(m_activeVPSId); };
  • branches/HTM-DEV-0.1-dev/source/Lib/TLibCommon/TComTrQuant.cpp

    r324 r362  
    19861986          }
    19871987         
    1988           if(piQCoef[minPos] == 32767 || piQCoef[minPos] == -32768)
     1988          if(piDstCoeff[minPos] == 32767 || piDstCoeff[minPos] == -32768)
    19891989          {
    19901990            finalChange = -1;
  • branches/HTM-DEV-0.1-dev/source/Lib/TLibCommon/TypeDef.h

    r324 r362  
    4949#endif
    5050
    51 ///// ***** HM 10.0 *********
    52 
     51///// ***** HM 10.1 *********
     52#define FIX1071 1 ///< Temporary fix for issue #1071
     53
     54#define L0208_SOP_DESCRIPTION_SEI     1 ///< L0208: add SOP descrioption SEI
     55#define MAX_NUM_PICS_IN_SOP           1024
     56
     57#define K0180_SCALABLE_NESTING_SEI  1   ///JCTVC-K0180 scalable nesting sei message
     58#define MAX_NESTING_NUM_OPS         1024
     59#define MAX_NESTING_NUM_LAYER       64
     60
     61#define J0149_TONE_MAPPING_SEI        1 ///< J0149: Tone mapping information SEI
    5362#define L0363_DU_BIT_RATE             1 ///< L0363: add bit_rate_du_value_minus1 to HRD parameters
    5463#define L0328_SPLICING                1 ///< L0328: splicing support in HRD
     
    7584#define SIGNAL_BITRATE_PICRATE_IN_VPS               0  ///< K0125: Signal bit_rate and pic_rate in VPS
    7685#define L0232_RD_PENALTY           1  ///< L0232: RD-penalty for 32x32 TU for intra in non-intra slices
     86#define L0386_DB_METRIC            1  ///< L0386: non-normative blockiness metric (automatically configures deblocking parameters in bitstream)
     87#define L0323_DPB                     1 ///< L0323: Specification of active reference indices and decoded picture buffer
     88
     89#define L0034_COMBINED_LIST_CLEANUP 1
    7790
    7891#define MAX_VPS_NUM_HRD_PARAMETERS                1
     
    412425  REF_PIC_LIST_0 = 0,   ///< reference list 0
    413426  REF_PIC_LIST_1 = 1,   ///< reference list 1
     427#if !L0034_COMBINED_LIST_CLEANUP
    414428  REF_PIC_LIST_C = 2,   ///< combined reference list for uni-prediction in B-Slices
     429#endif
    415430  REF_PIC_LIST_X = 100  ///< special mark
    416431};
  • branches/HTM-DEV-0.1-dev/source/Lib/TLibDecoder/NALread.cpp

    r324 r362  
    5050//! \ingroup TLibDecoder
    5151//! \{
    52 static void convertPayloadToRBSP(vector<uint8_t>& nalUnitBuf, Bool isVclNalUnit)
     52static void convertPayloadToRBSP(vector<uint8_t>& nalUnitBuf, TComInputBitstream *bitstream, Bool isVclNalUnit)
    5353{
    5454  UInt zeroCount = 0;
    5555  vector<uint8_t>::iterator it_read, it_write;
    5656
    57   for (it_read = it_write = nalUnitBuf.begin(); it_read != nalUnitBuf.end(); it_read++, it_write++)
     57  UInt pos = 0;
     58  bitstream->clearEmulationPreventionByteLocation();
     59  for (it_read = it_write = nalUnitBuf.begin(); it_read != nalUnitBuf.end(); it_read++, it_write++, pos++)
    5860  {
    5961    assert(zeroCount < 2 || *it_read >= 0x03);
    6062    if (zeroCount == 2 && *it_read == 0x03)
    6163    {
     64      bitstream->pushEmulationPreventionByteLocation( pos );
     65      pos++;
    6266      it_read++;
    6367      zeroCount = 0;
     
    109113  if ( nalu.m_temporalId )
    110114  {
    111     assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA
    112          && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLANT
     115    assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA_W_LP
     116         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA_W_RADL
    113117         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA_N_LP
    114          && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_IDR
     118         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_IDR_W_RADL
    115119         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_IDR_N_LP
    116120         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_CRA
     
    122126  else
    123127  {
    124     assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_TLA
     128    assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_TLA_R
    125129         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_TSA_N
    126130         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_STSA_R
     
    136140  /* perform anti-emulation prevention */
    137141  TComInputBitstream *pcBitstream = new TComInputBitstream(NULL);
    138   convertPayloadToRBSP(nalUnitBuf, (nalUnitBuf[0] & 64) == 0);
     142  convertPayloadToRBSP(nalUnitBuf, pcBitstream, (nalUnitBuf[0] & 64) == 0);
    139143 
    140144  nalu.m_Bitstream = new TComInputBitstream(&nalUnitBuf);
     145  nalu.m_Bitstream->setEmulationPreventionByteLocation(pcBitstream->getEmulationPreventionByteLocation());
    141146  delete pcBitstream;
    142147  readNalUnitHeader(nalu);
  • branches/HTM-DEV-0.1-dev/source/Lib/TLibDecoder/SEIread.cpp

    r324 r362  
    9090    fprintf( g_hTrace, "=========== Decoding Unit Information SEI message ===========\n");
    9191    break;
     92#if J0149_TONE_MAPPING_SEI
     93  case SEI::TONE_MAPPING_INFO:
     94    fprintf( g_hTrace, "===========Tone Mapping Info SEI message ===========\n");
     95    break;
     96#endif
     97#if L0208_SOP_DESCRIPTION_SEI
     98  case SEI::SOP_DESCRIPTION:
     99    fprintf( g_hTrace, "=========== SOP Description SEI message ===========\n");
     100    break;
     101#endif
     102#if K0180_SCALABLE_NESTING_SEI
     103  case SEI::SCALABLE_NESTING:
     104    fprintf( g_hTrace, "=========== Scalable Nesting SEI message ===========\n");
     105    break;
     106#endif
    92107  default:
    93108    fprintf( g_hTrace, "=========== Unknown SEI message ===========\n");
     
    154169  SEI *sei = NULL;
    155170
    156   if(nalUnitType == NAL_UNIT_SEI)
     171  if(nalUnitType == NAL_UNIT_PREFIX_SEI)
    157172  {
    158173    switch (payloadType)
     
    219234      xParseSEIGradualDecodingRefreshInfo((SEIGradualDecodingRefreshInfo&) *sei, payloadSize);
    220235      break;
     236#if J0149_TONE_MAPPING_SEI
     237    case SEI::TONE_MAPPING_INFO:
     238      sei = new SEIToneMappingInfo;
     239      xParseSEIToneMappingInfo((SEIToneMappingInfo&) *sei, payloadSize);
     240      break;
     241#endif
     242#if L0208_SOP_DESCRIPTION_SEI
     243    case SEI::SOP_DESCRIPTION:
     244      sei = new SEISOPDescription;
     245      xParseSEISOPDescription((SEISOPDescription&) *sei, payloadSize);
     246      break;
     247#endif
     248#if K0180_SCALABLE_NESTING_SEI
     249    case SEI::SCALABLE_NESTING:
     250      sei = new SEIScalableNesting;
     251      xParseSEIScalableNesting((SEIScalableNesting&) *sei, nalUnitType, payloadSize, sps);
     252      break;
     253#endif
    221254    default:
    222255      for (UInt i = 0; i < payloadSize; i++)
     
    284317    {
    285318      UInt reservedPayloadExtensionData;
    286       READ_CODE (1, reservedPayloadExtensionData, "reserved_payload_extension_data");
     319      READ_FLAG (reservedPayloadExtensionData, "reserved_payload_extension_data");
    287320    }
    288321
    289322    UInt dummy;
    290     READ_CODE (1, dummy, "payload_bit_equal_to_one");
    291     READ_CODE (payloadBitsRemaining-1, dummy, "payload_bit_equal_to_zero");
     323    READ_FLAG (dummy, "payload_bit_equal_to_one"); payloadBitsRemaining--;
     324    while (payloadBitsRemaining)
     325    {
     326      READ_FLAG (dummy, "payload_bit_equal_to_zero"); payloadBitsRemaining--;
     327    }
    292328  }
    293329
     
    632668}
    633669
     670#if J0149_TONE_MAPPING_SEI
     671Void SEIReader::xParseSEIToneMappingInfo(SEIToneMappingInfo& sei, UInt /*payloadSize*/)
     672{
     673  Int i;
     674  UInt val;
     675  READ_UVLC( val, "tone_map_id" );                         sei.m_toneMapId = val;
     676  READ_FLAG( val, "tone_map_cancel_flag" );                sei.m_toneMapCancelFlag = val;
     677
     678  if ( !sei.m_toneMapCancelFlag )
     679  {
     680    READ_FLAG( val, "tone_map_persistence_flag" );         sei.m_toneMapPersistenceFlag = val;
     681    READ_CODE( 8, val, "coded_data_bit_depth" );           sei.m_codedDataBitDepth = val;
     682    READ_CODE( 8, val, "target_bit_depth" );               sei.m_targetBitDepth = val;
     683    READ_UVLC( val, "model_id" );                          sei.m_modelId = val;
     684    switch(sei.m_modelId)
     685    {
     686    case 0:
     687      {
     688        READ_CODE( 32, val, "min_value" );                 sei.m_minValue = val;
     689        READ_CODE( 32, val, "max_value" );                 sei.m_maxValue = val;
     690        break;
     691      }
     692    case 1:
     693      {
     694        READ_CODE( 32, val, "sigmoid_midpoint" );          sei.m_sigmoidMidpoint = val;
     695        READ_CODE( 32, val, "sigmoid_width" );             sei.m_sigmoidWidth = val;
     696        break;
     697      }
     698    case 2:
     699      {
     700        UInt num = 1u << sei.m_targetBitDepth;
     701        sei.m_startOfCodedInterval.resize(num+1);
     702        for(i = 0; i < num; i++)
     703        {
     704          READ_CODE( ((( sei.m_codedDataBitDepth + 7 ) >> 3 ) << 3), val, "start_of_coded_interval" );
     705          sei.m_startOfCodedInterval[i] = val;
     706        }
     707        sei.m_startOfCodedInterval[num] = 1u << sei.m_codedDataBitDepth;
     708        break;
     709      }
     710    case 3:
     711      {
     712        READ_CODE( 16, val,  "num_pivots" );                       sei.m_numPivots = val;
     713        sei.m_codedPivotValue.resize(sei.m_numPivots);
     714        sei.m_targetPivotValue.resize(sei.m_numPivots);
     715        for(i = 0; i < sei.m_numPivots; i++ )
     716        {
     717          READ_CODE( ((( sei.m_codedDataBitDepth + 7 ) >> 3 ) << 3), val, "coded_pivot_value" );
     718          sei.m_codedPivotValue[i] = val;
     719          READ_CODE( ((( sei.m_targetBitDepth + 7 ) >> 3 ) << 3),    val, "target_pivot_value" );
     720          sei.m_targetPivotValue[i] = val;
     721        }
     722        break;
     723      }
     724    case 4:
     725      {
     726        READ_CODE( 8, val, "camera_iso_speed_idc" );                     sei.m_cameraIsoSpeedValue = val;
     727        if( sei.m_cameraIsoSpeedValue == 255) //Extended_ISO
     728        {
     729          READ_CODE( 32,   val,   "camera_iso_speed_value" );            sei.m_cameraIsoSpeedValue = val;
     730        }
     731        READ_FLAG( val, "exposure_compensation_value_sign_flag" );       sei.m_exposureCompensationValueSignFlag = val;
     732        READ_CODE( 16, val, "exposure_compensation_value_numerator" );   sei.m_exposureCompensationValueNumerator = val;
     733        READ_CODE( 16, val, "exposure_compensation_value_denom_idc" );   sei.m_exposureCompensationValueDenomIdc = val;
     734        READ_CODE( 32, val, "ref_screen_luminance_white" );              sei.m_refScreenLuminanceWhite = val;
     735        READ_CODE( 32, val, "extended_range_white_level" );              sei.m_extendedRangeWhiteLevel = val;
     736        READ_CODE( 16, val, "nominal_black_level_luma_code_value" );     sei.m_nominalBlackLevelLumaCodeValue = val;
     737        READ_CODE( 16, val, "nominal_white_level_luma_code_value" );     sei.m_nominalWhiteLevelLumaCodeValue= val;
     738        READ_CODE( 16, val, "extended_white_level_luma_code_value" );    sei.m_extendedWhiteLevelLumaCodeValue = val;
     739        break;
     740      }
     741    default:
     742      {
     743        assert(!"Undefined SEIToneMapModelId");
     744        break;
     745      }
     746    }//switch model id
     747  }// if(!sei.m_toneMapCancelFlag)
     748
     749  xParseByteAlign();
     750}
     751#endif
     752
     753#if L0208_SOP_DESCRIPTION_SEI
     754Void SEIReader::xParseSEISOPDescription(SEISOPDescription &sei, UInt payloadSize)
     755{
     756  Int iCode;
     757  UInt uiCode;
     758
     759  READ_UVLC( uiCode,           "sop_seq_parameter_set_id"            ); sei.m_sopSeqParameterSetId = uiCode;
     760  READ_UVLC( uiCode,           "num_pics_in_sop_minus1"              ); sei.m_numPicsInSopMinus1 = uiCode;
     761  for (UInt i = 0; i <= sei.m_numPicsInSopMinus1; i++)
     762  {
     763    READ_CODE( 6, uiCode,                     "sop_desc_vcl_nalu_type" );  sei.m_sopDescVclNaluType[i] = uiCode;
     764    READ_CODE( 3, sei.m_sopDescTemporalId[i], "sop_desc_temporal_id"   );  sei.m_sopDescTemporalId[i] = uiCode;
     765    if (sei.m_sopDescVclNaluType[i] != NAL_UNIT_CODED_SLICE_IDR_W_RADL && sei.m_sopDescVclNaluType[i] != NAL_UNIT_CODED_SLICE_IDR_N_LP)
     766    {
     767      READ_UVLC( sei.m_sopDescStRpsIdx[i],    "sop_desc_st_rps_idx"    ); sei.m_sopDescStRpsIdx[i] = uiCode;
     768    }
     769    if (i > 0)
     770    {
     771      READ_SVLC( iCode,                       "sop_desc_poc_delta"     ); sei.m_sopDescPocDelta[i] = iCode;
     772    }
     773  }
     774
     775  xParseByteAlign();
     776}
     777#endif
     778
     779#if K0180_SCALABLE_NESTING_SEI
     780Void SEIReader::xParseSEIScalableNesting(SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, TComSPS *sps)
     781{
     782  UInt uiCode;
     783  SEIMessages seis;
     784
     785  READ_FLAG( uiCode,            "bitstream_subset_flag"         ); sei.m_bitStreamSubsetFlag = uiCode;
     786  READ_FLAG( uiCode,            "nesting_op_flag"               ); sei.m_nestingOpFlag = uiCode;
     787  if (sei.m_nestingOpFlag)
     788  {
     789    READ_FLAG( uiCode,            "default_op_flag"               ); sei.m_defaultOpFlag = uiCode;
     790    READ_UVLC( uiCode,            "nesting_num_ops_minus1"        ); sei.m_nestingNumOpsMinus1 = uiCode;
     791    for (UInt i = sei.m_defaultOpFlag; i <= sei.m_nestingNumOpsMinus1; i++)
     792    {
     793      READ_CODE( 3,        uiCode,  "nesting_max_temporal_id_plus1"   ); sei.m_nestingMaxTemporalIdPlus1[i] = uiCode;
     794      READ_UVLC( uiCode,            "nesting_op_idx"                  ); sei.m_nestingOpIdx[i] = uiCode;
     795    }
     796  }
     797  else
     798  {
     799    READ_FLAG( uiCode,            "all_layers_flag"               ); sei.m_allLayersFlag       = uiCode;
     800    if (!sei.m_allLayersFlag)
     801    {
     802      READ_CODE( 3,        uiCode,  "nesting_no_op_max_temporal_id_plus1"  ); sei.m_nestingNoOpMaxTemporalIdPlus1 = uiCode;
     803      READ_UVLC( uiCode,            "nesting_num_layers_minus1"            ); sei.m_nestingNumLayersMinus1        = uiCode;
     804      for (UInt i = 0; i <= sei.m_nestingNumLayersMinus1; i++)
     805      {
     806        READ_CODE( 6,           uiCode,     "nesting_layer_id"      ); sei.m_nestingLayerId[i]   = uiCode;
     807      }
     808    }
     809  }
     810
     811  // byte alignment
     812  while ( m_pcBitstream->getNumBitsRead() % 8 != 0 )
     813  {
     814    UInt code;
     815    READ_FLAG( code, "nesting_zero_bit" );
     816  }
     817
     818  sei.m_callerOwnsSEIs = false;
     819
     820  // read nested SEI messages
     821  do {
     822    xReadSEImessage(sei.m_nestedSEIs, nalUnitType, sps);
     823  } while (m_pcBitstream->getNumBitsLeft() > 8);
     824
     825}
     826#endif
     827
    634828Void SEIReader::xParseByteAlign()
    635829{
  • branches/HTM-DEV-0.1-dev/source/Lib/TLibDecoder/SEIread.h

    r324 r362  
    7070  Void xParseSEITemporalLevel0Index   (SEITemporalLevel0Index &sei, UInt payloadSize);
    7171  Void xParseSEIGradualDecodingRefreshInfo (SEIGradualDecodingRefreshInfo &sei, UInt payloadSize);
     72#if J0149_TONE_MAPPING_SEI
     73  Void xParseSEIToneMappingInfo       (SEIToneMappingInfo& sei, UInt payloadSize);
     74#endif
     75#if L0208_SOP_DESCRIPTION_SEI
     76  Void xParseSEISOPDescription        (SEISOPDescription &sei, UInt payloadSize);
     77#endif
     78#if K0180_SCALABLE_NESTING_SEI
     79  Void xParseSEIScalableNesting       (SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, TComSPS *sps);
     80#endif
    7281  Void xParseByteAlign();
    7382};
  • branches/HTM-DEV-0.1-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r331 r362  
    175175}
    176176
    177 /** copy SAO parameter
    178 * \param dst 
    179 * \param src
    180 */
    181 inline Void copySaoOneLcuParam(SaoLcuParam* dst,  SaoLcuParam* src)
    182 {
    183   Int i;
    184   dst->partIdx = src->partIdx;
    185   dst->typeIdx = src->typeIdx;
    186   if (dst->typeIdx != -1)
    187   {
    188     dst->subTypeIdx = src->subTypeIdx ;
    189     dst->length  = src->length;
    190     for (i=0;i<dst->length;i++)
    191     {
    192       dst->offset[i] = src->offset[i];
    193     }
    194   }
    195   else
    196   {
    197     dst->length  = 0;
    198     for (i=0;i<SAO_BO_LEN;i++)
    199     {
    200       dst->offset[i] = 0;
    201     }
    202   }
    203 }
    204 
    205177Void TDecCavlc::parsePPS(TComPPS* pcPPS)
    206178{
     
    400372
    401373  READ_FLAG(     uiCode, "field_seq_flag");                           pcVUI->setFieldSeqFlag(uiCode);
    402   assert(pcVUI->getFieldSeqFlag() == false);        // not supported yet
    403374
    404375  READ_FLAG(uiCode, "frame_field_info_present_flag");                 pcVUI->setFrameFieldInfoPresentFlag(uiCode);
     
    593564
    594565  READ_UVLC(     uiCode, "bit_depth_luma_minus8" );
    595   g_bitDepthY = 8 + uiCode;
    596   pcSPS->setBitDepthY(g_bitDepthY);
     566  pcSPS->setBitDepthY( uiCode + 8 );
    597567  pcSPS->setQpBDOffsetY( (Int) (6*uiCode) );
    598568
    599569  READ_UVLC( uiCode,    "bit_depth_chroma_minus8" );
    600   g_bitDepthC = 8 + uiCode;
    601   pcSPS->setBitDepthC(g_bitDepthC);
     570  pcSPS->setBitDepthC( uiCode + 8 );
    602571  pcSPS->setQpBDOffsetC( (Int) (6*uiCode) );
    603572
     
    608577  for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++)
    609578  {
     579#if L0323_DPB
     580    READ_UVLC ( uiCode, "sps_max_dec_pic_buffering_minus1");
     581    pcSPS->setMaxDecPicBuffering( uiCode + 1, i);
     582#else
    610583    READ_UVLC ( uiCode, "sps_max_dec_pic_buffering");
    611584    pcSPS->setMaxDecPicBuffering( uiCode, i);
     585#endif
    612586    READ_UVLC ( uiCode, "sps_num_reorder_pics" );
    613587    pcSPS->setNumReorderPics(uiCode, i);
     
    628602
    629603  READ_UVLC( uiCode, "log2_min_coding_block_size_minus3" );
    630   UInt log2MinCUSize = uiCode + 3;
     604  Int log2MinCUSize = uiCode + 3;
     605  pcSPS->setLog2MinCodingBlockSize(log2MinCUSize);
    631606  READ_UVLC( uiCode, "log2_diff_max_min_coding_block_size" );
    632   UInt uiMaxCUDepthCorrect = uiCode;
    633   pcSPS->setMaxCUWidth  ( 1<<(log2MinCUSize + uiMaxCUDepthCorrect) ); g_uiMaxCUWidth  = 1<<(log2MinCUSize + uiMaxCUDepthCorrect);
    634   pcSPS->setMaxCUHeight ( 1<<(log2MinCUSize + uiMaxCUDepthCorrect) ); g_uiMaxCUHeight = 1<<(log2MinCUSize + uiMaxCUDepthCorrect);
     607  pcSPS->setLog2DiffMaxMinCodingBlockSize(uiCode);
     608  Int maxCUDepthDelta = uiCode;
     609  pcSPS->setMaxCUWidth  ( 1<<(log2MinCUSize + maxCUDepthDelta) );
     610  pcSPS->setMaxCUHeight ( 1<<(log2MinCUSize + maxCUDepthDelta) );
    635611  READ_UVLC( uiCode, "log2_min_transform_block_size_minus2" );   pcSPS->setQuadtreeTULog2MinSize( uiCode + 2 );
    636612
     
    640616  READ_UVLC( uiCode, "max_transform_hierarchy_depth_inter" );    pcSPS->setQuadtreeTUMaxDepthInter( uiCode+1 );
    641617  READ_UVLC( uiCode, "max_transform_hierarchy_depth_intra" );    pcSPS->setQuadtreeTUMaxDepthIntra( uiCode+1 );
    642   g_uiAddCUDepth = 0;
    643   while( ( pcSPS->getMaxCUWidth() >> uiMaxCUDepthCorrect ) > ( 1 << ( pcSPS->getQuadtreeTULog2MinSize() + g_uiAddCUDepth )  ) )
    644   {
    645     g_uiAddCUDepth++;
    646   }
    647   pcSPS->setMaxCUDepth( uiMaxCUDepthCorrect+g_uiAddCUDepth  );
    648   g_uiMaxCUDepth  = uiMaxCUDepthCorrect+g_uiAddCUDepth;
    649   // BB: these parameters may be removed completly and replaced by the fixed values
    650   pcSPS->setMinTrDepth( 0 );
    651   pcSPS->setMaxTrDepth( 1 );
     618
     619  Int addCuDepth = max (0, log2MinCUSize - (Int)pcSPS->getQuadtreeTULog2MinSize() );
     620  pcSPS->setMaxCUDepth( maxCUDepthDelta + addCuDepth );
     621
    652622  READ_FLAG( uiCode, "scaling_list_enabled_flag" );                 pcSPS->setScalingListFlag ( uiCode );
    653623  if(pcSPS->getScalingListFlag())
     
    748718  for(UInt i = 0; i <= pcVPS->getMaxTLayers()-1; i++)
    749719  {
     720#if L0323_DPB
     721    READ_UVLC( uiCode,  "vps_max_dec_pic_buffering_minus1[i]" );     pcVPS->setMaxDecPicBuffering( uiCode + 1, i );
     722#else
    750723    READ_UVLC( uiCode,  "vps_max_dec_pic_buffering[i]" );     pcVPS->setMaxDecPicBuffering( uiCode, i );
     724#endif
    751725    READ_UVLC( uiCode,  "vps_num_reorder_pics[i]" );          pcVPS->setNumReorderPics( uiCode, i );
    752726    READ_UVLC( uiCode,  "vps_max_latency_increase[i]" );      pcVPS->setMaxLatencyIncrease( uiCode, i );
     
    10561030        iPOCmsb = iPrevPOCmsb;
    10571031      }
    1058       if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA
    1059         || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLANT
     1032      if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP
     1033        || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL
    10601034        || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP )
    10611035      {
     
    10661040
    10671041      TComReferencePictureSet* rps;
     1042      rps = rpcSlice->getLocalRPS();
     1043      rpcSlice->setRPS(rps);
    10681044      READ_FLAG( uiCode, "short_term_ref_pic_set_sps_flag" );
    10691045      if(uiCode == 0) // use short-term reference picture set explicitly signalled in slice header
    10701046      {
    1071         rps = rpcSlice->getLocalRPS();
    10721047        parseShortTermRefPicSet(sps,rps, sps->getRPSList()->getNumberOfReferencePictureSets());
    1073         rpcSlice->setRPS(rps);
    10741048      }
    10751049      else // use reference to short-term reference picture set in PPS
     
    10881062          uiCode = 0;
    10891063        }
    1090         rpcSlice->setRPS(sps->getRPSList()->getReferencePictureSet(uiCode));
    1091 
    1092         rps = rpcSlice->getRPS();
     1064        memcpy(rps,sps->getRPSList()->getReferencePictureSet(uiCode),sizeof(TComReferencePictureSet));
    10931065      }
    10941066      if(sps->getLongTermRefsPresent())
     
    11131085        rps->setNumberOfLongtermPictures(numOfLtrp);
    11141086        Int maxPicOrderCntLSB = 1 << rpcSlice->getSPS()->getBitsForPOC();
    1115         Int prevLSB = 0, prevDeltaMSB = 0, deltaPocMSBCycleLT = 0;;
     1087        Int prevDeltaMSB = 0, deltaPocMSBCycleLT = 0;;
    11161088        for(Int j=offset+rps->getNumberOfLongtermPictures()-1, k = 0; k < numOfLtrp; j--, k++)
    11171089        {
     
    11401112            READ_UVLC( uiCode, "delta_poc_msb_cycle_lt[i]" );
    11411113            Bool deltaFlag = false;
    1142             //            First LTRP                               || First LTRP from SH           || curr LSB    != prev LSB
    1143             if( (j == offset+rps->getNumberOfLongtermPictures()-1) || (j == offset+(numOfLtrp-numLtrpInSPS)-1) || (pocLsbLt != prevLSB) )
     1114            //            First LTRP                               || First LTRP from SH
     1115            if( (j == offset+rps->getNumberOfLongtermPictures()-1) || (j == offset+(numOfLtrp-numLtrpInSPS)-1) )
    11441116            {
    11451117              deltaFlag = true;
     
    11661138            rps->setCheckLTMSBPresent(j,false); 
    11671139          }
    1168           prevLSB = pocLsbLt;
    11691140          prevDeltaMSB = deltaPocMSBCycleLT;
    11701141        }
     
    11721143        rps->setNumberOfPictures(offset);       
    11731144      } 
    1174       if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA
    1175         || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLANT
     1145      if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP
     1146        || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL
    11761147        || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP )
    11771148      {
     
    14051376        if(!rpcSlice->getDeblockingFilterDisable())
    14061377        {
    1407           READ_SVLC( iCode, "beta_offset_div2" );                       rpcSlice->setDeblockingFilterBetaOffsetDiv2(iCode);
    1408           READ_SVLC( iCode, "tc_offset_div2" );                         rpcSlice->setDeblockingFilterTcOffsetDiv2(iCode);
     1378          READ_SVLC( iCode, "slice_beta_offset_div2" );                       rpcSlice->setDeblockingFilterBetaOffsetDiv2(iCode);
     1379          assert(rpcSlice->getDeblockingFilterBetaOffsetDiv2() >= -6 &&
     1380                 rpcSlice->getDeblockingFilterBetaOffsetDiv2() <=  6);
     1381          READ_SVLC( iCode, "slice_tc_offset_div2" );                         rpcSlice->setDeblockingFilterTcOffsetDiv2(iCode);
     1382          assert(rpcSlice->getDeblockingFilterTcOffsetDiv2() >= -6 &&
     1383                 rpcSlice->getDeblockingFilterTcOffsetDiv2() <=  6);
    14091384        }
    14101385      }
     
    14381413  }
    14391414 
    1440   if( pps->getTilesEnabledFlag() || pps->getEntropyCodingSyncEnabledFlag() )
    1441   {
    14421415    UInt *entryPointOffset          = NULL;
    14431416    UInt numEntryPointOffsets, offsetLenMinus1;
    1444 
     1417  if( pps->getTilesEnabledFlag() || pps->getEntropyCodingSyncEnabledFlag() )
     1418  {
    14451419    READ_UVLC(numEntryPointOffsets, "num_entry_point_offsets"); rpcSlice->setNumEntryPointOffsets ( numEntryPointOffsets );
    14461420    if (numEntryPointOffsets>0)
     
    14591433#endif
    14601434    }
     1435  }
     1436  else
     1437  {
     1438    rpcSlice->setNumEntryPointOffsets ( 0 );
     1439  }
     1440
     1441  if(pps->getSliceHeaderExtensionPresentFlag())
     1442  {
     1443    READ_UVLC(uiCode,"slice_header_extension_length");
     1444    for(Int i=0; i<uiCode; i++)
     1445    {
     1446      UInt ignore;
     1447      READ_CODE(8,ignore,"slice_header_extension_data_byte");
     1448    }
     1449  }
     1450  m_pcBitstream->readByteAlignment();
     1451
     1452  if( pps->getTilesEnabledFlag() || pps->getEntropyCodingSyncEnabledFlag() )
     1453  {
     1454    Int endOfSliceHeaderLocation = m_pcBitstream->getByteLocation();
     1455    Int  curEntryPointOffset     = 0;
     1456    Int  prevEntryPointOffset    = 0;
     1457    for (UInt idx=0; idx<numEntryPointOffsets; idx++)
     1458    {
     1459      curEntryPointOffset += entryPointOffset[ idx ];
     1460
     1461      Int emulationPreventionByteCount = 0;
     1462      for ( UInt curByteIdx  = 0; curByteIdx<m_pcBitstream->numEmulationPreventionBytesRead(); curByteIdx++ )
     1463      {
     1464        if ( m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) >= ( prevEntryPointOffset + endOfSliceHeaderLocation ) &&
     1465             m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) <  ( curEntryPointOffset  + endOfSliceHeaderLocation ) )
     1466        {
     1467          emulationPreventionByteCount++;
     1468        }
     1469      }
     1470
     1471      entryPointOffset[ idx ] -= emulationPreventionByteCount;
     1472      prevEntryPointOffset = curEntryPointOffset;
     1473    }
    14611474
    14621475    if ( pps->getTilesEnabledFlag() )
     
    14941507    }
    14951508  }
    1496   else
    1497   {
    1498     rpcSlice->setNumEntryPointOffsets ( 0 );
    1499   }
    1500 
    1501   if(pps->getSliceHeaderExtensionPresentFlag())
    1502   {
    1503     READ_UVLC(uiCode,"slice_header_extension_length");
    1504     for(Int i=0; i<uiCode; i++)
    1505     {
    1506       UInt ignore;
    1507       READ_CODE(8,ignore,"slice_header_extension_data_byte");
    1508     }
    1509   }
    1510   m_pcBitstream->readByteAlignment();
     1509
    15111510  return;
    15121511}
     
    17591758// ====================================================================================================================
    17601759
    1761 
    1762 /** Parse PCM alignment zero bits.
    1763 * \returns Void
    1764 */
    1765 Void TDecCavlc::xReadPCMAlignZero( )
    1766 {
    1767   UInt uiNumberOfBits = m_pcBitstream->getNumBitsUntilByteAligned();
    1768 
    1769   if(uiNumberOfBits)
    1770   {
    1771     UInt uiBits;
    1772     UInt uiSymbol;
    1773 
    1774     for(uiBits = 0; uiBits < uiNumberOfBits; uiBits++)
    1775     {
    1776       xReadFlag( uiSymbol );
    1777       assert( uiSymbol == 0 );
    1778     }
    1779   }
    1780 }
    1781 
    1782 Void TDecCavlc::xReadUnaryMaxSymbol( UInt& ruiSymbol, UInt uiMaxSymbol )
    1783 {
    1784   if (uiMaxSymbol == 0)
    1785   {
    1786     ruiSymbol = 0;
    1787     return;
    1788   }
    1789 
    1790   xReadFlag( ruiSymbol );
    1791 
    1792   if (ruiSymbol == 0 || uiMaxSymbol == 1)
    1793   {
    1794     return;
    1795   }
    1796 
    1797   UInt uiSymbol = 0;
    1798   UInt uiCont;
    1799 
    1800   do
    1801   {
    1802     xReadFlag( uiCont );
    1803     uiSymbol++;
    1804   }
    1805   while( uiCont && (uiSymbol < uiMaxSymbol-1) );
    1806 
    1807   if( uiCont && (uiSymbol == uiMaxSymbol-1) )
    1808   {
    1809     uiSymbol++;
    1810   }
    1811 
    1812   ruiSymbol = uiSymbol;
    1813 }
    1814 
    1815 Void TDecCavlc::xReadExGolombLevel( UInt& ruiSymbol )
    1816 {
    1817   UInt uiSymbol ;
    1818   UInt uiCount = 0;
    1819   do
    1820   {
    1821     xReadFlag( uiSymbol );
    1822     uiCount++;
    1823   }
    1824   while( uiSymbol && (uiCount != 13));
    1825 
    1826   ruiSymbol = uiCount-1;
    1827 
    1828   if( uiSymbol )
    1829   {
    1830     xReadEpExGolomb( uiSymbol, 0 );
    1831     ruiSymbol += uiSymbol+1;
    1832   }
    1833 
    1834   return;
    1835 }
    1836 
    1837 Void TDecCavlc::xReadEpExGolomb( UInt& ruiSymbol, UInt uiCount )
    1838 {
    1839   UInt uiSymbol = 0;
    1840   UInt uiBit = 1;
    1841 
    1842 
    1843   while( uiBit )
    1844   {
    1845     xReadFlag( uiBit );
    1846     uiSymbol += uiBit << uiCount++;
    1847   }
    1848 
    1849   uiCount--;
    1850   while( uiCount-- )
    1851   {
    1852     xReadFlag( uiBit );
    1853     uiSymbol += uiBit << uiCount;
    1854   }
    1855 
    1856   ruiSymbol = uiSymbol;
    1857 
    1858   return;
    1859 }
    1860 
    1861 UInt TDecCavlc::xGetBit()
    1862 {
    1863   UInt ruiCode;
    1864   m_pcBitstream->read( 1, ruiCode );
    1865   return ruiCode;
    1866 }
    1867 
    1868 
    18691760/** parse explicit wp tables
    18701761* \param TComSlice* pcSlice
     
    18831774  // decode delta_luma_log2_weight_denom :
    18841775  READ_UVLC( uiLog2WeightDenomLuma, "luma_log2_weight_denom" );     // ue(v): luma_log2_weight_denom
     1776  assert( uiLog2WeightDenomLuma <= 7 );
    18851777  if( bChroma )
    18861778  {
    18871779    READ_SVLC( iDeltaDenom, "delta_chroma_log2_weight_denom" );     // se(v): delta_chroma_log2_weight_denom
    18881780    assert((iDeltaDenom + (Int)uiLog2WeightDenomLuma)>=0);
     1781    assert((iDeltaDenom + (Int)uiLog2WeightDenomLuma)<=7);
    18891782    uiLog2WeightDenomChroma = (UInt)(iDeltaDenom + uiLog2WeightDenomLuma);
    18901783  }
     
    19251818        Int iDeltaWeight;
    19261819        READ_SVLC( iDeltaWeight, "delta_luma_weight_lX" );  // se(v): delta_luma_weight_l0[i]
     1820        assert( iDeltaWeight >= -128 );
     1821        assert( iDeltaWeight <=  127 );
    19271822        wp[0].iWeight = (iDeltaWeight + (1<<wp[0].uiLog2WeightDenom));
    19281823        READ_SVLC( wp[0].iOffset, "luma_offset_lX" );       // se(v): luma_offset_l0[i]
     1824        assert( wp[0].iOffset >= -128 );
     1825        assert( wp[0].iOffset <=  127 );
    19291826      }
    19301827      else
     
    19411838            Int iDeltaWeight;
    19421839            READ_SVLC( iDeltaWeight, "delta_chroma_weight_lX" );  // se(v): chroma_weight_l0[i][j]
     1840            assert( iDeltaWeight >= -128 );
     1841            assert( iDeltaWeight <=  127 );
    19431842            wp[j].iWeight = (iDeltaWeight + (1<<wp[1].uiLog2WeightDenom));
    19441843
    19451844            Int iDeltaChroma;
    19461845            READ_SVLC( iDeltaChroma, "delta_chroma_offset_lX" );  // se(v): delta_chroma_offset_l0[i][j]
     1846            assert( iDeltaChroma >= -512 );
     1847            assert( iDeltaChroma <=  511 );
    19471848            Int pred = ( 128 - ( ( 128*wp[j].iWeight)>>(wp[j].uiLog2WeightDenom) ) );
    19481849            wp[j].iOffset = Clip3(-128, 127, (iDeltaChroma + pred) );
  • branches/HTM-DEV-0.1-dev/source/Lib/TLibDecoder/TDecCAVLC.h

    r324 r362  
    6161 
    6262protected:
    63   Void  xReadEpExGolomb       ( UInt& ruiSymbol, UInt uiCount );
    64   Void  xReadExGolombLevel    ( UInt& ruiSymbol );
    65   Void  xReadUnaryMaxSymbol   ( UInt& ruiSymbol, UInt uiMaxSymbol );
    66  
    67   Void  xReadPCMAlignZero     ();
    68 
    69   UInt  xGetBit             ();
    70  
    7163  void  parseShortTermRefPicSet            (TComSPS* pcSPS, TComReferencePictureSet* pcRPS, Int idx);
    72 private:
    7364 
    7465public:
  • branches/HTM-DEV-0.1-dev/source/Lib/TLibDecoder/TDecSlice.h

    r324 r362  
    8484  Void      initCtxMem(  UInt i );
    8585  Void      setCtxMem( TDecSbac* sb, Int b )   { CTXMem[b] = sb; }
     86  Int       getCtxMemSize( )                   { return (Int)CTXMem.size(); }
    8687};
    8788
  • branches/HTM-DEV-0.1-dev/source/Lib/TLibDecoder/TDecTop.cpp

    r324 r362  
    4242ParameterSetManagerDecoder TDecTop::m_parameterSetManagerDecoder;
    4343#endif
    44 
    4544//! \ingroup TLibDecoder
    4645//! \{
     
    149148  }
    150149
     150#if L0323_DPB
     151  m_iMaxRefPicNum = pcSlice->getSPS()->getMaxDecPicBuffering(pcSlice->getTLayer())+pcSlice->getSPS()->getNumReorderPics(pcSlice->getTLayer());     // m_uiMaxDecPicBuffering has the space for the picture currently being decoded
     152#else
    151153  m_iMaxRefPicNum = pcSlice->getSPS()->getMaxDecPicBuffering(pcSlice->getTLayer())+pcSlice->getSPS()->getNumReorderPics(pcSlice->getTLayer()) + 1; // +1 to have space for the picture currently being decoded
     154#endif
    152155  if (m_cListPic.size() < (UInt)m_iMaxRefPicNum)
    153156  {
     
    290293  assert (sps != 0);
    291294
    292   if (false == m_parameterSetManagerDecoder.activatePPS(m_apcSlicePilot->getPPSId(),m_apcSlicePilot->getIdrPicFlag()))
     295  if (false == m_parameterSetManagerDecoder.activatePPS(m_apcSlicePilot->getPPSId(),m_apcSlicePilot->isIRAP()))
    293296  {
    294297    printf ("Parameter set activation failed!");
     
    296299  }
    297300
     301  if( pps->getDependentSliceSegmentsEnabledFlag() )
     302  {
     303    Int NumCtx = pps->getEntropyCodingSyncEnabledFlag()?2:1;
     304
     305    if (m_cSliceDecoder.getCtxMemSize() != NumCtx)
     306    {
     307      m_cSliceDecoder.initCtxMem(NumCtx);
     308      for ( UInt st = 0; st < NumCtx; st++ )
     309      {
     310        TDecSbac* ctx = NULL;
     311        ctx = new TDecSbac;
     312        ctx->init( &m_cBinCABAC );
     313        m_cSliceDecoder.setCtxMem( ctx, st );
     314      }
     315    }
     316  }
     317
    298318  m_apcSlicePilot->setPPS(pps);
    299319  m_apcSlicePilot->setSPS(sps);
    300 
    301 #if H_MV
    302   m_apcSlicePilot->setVPS( m_parameterSetManagerDecoder.getActiveVPS() );
    303 #endif
    304 
    305320  pps->setSPS(sps);
    306321  pps->setNumSubstreams(pps->getEntropyCodingSyncEnabledFlag() ? ((sps->getPicHeightInLumaSamples() + sps->getMaxCUHeight() - 1) / sps->getMaxCUHeight()) * (pps->getNumColumnsMinus1() + 1) : 1);
    307322  pps->setMinCuDQPSize( sps->getMaxCUWidth() >> ( pps->getMaxCuDQPDepth()) );
    308323
    309   for (Int i = 0; i < sps->getMaxCUDepth() - g_uiAddCUDepth; i++)
     324  g_bitDepthY     = sps->getBitDepthY();
     325  g_bitDepthC     = sps->getBitDepthC();
     326  g_uiMaxCUWidth  = sps->getMaxCUWidth();
     327  g_uiMaxCUHeight = sps->getMaxCUHeight();
     328  g_uiMaxCUDepth  = sps->getMaxCUDepth();
     329  g_uiAddCUDepth  = max (0, sps->getLog2MinCodingBlockSize() - (Int)sps->getQuadtreeTULog2MinSize() );
     330
     331  for (Int i = 0; i < sps->getLog2DiffMaxMinCodingBlockSize(); i++)
    310332  {
    311333    sps->setAMPAcc( i, sps->getUseAMP() );
    312334  }
    313335
    314   for (Int i = sps->getMaxCUDepth() - g_uiAddCUDepth; i < sps->getMaxCUDepth(); i++)
     336  for (Int i = sps->getLog2DiffMaxMinCodingBlockSize(); i < sps->getMaxCUDepth(); i++)
    315337  {
    316338    sps->setAMPAcc( i, 0 );
     
    318340
    319341  m_cSAO.destroy();
    320   m_cSAO.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight );
    321   m_cLoopFilter.        create( g_uiMaxCUDepth );
     342  m_cSAO.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), sps->getMaxCUWidth(), sps->getMaxCUHeight() );
     343  m_cLoopFilter.create( sps->getMaxCUDepth() );
    322344}
    323345
     
    345367
    346368  m_apcSlicePilot->setNalUnitType(nalu.m_nalUnitType);
    347   if((m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TRAIL_N) ||
    348      (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N) ||
    349      (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_N))
    350   {
    351     m_apcSlicePilot->setTemporalLayerNonReferenceFlag(true);
    352   }
     369  Bool nonReferenceFlag = (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TRAIL_N ||
     370                           m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N   ||
     371                           m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_N  ||
     372                           m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_N  ||
     373                           m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N);
     374  m_apcSlicePilot->setTemporalLayerNonReferenceFlag(nonReferenceFlag);
     375 
    353376  m_apcSlicePilot->setReferenced(true); // Putting this as true ensures that picture is referenced the first time it is in an RPS
    354377  m_apcSlicePilot->setTLayerInfo(nalu.m_temporalId);
     
    371394#endif
    372395#endif
    373 
    374   if (m_apcSlicePilot->isNextSlice())
    375   {
    376396    // Skip pictures due to random access
    377397    if (isRandomAccessSkipPicture(iSkipFrame, iPOCLastDisplay))
     
    384404      return false;
    385405    }
    386   }
    387 
     406
     407  //we should only get a different poc for a new picture (with CTU address==0)
     408  if (m_apcSlicePilot->isNextSlice() && m_apcSlicePilot->getPOC()!=m_prevPOC && !m_bFirstSliceInSequence && (!m_apcSlicePilot->getSliceCurStartCUAddr()==0))
     409  {
     410    printf ("Warning, the first slice of a picture might have been lost!\n");
     411  }
    388412  // exit when a new picture is found
    389   if (m_apcSlicePilot->isNextSlice() && m_apcSlicePilot->getPOC()!=m_prevPOC && !m_bFirstSliceInSequence)
     413  if (m_apcSlicePilot->isNextSlice() && (m_apcSlicePilot->getSliceCurStartCUAddr() == 0 && !m_bFirstSliceInPicture) && !m_bFirstSliceInSequence )
    390414  {
    391415    if (m_prevPOC >= m_pocRandomAccess)
     
    396420    m_prevPOC = m_apcSlicePilot->getPOC();
    397421  }
    398 
    399422#if H_MV
    400423  if ( newLayerFlag )
     
    403426  }
    404427#endif
    405 
    406 
    407428  // actual decoding starts here
    408429  xActivateParameterSets();
     
    419440    xCreateLostPicture(lostPoc-1);
    420441  }
    421 
    422442  if (m_bFirstSliceInPicture)
    423443  {
     
    425445    m_cPrediction.initTempBuff();
    426446    m_apcSlicePilot->applyReferencePictureSet(m_cListPic, m_apcSlicePilot->getRPS());
    427    
    428447#if H_MV
    429448    m_apcSlicePilot->createAndApplyIvReferencePictureSet( m_ivPicLists, m_refPicSetInterLayer );
    430449#endif
    431 
    432 
    433450    //  Get a new picture buffer
    434451    xGetNewPicBuffer (m_apcSlicePilot, pcPic);
     
    569586#endif
    570587#endif
    571 
    572588  if (bNextSlice)
    573589  {
    574     pcSlice->checkCRA(pcSlice->getRPS(), m_pocCRA, m_prevRAPisBLA );
     590    pcSlice->checkCRA(pcSlice->getRPS(), m_pocCRA, m_prevRAPisBLA, m_cListPic );
    575591    // Set reference list
    576 
    577592#if H_MV   
    578     pcSlice->setRefPicList( m_cListPic, m_refPicSetInterLayer );   
     593    pcSlice->setRefPicList( m_cListPic, true, m_refPicSetInterLayer );   
     594#else
     595#if FIX1071
     596    pcSlice->setRefPicList( m_cListPic, true );
    579597#else
    580598    pcSlice->setRefPicList( m_cListPic );
    581599#endif
    582600
     601#endif
    583602    // For generalized B
    584603    // note: maybe not existed case (always L0 is copied to L1 if L1 is empty)
     
    622641    //---------------
    623642    pcSlice->setRefPOCList();
     643#if !L0034_COMBINED_LIST_CLEANUP
    624644    pcSlice->setNoBackPredFlag( false );
    625645    if ( pcSlice->getSliceType() == B_SLICE )
     
    638658      }
    639659    }
     660#endif
    640661  }
    641662
     
    691712  m_cEntropyDecoder.decodePPS( pps );
    692713  m_parameterSetManagerDecoder.storePrefetchedPPS( pps );
    693 
    694   if( pps->getDependentSliceSegmentsEnabledFlag() )
    695   {
    696     Int NumCtx = pps->getEntropyCodingSyncEnabledFlag()?2:1;
    697     m_cSliceDecoder.initCtxMem(NumCtx);
    698     for ( UInt st = 0; st < NumCtx; st++ )
    699     {
    700       TDecSbac* ctx = NULL;
    701       ctx = new TDecSbac;
    702       ctx->init( &m_cBinCABAC );
    703       m_cSliceDecoder.setCtxMem( ctx, st );
    704     }
    705   }
    706714}
    707715
    708716Void TDecTop::xDecodeSEI( TComInputBitstream* bs, const NalUnitType nalUnitType )
    709717{
    710   if(nalUnitType == NAL_UNIT_SEI_SUFFIX)
     718  if(nalUnitType == NAL_UNIT_SUFFIX_SEI)
    711719  {
    712720    m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveSPS() );
     
    753761      return false;
    754762     
    755     case NAL_UNIT_SEI:
    756     case NAL_UNIT_SEI_SUFFIX:
     763    case NAL_UNIT_PREFIX_SEI:
     764    case NAL_UNIT_SUFFIX_SEI:
    757765      xDecodeSEI( nalu.m_Bitstream, nalu.m_nalUnitType );
    758766      return false;
     
    760768    case NAL_UNIT_CODED_SLICE_TRAIL_R:
    761769    case NAL_UNIT_CODED_SLICE_TRAIL_N:
    762     case NAL_UNIT_CODED_SLICE_TLA:
     770    case NAL_UNIT_CODED_SLICE_TLA_R:
    763771    case NAL_UNIT_CODED_SLICE_TSA_N:
    764772    case NAL_UNIT_CODED_SLICE_STSA_R:
    765773    case NAL_UNIT_CODED_SLICE_STSA_N:
    766     case NAL_UNIT_CODED_SLICE_BLA:
    767     case NAL_UNIT_CODED_SLICE_BLANT:
     774    case NAL_UNIT_CODED_SLICE_BLA_W_LP:
     775    case NAL_UNIT_CODED_SLICE_BLA_W_RADL:
    768776    case NAL_UNIT_CODED_SLICE_BLA_N_LP:
    769     case NAL_UNIT_CODED_SLICE_IDR:
     777    case NAL_UNIT_CODED_SLICE_IDR_W_RADL:
    770778    case NAL_UNIT_CODED_SLICE_IDR_N_LP:
    771779    case NAL_UNIT_CODED_SLICE_CRA:
    772780    case NAL_UNIT_CODED_SLICE_RADL_N:
    773     case NAL_UNIT_CODED_SLICE_DLP:
     781    case NAL_UNIT_CODED_SLICE_RADL_R:
    774782    case NAL_UNIT_CODED_SLICE_RASL_N:
    775     case NAL_UNIT_CODED_SLICE_TFD:
    776 #if H_MV
    777       return xDecodeSlice(nalu, iSkipFrame, iPOCLastDisplay, newLayerFlag);
    778 #else
     783    case NAL_UNIT_CODED_SLICE_RASL_R:
    779784      return xDecodeSlice(nalu, iSkipFrame, iPOCLastDisplay);
    780 #endif
    781785      break;
    782786    default:
     
    795799Bool TDecTop::isSkipPictureForBLA(Int& iPOCLastDisplay)
    796800{
    797   if (m_prevRAPisBLA && m_apcSlicePilot->getPOC() < m_pocCRA && (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TFD || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N))
     801  if (m_prevRAPisBLA && m_apcSlicePilot->getPOC() < m_pocCRA && (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_R || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N))
    798802  {
    799803    iPOCLastDisplay++;
     
    826830  {
    827831    if (   m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA
    828         || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA
     832        || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP
    829833        || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP
    830         || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLANT )
     834        || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL )
    831835    {
    832836      // set the POC random access since we need to skip the reordered pictures in the case of CRA/CRANT/BLA/BLANT.
    833837      m_pocRandomAccess = m_apcSlicePilot->getPOC();
    834838    }
    835     else if ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP )
     839    else if ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP )
    836840    {
    837841      m_pocRandomAccess = -MAX_INT; // no need to skip the reordered pictures in IDR, they are decodable.
     
    849853  }
    850854  // skip the reordered pictures, if necessary
    851   else if (m_apcSlicePilot->getPOC() < m_pocRandomAccess && (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TFD || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N))
     855  else if (m_apcSlicePilot->getPOC() < m_pocRandomAccess && (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_R || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N))
    852856  {
    853857    iPOCLastDisplay++;
     
    881885
    882886#endif
    883 
    884887//! \}
  • branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/SEIwrite.cpp

    r324 r362  
    8484    fprintf( g_hTrace, "=========== Decoding Unit Information SEI message ===========\n");
    8585    break;
     86#if J0149_TONE_MAPPING_SEI
     87  case SEI::TONE_MAPPING_INFO:
     88    fprintf( g_hTrace, "=========== Tone Mapping Info SEI message ===========\n");
     89    break;
     90#endif
     91#if L0208_SOP_DESCRIPTION_SEI
     92  case SEI::SOP_DESCRIPTION:
     93    fprintf( g_hTrace, "=========== SOP Description SEI message ===========\n");
     94    break;
     95#endif
     96#if K0180_SCALABLE_NESTING_SEI
     97  case SEI::SCALABLE_NESTING:
     98    fprintf( g_hTrace, "=========== Scalable Nesting SEI message ===========\n");
     99    break;
     100#endif
    86101  default:
    87102    fprintf( g_hTrace, "=========== Unknown SEI message ===========\n");
     
    91106#endif
    92107
     108#if K0180_SCALABLE_NESTING_SEI
     109void SEIWriter::xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComSPS *sps)
     110#else
    93111void SEIWriter::xWriteSEIpayloadData(const SEI& sei, TComSPS *sps)
     112#endif
    94113{
    95114  switch (sei.payloadType())
     
    128147    xWriteSEIGradualDecodingRefreshInfo(*static_cast<const SEIGradualDecodingRefreshInfo*>(&sei));
    129148    break;
     149#if J0149_TONE_MAPPING_SEI
     150  case SEI::TONE_MAPPING_INFO:
     151    xWriteSEIToneMappingInfo(*static_cast<const SEIToneMappingInfo*>(&sei));
     152    break;
     153#endif
     154#if L0208_SOP_DESCRIPTION_SEI
     155  case SEI::SOP_DESCRIPTION:
     156    xWriteSEISOPDescription(*static_cast<const SEISOPDescription*>(&sei));
     157    break;
     158#endif
     159#if K0180_SCALABLE_NESTING_SEI
     160  case SEI::SCALABLE_NESTING:
     161    xWriteSEIScalableNesting(bs, *static_cast<const SEIScalableNesting*>(&sei), sps);
     162    break;
     163#endif
    130164  default:
    131165    assert(!"Unhandled SEI message");
     
    145179  setBitstream(&bs_count);
    146180
     181
     182#if K0180_SCALABLE_NESTING_SEI
     183
     184#if ENC_DEC_TRACE
     185  Bool traceEnable = g_HLSTraceEnable;
     186  g_HLSTraceEnable = false;
     187#endif
     188  xWriteSEIpayloadData(bs_count, sei, sps);
     189#if ENC_DEC_TRACE
     190  g_HLSTraceEnable = traceEnable;
     191#endif
     192
     193#else
     194
    147195#if ENC_DEC_TRACE
    148196  g_HLSTraceEnable = false;
     
    152200  g_HLSTraceEnable = true;
    153201#endif
     202
     203#endif
     204
    154205  UInt payload_data_num_bits = bs_count.getNumberOfWrittenBits();
    155206  assert(0 == payload_data_num_bits % 8);
     
    158209
    159210#if ENC_DEC_TRACE
     211#if K0180_SCALABLE_NESTING_SEI
     212  if (g_HLSTraceEnable)
     213#endif
    160214  xTraceSEIHeader();
    161215#endif
     
    177231  /* payloadData */
    178232#if ENC_DEC_TRACE
     233#if K0180_SCALABLE_NESTING_SEI
     234  if (g_HLSTraceEnable)
     235#endif
    179236  xTraceSEIMessageType(sei.payloadType());
    180237#endif
    181238
     239#if K0180_SCALABLE_NESTING_SEI
     240  xWriteSEIpayloadData(bs, sei, sps);
     241#else
    182242  xWriteSEIpayloadData(sei, sps);
     243#endif
    183244}
    184245
     
    421482  xWriteByteAlign();
    422483}
     484
     485#if J0149_TONE_MAPPING_SEI
     486Void SEIWriter::xWriteSEIToneMappingInfo(const SEIToneMappingInfo& sei)
     487{
     488  Int i;
     489  WRITE_UVLC( sei.m_toneMapId,                    "tone_map_id" );
     490  WRITE_FLAG( sei.m_toneMapCancelFlag,            "tone_map_cancel_flag" );
     491  if( !sei.m_toneMapCancelFlag )
     492  {
     493    WRITE_FLAG( sei.m_toneMapPersistenceFlag,     "tone_map_persistence_flag" );
     494    WRITE_CODE( sei.m_codedDataBitDepth,    8,    "coded_data_bit_depth" );
     495    WRITE_CODE( sei.m_targetBitDepth,       8,    "target_bit_depth" );
     496    WRITE_UVLC( sei.m_modelId,                    "model_id" );
     497    switch(sei.m_modelId)
     498    {
     499    case 0:
     500      {
     501        WRITE_CODE( sei.m_minValue,  32,        "min_value" );
     502        WRITE_CODE( sei.m_maxValue, 32,         "max_value" );
     503        break;
     504      }
     505    case 1:
     506      {
     507        WRITE_CODE( sei.m_sigmoidMidpoint, 32,  "sigmoid_midpoint" );
     508        WRITE_CODE( sei.m_sigmoidWidth,    32,  "sigmoid_width"    );
     509        break;
     510      }
     511    case 2:
     512      {
     513        UInt num = 1u << sei.m_targetBitDepth;
     514        for(i = 0; i < num; i++)
     515        {
     516          WRITE_CODE( sei.m_startOfCodedInterval[i], (( sei.m_codedDataBitDepth + 7 ) >> 3 ) << 3,  "start_of_coded_interval" );
     517        }
     518        break;
     519      }
     520    case 3:
     521      {
     522        WRITE_CODE( sei.m_numPivots, 16,          "num_pivots" );
     523        for(i = 0; i < sei.m_numPivots; i++ )
     524        {
     525          WRITE_CODE( sei.m_codedPivotValue[i], (( sei.m_codedDataBitDepth + 7 ) >> 3 ) << 3,       "coded_pivot_value" );
     526          WRITE_CODE( sei.m_targetPivotValue[i], (( sei.m_targetBitDepth + 7 ) >> 3 ) << 3,         "target_pivot_value");
     527        }
     528        break;
     529      }
     530    case 4:
     531      {
     532        WRITE_CODE( sei.m_cameraIsoSpeedIdc,    8,    "camera_iso_speed_idc" );
     533        if( sei.m_cameraIsoSpeedIdc == 255) //Extended_ISO
     534        {
     535          WRITE_CODE( sei.m_cameraIsoSpeedValue,    32,    "camera_iso_speed_value" );
     536        }
     537        WRITE_FLAG( sei.m_exposureCompensationValueSignFlag,           "exposure_compensation_value_sign_flag" );
     538        WRITE_CODE( sei.m_exposureCompensationValueNumerator,     16,  "exposure_compensation_value_numerator" );
     539        WRITE_CODE( sei.m_exposureCompensationValueDenomIdc,      16,  "exposure_compensation_value_denom_idc" );
     540        WRITE_CODE( sei.m_refScreenLuminanceWhite,                32,  "ref_screen_luminance_white" );
     541        WRITE_CODE( sei.m_extendedRangeWhiteLevel,                32,  "extended_range_white_level" );
     542        WRITE_CODE( sei.m_nominalBlackLevelLumaCodeValue,         16,  "nominal_black_level_luma_code_value" );
     543        WRITE_CODE( sei.m_nominalWhiteLevelLumaCodeValue,         16,  "nominal_white_level_luma_code_value" );
     544        WRITE_CODE( sei.m_extendedWhiteLevelLumaCodeValue,        16,  "extended_white_level_luma_code_value" );
     545        break;
     546      }
     547    default:
     548      {
     549        assert(!"Undefined SEIToneMapModelId");
     550        break;
     551      }
     552    }//switch m_modelId
     553  }//if(!sei.m_toneMapCancelFlag)
     554
     555  xWriteByteAlign();
     556}
     557#endif
     558
    423559Void SEIWriter::xWriteSEIDisplayOrientation(const SEIDisplayOrientation &sei)
    424560{
     
    455591}
    456592
     593#if L0208_SOP_DESCRIPTION_SEI
     594Void SEIWriter::xWriteSEISOPDescription(const SEISOPDescription& sei)
     595{
     596  WRITE_UVLC( sei.m_sopSeqParameterSetId,           "sop_seq_parameter_set_id"               );
     597  WRITE_UVLC( sei.m_numPicsInSopMinus1,             "num_pics_in_sop_minus1"               );
     598  for (UInt i = 0; i <= sei.m_numPicsInSopMinus1; i++)
     599  {
     600    WRITE_CODE( sei.m_sopDescVclNaluType[i], 6, "sop_desc_vcl_nalu_type" );
     601    WRITE_CODE( sei.m_sopDescTemporalId[i],  3, "sop_desc_temporal_id" );
     602    if (sei.m_sopDescVclNaluType[i] != NAL_UNIT_CODED_SLICE_IDR_W_RADL && sei.m_sopDescVclNaluType[i] != NAL_UNIT_CODED_SLICE_IDR_N_LP)
     603    {
     604      WRITE_UVLC( sei.m_sopDescStRpsIdx[i],           "sop_desc_st_rps_idx"               );
     605    }
     606    if (i > 0)
     607    {
     608      WRITE_SVLC( sei.m_sopDescPocDelta[i],           "sop_desc_poc_delta"               );
     609    }
     610  }
     611
     612  xWriteByteAlign();
     613}
     614#endif
     615
     616#if K0180_SCALABLE_NESTING_SEI
     617Void SEIWriter::xWriteSEIScalableNesting(TComBitIf& bs, const SEIScalableNesting& sei, TComSPS *sps)
     618{
     619  WRITE_FLAG( sei.m_bitStreamSubsetFlag,             "bitstream_subset_flag"         );
     620  WRITE_FLAG( sei.m_nestingOpFlag,                   "nesting_op_flag      "         );
     621  if (sei.m_nestingOpFlag)
     622  {
     623    WRITE_FLAG( sei.m_defaultOpFlag,                 "default_op_flag"               );
     624    WRITE_UVLC( sei.m_nestingNumOpsMinus1,           "nesting_num_ops"               );
     625    for (UInt i = (sei.m_defaultOpFlag ? 1 : 0); i <= sei.m_nestingNumOpsMinus1; i++)
     626    {
     627      WRITE_CODE( sei.m_nestingNoOpMaxTemporalIdPlus1, 3, "nesting_no_op_max_temporal_id" );
     628      WRITE_CODE( sei.m_nestingMaxTemporalIdPlus1[i], 3,  "nesting_max_temporal_id"       );
     629      WRITE_UVLC( sei.m_nestingOpIdx[i],                  "nesting_op_idx"                );
     630    }
     631  }
     632  else
     633  {
     634    WRITE_FLAG( sei.m_allLayersFlag,                      "all_layers_flag"               );
     635    if (!sei.m_allLayersFlag)
     636    {
     637      WRITE_CODE( sei.m_nestingNoOpMaxTemporalIdPlus1, 3, "nesting_no_op_max_temporal_id" );
     638      WRITE_UVLC( sei.m_nestingNumLayersMinus1,           "nesting_num_layers"            );
     639      for (UInt i = 0; i <= sei.m_nestingNumLayersMinus1; i++)
     640      {
     641        WRITE_CODE( sei.m_nestingLayerId[i], 6,           "nesting_layer_id"              );
     642      }
     643    }
     644  }
     645 
     646  // byte alignment
     647  while ( m_pcBitIf->getNumberOfWrittenBits() % 8 != 0 )
     648  {
     649    WRITE_FLAG( 0, "nesting_zero_bit" );
     650  }
     651
     652  // write nested SEI messages
     653  for (SEIMessages::const_iterator it = sei.m_nestedSEIs.begin(); it != sei.m_nestedSEIs.end(); it++)
     654  {
     655    writeSEImessage(bs, *(*it), sps);
     656  }
     657}
     658#endif
     659
    457660Void SEIWriter::xWriteByteAlign()
    458661{
  • branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/SEIwrite.h

    r324 r362  
    5050
    5151protected:
     52#if K0180_SCALABLE_NESTING_SEI
     53  Void xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComSPS *sps);
     54#else
    5255  Void xWriteSEIpayloadData(const SEI& sei, TComSPS *sps);
     56#endif
    5357  Void xWriteSEIuserDataUnregistered(const SEIuserDataUnregistered &sei);
    5458  Void xWriteSEIActiveParameterSets(const SEIActiveParameterSets& sei);
     
    6367  Void xWriteSEITemporalLevel0Index(const SEITemporalLevel0Index &sei);
    6468  Void xWriteSEIGradualDecodingRefreshInfo(const SEIGradualDecodingRefreshInfo &sei);
     69#if J0149_TONE_MAPPING_SEI
     70  Void xWriteSEIToneMappingInfo(const SEIToneMappingInfo& sei);
     71#endif
     72#if L0208_SOP_DESCRIPTION_SEI
     73  Void xWriteSEISOPDescription(const SEISOPDescription& sei);
     74#endif
     75#if K0180_SCALABLE_NESTING_SEI
     76  Void xWriteSEIScalableNesting(TComBitIf& bs, const SEIScalableNesting& sei, TComSPS *sps);
     77#endif
    6578  Void xWriteByteAlign();
    6679};
  • branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/TEncCavlc.cpp

    r331 r362  
    285285  WRITE_FLAG(pcVUI->getNeutralChromaIndicationFlag(),           "neutral_chroma_indication_flag");
    286286  WRITE_FLAG(pcVUI->getFieldSeqFlag(),                          "field_seq_flag");
    287   assert(pcVUI->getFieldSeqFlag() == 0);                        // not currently supported
    288287  WRITE_FLAG(pcVUI->getFrameFieldInfoPresentFlag(),             "frame_field_info_present_flag");
    289288
     
    474473  for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++)
    475474  {
     475#if L0323_DPB
     476    WRITE_UVLC( pcSPS->getMaxDecPicBuffering(i) - 1,       "sps_max_dec_pic_buffering_minus1[i]" );
     477#else
    476478    WRITE_UVLC( pcSPS->getMaxDecPicBuffering(i),           "sps_max_dec_pic_buffering[i]" );
     479#endif
    477480    WRITE_UVLC( pcSPS->getNumReorderPics(i),               "sps_num_reorder_pics[i]" );
    478481    WRITE_UVLC( pcSPS->getMaxLatencyIncrease(i),           "sps_max_latency_increase[i]" );
     
    484487  assert( pcSPS->getMaxCUWidth() == pcSPS->getMaxCUHeight() );
    485488 
    486   UInt MinCUSize = pcSPS->getMaxCUWidth() >> ( pcSPS->getMaxCUDepth()-g_uiAddCUDepth );
    487   UInt log2MinCUSize = 0;
    488   while(MinCUSize > 1)
    489   {
    490     MinCUSize >>= 1;
    491     log2MinCUSize++;
    492   }
    493 
    494   WRITE_UVLC( log2MinCUSize - 3,                                                     "log2_min_coding_block_size_minus3" );
    495   WRITE_UVLC( pcSPS->getMaxCUDepth()-g_uiAddCUDepth,                                 "log2_diff_max_min_coding_block_size" );
     489  WRITE_UVLC( pcSPS->getLog2MinCodingBlockSize() - 3,                                "log2_min_coding_block_size_minus3" );
     490  WRITE_UVLC( pcSPS->getLog2DiffMaxMinCodingBlockSize(),                             "log2_diff_max_min_coding_block_size" );
    496491  WRITE_UVLC( pcSPS->getQuadtreeTULog2MinSize() - 2,                                 "log2_min_transform_block_size_minus2" );
    497492  WRITE_UVLC( pcSPS->getQuadtreeTULog2MaxSize() - pcSPS->getQuadtreeTULog2MinSize(), "log2_diff_max_min_transform_block_size" );
     
    575570  WRITE_FLAG( pcVPS->getTemporalNestingFlag(),                "vps_temporal_id_nesting_flag" );
    576571  assert (pcVPS->getMaxTLayers()>1||pcVPS->getTemporalNestingFlag());
     572#if H_MV
    577573  WRITE_CODE( 0xffff,                              16,        "vps_extension_offset" );
     574#else
     575  WRITE_CODE( 0xffff,                              16,        "vps_reserved_ffff_16bits" );
     576#endif
    578577  codePTL( pcVPS->getPTL(), true, pcVPS->getMaxTLayers() - 1 );
    579578#if SIGNAL_BITRATE_PICRATE_IN_VPS
     
    584583  for(UInt i=0; i <= pcVPS->getMaxTLayers()-1; i++)
    585584  {
     585#if L0323_DPB
     586    WRITE_UVLC( pcVPS->getMaxDecPicBuffering(i) - 1,       "vps_max_dec_pic_buffering_minus1[i]" );
     587#else
    586588    WRITE_UVLC( pcVPS->getMaxDecPicBuffering(i),           "vps_max_dec_pic_buffering[i]" );
     589#endif
    587590    WRITE_UVLC( pcVPS->getNumReorderPics(i),               "vps_num_reorder_pics[i]" );
    588591    WRITE_UVLC( pcVPS->getMaxLatencyIncrease(i),           "vps_max_latency_increase[i]" );
     
    790793      WRITE_CODE( picOrderCntLSB, pcSlice->getSPS()->getBitsForPOC(), "pic_order_cnt_lsb");
    791794      TComReferencePictureSet* rps = pcSlice->getRPS();
     795     
     796#if FIX1071
     797      // Deal with bitstream restriction stating that:
     798      // – If the current picture is a BLA or CRA picture, the value of NumPocTotalCurr shall be equal to 0.
     799      // Ideally this process should not be repeated for each slice in a picture
     800      TComReferencePictureSet altRps;
     801      Bool useAltRps = false;
     802      if (pcSlice->getRapPicFlag())
     803      {
     804        for (Int picIdx = 0; !useAltRps && picIdx < rps->getNumberOfPictures(); picIdx++)
     805        {
     806          useAltRps = rps->getUsed(picIdx);
     807        }
     808        if (useAltRps)
     809        {
     810          memcpy(&altRps, rps, sizeof(TComReferencePictureSet));
     811          rps = &altRps;
     812          for (Int picIdx = 0; picIdx < rps->getNumberOfPictures(); picIdx++)
     813          {
     814            rps->setUsed(picIdx, false);
     815          }
     816        }
     817      }
     818
     819      if(pcSlice->getRPSidx() < 0 || useAltRps)
     820#else
    792821      if(pcSlice->getRPSidx() < 0)
     822#endif
    793823      {
    794824        WRITE_FLAG( 0, "short_term_ref_pic_set_sps_flag");
     
    13731403// ====================================================================================================================
    13741404
    1375 
    1376 /** Write PCM alignment bits.
    1377  * \returns Void
    1378  */
    1379 Void  TEncCavlc::xWritePCMAlignZero    ()
    1380 {
    1381   m_pcBitIf->writeAlignZero();
    1382 }
    1383 
    1384 Void TEncCavlc::xWriteUnaryMaxSymbol( UInt uiSymbol, UInt uiMaxSymbol )
    1385 {
    1386   if (uiMaxSymbol == 0)
    1387   {
    1388     return;
    1389   }
    1390   xWriteFlag( uiSymbol ? 1 : 0 );
    1391   if ( uiSymbol == 0 )
    1392   {
    1393     return;
    1394   }
    1395  
    1396   Bool bCodeLast = ( uiMaxSymbol > uiSymbol );
    1397  
    1398   while( --uiSymbol )
    1399   {
    1400     xWriteFlag( 1 );
    1401   }
    1402   if( bCodeLast )
    1403   {
    1404     xWriteFlag( 0 );
    1405   }
    1406   return;
    1407 }
    1408 
    1409 Void TEncCavlc::xWriteExGolombLevel( UInt uiSymbol )
    1410 {
    1411   if( uiSymbol )
    1412   {
    1413     xWriteFlag( 1 );
    1414     UInt uiCount = 0;
    1415     Bool bNoExGo = (uiSymbol < 13);
    1416    
    1417     while( --uiSymbol && ++uiCount < 13 )
    1418     {
    1419       xWriteFlag( 1 );
    1420     }
    1421     if( bNoExGo )
    1422     {
    1423       xWriteFlag( 0 );
    1424     }
    1425     else
    1426     {
    1427       xWriteEpExGolomb( uiSymbol, 0 );
    1428     }
    1429   }
    1430   else
    1431   {
    1432     xWriteFlag( 0 );
    1433   }
    1434   return;
    1435 }
    1436 
    1437 Void TEncCavlc::xWriteEpExGolomb( UInt uiSymbol, UInt uiCount )
    1438 {
    1439   while( uiSymbol >= (UInt)(1<<uiCount) )
    1440   {
    1441     xWriteFlag( 1 );
    1442     uiSymbol -= 1<<uiCount;
    1443     uiCount  ++;
    1444   }
    1445   xWriteFlag( 0 );
    1446   while( uiCount-- )
    1447   {
    1448     xWriteFlag( (uiSymbol>>uiCount) & 1 );
    1449   }
    1450   return;
    1451 }
    1452 
    14531405/** code explicit wp tables
    14541406 * \param TComSlice* pcSlice
  • branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/TEncCavlc.h

    r324 r362  
    6868  TComSlice*    m_pcSlice;
    6969  UInt          m_uiCoeffCost;
    70 
    71   Void  xWritePCMAlignZero    ();
    72   Void  xWriteEpExGolomb      ( UInt uiSymbol, UInt uiCount );
    73   Void  xWriteExGolombLevel    ( UInt uiSymbol );
    74   Void  xWriteUnaryMaxSymbol  ( UInt uiSymbol, UInt uiMaxSymbol );
    7570
    7671  Void codeShortTermRefPicSet              ( TComSPS* pcSPS, TComReferencePictureSet* pcRPS, Bool calledFromSliceHeader, Int idx );
  • branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/TEncCfg.h

    r324 r362  
    7474  Int m_interViewRefPosL[2][MAX_NUM_REF_PICS]; 
    7575#endif
    76 
    7776  GOPEntry()
    7877  : m_POC(-1)
     
    9897#if H_MV
    9998    ::memset( m_interViewRefs,   0, sizeof(m_interViewRefs) );
    100     ::memset( m_interViewRefPosL[0], -1, sizeof(m_interViewRefPosL[0]) );
    101     ::memset( m_interViewRefPosL[1], -1, sizeof(m_interViewRefPosL[1]) );
    102 #endif
     99    ::memset( m_interViewRefPosL[0], -1, sizeof(m_interViewRefPosL[0]) );    ::memset( m_interViewRefPosL[1], -1, sizeof(m_interViewRefPosL[1]) );#endif
    103100  }
    104101};
     
    172169  Int       m_loopFilterTcOffsetDiv2;
    173170  Bool      m_DeblockingFilterControlPresent;
     171#if L0386_DB_METRIC
     172  Bool      m_DeblockingFilterMetric;
     173#endif
    174174  Bool      m_bUseSAO;
    175175  Int       m_maxNumOffsetsPerPic;
     
    202202  Bool      m_bUseASR;
    203203  Bool      m_bUseHADME;
     204#if !L0034_COMBINED_LIST_CLEANUP
    204205  Bool      m_bUseLComb;
     206#endif
    205207  Bool      m_useRDOQ;
    206208  Bool      m_useRDOQTS;
     
    248250  Int       m_pictureTimingSEIEnabled;
    249251  Int       m_recoveryPointSEIEnabled;
     252#if J0149_TONE_MAPPING_SEI
     253  Bool      m_toneMappingInfoSEIEnabled;
     254  Int       m_toneMapId;
     255  Bool      m_toneMapCancelFlag;
     256  Bool      m_toneMapPersistenceFlag;
     257  Int       m_codedDataBitDepth;
     258  Int       m_targetBitDepth;
     259  Int       m_modelId;
     260  Int       m_minValue;
     261  Int       m_maxValue;
     262  Int       m_sigmoidMidpoint;
     263  Int       m_sigmoidWidth;
     264  Int       m_numPivots;
     265  Int       m_cameraIsoSpeedIdc;
     266  Int       m_cameraIsoSpeedValue;
     267  Int       m_exposureCompensationValueSignFlag;
     268  Int       m_exposureCompensationValueNumerator;
     269  Int       m_exposureCompensationValueDenomIdc;
     270  Int       m_refScreenLuminanceWhite;
     271  Int       m_extendedRangeWhiteLevel;
     272  Int       m_nominalBlackLevelLumaCodeValue;
     273  Int       m_nominalWhiteLevelLumaCodeValue;
     274  Int       m_extendedWhiteLevelLumaCodeValue;
     275  Int*      m_startOfCodedInterval;
     276  Int*      m_codedPivotValue;
     277  Int*      m_targetPivotValue;
     278#endif
    250279  Int       m_framePackingSEIEnabled;
    251280  Int       m_framePackingSEIType;
     
    257286  Int       m_gradualDecodingRefreshInfoEnabled;
    258287  Int       m_decodingUnitInfoSEIEnabled;
     288#if L0208_SOP_DESCRIPTION_SEI
     289  Int       m_SOPDescriptionSEIEnabled;
     290#endif
     291#if K0180_SCALABLE_NESTING_SEI
     292  Int       m_scalableNestingSEIEnabled;
     293#endif
    259294  //====== Weighted Prediction ========
    260295  Bool      m_useWeightedPred;       //< Use of Weighting Prediction (P_SLICE)
     
    325360#endif
    326361#endif
    327 
    328362public:
    329363  TEncCfg()
     
    409443  Void      setLoopFilterTcOffset           ( Int   i )      { m_loopFilterTcOffsetDiv2    = i; }
    410444  Void      setDeblockingFilterControlPresent ( Bool b ) { m_DeblockingFilterControlPresent = b; }
     445#if L0386_DB_METRIC
     446  Void      setDeblockingFilterMetric       ( Bool  b )      { m_DeblockingFilterMetric = b; }
     447#endif
    411448
    412449  //====== Motion search ========
     
    463500  Int       getLoopFilterTcOffset           ()      { return m_loopFilterTcOffsetDiv2; }
    464501  Bool      getDeblockingFilterControlPresent()  { return  m_DeblockingFilterControlPresent; }
     502#if L0386_DB_METRIC
     503  Bool      getDeblockingFilterMetric       ()      { return m_DeblockingFilterMetric; }
     504#endif
    465505
    466506  //==== Motion search ========
     
    480520  Void      setUseASR                       ( Bool  b )     { m_bUseASR     = b; }
    481521  Void      setUseHADME                     ( Bool  b )     { m_bUseHADME   = b; }
     522#if !L0034_COMBINED_LIST_CLEANUP
    482523  Void      setUseLComb                     ( Bool  b )     { m_bUseLComb   = b; }
     524#endif
    483525  Void      setUseRDOQ                      ( Bool  b )     { m_useRDOQ    = b; }
    484526  Void      setUseRDOQTS                    ( Bool  b )     { m_useRDOQTS  = b; }
     
    502544  Bool      getUseASR                       ()      { return m_bUseASR;     }
    503545  Bool      getUseHADME                     ()      { return m_bUseHADME;   }
     546#if !L0034_COMBINED_LIST_CLEANUP
    504547  Bool      getUseLComb                     ()      { return m_bUseLComb;   }
     548#endif
    505549  Bool      getUseRDOQ                      ()      { return m_useRDOQ;    }
    506550  Bool      getUseRDOQTS                    ()      { return m_useRDOQTS;  }
     
    599643  Void  setRecoveryPointSEIEnabled(Int b)                { m_recoveryPointSEIEnabled = b; }
    600644  Int   getRecoveryPointSEIEnabled()                     { return m_recoveryPointSEIEnabled; }
     645#if J0149_TONE_MAPPING_SEI
     646  Void  setToneMappingInfoSEIEnabled(Bool b)                 {  m_toneMappingInfoSEIEnabled = b;  }
     647  Bool  getToneMappingInfoSEIEnabled()                       {  return m_toneMappingInfoSEIEnabled;  }
     648  Void  setTMISEIToneMapId(Int b)                            {  m_toneMapId = b;  }
     649  Int   getTMISEIToneMapId()                                 {  return m_toneMapId;  }
     650  Void  setTMISEIToneMapCancelFlag(Bool b)                   {  m_toneMapCancelFlag=b;  }
     651  Bool  getTMISEIToneMapCancelFlag()                         {  return m_toneMapCancelFlag;  }
     652  Void  setTMISEIToneMapPersistenceFlag(Bool b)              {  m_toneMapPersistenceFlag = b;  }
     653  Bool   getTMISEIToneMapPersistenceFlag()                   {  return m_toneMapPersistenceFlag;  }
     654  Void  setTMISEICodedDataBitDepth(Int b)                    {  m_codedDataBitDepth = b;  }
     655  Int   getTMISEICodedDataBitDepth()                         {  return m_codedDataBitDepth;  }
     656  Void  setTMISEITargetBitDepth(Int b)                       {  m_targetBitDepth = b;  }
     657  Int   getTMISEITargetBitDepth()                            {  return m_targetBitDepth;  }
     658  Void  setTMISEIModelID(Int b)                              {  m_modelId = b;  }
     659  Int   getTMISEIModelID()                                   {  return m_modelId;  }
     660  Void  setTMISEIMinValue(Int b)                             {  m_minValue = b;  }
     661  Int   getTMISEIMinValue()                                  {  return m_minValue;  }
     662  Void  setTMISEIMaxValue(Int b)                             {  m_maxValue = b;  }
     663  Int   getTMISEIMaxValue()                                  {  return m_maxValue;  }
     664  Void  setTMISEISigmoidMidpoint(Int b)                      {  m_sigmoidMidpoint = b;  }
     665  Int   getTMISEISigmoidMidpoint()                           {  return m_sigmoidMidpoint;  }
     666  Void  setTMISEISigmoidWidth(Int b)                         {  m_sigmoidWidth = b;  }
     667  Int   getTMISEISigmoidWidth()                              {  return m_sigmoidWidth;  }
     668  Void  setTMISEIStartOfCodedInterva( Int*  p )              {  m_startOfCodedInterval = p;  }
     669  Int*  getTMISEIStartOfCodedInterva()                       {  return m_startOfCodedInterval;  }
     670  Void  setTMISEINumPivots(Int b)                            {  m_numPivots = b;  }
     671  Int   getTMISEINumPivots()                                 {  return m_numPivots;  }
     672  Void  setTMISEICodedPivotValue( Int*  p )                  {  m_codedPivotValue = p;  }
     673  Int*  getTMISEICodedPivotValue()                           {  return m_codedPivotValue;  }
     674  Void  setTMISEITargetPivotValue( Int*  p )                 {  m_targetPivotValue = p;  }
     675  Int*  getTMISEITargetPivotValue()                          {  return m_targetPivotValue;  }
     676  Void  setTMISEICameraIsoSpeedIdc(Int b)                    {  m_cameraIsoSpeedIdc = b;  }
     677  Int   getTMISEICameraIsoSpeedIdc()                         {  return m_cameraIsoSpeedIdc;  }
     678  Void  setTMISEICameraIsoSpeedValue(Int b)                  {  m_cameraIsoSpeedValue = b;  }
     679  Int   getTMISEICameraIsoSpeedValue()                       {  return m_cameraIsoSpeedValue;  }
     680  Void  setTMISEIExposureCompensationValueSignFlag(Int b)    {  m_exposureCompensationValueSignFlag = b;  }
     681  Int   getTMISEIExposureCompensationValueSignFlag()         {  return m_exposureCompensationValueSignFlag;  }
     682  Void  setTMISEIExposureCompensationValueNumerator(Int b)   {  m_exposureCompensationValueNumerator = b;  }
     683  Int   getTMISEIExposureCompensationValueNumerator()        {  return m_exposureCompensationValueNumerator;  }
     684  Void  setTMISEIExposureCompensationValueDenomIdc(Int b)    {  m_exposureCompensationValueDenomIdc =b;  }
     685  Int   getTMISEIExposureCompensationValueDenomIdc()         {  return m_exposureCompensationValueDenomIdc;  }
     686  Void  setTMISEIRefScreenLuminanceWhite(Int b)              {  m_refScreenLuminanceWhite = b;  }
     687  Int   getTMISEIRefScreenLuminanceWhite()                   {  return m_refScreenLuminanceWhite;  }
     688  Void  setTMISEIExtendedRangeWhiteLevel(Int b)              {  m_extendedRangeWhiteLevel = b;  }
     689  Int   getTMISEIExtendedRangeWhiteLevel()                   {  return m_extendedRangeWhiteLevel;  }
     690  Void  setTMISEINominalBlackLevelLumaCodeValue(Int b)       {  m_nominalBlackLevelLumaCodeValue = b;  }
     691  Int   getTMISEINominalBlackLevelLumaCodeValue()            {  return m_nominalBlackLevelLumaCodeValue;  }
     692  Void  setTMISEINominalWhiteLevelLumaCodeValue(Int b)       {  m_nominalWhiteLevelLumaCodeValue = b;  }
     693  Int   getTMISEINominalWhiteLevelLumaCodeValue()            {  return m_nominalWhiteLevelLumaCodeValue;  }
     694  Void  setTMISEIExtendedWhiteLevelLumaCodeValue(Int b)      {  m_extendedWhiteLevelLumaCodeValue =b;  }
     695  Int   getTMISEIExtendedWhiteLevelLumaCodeValue()           {  return m_extendedWhiteLevelLumaCodeValue;  }
     696#endif
    601697  Void  setFramePackingArrangementSEIEnabled(Int b)      { m_framePackingSEIEnabled = b; }
    602698  Int   getFramePackingArrangementSEIEnabled()           { return m_framePackingSEIEnabled; }
     
    617713  Void  setDecodingUnitInfoSEIEnabled(Int b)                { m_decodingUnitInfoSEIEnabled = b;    }
    618714  Int   getDecodingUnitInfoSEIEnabled()                     { return m_decodingUnitInfoSEIEnabled; }
     715#if L0208_SOP_DESCRIPTION_SEI
     716  Void  setSOPDescriptionSEIEnabled(Int b)                { m_SOPDescriptionSEIEnabled = b; }
     717  Int   getSOPDescriptionSEIEnabled()                     { return m_SOPDescriptionSEIEnabled; }
     718#endif
     719#if K0180_SCALABLE_NESTING_SEI
     720  Void  setScalableNestingSEIEnabled(Int b)                { m_scalableNestingSEIEnabled = b; }
     721  Int   getScalableNestingSEIEnabled()                     { return m_scalableNestingSEIEnabled; }
     722#endif
    619723  Void      setUseWP               ( Bool b )    { m_useWeightedPred   = b;    }
    620724  Void      setWPBiPred            ( Bool b )    { m_useWeightedBiPred = b;    }
  • branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/TEncGOP.cpp

    r324 r362  
    9696#if L0045_NON_NESTED_SEI_RESTRICTIONS
    9797  xResetNonNestedSEIPresentFlags();
    98 #endif
    99 
     98#if K0180_SCALABLE_NESTING_SEI
     99  xResetNestedSEIPresentFlags();
     100#endif
     101#endif
    100102#if H_MV
    101103  m_layerId      = 0;
     
    106108#endif
    107109#endif
    108 
    109110  return;
    110111}
     
    211212}
    212213
     214#if J0149_TONE_MAPPING_SEI
     215SEIToneMappingInfo*  TEncGOP::xCreateSEIToneMappingInfo()
     216{
     217  SEIToneMappingInfo *seiToneMappingInfo = new SEIToneMappingInfo();
     218  seiToneMappingInfo->m_toneMapId = m_pcCfg->getTMISEIToneMapId();
     219  seiToneMappingInfo->m_toneMapCancelFlag = m_pcCfg->getTMISEIToneMapCancelFlag();
     220  seiToneMappingInfo->m_toneMapPersistenceFlag = m_pcCfg->getTMISEIToneMapPersistenceFlag();
     221
     222  seiToneMappingInfo->m_codedDataBitDepth = m_pcCfg->getTMISEICodedDataBitDepth();
     223  assert(seiToneMappingInfo->m_codedDataBitDepth >= 8 && seiToneMappingInfo->m_codedDataBitDepth <= 14);
     224  seiToneMappingInfo->m_targetBitDepth = m_pcCfg->getTMISEITargetBitDepth();
     225  assert( (seiToneMappingInfo->m_targetBitDepth >= 1 && seiToneMappingInfo->m_targetBitDepth <= 17) || (seiToneMappingInfo->m_targetBitDepth  == 255) );
     226  seiToneMappingInfo->m_modelId = m_pcCfg->getTMISEIModelID();
     227  assert(seiToneMappingInfo->m_modelId >=0 &&seiToneMappingInfo->m_modelId<=4);
     228
     229  switch( seiToneMappingInfo->m_modelId)
     230  {
     231  case 0:
     232    {
     233      seiToneMappingInfo->m_minValue = m_pcCfg->getTMISEIMinValue();
     234      seiToneMappingInfo->m_maxValue = m_pcCfg->getTMISEIMaxValue();
     235      break;
     236    }
     237  case 1:
     238    {
     239      seiToneMappingInfo->m_sigmoidMidpoint = m_pcCfg->getTMISEISigmoidMidpoint();
     240      seiToneMappingInfo->m_sigmoidWidth = m_pcCfg->getTMISEISigmoidWidth();
     241      break;
     242    }
     243  case 2:
     244    {
     245      UInt num = 1u<<(seiToneMappingInfo->m_targetBitDepth);
     246      seiToneMappingInfo->m_startOfCodedInterval.resize(num);
     247      Int* ptmp = m_pcCfg->getTMISEIStartOfCodedInterva();
     248      if(ptmp)
     249      {
     250        for(int i=0; i<num;i++)
     251        {
     252          seiToneMappingInfo->m_startOfCodedInterval[i] = ptmp[i];
     253        }
     254      }
     255      break;
     256    }
     257  case 3:
     258    {
     259      seiToneMappingInfo->m_numPivots = m_pcCfg->getTMISEINumPivots();
     260      seiToneMappingInfo->m_codedPivotValue.resize(seiToneMappingInfo->m_numPivots);
     261      seiToneMappingInfo->m_targetPivotValue.resize(seiToneMappingInfo->m_numPivots);
     262      Int* ptmpcoded = m_pcCfg->getTMISEICodedPivotValue();
     263      Int* ptmptarget = m_pcCfg->getTMISEITargetPivotValue();
     264      if(ptmpcoded&&ptmptarget)
     265      {
     266        for(int i=0; i<(seiToneMappingInfo->m_numPivots);i++)
     267        {
     268          seiToneMappingInfo->m_codedPivotValue[i]=ptmpcoded[i];
     269          seiToneMappingInfo->m_targetPivotValue[i]=ptmptarget[i];
     270         }
     271       }
     272       break;
     273     }
     274  case 4:
     275     {
     276       seiToneMappingInfo->m_cameraIsoSpeedIdc = m_pcCfg->getTMISEICameraIsoSpeedIdc();
     277       seiToneMappingInfo->m_cameraIsoSpeedValue = m_pcCfg->getTMISEICameraIsoSpeedValue();
     278       assert( seiToneMappingInfo->m_cameraIsoSpeedValue !=0 );
     279       seiToneMappingInfo->m_exposureCompensationValueSignFlag = m_pcCfg->getTMISEIExposureCompensationValueSignFlag();
     280       seiToneMappingInfo->m_exposureCompensationValueNumerator = m_pcCfg->getTMISEIExposureCompensationValueNumerator();
     281       seiToneMappingInfo->m_exposureCompensationValueDenomIdc = m_pcCfg->getTMISEIExposureCompensationValueDenomIdc();
     282       seiToneMappingInfo->m_refScreenLuminanceWhite = m_pcCfg->getTMISEIRefScreenLuminanceWhite();
     283       seiToneMappingInfo->m_extendedRangeWhiteLevel = m_pcCfg->getTMISEIExtendedRangeWhiteLevel();
     284       assert( seiToneMappingInfo->m_extendedRangeWhiteLevel >= 100 );
     285       seiToneMappingInfo->m_nominalBlackLevelLumaCodeValue = m_pcCfg->getTMISEINominalBlackLevelLumaCodeValue();
     286       seiToneMappingInfo->m_nominalWhiteLevelLumaCodeValue = m_pcCfg->getTMISEINominalWhiteLevelLumaCodeValue();
     287       assert( seiToneMappingInfo->m_nominalWhiteLevelLumaCodeValue > seiToneMappingInfo->m_nominalBlackLevelLumaCodeValue );
     288       seiToneMappingInfo->m_extendedWhiteLevelLumaCodeValue = m_pcCfg->getTMISEIExtendedWhiteLevelLumaCodeValue();
     289       assert( seiToneMappingInfo->m_extendedWhiteLevelLumaCodeValue >= seiToneMappingInfo->m_nominalWhiteLevelLumaCodeValue );
     290       break;
     291    }
     292  default:
     293    {
     294      assert(!"Undefined SEIToneMapModelId");
     295      break;
     296    }
     297  }
     298  return seiToneMappingInfo;
     299}
     300#endif
    213301Void TEncGOP::xCreateLeadingSEIMessages (/*SEIMessages seiMessages,*/ AccessUnit &accessUnit, TComSPS *sps)
    214302{
    215   OutputNALUnit nalu(NAL_UNIT_SEI);
     303  OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI);
    216304
    217305  if(m_pcCfg->getActiveParameterSetsSEIEnabled())
     
    234322    SEIFramePacking *sei = xCreateSEIFramePacking ();
    235323
    236     nalu = NALUnit(NAL_UNIT_SEI);
     324    nalu = NALUnit(NAL_UNIT_PREFIX_SEI);
    237325    m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
    238326    m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps);
     
    245333    SEIDisplayOrientation *sei = xCreateSEIDisplayOrientation();
    246334
    247     nalu = NALUnit(NAL_UNIT_SEI);
     335    nalu = NALUnit(NAL_UNIT_PREFIX_SEI);
    248336    m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
    249337    m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps);
     
    252340    delete sei;
    253341  }
     342#if J0149_TONE_MAPPING_SEI
     343  if(m_pcCfg->getToneMappingInfoSEIEnabled())
     344  {
     345    SEIToneMappingInfo *sei = xCreateSEIToneMappingInfo ();
     346     
     347    nalu = NALUnit(NAL_UNIT_PREFIX_SEI);
     348    m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
     349    m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps);
     350    writeRBSPTrailingBits(nalu.m_Bitstream);
     351    accessUnit.push_back(new NALUnitEBSP(nalu));
     352    delete sei;
     353  }
     354#endif
    254355}
    255356
     
    275376  TComPicYuv*     pcPicYuvRecOut;
    276377  TComSlice*      pcSlice;
    277   TComOutputBitstream* pcBitstreamRedirect = new TComOutputBitstream;
     378  TComOutputBitstream  *pcBitstreamRedirect;
     379  pcBitstreamRedirect = new TComOutputBitstream;
    278380  AccessUnit::iterator  itLocationToPushSliceHeaderNALU; // used to store location where NALU containing slice header is to be inserted
    279381  UInt                  uiOneBitstreamPerSliceLength = 0;
     
    286388  m_iNumPicCoded = 0;
    287389#endif
    288 
    289390  SEIPictureTiming pictureTimingSEI;
     391#if L0208_SOP_DESCRIPTION_SEI
     392  Bool writeSOP = m_pcCfg->getSOPDescriptionSEIEnabled();
     393#endif
     394#if K0180_SCALABLE_NESTING_SEI
     395  // Initialize Scalable Nesting SEI with single layer values
     396  SEIScalableNesting scalableNestingSEI;
     397  scalableNestingSEI.m_bitStreamSubsetFlag           = 1;      // If the nested SEI messages are picture buffereing SEI mesages, picure timing SEI messages or sub-picture timing SEI messages, bitstream_subset_flag shall be equal to 1
     398  scalableNestingSEI.m_nestingOpFlag                 = 0;
     399  scalableNestingSEI.m_nestingNumOpsMinus1           = 0;      //nesting_num_ops_minus1
     400  scalableNestingSEI.m_allLayersFlag                 = 0;
     401  scalableNestingSEI.m_nestingNoOpMaxTemporalIdPlus1 = 6 + 1;  //nesting_no_op_max_temporal_id_plus1
     402  scalableNestingSEI.m_nestingNumLayersMinus1        = 1 - 1;  //nesting_num_layers_minus1
     403  scalableNestingSEI.m_nestingLayerId[0]             = 0;
     404  scalableNestingSEI.m_callerOwnsSEIs                = true;
     405#endif
    290406#if L0044_DU_DPB_OUTPUT_DELAY_HRD
    291407  Int picSptDpbOutputDuDelay = 0;
     
    298414  for ( Int iGOPid=0; iGOPid < m_iGopSize; iGOPid++ )
    299415#endif
    300 
    301416  {
    302417    UInt uiColDir = 1;
     
    364479      continue;
    365480#endif
    366 
    367     }
    368 
    369     if( getNalUnitType(pocCurr) == NAL_UNIT_CODED_SLICE_IDR || getNalUnitType(pocCurr) == NAL_UNIT_CODED_SLICE_IDR_N_LP )
     481    }
     482
     483    if( getNalUnitType(pocCurr, m_iLastIDR) == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType(pocCurr, m_iLastIDR) == NAL_UNIT_CODED_SLICE_IDR_N_LP )
    370484    {
    371485      m_iLastIDR = pocCurr;
     
    385499    pcSlice->setLastIDR(m_iLastIDR);
    386500    pcSlice->setSliceIdx(0);
    387 
    388501#if H_MV
    389502    pcPic  ->setLayerId     ( getLayerId() );
     
    397510#endif
    398511#endif
    399 
    400512    //set default slice level flag to the same as SPS level flag
    401513    pcSlice->setLFCrossSliceBoundaryFlag(  pcSlice->getPPS()->getLoopFilterAcrossSlicesEnabledFlag()  );
     
    437549#if H_MV
    438550    // Set the nal unit type
    439     pcSlice->setNalUnitType(getNalUnitType(pocCurr));
     551    pcSlice->setNalUnitType(getNalUnitType(pocCurr, m_iLastIDR));
    440552    if( pcSlice->getSliceType() == B_SLICE )
    441553    {
     
    451563    }
    452564    // Set the nal unit type
    453     pcSlice->setNalUnitType(getNalUnitType(pocCurr));
    454 #endif
    455     if(pcSlice->getNalUnitType()==NAL_UNIT_CODED_SLICE_TRAIL_R)
    456     {
    457       if(pcSlice->getTemporalLayerNonReferenceFlag())
     565    pcSlice->setNalUnitType(getNalUnitType(pocCurr, m_iLastIDR));
     566#endif
     567    if(pcSlice->getTemporalLayerNonReferenceFlag())
     568    {
     569      if(pcSlice->getNalUnitType()==NAL_UNIT_CODED_SLICE_TRAIL_R)
    458570      {
    459571        pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_TRAIL_N);
     572      }
     573      if(pcSlice->getNalUnitType()==NAL_UNIT_CODED_SLICE_RADL_R)
     574      {
     575        pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_RADL_N);
     576      }
     577      if(pcSlice->getNalUnitType()==NAL_UNIT_CODED_SLICE_RASL_R)
     578      {
     579        pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_RASL_N);
    460580      }
    461581    }
     
    482602        else
    483603        {
    484           pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_TLA);
     604          pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_TLA_R);
    485605        }
    486606      }
     
    568688    }
    569689#endif
    570 
     690#if !L0034_COMBINED_LIST_CLEANUP
    571691    if (pcSlice->getSliceType() != B_SLICE || !pcSlice->getSPS()->getUseLComb())
    572692    {
     
    580700      pcSlice->setNumRefIdx(REF_PIC_LIST_C, pcSlice->getNumRefIdx(REF_PIC_LIST_0));
    581701    }
     702#endif
    582703
    583704    if (pcSlice->getSliceType() == B_SLICE)
     
    605726      pcSlice->setCheckLDC(bLowDelay); 
    606727    }
     728    else
     729    {
     730      pcSlice->setCheckLDC(true); 
     731    }
    607732
    608733    uiColDir = 1-uiColDir;
     
    611736    pcSlice->setRefPOCList();
    612737
     738#if L0034_COMBINED_LIST_CLEANUP
     739    pcSlice->setList1IdxToList0Idx();
     740#else
    613741    pcSlice->setNoBackPredFlag( false );
    614742    if ( pcSlice->getSliceType() == B_SLICE && !pcSlice->getRefPicListCombinationFlag())
     
    634762    }
    635763    pcSlice->generateCombinedList();
     764#endif
    636765
    637766    if (m_pcEncTop->getTMVPModeId() == 2)
     
    9391068    Bool bLFCrossTileBoundary = pcSlice->getPPS()->getLoopFilterAcrossTilesEnabledFlag();
    9401069    m_pcLoopFilter->setCfg(bLFCrossTileBoundary);
     1070#if L0386_DB_METRIC
     1071    if ( m_pcCfg->getDeblockingFilterMetric() )
     1072    {
     1073      dblMetric(pcPic, uiNumSlices);
     1074    }
     1075#endif
    9411076    m_pcLoopFilter->loopFilterPic( pcPic );
    9421077
     
    10371172    }
    10381173
     1174#if L0208_SOP_DESCRIPTION_SEI
     1175    if (writeSOP) // write SOP description SEI (if enabled) at the beginning of GOP
     1176    {
     1177      Int SOPcurrPOC = pocCurr;
     1178
     1179      OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI);
     1180      m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice);
     1181      m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
     1182
     1183      SEISOPDescription SOPDescriptionSEI;
     1184      SOPDescriptionSEI.m_sopSeqParameterSetId = pcSlice->getSPS()->getSPSId();
     1185
     1186      UInt i = 0;
     1187      UInt prevEntryId = iGOPid;
     1188      for (j = iGOPid; j < m_iGopSize; j++)
     1189      {
     1190        Int deltaPOC = m_pcCfg->getGOPEntry(j).m_POC - m_pcCfg->getGOPEntry(prevEntryId).m_POC;
     1191        if ((SOPcurrPOC + deltaPOC) < m_pcCfg->getFramesToBeEncoded())
     1192        {
     1193          SOPcurrPOC += deltaPOC;
     1194          SOPDescriptionSEI.m_sopDescVclNaluType[i] = getNalUnitType(SOPcurrPOC, m_iLastIDR);
     1195          SOPDescriptionSEI.m_sopDescTemporalId[i] = m_pcCfg->getGOPEntry(j).m_temporalId;
     1196          SOPDescriptionSEI.m_sopDescStRpsIdx[i] = m_pcEncTop->getReferencePictureSetIdxForSOP(pcSlice, SOPcurrPOC, j);
     1197          SOPDescriptionSEI.m_sopDescPocDelta[i] = deltaPOC;
     1198
     1199          prevEntryId = j;
     1200          i++;
     1201        }
     1202      }
     1203
     1204      SOPDescriptionSEI.m_numPicsInSopMinus1 = i - 1;
     1205
     1206      m_seiWriter.writeSEImessage( nalu.m_Bitstream, SOPDescriptionSEI, pcSlice->getSPS());
     1207      writeRBSPTrailingBits(nalu.m_Bitstream);
     1208      accessUnit.push_back(new NALUnitEBSP(nalu));
     1209
     1210      writeSOP = false;
     1211    }
     1212#endif
     1213
    10391214    if( ( m_pcCfg->getPictureTimingSEIEnabled() || m_pcCfg->getDecodingUnitInfoSEIEnabled() ) &&
    10401215        ( pcSlice->getSPS()->getVuiParametersPresentFlag() ) &&
     
    10821257       || ( pcSlice->getSPS()->getVuiParameters()->getHrdParameters()->getVclHrdParametersPresentFlag() ) ) )
    10831258    {
    1084       OutputNALUnit nalu(NAL_UNIT_SEI);
     1259      OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI);
    10851260      m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice);
    10861261      m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
     
    11231298      writeRBSPTrailingBits(nalu.m_Bitstream);
    11241299#if L0045_NON_NESTED_SEI_RESTRICTIONS
     1300      {
    11251301      UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit);
    11261302      UInt offsetPosition = m_activeParameterSetSEIPresentInAU;   // Insert BP SEI after APS SEI
     
    11321308      accessUnit.insert(it, new NALUnitEBSP(nalu));
    11331309      m_bufferingPeriodSEIPresentInAU = true;
     1310      }
    11341311#else
    11351312      accessUnit.push_back(new NALUnitEBSP(nalu));
    11361313#endif
    11371314
     1315#if K0180_SCALABLE_NESTING_SEI
     1316      if (m_pcCfg->getScalableNestingSEIEnabled())
     1317      {
     1318        OutputNALUnit naluTmp(NAL_UNIT_PREFIX_SEI);
     1319        m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice);
     1320        m_pcEntropyCoder->setBitstream(&naluTmp.m_Bitstream);
     1321        scalableNestingSEI.m_nestedSEIs.clear();
     1322        scalableNestingSEI.m_nestedSEIs.push_back(&sei_buffering_period);
     1323        m_seiWriter.writeSEImessage( naluTmp.m_Bitstream, scalableNestingSEI, pcSlice->getSPS());
     1324        writeRBSPTrailingBits(naluTmp.m_Bitstream);
     1325#if L0045_NON_NESTED_SEI_RESTRICTIONS
     1326        UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit);
     1327        UInt offsetPosition = m_activeParameterSetSEIPresentInAU + m_bufferingPeriodSEIPresentInAU + m_pictureTimingSEIPresentInAU;   // Insert BP SEI after non-nested APS, BP and PT SEIs
     1328        AccessUnit::iterator it;
     1329        for(j = 0, it = accessUnit.begin(); j < seiPositionInAu + offsetPosition; j++)
     1330        {
     1331          it++;
     1332        }
     1333        accessUnit.insert(it, new NALUnitEBSP(naluTmp));
     1334        m_nestedBufferingPeriodSEIPresentInAU = true;
     1335#else
     1336        accessUnit.push_back(new NALUnitEBSP(naluTmp));
     1337#endif
     1338      }
     1339#endif
     1340
    11381341      m_lastBPSEI = m_totalCoded;
    11391342      m_cpbRemovalDelay = 0;
     
    11451348      {
    11461349        // Gradual decoding refresh SEI
    1147         OutputNALUnit nalu(NAL_UNIT_SEI);
     1350        OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI);
    11481351        m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice);
    11491352        m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
     
    11571360      }
    11581361    // Recovery point SEI
    1159       OutputNALUnit nalu(NAL_UNIT_SEI);
     1362      OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI);
    11601363      m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice);
    11611364      m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
     
    13481551
    13491552          pcSlice->setTileOffstForMultES( uiOneBitstreamPerSliceLength );
    1350           if (!sliceSegment)
    1351           {
    13521553            pcSlice->setTileLocationCount ( 0 );
    1353             m_pcSliceEncoder->encodeSlice(pcPic, pcBitstreamRedirect, pcSubstreamsOut); // redirect is only used for CAVLC tile position info.
    1354           }
    1355           else
    1356           {
    1357             m_pcSliceEncoder->encodeSlice(pcPic, &nalu.m_Bitstream, pcSubstreamsOut); // nalu.m_Bitstream is only used for CAVLC tile position info.
    1358           }
     1554          m_pcSliceEncoder->encodeSlice(pcPic, pcSubstreamsOut);
    13591555
    13601556          {
     
    13881584              if (ui+1 < pcSlice->getPPS()->getNumSubstreams())
    13891585              {
    1390                 puiSubstreamSizes[ui] = pcSubstreamsOut[ui].getNumberOfWrittenBits();
     1586                puiSubstreamSizes[ui] = pcSubstreamsOut[ui].getNumberOfWrittenBits() + (pcSubstreamsOut[ui].countStartCodeEmulations()<<3);
    13911587              }
    13921588            }
     
    14201616          // If current NALU is the last NALU of slice and a NALU was buffered, then (a) Write current NALU (b) Update an write buffered NALU at approproate location in NALU list.
    14211617          Bool bNALUAlignedWrittenToList    = false; // used to ensure current NALU is not written more than once to the NALU list.
    1422           xWriteTileLocationToSliceHeader(nalu, pcBitstreamRedirect, pcSlice);
     1618          xAttachSliceDataToNalUnit(nalu, pcBitstreamRedirect);
    14231619          accessUnit.push_back(new NALUnitEBSP(nalu));
    14241620#if RATE_CONTROL_LAMBDA_DOMAIN
     
    14481644            {
    14491645              UInt numRBSPBytes_nal = UInt((*it)->m_nalUnitData.str().size());
    1450               if ((*it)->m_nalUnitType != NAL_UNIT_SEI && (*it)->m_nalUnitType != NAL_UNIT_SEI_SUFFIX)
     1646              if ((*it)->m_nalUnitType != NAL_UNIT_PREFIX_SEI && (*it)->m_nalUnitType != NAL_UNIT_SUFFIX_SEI)
    14511647              {
    14521648                numRBSPBytes += numRBSPBytes_nal;
     
    15491745          digestStr = digestToString(sei_recon_picture_digest.digest, 4);
    15501746        }
    1551         OutputNALUnit nalu(NAL_UNIT_SEI_SUFFIX, pcSlice->getTLayer());
     1747        OutputNALUnit nalu(NAL_UNIT_SUFFIX_SEI, pcSlice->getTLayer());
    15521748
    15531749        /* write the SEI messages */
     
    15731769        sei_temporal_level0_index.rapIdx = m_rapIdx;
    15741770
    1575         OutputNALUnit nalu(NAL_UNIT_SEI);
     1771        OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI);
    15761772
    15771773        /* write the SEI messages */
     
    17131909        if( m_pcCfg->getPictureTimingSEIEnabled() )
    17141910        {
    1715           OutputNALUnit nalu(NAL_UNIT_SEI, pcSlice->getTLayer());
     1911          {
     1912            OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI, pcSlice->getTLayer());
    17161913          m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice);
    17171914          m_seiWriter.writeSEImessage(nalu.m_Bitstream, pictureTimingSEI, pcSlice->getSPS());
     
    17331930#endif
    17341931        }
     1932#if K0180_SCALABLE_NESTING_SEI
     1933          if ( m_pcCfg->getScalableNestingSEIEnabled() ) // put picture timing SEI into scalable nesting SEI
     1934          {
     1935            OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI, pcSlice->getTLayer());
     1936            m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice);
     1937            scalableNestingSEI.m_nestedSEIs.clear();
     1938            scalableNestingSEI.m_nestedSEIs.push_back(&pictureTimingSEI);
     1939            m_seiWriter.writeSEImessage(nalu.m_Bitstream, scalableNestingSEI, pcSlice->getSPS());
     1940            writeRBSPTrailingBits(nalu.m_Bitstream);
     1941#if L0045_NON_NESTED_SEI_RESTRICTIONS
     1942            UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit);
     1943            UInt offsetPosition = m_activeParameterSetSEIPresentInAU
     1944              + m_bufferingPeriodSEIPresentInAU + m_pictureTimingSEIPresentInAU + m_nestedBufferingPeriodSEIPresentInAU;    // Insert PT SEI after APS and BP SEI
     1945            AccessUnit::iterator it;
     1946            for(j = 0, it = accessUnit.begin(); j < seiPositionInAu + offsetPosition; j++)
     1947            {
     1948              it++;
     1949            }
     1950            accessUnit.insert(it, new NALUnitEBSP(nalu));
     1951            m_nestedPictureTimingSEIPresentInAU = true;
     1952#else
     1953            AccessUnit::iterator it = find_if(accessUnit.begin(), accessUnit.end(), mem_fun(&NALUnit::isSlice));
     1954            accessUnit.insert(it, new NALUnitEBSP(nalu));
     1955#endif
     1956          }
     1957#endif
     1958
     1959        }
    17351960        if( m_pcCfg->getDecodingUnitInfoSEIEnabled() && hrd->getSubPicCpbParamsPresentFlag() )
    17361961        {             
     
    17381963          for( Int i = 0; i < ( pictureTimingSEI.m_numDecodingUnitsMinus1 + 1 ); i ++ )
    17391964          {
    1740             OutputNALUnit nalu(NAL_UNIT_SEI, pcSlice->getTLayer());
     1965            OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI, pcSlice->getTLayer());
    17411966
    17421967            SEIDecodingUnitInfo tempSEI;
     
    17862011                  break;
    17872012                }
    1788                 if ((*it)->m_nalUnitType != NAL_UNIT_SEI && (*it)->m_nalUnitType != NAL_UNIT_SEI_SUFFIX)
     2013                if ((*it)->m_nalUnitType != NAL_UNIT_PREFIX_SEI && (*it)->m_nalUnitType != NAL_UNIT_SUFFIX_SEI)
    17892014                {
    17902015                  ctr++;
     
    17972022#if L0045_NON_NESTED_SEI_RESTRICTIONS
    17982023      xResetNonNestedSEIPresentFlags();
     2024#if K0180_SCALABLE_NESTING_SEI
     2025      xResetNestedSEIPresentFlags();
     2026#endif
    17992027#endif
    18002028      pcPic->getPicYuvRec()->copyToPic(pcPicYuvRecOut);
     
    20232251    case NAL_UNIT_CODED_SLICE_TRAIL_R: return "TRAIL_R";
    20242252    case NAL_UNIT_CODED_SLICE_TRAIL_N: return "TRAIL_N";
    2025     case NAL_UNIT_CODED_SLICE_TLA: return "TLA";
     2253    case NAL_UNIT_CODED_SLICE_TLA_R:      return "TLA_R";
    20262254    case NAL_UNIT_CODED_SLICE_TSA_N: return "TSA_N";
    20272255    case NAL_UNIT_CODED_SLICE_STSA_R: return "STSA_R";
    20282256    case NAL_UNIT_CODED_SLICE_STSA_N: return "STSA_N";
    2029     case NAL_UNIT_CODED_SLICE_BLA: return "BLA";
    2030     case NAL_UNIT_CODED_SLICE_BLANT: return "BLANT";
     2257    case NAL_UNIT_CODED_SLICE_BLA_W_LP:   return "BLA_W_LP";
     2258    case NAL_UNIT_CODED_SLICE_BLA_W_RADL: return "BLA_W_RADL";
    20312259    case NAL_UNIT_CODED_SLICE_BLA_N_LP: return "BLA_N_LP";
    2032     case NAL_UNIT_CODED_SLICE_IDR: return "IDR";
     2260    case NAL_UNIT_CODED_SLICE_IDR_W_RADL: return "IDR_W_RADL";
    20332261    case NAL_UNIT_CODED_SLICE_IDR_N_LP: return "IDR_N_LP";
    20342262    case NAL_UNIT_CODED_SLICE_CRA: return "CRA";
    2035     case NAL_UNIT_CODED_SLICE_DLP: return "DLP";
    2036     case NAL_UNIT_CODED_SLICE_TFD: return "TFD";
     2263    case NAL_UNIT_CODED_SLICE_RADL_R:     return "RADL_R";
     2264    case NAL_UNIT_CODED_SLICE_RASL_R:     return "RASL_R";
    20372265    case NAL_UNIT_VPS: return "VPS";
    20382266    case NAL_UNIT_SPS: return "SPS";
     
    20422270    case NAL_UNIT_EOB: return "EOB";
    20432271    case NAL_UNIT_FILLER_DATA: return "FILLER";
    2044     case NAL_UNIT_SEI: return "SEI";
     2272    case NAL_UNIT_PREFIX_SEI:             return "SEI";
     2273    case NAL_UNIT_SUFFIX_SEI:             return "SEI";
    20452274    default: return "UNK";
    20462275  }
     
    21332362    printf("*** %6s numBytesInNALunit: %u\n", nalUnitTypeToString((*it)->m_nalUnitType), numRBSPBytes_nal);
    21342363#endif
    2135     if ((*it)->m_nalUnitType != NAL_UNIT_SEI && (*it)->m_nalUnitType != NAL_UNIT_SEI_SUFFIX)
     2364    if ((*it)->m_nalUnitType != NAL_UNIT_PREFIX_SEI && (*it)->m_nalUnitType != NAL_UNIT_SUFFIX_SEI)
    21362365    {
    21372366      numRBSPBytes += numRBSPBytes_nal;
     
    21432372
    21442373  //===== add PSNR =====
    2145 
    21462374#if H_MV
    21472375  m_pcEncTop->getAnalyzeAll()->addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits);
     
    21532381  if (pcSlice->isIntra())
    21542382  {
    2155 
    21562383#if H_MV
    21572384    m_pcEncTop->getAnalyzeI()->addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits);
     
    21632390  if (pcSlice->isInterP())
    21642391  {
    2165 
    21662392#if H_MV
    21672393    m_pcEncTop->getAnalyzeP()->addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits);
     
    21692395    m_gcAnalyzeP.addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits);
    21702396#endif
    2171 
    21722397  }
    21732398  if (pcSlice->isInterB())
    21742399  {
    2175 
    21762400#if H_MV
    21772401    m_pcEncTop->getAnalyzeB()->addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits);
     
    21792403    m_gcAnalyzeB.addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits);
    21802404#endif
    2181 
    21822405  }
    21832406
     
    21862409
    21872410#if ADAPTIVE_QP_SELECTION
    2188 
    21892411#if H_MV
    21902412  printf("Layer %3d   POC %4d TId: %1d ( %c-SLICE, nQP %d QP %d ) %10d bits",
     
    22052427         uibits );
    22062428#endif
    2207 
    22082429#else
    2209 
    22102430#if H_MV
    22112431  printf("Layer %3d   POC %4d TId: %1d ( %c-SLICE, QP %d ) %10d bits",
     
    22262446
    22272447#endif
    2228 
    22292448  printf(" [Y %6.4lf dB    U %6.4lf dB    V %6.4lf dB]", dYPSNR, dUPSNR, dVPSNR );
    22302449  printf(" [ET %5.0f ]", dEncTime );
     
    22572476 * This function checks the configuration and returns the appropriate nal_unit_type for the picture.
    22582477 */
    2259 NalUnitType TEncGOP::getNalUnitType(Int pocCurr)
     2478NalUnitType TEncGOP::getNalUnitType(Int pocCurr, Int lastIDR)
    22602479{
    22612480  if (pocCurr == 0)
    22622481  {
    2263     return NAL_UNIT_CODED_SLICE_IDR;
     2482    return NAL_UNIT_CODED_SLICE_IDR_W_RADL;
    22642483  }
    22652484  if (pocCurr % m_pcCfg->getIntraPeriod() == 0)
     
    22712490    else if (m_pcCfg->getDecodingRefreshType() == 2)
    22722491    {
    2273       return NAL_UNIT_CODED_SLICE_IDR;
     2492      return NAL_UNIT_CODED_SLICE_IDR_W_RADL;
    22742493    }
    22752494  }
     
    22832502      // controlling the reference pictures used for encoding that leading picture. Such a leading
    22842503      // picture need not be marked as a TFD picture.
    2285       return NAL_UNIT_CODED_SLICE_TFD;
     2504      return NAL_UNIT_CODED_SLICE_RASL_R;
     2505    }
     2506  }
     2507  if (lastIDR>0)
     2508  {
     2509    if (pocCurr < lastIDR)
     2510    {
     2511      return NAL_UNIT_CODED_SLICE_RADL_R;
    22862512    }
    22872513  }
     
    23342560}
    23352561
    2336 /** Determine the difference between consecutive tile sizes (in bytes) and writes it to  bistream rNalu [slice header]
    2337  * \param rpcBitstreamRedirect contains the bitstream to be concatenated to rNalu. rpcBitstreamRedirect contains slice payload. rpcSlice contains tile location information.
    2338  * \returns Updates rNalu to contain concatenated bitstream. rpcBitstreamRedirect is cleared at the end of this function call.
     2562/** Attaches the input bitstream to the stream in the output NAL unit
     2563    Updates rNalu to contain concatenated bitstream. rpcBitstreamRedirect is cleared at the end of this function call.
     2564 *  \param codedSliceData contains the coded slice data (bitstream) to be concatenated to rNalu
     2565 *  \param rNalu          target NAL unit
    23392566 */
    2340 Void TEncGOP::xWriteTileLocationToSliceHeader (OutputNALUnit& rNalu, TComOutputBitstream*& rpcBitstreamRedirect, TComSlice*& rpcSlice)
     2567Void TEncGOP::xAttachSliceDataToNalUnit (OutputNALUnit& rNalu, TComOutputBitstream*& codedSliceData)
    23412568{
    23422569  // Byte-align
     
    23442571
    23452572  // Perform bitstream concatenation
    2346   if (rpcBitstreamRedirect->getNumberOfWrittenBits() > 0)
    2347   {
    2348     UInt uiBitCount  = rpcBitstreamRedirect->getNumberOfWrittenBits();
    2349     if (rpcBitstreamRedirect->getByteStreamLength()>0)
    2350     {
    2351       UChar *pucStart  =  reinterpret_cast<UChar*>(rpcBitstreamRedirect->getByteStream());
    2352       UInt uiWriteByteCount = 0;
    2353       while (uiWriteByteCount < (uiBitCount >> 3) )
    2354       {
    2355         UInt uiBits = (*pucStart);
    2356         rNalu.m_Bitstream.write(uiBits, 8);
    2357         pucStart++;
    2358         uiWriteByteCount++;
    2359       }
    2360     }
    2361     UInt uiBitsHeld = (uiBitCount & 0x07);
    2362     for (UInt uiIdx=0; uiIdx < uiBitsHeld; uiIdx++)
    2363     {
    2364       rNalu.m_Bitstream.write((rpcBitstreamRedirect->getHeldBits() & (1 << (7-uiIdx))) >> (7-uiIdx), 1);
    2365     }         
     2573  if (codedSliceData->getNumberOfWrittenBits() > 0)
     2574    {
     2575    rNalu.m_Bitstream.addSubstream(codedSliceData);
    23662576  }
    23672577
    23682578  m_pcEntropyCoder->setBitstream(&rNalu.m_Bitstream);
    23692579
    2370   delete rpcBitstreamRedirect;
    2371   rpcBitstreamRedirect = new TComOutputBitstream;
     2580  codedSliceData->clear();
    23722581}
    23732582
     
    24942703     }               
    24952704  }
    2496   assert(it != accessUnit.end());
     2705//  assert(it != accessUnit.end());  // Triggers with some legit configurations
    24972706  return seiStartPos;
    24982707}
    24992708#endif
    25002709
     2710#if L0386_DB_METRIC
     2711Void TEncGOP::dblMetric( TComPic* pcPic, UInt uiNumSlices )
     2712{
     2713  TComPicYuv* pcPicYuvRec = pcPic->getPicYuvRec();
     2714  Pel* Rec    = pcPicYuvRec->getLumaAddr( 0 );
     2715  Pel* tempRec = Rec;
     2716  Int  stride = pcPicYuvRec->getStride();
     2717  UInt log2maxTB = pcPic->getSlice(0)->getSPS()->getQuadtreeTULog2MaxSize();
     2718  UInt maxTBsize = (1<<log2maxTB);
     2719  const UInt minBlockArtSize = 8;
     2720  const UInt picWidth = pcPicYuvRec->getWidth();
     2721  const UInt picHeight = pcPicYuvRec->getHeight();
     2722  const UInt noCol = (picWidth>>log2maxTB);
     2723  const UInt noRows = (picHeight>>log2maxTB);
     2724  UInt64 *colSAD = (UInt64*)malloc(noCol*sizeof(UInt64));
     2725  UInt64 *rowSAD = (UInt64*)malloc(noRows*sizeof(UInt64));
     2726  UInt colIdx = 0;
     2727  UInt rowIdx = 0;
     2728  Pel p0, p1, p2, q0, q1, q2;
     2729 
     2730  Int qp = pcPic->getSlice(0)->getSliceQp();
     2731  Int bitdepthScale = 1 << (g_bitDepthY-8);
     2732  Int beta = TComLoopFilter::getBeta( qp ) * bitdepthScale;
     2733  const Int thr2 = (beta>>2);
     2734  const Int thr1 = 2*bitdepthScale;
     2735  UInt a = 0;
     2736 
     2737  memset(colSAD, 0, noCol*sizeof(UInt64));
     2738  memset(rowSAD, 0, noRows*sizeof(UInt64));
     2739 
     2740  if (maxTBsize > minBlockArtSize)
     2741  {
     2742    // Analyze vertical artifact edges
     2743    for(Int c = maxTBsize; c < picWidth; c += maxTBsize)
     2744    {
     2745      for(Int r = 0; r < picHeight; r++)
     2746      {
     2747        p2 = Rec[c-3];
     2748        p1 = Rec[c-2];
     2749        p0 = Rec[c-1];
     2750        q0 = Rec[c];
     2751        q1 = Rec[c+1];
     2752        q2 = Rec[c+2];
     2753        a = ((abs(p2-(p1<<1)+p0)+abs(q0-(q1<<1)+q2))<<1);
     2754        if ( thr1 < a && a < thr2)
     2755        {
     2756          colSAD[colIdx] += abs(p0 - q0);
     2757        }
     2758        Rec += stride;
     2759      }
     2760      colIdx++;
     2761      Rec = tempRec;
     2762    }
     2763   
     2764    // Analyze horizontal artifact edges
     2765    for(Int r = maxTBsize; r < picHeight; r += maxTBsize)
     2766    {
     2767      for(Int c = 0; c < picWidth; c++)
     2768      {
     2769        p2 = Rec[c + (r-3)*stride];
     2770        p1 = Rec[c + (r-2)*stride];
     2771        p0 = Rec[c + (r-1)*stride];
     2772        q0 = Rec[c + r*stride];
     2773        q1 = Rec[c + (r+1)*stride];
     2774        q2 = Rec[c + (r+2)*stride];
     2775        a = ((abs(p2-(p1<<1)+p0)+abs(q0-(q1<<1)+q2))<<1);
     2776        if (thr1 < a && a < thr2)
     2777        {
     2778          rowSAD[rowIdx] += abs(p0 - q0);
     2779        }
     2780      }
     2781      rowIdx++;
     2782    }
     2783  }
     2784 
     2785  UInt64 colSADsum = 0;
     2786  UInt64 rowSADsum = 0;
     2787  for(Int c = 0; c < noCol-1; c++)
     2788  {
     2789    colSADsum += colSAD[c];
     2790  }
     2791  for(Int r = 0; r < noRows-1; r++)
     2792  {
     2793    rowSADsum += rowSAD[r];
     2794  }
     2795 
     2796  colSADsum <<= 10;
     2797  rowSADsum <<= 10;
     2798  colSADsum /= (noCol-1);
     2799  colSADsum /= picHeight;
     2800  rowSADsum /= (noRows-1);
     2801  rowSADsum /= picWidth;
     2802 
     2803  UInt64 avgSAD = ((colSADsum + rowSADsum)>>1);
     2804  avgSAD >>= (g_bitDepthY-8);
     2805 
     2806  if ( avgSAD > 2048 )
     2807  {
     2808    avgSAD >>= 9;
     2809    Int offset = Clip3(2,6,(Int)avgSAD);
     2810    for (Int i=0; i<uiNumSlices; i++)
     2811    {
     2812      pcPic->getSlice(i)->setDeblockingFilterOverrideFlag(true);
     2813      pcPic->getSlice(i)->setDeblockingFilterDisable(false);
     2814      pcPic->getSlice(i)->setDeblockingFilterBetaOffsetDiv2( offset );
     2815      pcPic->getSlice(i)->setDeblockingFilterTcOffsetDiv2( offset );
     2816    }
     2817  }
     2818  else
     2819  {
     2820    for (Int i=0; i<uiNumSlices; i++)
     2821    {
     2822      pcPic->getSlice(i)->setDeblockingFilterOverrideFlag(false);
     2823      pcPic->getSlice(i)->setDeblockingFilterDisable(        pcPic->getSlice(i)->getPPS()->getPicDisableDeblockingFilterFlag() );
     2824      pcPic->getSlice(i)->setDeblockingFilterBetaOffsetDiv2( pcPic->getSlice(i)->getPPS()->getDeblockingFilterBetaOffsetDiv2() );
     2825      pcPic->getSlice(i)->setDeblockingFilterTcOffsetDiv2(   pcPic->getSlice(i)->getPPS()->getDeblockingFilterTcOffsetDiv2()   );
     2826    }
     2827  }
     2828 
     2829  free(colSAD);
     2830  free(rowSAD);
     2831}
     2832#endif
    25012833#if H_MV
    25022834Void TEncGOP::xSetRefPicListModificationsMvc( TComSlice* pcSlice, UInt uiPOCCurr, UInt iGOPid )
     
    25782910}
    25792911#endif
    2580 
    25812912//! \}
  • branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/TEncGOP.h

    r324 r362  
    132132  Bool                    m_bufferingPeriodSEIPresentInAU;
    133133  Bool                    m_pictureTimingSEIPresentInAU;
     134#if K0180_SCALABLE_NESTING_SEI
     135  Bool                    m_nestedBufferingPeriodSEIPresentInAU;
     136  Bool                    m_nestedPictureTimingSEIPresentInAU;
     137#endif
    134138#endif
    135139public:
     
    141145 
    142146  Void  init        ( TEncTop* pcTEncTop );
    143 
    144147#if H_MV
    145148  Void  initGOP     ( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsInGOP);
     
    148151  Void  compressGOP( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRec, std::list<AccessUnit>& accessUnitsInGOP );
    149152#endif
    150 
    151   Void xWriteTileLocationToSliceHeader (OutputNALUnit& rNalu, TComOutputBitstream*& rpcBitstreamRedirect, TComSlice*& rpcSlice);
     153  Void  xAttachSliceDataToNalUnit (OutputNALUnit& rNalu, TComOutputBitstream*& rpcBitstreamRedirect);
    152154
    153155#if H_MV
     
    167169  Void  printOutSummary      ( UInt uiNumAllPicCoded );
    168170#endif
    169 
    170171  Void  preLoopFilterPicAll  ( TComPic* pcPic, UInt64& ruiDist, UInt64& ruiBits );
    171172 
    172173  TEncSlice*  getSliceEncoder()   { return m_pcSliceEncoder; }
    173   NalUnitType getNalUnitType( Int pocCurr );
     174  NalUnitType getNalUnitType( Int pocCurr, Int lastIdr );
    174175  Void arrangeLongtermPicturesInRPS(TComSlice *, TComList<TComPic*>& );
    175176protected:
     
    189190  SEIFramePacking*        xCreateSEIFramePacking();
    190191  SEIDisplayOrientation*  xCreateSEIDisplayOrientation();
     192
     193#if J0149_TONE_MAPPING_SEI
     194  SEIToneMappingInfo*     xCreateSEIToneMappingInfo();
     195#endif
    191196
    192197  Void xCreateLeadingSEIMessages (/*SEIMessages seiMessages,*/ AccessUnit &accessUnit, TComSPS *sps);
     
    199204    m_pictureTimingSEIPresentInAU      = false;
    200205  }
    201 #endif
    202 
     206#if K0180_SCALABLE_NESTING_SEI
     207  Void xResetNestedSEIPresentFlags()
     208  {
     209    m_nestedBufferingPeriodSEIPresentInAU    = false;
     210    m_nestedPictureTimingSEIPresentInAU      = false;
     211  }
     212#endif
    203213#if H_MV
    204214   Void  xSetRefPicListModificationsMvc( TComSlice* pcSlice, UInt uiPOCCurr, UInt iGOPid );
    205215#endif
    206 
     216#if L0386_DB_METRIC
     217  Void dblMetric( TComPic* pcPic, UInt uiNumSlices );
     218#endif
    207219};// END CLASS DEFINITION TEncGOP
    208220
  • branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp

    r324 r362  
    16771677#endif
    16781678{
    1679 #if SAO_CHROMA_LAMBDA
    1680   m_dLambdaLuma    = dLambdaLuma;
    1681   m_dLambdaChroma  = dLambdaChroma;
    1682 #else
    1683   m_dLambdaLuma    = dLambda;
    1684   m_dLambdaChroma  = dLambda;
    1685 #endif
    1686 
    16871679  if(m_bUseNIF)
    16881680  {
  • branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.h

    r324 r362  
    5757{
    5858private:
    59   Double            m_dLambdaLuma;
    60   Double            m_dLambdaChroma;
    61 
    6259  TEncEntropy*      m_pcEntropyCoder;
    6360  TEncSbac***       m_pppcRDSbacCoder;              ///< for CABAC
  • branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/TEncSbac.h

    r324 r362  
    109109  Void  xWriteEpExGolomb     ( UInt uiSymbol, UInt uiCount );
    110110  Void  xWriteCoefRemainExGolomb ( UInt symbol, UInt &rParam );
    111   Void  xWriteTerminatingBit ( UInt uiBit );
    112111 
    113112  Void  xCopyFrom            ( TEncSbac* pSrc );
  • branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/TEncSearch.cpp

    r324 r362  
    32093209    UInt          uiBitsTempL0[MAX_NUM_REF];
    32103210
     3211#if L0034_COMBINED_LIST_CLEANUP
     3212    TComMv        mvValidList1;
     3213    Int           refIdxValidList1 = 0;
     3214    UInt          bitsValidList1 = MAX_UINT;
     3215    UInt          costValidList1 = MAX_UINT;
     3216#endif
     3217
    32113218    xGetBlkBits( ePartSize, pcCU->getSlice()->isInterP(), iPartIdx, uiLastMode, uiMbBits);
    32123219   
     
    32553262        uiBitsTemp += m_auiMVPIdxCost[aaiMvpIdx[iRefList][iRefIdxTemp]][AMVP_MAX_NUM_CANDS];
    32563263#if ZERO_MVD_EST
     3264#if L0034_COMBINED_LIST_CLEANUP
     3265        if ( iRefList == 0 || pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp ) < 0 )
     3266#else
    32573267        if ((iRefList != 1 || !pcCU->getSlice()->getNoBackPredFlag()) &&
    32583268            (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) <= 0 || pcCU->getSlice()->getRefIdxOfLC(eRefPicList, iRefIdxTemp)>=0))
     3269#endif
    32593270        {
    32603271          uiZeroMvdBitsTemp = uiBitsTemp;
     
    32763287       
    32773288#if GPB_SIMPLE_UNI
     3289#if L0034_COMBINED_LIST_CLEANUP
     3290        if ( iRefList == 1 )    // list 1
     3291        {
     3292          if ( pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp ) >= 0 )
     3293          {
     3294            cMvTemp[1][iRefIdxTemp] = cMvTemp[0][pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp )];
     3295            uiCostTemp = uiCostTempL0[pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp )];
     3296            /*first subtract the bit-rate part of the cost of the other list*/
     3297            uiCostTemp -= m_pcRdCost->getCost( uiBitsTempL0[pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp )] );
     3298            /*correct the bit-rate part of the current ref*/
     3299            m_pcRdCost->setPredictor  ( cMvPred[iRefList][iRefIdxTemp] );
     3300            uiBitsTemp += m_pcRdCost->getBits( cMvTemp[1][iRefIdxTemp].getHor(), cMvTemp[1][iRefIdxTemp].getVer() );
     3301            /*calculate the correct cost*/
     3302            uiCostTemp += m_pcRdCost->getCost( uiBitsTemp );
     3303          }
     3304          else
     3305          {
     3306            xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp );
     3307          }
     3308        }
     3309        else
     3310        {
     3311          xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp );
     3312        }
     3313#else
    32783314        if ( pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0)
    32793315        {
     
    33173353          }       
    33183354        }
     3355#endif
    33193356#else
    33203357        xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp );
     
    33233360        xCheckBestMVP(pcCU, eRefPicList, cMvTemp[iRefList][iRefIdxTemp], cMvPred[iRefList][iRefIdxTemp], aaiMvpIdx[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp);
    33243361
     3362#if L0034_COMBINED_LIST_CLEANUP
     3363        if ( iRefList == 0 )
     3364        {
     3365          uiCostTempL0[iRefIdxTemp] = uiCostTemp;
     3366          uiBitsTempL0[iRefIdxTemp] = uiBitsTemp;
     3367        }
     3368        if ( uiCostTemp < uiCost[iRefList] )
     3369        {
     3370          uiCost[iRefList] = uiCostTemp;
     3371          uiBits[iRefList] = uiBitsTemp; // storing for bi-prediction
     3372
     3373          // set motion
     3374          cMv[iRefList]     = cMvTemp[iRefList][iRefIdxTemp];
     3375          iRefIdx[iRefList] = iRefIdxTemp;
     3376        }
     3377
     3378        if ( iRefList == 1 && uiCostTemp < costValidList1 && pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp ) < 0 )
     3379        {
     3380          costValidList1 = uiCostTemp;
     3381          bitsValidList1 = uiBitsTemp;
     3382
     3383          // set motion
     3384          mvValidList1     = cMvTemp[iRefList][iRefIdxTemp];
     3385          refIdxValidList1 = iRefIdxTemp;
     3386        }
     3387#else
    33253388        if(pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && !pcCU->getSlice()->getNoBackPredFlag())
    33263389        {
     
    33723435            }
    33733436          }
     3437#endif
    33743438      }
    33753439    }
     
    34353499       
    34363500        Int         iRefList    = iIter % 2;
     3501#if L0034_COMBINED_LIST_CLEANUP
     3502        if ( m_pcEncCfg->getUseFastEnc() )
     3503        {
     3504          if( uiCost[0] <= uiCost[1] )
     3505          {
     3506            iRefList = 1;
     3507          }
     3508          else
     3509          {
     3510            iRefList = 0;
     3511          }
     3512        }
     3513        else if ( iIter == 0 )
     3514        {
     3515          iRefList = 0;
     3516        }
     3517        if ( iIter == 0 && !pcCU->getSlice()->getMvdL1ZeroFlag())
     3518        {
     3519          pcCU->getCUMvField(RefPicList(1-iRefList))->setAllMv( cMv[1-iRefList], ePartSize, uiPartAddr, 0, iPartIdx );
     3520          pcCU->getCUMvField(RefPicList(1-iRefList))->setAllRefIdx( iRefIdx[1-iRefList], ePartSize, uiPartAddr, 0, iPartIdx );
     3521          TComYuv*  pcYuvPred = &m_acYuvPred[1-iRefList];
     3522          motionCompensation ( pcCU, pcYuvPred, RefPicList(1-iRefList), iPartIdx );
     3523        }
     3524#else
    34373525        if ( m_pcEncCfg->getUseFastEnc() && (pcCU->getSlice()->getNoBackPredFlag() || (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(0)==0 )) )
    34383526        {
    34393527          iRefList = 1;
    34403528        }
     3529#endif
    34413530        RefPicList  eRefPicList = ( iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0 );
    34423531
     
    35733662    UInt uiMEBits = 0;
    35743663    // Set Motion Field_
     3664#if L0034_COMBINED_LIST_CLEANUP
     3665    cMv[1] = mvValidList1;
     3666    iRefIdx[1] = refIdxValidList1;
     3667    uiBits[1] = bitsValidList1;
     3668    uiCost[1] = costValidList1;
     3669#else
    35753670    if ( pcCU->getSlice()->getNoBackPredFlag() || (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(0)==0 ) )
    35763671    {
    35773672      uiCost[1] = MAX_UINT;
    35783673    }
     3674#endif
    35793675#if AMP_MRG
    35803676    if (bTestNormalMC)
     
    45224618    while( pcCU->getWidth(0) > (pcCU->getSlice()->getSPS()->getMaxTrSize()<<uiTrLevel) ) uiTrLevel++;
    45234619  }
    4524   UInt uiMaxTrMode = pcCU->getSlice()->getSPS()->getMaxTrDepth() + uiTrLevel;
     4620  UInt uiMaxTrMode = 1 + uiTrLevel;
    45254621 
    45264622  while((uiWidth>>uiMaxTrMode) < (g_uiMaxCUWidth>>g_uiMaxCUDepth)) uiMaxTrMode--;
  • branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/TEncSlice.cpp

    r324 r362  
    438438#endif
    439439
     440#if L0386_DB_METRIC
     441  if ( m_pcCfg->getDeblockingFilterMetric() )
     442  {
     443    rpcSlice->setDeblockingFilterOverrideFlag(true);
     444    rpcSlice->setDeblockingFilterDisable(false);
     445    rpcSlice->setDeblockingFilterBetaOffsetDiv2( 0 );
     446    rpcSlice->setDeblockingFilterTcOffsetDiv2( 0 );
     447  } else
     448#endif
    440449  if (rpcSlice->getPPS()->getDeblockingFilterControlPresentFlag())
    441450  {
     
    12231232 \retval rpcBitstream  bitstream class
    12241233 */
    1225 Void TEncSlice::encodeSlice   ( TComPic*& rpcPic, TComOutputBitstream* pcBitstream, TComOutputBitstream* pcSubstreams )
     1234Void TEncSlice::encodeSlice   ( TComPic*& rpcPic, TComOutputBitstream* pcSubstreams )
    12261235{
    12271236  UInt       uiCUAddr;
     
    14031412      }
    14041413      {
    1405           UInt uiCounter = 0;
    1406           vector<uint8_t>& rbsp   = pcSubstreams[uiSubStrm].getFIFO();
    1407           for (vector<uint8_t>::iterator it = rbsp.begin(); it != rbsp.end();)
    1408           {
    1409             /* 1) find the next emulated 00 00 {00,01,02,03}
    1410              * 2a) if not found, write all remaining bytes out, stop.
    1411              * 2b) otherwise, write all non-emulated bytes out
    1412              * 3) insert emulation_prevention_three_byte
    1413              */
    1414             vector<uint8_t>::iterator found = it;
    1415             do
    1416             {
    1417               /* NB, end()-1, prevents finding a trailing two byte sequence */
    1418               found = search_n(found, rbsp.end()-1, 2, 0);
    1419               found++;
    1420               /* if not found, found == end, otherwise found = second zero byte */
    1421               if (found == rbsp.end())
    1422               {
    1423                 break;
    1424               }
    1425               if (*(++found) <= 3)
    1426               {
    1427                 break;
    1428               }
    1429             } while (true);
    1430             it = found;
    1431             if (found != rbsp.end())
    1432             {
    1433               it++;
    1434               uiCounter++;
    1435             }
    1436           }
    1437        
     1414        UInt numStartCodeEmulations = pcSubstreams[uiSubStrm].countStartCodeEmulations();
    14381415        UInt uiAccumulatedSubstreamLength = 0;
    14391416        for (Int iSubstrmIdx=0; iSubstrmIdx < iNumSubstreams; iSubstrmIdx++)
     
    14431420        // add bits coded in previous dependent slices + bits coded so far
    14441421        // add number of emulation prevention byte count in the tile
    1445         pcSlice->addTileLocation( ((pcSlice->getTileOffstForMultES() + uiAccumulatedSubstreamLength - uiBitsOriginallyInSubstreams) >> 3) + uiCounter );
     1422        pcSlice->addTileLocation( ((pcSlice->getTileOffstForMultES() + uiAccumulatedSubstreamLength - uiBitsOriginallyInSubstreams) >> 3) + numStartCodeEmulations );
    14461423      }
    14471424    }
  • branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/TEncSlice.h

    r324 r362  
    122122  Void    precompressSlice    ( TComPic*& rpcPic                                );      ///< precompress slice for multi-loop opt.
    123123  Void    compressSlice       ( TComPic*& rpcPic                                );      ///< analysis stage of slice
    124   Void    encodeSlice         ( TComPic*& rpcPic, TComOutputBitstream* rpcBitstream, TComOutputBitstream* pcSubstreams  );
     124  Void    encodeSlice         ( TComPic*& rpcPic, TComOutputBitstream* pcSubstreams  );
    125125 
    126126  // misc. functions
  • branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/TEncTop.cpp

    r324 r362  
    8181  m_pcBitCounters          = NULL;
    8282  m_pcRdCosts              = NULL;
    83 
    8483#if H_MV
    8584  m_ivPicLists = NULL;
     
    9695Void TEncTop::create ()
    9796{
    98 
    9997#if !H_MV
    10098  // initialize global variables
     
    288286Void TEncTop::init()
    289287{
    290 
    291288  // initialize SPS
    292289  xInitSPS();
     
    348345}
    349346#endif
    350 
    351347Void TEncTop::deletePicBuffer()
    352348{
     
    375371 \retval  iNumEncoded         number of encoded pictures
    376372 */
    377 Void TEncTop::encode(Bool flush, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded
    378373#if H_MV
    379                      , Int gopId
    380 #endif               
    381                      )
    382 {
    383 
     374Void TEncTop::encode(Bool flush, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded , Int gopId )
     375{
     376#else
     377Void TEncTop::encode(Bool flush, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded )
     378{
     379#endif
    384380#if H_3D
    385381  TComPic* picLastCoded = getPic( getGOPEncoder()->getPocLastCoded() );
     
    389385  }
    390386#endif
    391 
    392387#if H_MV
    393388  if( gopId == 0)
     
    547542  m_cSPS.setMaxCUHeight   ( g_uiMaxCUHeight     );
    548543  m_cSPS.setMaxCUDepth    ( g_uiMaxCUDepth      );
    549   m_cSPS.setMinTrDepth    ( 0                   );
    550   m_cSPS.setMaxTrDepth    ( 1                   );
     544
     545  Int minCUSize = m_cSPS.getMaxCUWidth() >> ( m_cSPS.getMaxCUDepth()-g_uiAddCUDepth );
     546  Int log2MinCUSize = 0;
     547  while(minCUSize > 1)
     548  {
     549    minCUSize >>= 1;
     550    log2MinCUSize++;
     551  }
     552
     553  m_cSPS.setLog2MinCodingBlockSize(log2MinCUSize);
     554  m_cSPS.setLog2DiffMaxMinCodingBlockSize(m_cSPS.getMaxCUDepth()-g_uiAddCUDepth);
    551555 
    552556  m_cSPS.setPCMLog2MinSize (m_uiPCMLog2MinSize);
     
    563567
    564568  m_cSPS.setMaxTrSize   ( 1 << m_uiQuadtreeTULog2MaxSize );
    565  
     569#if !L0034_COMBINED_LIST_CLEANUP
    566570  m_cSPS.setUseLComb    ( m_bUseLComb           );
     571#endif
    567572 
    568573  Int i;
     
    716721  m_cPPS.setOutputFlagPresentFlag( false );
    717722  m_cPPS.setSignHideFlag(getSignHideFlag());
     723#if L0386_DB_METRIC
     724  if ( getDeblockingFilterMetric() )
     725  {
     726    m_cPPS.setDeblockingFilterControlPresentFlag (true);
     727    m_cPPS.setDeblockingFilterOverrideEnabledFlag(true);
     728    m_cPPS.setPicDisableDeblockingFilterFlag(false);
     729    m_cPPS.setDeblockingFilterBetaOffsetDiv2(0);
     730    m_cPPS.setDeblockingFilterTcOffsetDiv2(0);
     731  }
     732  else
     733  {
    718734  m_cPPS.setDeblockingFilterControlPresentFlag (m_DeblockingFilterControlPresent );
     735  }
     736#else
     737  m_cPPS.setDeblockingFilterControlPresentFlag (m_DeblockingFilterControlPresent );
     738#endif
    719739  m_cPPS.setLog2ParallelMergeLevelMinus2   (m_log2ParallelMergeLevelMinus2 );
    720740  m_cPPS.setCabacInitPresentFlag(CABAC_INIT_PRESENT_FLAG);
     
    9901010}
    9911011
     1012#if L0208_SOP_DESCRIPTION_SEI
     1013Int TEncTop::getReferencePictureSetIdxForSOP(TComSlice* slice, Int POCCurr, Int GOPid )
     1014{
     1015  int rpsIdx = GOPid;
     1016
     1017  for(Int extraNum=m_iGOPSize; extraNum<m_extraRPSs+m_iGOPSize; extraNum++)
     1018  {   
     1019    if(m_uiIntraPeriod > 0 && getDecodingRefreshType() > 0)
     1020    {
     1021      Int POCIndex = POCCurr%m_uiIntraPeriod;
     1022      if(POCIndex == 0)
     1023      {
     1024        POCIndex = m_uiIntraPeriod;
     1025      }
     1026      if(POCIndex == m_GOPList[extraNum].m_POC)
     1027      {
     1028        rpsIdx = extraNum;
     1029      }
     1030    }
     1031    else
     1032    {
     1033      if(POCCurr==m_GOPList[extraNum].m_POC)
     1034      {
     1035        rpsIdx = extraNum;
     1036      }
     1037    }
     1038  }
     1039
     1040  return rpsIdx;
     1041}
     1042#endif
     1043
    9921044Void  TEncTop::xInitPPSforTiles()
    9931045{
  • branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/TEncTop.h

    r324 r362  
    195195  TComPPS*                getPPS                () { return  &m_cPPS;                 }
    196196  Void selectReferencePictureSet(TComSlice* slice, Int POCCurr, Int GOPid );
     197#if L0208_SOP_DESCRIPTION_SEI
     198  Int getReferencePictureSetIdxForSOP(TComSlice* slice, Int POCCurr, Int GOPid );
     199#endif
    197200  TComScalingList*        getScalingList        () { return  &m_scalingList;         }
    198 
    199201#if H_MV
    200202  TEncAnalyze*            getAnalyzeAll         () { return &m_cAnalyzeAll; }
     
    210212  Void                    setIvPicLists         ( TComPicLists* picLists) { m_ivPicLists = picLists; }
    211213#endif
    212 
    213 
    214214  // -------------------------------------------------------------------------------------------------------------------
    215215  // encoder function
     
    217217
    218218  /// encode several number of pictures until end-of-sequence
     219#if H_MV
     220  Void encode( Bool bEos, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded  , Int gopId  ); 
     221#else
    219222  Void encode( Bool bEos, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut,
    220               std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded
    221 #if H_MV
    222               , Int gopId
    223 #endif       
    224               ); 
    225 
    226 #if H_MV
    227   void printSummary      ( Int numAllPicCoded );
     223              std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded ); 
     224#endif
     225
     226#if H_MV
     227  Void printSummary      ( Int numAllPicCoded );
    228228#else
    229229  void printSummary() { m_cGOPEncoder.printOutSummary (m_uiNumAllPicCoded); }
    230230#endif
    231 
    232231};
    233232
  • branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/WeightPredAnalysis.cpp

    r324 r362  
    235235        Int offset = (Int)( ((currDC<<log2Denom) - ((Int64)weight * refDC) + (Int64)realOffset) >> realLog2Denom );
    236236
    237         // Chroma offset range limination
     237        // Chroma offset range limitation
    238238        if(comp)
    239239        {
    240           Int shift = 1 << (g_bitDepthC - 1);
    241           Int pred = ( shift - ( ( shift*weight)>>(log2Denom) ) );
     240          Int pred = ( 128 - ( ( 128*weight)>>(log2Denom) ) );
    242241          Int deltaOffset = Clip3( -512, 511, (offset - pred) );    // signed 10bit
    243242          offset = Clip3( -128, 127, (deltaOffset + pred) );        // signed 8bit
     243        }
     244        // Luma offset range limitation
     245        else
     246        {
     247          offset = Clip3( -128, 127, offset);
    244248        }
    245249
Note: See TracChangeset for help on using the changeset viewer.