Changeset 362 in 3DVCSoftware for branches/HTM-DEV-0.1-dev/source
- Timestamp:
- 3 May 2013, 15:34:11 (12 years ago)
- Location:
- branches/HTM-DEV-0.1-dev/source
- Files:
-
- 41 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-DEV-0.1-dev/source/App/TAppDecoder/TAppDecTop.cpp
r324 r362 296 296 } 297 297 if ( bNewPicture && 298 #endif 299 ( nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR 298 ( nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL 300 299 || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP 301 300 || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_N_LP 302 || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA NT303 || 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 ) ) 304 303 { 305 304 #if H_MV -
branches/HTM-DEV-0.1-dev/source/App/TAppEncoder/TAppEncCfg.cpp
r324 r362 78 78 #if !H_MV 79 79 m_aidQP = NULL; 80 #if J0149_TONE_MAPPING_SEI 81 m_startOfCodedInterval = NULL; 82 m_codedPivotValue = NULL; 83 m_targetPivotValue = NULL; 80 84 #endif 81 85 } … … 104 108 free(m_pchInputFile); 105 109 #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 107 127 free(m_pchBitstreamFile); 108 128 … … 321 341 string cfg_RowHeight; 322 342 string cfg_ScalingListFile; 343 #if J0149_TONE_MAPPING_SEI 344 string cfg_startOfCodedInterval; 345 string cfg_codedPivotValue; 346 string cfg_targetPivotValue; 347 #endif 323 348 #if SIGNAL_BITRATE_PICRATE_IN_VPS 324 349 string cfg_bitRateInfoPresentFlag; … … 417 442 ("DecodingRefreshType,-dr", m_iDecodingRefreshType, 0, "Intra refresh type (0:none 1:CRA 2:IDR)") 418 443 ("GOPSize,g", m_iGOPSize, 1, "GOP size of temporal structure") 444 #if !L0034_COMBINED_LIST_CLEANUP 419 445 ("ListCombination,-lc", m_bUseLComb, true, "Combined reference list for uni-prediction estimation in B-slices") 446 #endif 420 447 // motion options 421 448 ("FastSearch", m_iFastSearch, 1, "0:Full search 1:Diamond 2:PMVFAST") … … 473 500 ("LoopFilterTcOffset_div2", m_loopFilterTcOffsetDiv2, 0 ) 474 501 ("DeblockingFilterControlPresent", m_DeblockingFilterControlPresent, false ) 502 #if L0386_DB_METRIC 503 ("DeblockingFilterMetric", m_DeblockingFilterMetric, false ) 504 #endif 475 505 476 506 // Coding tools … … 591 621 ("SEIBufferingPeriod", m_bufferingPeriodSEIEnabled, 0, "Control generation of buffering period SEI messages") 592 622 ("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 593 655 ("SEIFramePacking", m_framePackingSEIEnabled, 0, "Control generation of frame packing SEI messages") 594 656 ("SEIFramePackingType", m_framePackingSEIType, 0, "Define frame packing arrangement\n" … … 611 673 ("SEIGradualDecodingRefreshInfo", m_gradualDecodingRefreshInfoEnabled, 0, "Control generation of gradual decoding refresh information SEI message") 612 674 ("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 613 681 #if SIGNAL_BITRATE_PICRATE_IN_VPS 614 682 ("BitRatePicRateMaxTLayers", m_bitRatePicRateMaxTLayers, 0, "Maximum number of sub-layers signalled; can be inferred otherwise; here for easy parsing of config. file") … … 914 982 m_iWaveFrontSubstreams = m_iWaveFrontSynchro ? (m_iSourceHeight + m_uiMaxCUHeight - 1) / m_uiMaxCUHeight : 1; 915 983 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 916 1044 // check validity of input parameters 917 1045 xCheckParameter(); … … 1609 1737 { 1610 1738 m_numReorderPics[i] = 0; 1739 #if L0323_DPB 1740 m_maxDecPicBuffering[i] = 1; 1741 #else 1611 1742 m_maxDecPicBuffering[i] = 0; 1743 #endif 1612 1744 } 1613 1745 for(Int i=0; i<m_iGOPSize; i++) 1614 1746 { 1747 #if L0323_DPB 1748 if(m_GOPList[i].m_numRefPics+1 > m_maxDecPicBuffering[m_GOPList[i].m_temporalId]) 1749 #else 1615 1750 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 1617 1756 m_maxDecPicBuffering[m_GOPList[i].m_temporalId] = m_GOPList[i].m_numRefPics; 1757 #endif 1618 1758 } 1619 1759 Int highestDecodingNumberWithLowerPOC = 0; … … 1646 1786 m_numReorderPics[i+1] = m_numReorderPics[i]; 1647 1787 } 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 1648 1795 // the value of num_reorder_pics[ i ] shall be in the range of 0 to max_dec_pic_buffering[ i ], inclusive 1649 1796 if(m_numReorderPics[i] > m_maxDecPicBuffering[i]) … … 1651 1798 m_maxDecPicBuffering[i] = m_numReorderPics[i]; 1652 1799 } 1800 #endif 1653 1801 // a lower layer can not have higher value of m_uiMaxDecPicBuffering than a higher layer 1654 1802 if(m_maxDecPicBuffering[i+1] < m_maxDecPicBuffering[i]) … … 1657 1805 } 1658 1806 } 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 1659 1816 // the value of num_reorder_pics[ i ] shall be in the range of 0 to max_dec_pic_buffering[ i ], inclusive 1660 1817 if(m_numReorderPics[MAX_TLAYER-1] > m_maxDecPicBuffering[MAX_TLAYER-1]) … … 1662 1819 m_maxDecPicBuffering[MAX_TLAYER-1] = m_numReorderPics[MAX_TLAYER-1]; 1663 1820 } 1821 #endif 1664 1822 1665 1823 if(m_vuiParametersPresentFlag && m_bitstreamRestrictionFlag) … … 1736 1894 } 1737 1895 } 1896 #if !L0034_COMBINED_LIST_CLEANUP 1738 1897 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 1739 1899 xConfirmPara( m_iWaveFrontSynchro < 0, "WaveFrontSynchro cannot be negative" ); 1740 1900 xConfirmPara( m_iWaveFrontSubstreams <= 0, "WaveFrontSubstreams must be positive" ); … … 1742 1902 1743 1903 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 1744 1917 1745 1918 #if RATE_CONTROL_LAMBDA_DOMAIN … … 1908 2081 printf("SQP:%d ", m_uiDeltaQpRD ); 1909 2082 printf("ASR:%d ", m_bUseASR ); 2083 #if !L0034_COMBINED_LIST_CLEANUP 1910 2084 printf("LComb:%d ", m_bUseLComb ); 2085 #endif 1911 2086 printf("FEN:%d ", m_bUseFastEnc ); 1912 2087 printf("ECU:%d ", m_bUseEarlyCU ); -
branches/HTM-DEV-0.1-dev/source/App/TAppEncoder/TAppEncCfg.h
r324 r362 124 124 GOPEntry m_GOPList[MAX_GOP]; ///< the coding structure entries from the config file 125 125 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 126 129 Int m_maxDecPicBuffering[MAX_TLAYER]; ///< total number of reference pictures needed for decoding 127 130 #endif 131 #if !L0034_COMBINED_LIST_CLEANUP 128 132 Bool m_bUseLComb; ///< flag for using combined reference list for uni-prediction in B-slices (JCTVC-D421) 133 #endif 129 134 Bool m_useTransformSkip; ///< flag for enabling intra transform skipping 130 135 Bool m_useTransformSkipFast; ///< flag for enabling fast intra transform skipping … … 207 212 Int m_loopFilterTcOffsetDiv2; ///< tc offset for deblocking filter 208 213 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 209 217 210 218 // coding tools (PCM) … … 256 264 Int m_bufferingPeriodSEIEnabled; 257 265 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 258 293 Int m_framePackingSEIEnabled; 259 294 Int m_framePackingSEIType; … … 265 300 Int m_gradualDecodingRefreshInfoEnabled; 266 301 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 267 308 // weighted prediction 268 309 Bool m_useWeightedPred; ///< Use of weighted prediction in P slices -
branches/HTM-DEV-0.1-dev/source/App/TAppEncoder/TAppEncTop.cpp
r324 r362 207 207 m_cTEncTop.setLoopFilterTcOffset ( m_loopFilterTcOffsetDiv2 ); 208 208 m_cTEncTop.setDeblockingFilterControlPresent( m_DeblockingFilterControlPresent); 209 #if L0386_DB_METRIC 210 m_cTEncTop.setDeblockingFilterMetric ( m_DeblockingFilterMetric ); 211 #endif 209 212 210 213 //====== Motion search ======== … … 243 246 m_cTEncTop.setUseHADME ( m_bUseHADME ); 244 247 m_cTEncTop.setUseLossless ( m_useLossless ); 248 #if !L0034_COMBINED_LIST_CLEANUP 245 249 m_cTEncTop.setUseLComb ( m_bUseLComb ); 250 #endif 246 251 #if H_MV 247 252 m_cTEncTop.setdQPs ( m_aidQP[layer] ); … … 321 326 m_cTEncTop.setBufferingPeriodSEIEnabled( m_bufferingPeriodSEIEnabled ); 322 327 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 323 355 m_cTEncTop.setFramePackingArrangementSEIEnabled( m_framePackingSEIEnabled ); 324 356 m_cTEncTop.setFramePackingArrangementSEIType( m_framePackingSEIType ); … … 330 362 m_cTEncTop.setGradualDecodingRefreshInfoEnabled( m_gradualDecodingRefreshInfoEnabled ); 331 363 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 332 370 m_cTEncTop.setUniformSpacingIdr ( m_iUniformSpacingIdr ); 333 371 m_cTEncTop.setNumColumnsMinus1 ( m_iNumColumnsMinus1 ); … … 832 870 case NAL_UNIT_CODED_SLICE_TRAIL_R: 833 871 case NAL_UNIT_CODED_SLICE_TRAIL_N: 834 case NAL_UNIT_CODED_SLICE_TLA :872 case NAL_UNIT_CODED_SLICE_TLA_R: 835 873 case NAL_UNIT_CODED_SLICE_TSA_N: 836 874 case NAL_UNIT_CODED_SLICE_STSA_R: 837 875 case NAL_UNIT_CODED_SLICE_STSA_N: 838 case NAL_UNIT_CODED_SLICE_BLA :839 case NAL_UNIT_CODED_SLICE_BLA NT:876 case NAL_UNIT_CODED_SLICE_BLA_W_LP: 877 case NAL_UNIT_CODED_SLICE_BLA_W_RADL: 840 878 case NAL_UNIT_CODED_SLICE_BLA_N_LP: 841 case NAL_UNIT_CODED_SLICE_IDR :879 case NAL_UNIT_CODED_SLICE_IDR_W_RADL: 842 880 case NAL_UNIT_CODED_SLICE_IDR_N_LP: 843 881 case NAL_UNIT_CODED_SLICE_CRA: 844 882 case NAL_UNIT_CODED_SLICE_RADL_N: 845 case NAL_UNIT_CODED_SLICE_ DLP:883 case NAL_UNIT_CODED_SLICE_RADL_R: 846 884 case NAL_UNIT_CODED_SLICE_RASL_N: 847 case NAL_UNIT_CODED_SLICE_ TFD:885 case NAL_UNIT_CODED_SLICE_RASL_R: 848 886 case NAL_UNIT_VPS: 849 887 case NAL_UNIT_SPS: -
branches/HTM-DEV-0.1-dev/source/Lib/TLibCommon/CommonDef.h
r324 r362 58 58 #if H_MV 59 59 #define NV_VERSION "0.1" ///< Current software version 60 #define HM_VERSION "10. 0" ///<61 #else 62 #define NV_VERSION "10. 0" ///< Current software version60 #define HM_VERSION "10.1" ///< 61 #else 62 #define NV_VERSION "10.1" ///< Current software version 63 63 #endif 64 64 … … 115 115 #define MAX_NUM_REF_PICS 16 ///< max. number of pictures used for reference 116 116 #define MAX_NUM_REF 16 ///< max. number of entries in picture reference list 117 #if !L0034_COMBINED_LIST_CLEANUP 117 118 #define MAX_NUM_REF_LC MAX_NUM_REF_PICS // TODO: remove this macro definition (leftover from combined list concept) 119 #endif 118 120 119 121 #define MAX_UINT 0xFFFFFFFFU ///< max. value of unsigned 32-bit integer … … 214 216 215 217 NAL_UNIT_CODED_SLICE_TSA_N, // 2 216 NAL_UNIT_CODED_SLICE_TLA , // 3 // Current name in the spec: TSA_R218 NAL_UNIT_CODED_SLICE_TLA_R, // 3 217 219 218 220 NAL_UNIT_CODED_SLICE_STSA_N, // 4 … … 220 222 221 223 NAL_UNIT_CODED_SLICE_RADL_N, // 6 222 NAL_UNIT_CODED_SLICE_ DLP, // 7 // Current name in the spec: RADL_R224 NAL_UNIT_CODED_SLICE_RADL_R, // 7 223 225 224 226 NAL_UNIT_CODED_SLICE_RASL_N, // 8 225 NAL_UNIT_CODED_SLICE_ TFD, // 9 // Current name in the spec: RASL_R226 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_LP235 NAL_UNIT_CODED_SLICE_BLA NT, // 17 // Current name in the spec: BLA_W_DLP227 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 236 238 NAL_UNIT_CODED_SLICE_BLA_N_LP, // 18 237 NAL_UNIT_CODED_SLICE_IDR , // 19 // Current name in the spec: IDR_W_DLP239 NAL_UNIT_CODED_SLICE_IDR_W_RADL, // 19 238 240 NAL_UNIT_CODED_SLICE_IDR_N_LP, // 20 239 241 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, 251 253 252 254 NAL_UNIT_VPS, // 32 … … 257 259 NAL_UNIT_EOB, // 37 258 260 NAL_UNIT_FILLER_DATA, // 38 259 NAL_UNIT_ SEI, // 39 Prefix SEI260 NAL_UNIT_S EI_SUFFIX, // 40 Suffix SEI261 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, 268 270 NAL_UNIT_UNSPECIFIED_48, 269 271 NAL_UNIT_UNSPECIFIED_49, -
branches/HTM-DEV-0.1-dev/source/Lib/TLibCommon/NAL.h
r324 r362 80 80 return m_nalUnitType == NAL_UNIT_CODED_SLICE_TRAIL_R 81 81 || 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 83 83 || m_nalUnitType == NAL_UNIT_CODED_SLICE_TSA_N 84 84 || m_nalUnitType == NAL_UNIT_CODED_SLICE_STSA_R 85 85 || m_nalUnitType == NAL_UNIT_CODED_SLICE_STSA_N 86 || m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA 87 || m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA NT86 || m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_LP 87 || m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_RADL 88 88 || 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 90 90 || m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP 91 91 || m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA 92 92 || m_nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N 93 || m_nalUnitType == NAL_UNIT_CODED_SLICE_ DLP93 || m_nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R 94 94 || 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; 96 96 } 97 97 #if L0045_NON_NESTED_SEI_RESTRICTIONS 98 98 Bool isSei() 99 99 { 100 return m_nalUnitType == NAL_UNIT_ SEI101 || m_nalUnitType == NAL_UNIT_S EI_SUFFIX;100 return m_nalUnitType == NAL_UNIT_PREFIX_SEI 101 || m_nalUnitType == NAL_UNIT_SUFFIX_SEI; 102 102 } 103 103 -
branches/HTM-DEV-0.1-dev/source/Lib/TLibCommon/SEI.cpp
r324 r362 38 38 #include "CommonDef.h" 39 39 #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 43 Int 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 40 45 41 46 SEIMessages getSeisByType(SEIMessages &seiList, SEI::PayloadType seiType) -
branches/HTM-DEV-0.1-dev/source/Lib/TLibCommon/SEI.h
r324 r362 355 355 }; 356 356 357 #if L0208_SOP_DESCRIPTION_SEI 358 class SEISOPDescription : public SEI 359 { 360 public: 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 377 class SEIToneMappingInfo : public SEI 378 { 379 public: 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 357 411 typedef std::list<SEI*> SEIMessages; 358 412 … … 366 420 Void deleteSEIs (SEIMessages &seiList); 367 421 422 #if K0180_SCALABLE_NESTING_SEI 423 class SEIScalableNesting : public SEI 424 { 425 public: 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 368 454 //! \} -
branches/HTM-DEV-0.1-dev/source/Lib/TLibCommon/TComBitStream.cpp
r324 r362 177 177 } 178 178 } 179 179 180 Void TComOutputBitstream::writeByteAlignment() 180 181 { … … 182 183 writeAlignZero(); 183 184 } 185 186 Int 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 184 218 /** 185 219 * read #uiNumberOfBits# from bitstream without updating the bitstream -
branches/HTM-DEV-0.1-dev/source/Lib/TLibCommon/TComBitStream.h
r324 r362 154 154 Void addSubstream ( TComOutputBitstream* pcSubstream ); 155 155 Void writeByteAlignment(); 156 157 //! returns the number of start code emulations contained in the current buffer 158 Int countStartCodeEmulations(); 156 159 }; 157 160 … … 163 166 { 164 167 std::vector<uint8_t> *m_fifo; /// FIFO for storage of complete bytes 168 std::vector<UInt> m_emulationPreventionByteLocation; 165 169 166 170 protected: … … 206 210 UInt getNumBitsRead() { return m_numBitsRead; } 207 211 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; } 208 219 }; 209 220 -
branches/HTM-DEV-0.1-dev/source/Lib/TLibCommon/TComLoopFilter.cpp
r324 r362 57 57 // ==================================================================================================================== 58 58 59 const UChar tctable_8x8[54] =59 const UChar TComLoopFilter::sm_tcTable[54] = 60 60 { 61 61 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 62 62 }; 63 63 64 const UChar betatable_8x8[52] =64 const UChar TComLoopFilter::sm_betaTable[52] = 65 65 { 66 66 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 … … 585 585 Int iIndexB = Clip3(0, MAX_QP, iQP + (betaOffsetDiv2 << 1)); 586 586 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; 589 589 Int iSideThreshold = (iBeta+(iBeta>>1))>>3; 590 590 Int iThrCut = iTc*10; … … 735 735 736 736 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; 738 738 739 739 for ( UInt uiStep = 0; uiStep < uiPelsInPartChroma; uiStep++ ) -
branches/HTM-DEV-0.1-dev/source/Lib/TLibCommon/TComLoopFilter.h
r324 r362 99 99 __inline Int xCalcDQ( Pel* piSrc, Int iOffset); 100 100 101 static const UChar sm_tcTable[54]; 102 static const UChar sm_betaTable[52]; 103 101 104 public: 102 105 TComLoopFilter(); … … 111 114 /// picture-level deblocking filter 112 115 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 } 113 122 }; 114 123 -
branches/HTM-DEV-0.1-dev/source/Lib/TLibCommon/TComPrediction.cpp
r324 r362 83 83 if( m_piYuvExt == NULL ) 84 84 { 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; 87 87 Int i, j; 88 88 for (i = 0; i < 4; i++) … … 94 94 } 95 95 } 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); 98 98 m_piYuvExt = new Int[ m_iYuvExtStride * m_iYuvExtHeight ]; 99 99 100 100 // 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; 110 110 if (!m_pLumaRecBuffer) 111 111 { -
branches/HTM-DEV-0.1-dev/source/Lib/TLibCommon/TComRom.cpp
r324 r362 62 62 g_aucConvertToBit[ i ] = c; 63 63 64 // g_auiFrameScanXY[ g_aucConvertToBit[ transformSize ] ]: zigzag scan array for transformSize65 64 c=2; 66 65 for ( i=0; i<MAX_CU_DEPTH; i++ ) … … 77 76 Void destroyROM() 78 77 { 79 Int i; 80 81 for ( i=0; i<MAX_CU_DEPTH; i++ ) 78 for (Int i=0; i<MAX_CU_DEPTH; i++ ) 82 79 { 83 80 delete[] g_auiSigLastScan[0][i]; -
branches/HTM-DEV-0.1-dev/source/Lib/TLibCommon/TComSlice.cpp
r331 r362 49 49 , m_iPOC ( 0 ) 50 50 , m_iLastIDR ( 0 ) 51 , m_eNalUnitType ( NAL_UNIT_CODED_SLICE_IDR )51 , m_eNalUnitType ( NAL_UNIT_CODED_SLICE_IDR_W_RADL ) 52 52 , m_eSliceType ( I_SLICE ) 53 53 , m_iSliceQp ( 0 ) … … 60 60 , m_deblockingFilterBetaOffsetDiv2 ( 0 ) 61 61 , m_deblockingFilterTcOffsetDiv2 ( 0 ) 62 #if !L0034_COMBINED_LIST_CLEANUP 62 63 , m_bRefPicListModificationFlagLC ( false ) 63 64 , m_bRefPicListCombinationFlag ( false ) 65 #endif 64 66 , m_bCheckLDC ( false ) 65 67 , m_iSliceQpDelta ( 0 ) … … 79 81 , m_dLambda ( 0.0 ) 80 82 #endif 83 #if !L0034_COMBINED_LIST_CLEANUP 81 84 , m_bNoBackPredFlag ( false ) 85 #endif 82 86 , m_uiTLayer ( 0 ) 83 87 , m_bTLayerSwitchingFlag ( false ) … … 111 115 #endif 112 116 { 117 #if L0034_COMBINED_LIST_CLEANUP 118 m_aiNumRefIdx[0] = m_aiNumRefIdx[1] = 0; 119 #else 113 120 m_aiNumRefIdx[0] = m_aiNumRefIdx[1] = m_aiNumRefIdx[2] = 0; 121 #endif 114 122 115 123 initEqualRef(); 116 124 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 117 131 for(Int iNumCount = 0; iNumCount < MAX_NUM_REF_LC; iNumCount++) 118 132 { … … 124 138 m_iRefIdxOfL1FromRefIdxOfL0[iNumCount] = -1; 125 139 } 140 #endif 126 141 for(Int iNumCount = 0; iNumCount < MAX_NUM_REF; iNumCount++) 127 142 { … … 135 150 #endif 136 151 } 137 resetWpScaling( m_weightPredTable);152 resetWpScaling(); 138 153 initWpAcDcParam(); 139 154 m_saoEnabledFlag = false; … … 156 171 m_colRefIdx = 0; 157 172 initEqualRef(); 173 #if !L0034_COMBINED_LIST_CLEANUP 158 174 m_bNoBackPredFlag = false; 159 175 m_bRefPicListCombinationFlag = false; 160 176 m_bRefPicListModificationFlagLC = false; 177 #endif 161 178 m_bCheckLDC = false; 162 179 m_iSliceQpDeltaCb = 0; 163 180 m_iSliceQpDeltaCr = 0; 164 181 182 #if !L0034_COMBINED_LIST_CLEANUP 165 183 m_aiNumRefIdx[REF_PIC_LIST_C] = 0; 184 #endif 166 185 167 186 m_maxNumMergeCand = MRG_MAX_NUM_CANDS; … … 177 196 Bool TComSlice::getRapPicFlag() 178 197 { 179 return getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR 198 return getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL 180 199 || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP 181 200 || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP 182 || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA NT183 || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA 201 || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL 202 || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 184 203 || getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA; 185 204 } … … 251 270 252 271 253 TComPic* TComSlice::xGetLongTermRefPic (TComList<TComPic*>& rcListPic, 254 Int poc) 272 TComPic* TComSlice::xGetLongTermRefPic(TComList<TComPic*>& rcListPic, Int poc, Bool pocHasMsb) 255 273 { 256 274 TComList<TComPic*>::iterator iterPic = rcListPic.begin(); 257 275 TComPic* pcPic = *(iterPic); 258 276 TComPic* pcStPic = pcPic; 277 278 Int pocCycle = 1 << getSPS()->getBitsForPOC(); 279 if (!pocHasMsb) 280 { 281 poc = poc % pocCycle; 282 } 283 259 284 while ( iterPic != rcListPic.end() ) 260 285 { 261 286 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) 263 296 { 264 297 if(pcPic->getIsLongTerm()) … … 272 305 break; 273 306 } 307 } 274 308 275 309 iterPic++; 276 310 } 311 277 312 return pcStPic; 278 313 } … … 293 328 } 294 329 330 #if L0034_COMBINED_LIST_CLEANUP 331 Void 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 295 348 Void TComSlice::generateCombinedList() 296 349 { … … 365 418 } 366 419 } 420 #endif 367 421 368 422 #if H_MV 369 Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic, std::vector<TComPic*>& refPicSetInterLayer ) 423 Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic, Bool checkNumPocTotalCurr,std::vector<TComPic*>& refPicSetInterLayer ) 424 #else 425 #if FIX1071 426 Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic, Bool checkNumPocTotalCurr ) 370 427 #else 371 428 Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic ) 372 429 #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 } 378 443 379 return;380 }381 382 444 #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 } 386 449 387 450 TComPic* pcRefPic= NULL; … … 410 473 } 411 474 } 475 412 476 for(; i < m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures(); i++) 413 477 { … … 422 486 } 423 487 } 488 424 489 for(i = m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures()+m_pcRPS->getNumberOfLongtermPictures()-1; i > m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures()-1 ; i--) 425 490 { 426 491 if(m_pcRPS->getUsed(i)) 427 492 { 428 pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i) );493 pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i), m_pcRPS->getCheckLTMSBPresent(i)); 429 494 pcRefPic->setIsLongTerm(1); 430 495 pcRefPic->getPicYuvRec()->extendPicBorder(); … … 434 499 if(pcRefPic==NULL) 435 500 { 436 pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i) );501 pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i), m_pcRPS->getCheckLTMSBPresent(i)); 437 502 } 438 503 pcRefPic->setCheckLTMSBPresent(m_pcRPS->getCheckLTMSBPresent(i)); … … 448 513 Int numPocTotalCurr = NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr; 449 514 #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 } 465 554 #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 475 563 476 564 if (m_eSliceType==B_SLICE) 477 565 { 478 IntcIdx = 0;566 cIdx = 0; 479 567 for ( i=0; i<NumPocStCurr1; i++, cIdx++) 480 568 { … … 585 673 } 586 674 587 Void TComSlice::checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, Bool& prevRAPisBLA )675 Void TComSlice::checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, Bool& prevRAPisBLA, TComList<TComPic *>& rcListPic) 588 676 { 589 677 for(Int i = 0; i < pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures(); i++) … … 598 686 if(pocCRA < MAX_UINT && getPOC() > pocCRA) 599 687 { 688 if (!pReferencePictureSet->getCheckLTMSBPresent(i)) 689 { 690 assert(xGetLongTermRefPic(rcListPic, pReferencePictureSet->getPOC(i), false)->getPOC() >= pocCRA); 691 } 692 else 693 { 600 694 assert(pReferencePictureSet->getPOC(i) >= pocCRA); 601 695 } 602 696 } 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 604 699 { 605 700 pocCRA = getPOC(); … … 611 706 prevRAPisBLA = false; 612 707 } 613 else if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA 614 || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA NT708 else if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 709 || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL 615 710 || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) // BLA picture found 616 711 { … … 643 738 Int pocCurr = getPOC(); 644 739 645 if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA 646 || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA NT740 if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 741 || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL 647 742 || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP 648 || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR 743 || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL 649 744 || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP ) // IDR or BLA picture 650 745 { … … 658 753 iterPic++; 659 754 } 660 if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA 661 || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA NT755 if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 756 || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL 662 757 || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) 663 758 { … … 673 768 { 674 769 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 } 676 774 iterPic++; 677 775 } … … 707 805 m_deblockingFilterTcOffsetDiv2 = pSrc->m_deblockingFilterTcOffsetDiv2; 708 806 807 #if L0034_COMBINED_LIST_CLEANUP 808 for (i = 0; i < 2; i++) 809 #else 709 810 for (i = 0; i < 3; i++) 811 #endif 710 812 { 711 813 m_aiNumRefIdx[i] = pSrc->m_aiNumRefIdx[i]; 712 814 } 713 815 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 714 822 for (i = 0; i < 2; i++) 715 823 { … … 728 836 m_bRefPicListModificationFlagLC = pSrc->m_bRefPicListModificationFlagLC; 729 837 m_bRefPicListCombinationFlag = pSrc->m_bRefPicListCombinationFlag; 838 #endif 730 839 m_bCheckLDC = pSrc->m_bCheckLDC; 731 840 m_iSliceQpDelta = pSrc->m_iSliceQpDelta; … … 785 894 } 786 895 896 #if !L0034_COMBINED_LIST_CLEANUP 787 897 m_bNoBackPredFlag = pSrc->m_bNoBackPredFlag; 898 #endif 788 899 m_uiTLayer = pSrc->m_uiTLayer; 789 900 m_bTLayerSwitchingFlag = pSrc->m_bTLayerSwitchingFlag; … … 819 930 820 931 Int TComSlice::m_prevPOC = 0; 932 821 933 /** Function for setting the slice's temporal layer ID and corresponding temporal_layer_switching_point_flag. 822 934 * \param uiTLayer Temporal layer ID of the current slice … … 879 991 Int i, isReference; 880 992 881 Int j = 0;882 993 // loop through all pictures in the reference picture buffer 883 994 TComList<TComPic*>::iterator iterPic = rcListPic.begin(); 884 995 while ( iterPic != rcListPic.end()) 885 996 { 886 j++;887 997 rpcPic = *(iterPic++); 998 999 if(!rpcPic->getSlice( 0 )->isReferenced()) 1000 { 1001 continue; 1002 } 888 1003 889 1004 isReference = 0; … … 924 1039 { 925 1040 rpcPic->getSlice( 0 )->setReferenced( false ); 1041 rpcPic->setUsedByCurr(0); 926 1042 rpcPic->setIsLongTerm(0); 927 1043 } … … 929 1045 assert(rpcPic->getSlice( 0 )->isReferenced()==0||rpcPic->getUsedByCurr()==0||rpcPic->getTLayer()<=this->getTLayer()); 930 1046 //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) 932 1048 { 933 1049 assert(rpcPic->getSlice( 0 )->isReferenced()==0||rpcPic->getTLayer()<this->getTLayer()); 934 1050 } 935 936 1051 //check that pictures marked as temporal layer non-reference pictures are not used for reference 937 1052 if(rpcPic->getPicSym()->getSlice(0)->getPOC() != this->getPOC() && rpcPic->getTLayer()==this->getTLayer()) … … 947 1062 { 948 1063 TComPic* rpcPic; 949 Int i, isAvailable , j;1064 Int i, isAvailable; 950 1065 Int atLeastOneLost = 0; 951 1066 Int atLeastOneRemoved = 0; … … 956 1071 for(i=pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures();i<pReferencePictureSet->getNumberOfPictures();i++) 957 1072 { 958 j = 0;959 1073 isAvailable = 0; 960 1074 // loop through all pictures in the reference picture buffer … … 962 1076 while ( iterPic != rcListPic.end()) 963 1077 { 964 j++;965 1078 rpcPic = *(iterPic++); 966 1079 if(pReferencePictureSet->getCheckLTMSBPresent(i)==true) … … 985 1098 while ( iterPic != rcListPic.end()) 986 1099 { 987 j++;988 1100 rpcPic = *(iterPic++); 989 1101 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) 991 1112 { 992 1113 isAvailable = 1; … … 1026 1147 for(i=0;i<pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures();i++) 1027 1148 { 1028 j = 0;1029 1149 isAvailable = 0; 1030 1150 // loop through all pictures in the reference picture buffer … … 1032 1152 while ( iterPic != rcListPic.end()) 1033 1153 { 1034 j++;1035 1154 rpcPic = *(iterPic++); 1036 1155 … … 1049 1168 { 1050 1169 if(printErrors) 1170 { 1051 1171 printf("\nShort-term reference picture with POC = %3d seems to have been removed or not correctly decoded.", this->getPOC() + pReferencePictureSet->getDeltaPOC(i)); 1172 } 1052 1173 atLeastOneRemoved = 1; 1053 1174 } … … 1055 1176 { 1056 1177 if(printErrors) 1178 { 1057 1179 printf("\nShort-term reference picture with POC = %3d is lost or not correctly decoded!", this->getPOC() + pReferencePictureSet->getDeltaPOC(i)); 1180 } 1058 1181 atLeastOneLost = 1; 1059 1182 iPocLost=this->getPOC() + pReferencePictureSet->getDeltaPOC(i); … … 1201 1324 * \returns Void 1202 1325 */ 1203 Void TComSlice::resetWpScaling( wpScalingParam wp[2][MAX_NUM_REF][3])1326 Void TComSlice::resetWpScaling() 1204 1327 { 1205 1328 for ( Int e=0 ; e<2 ; e++ ) … … 1209 1332 for ( Int yuv=0 ; yuv<3 ; yuv++ ) 1210 1333 { 1211 wpScalingParam *pwp = &( wp[e][i][yuv]);1334 wpScalingParam *pwp = &(m_weightPredTable[e][i][yuv]); 1212 1335 pwp->bPresentFlag = false; 1213 1336 pwp->uiLog2WeightDenom = 0; … … 1225 1348 Void TComSlice::initWpScaling() 1226 1349 { 1227 initWpScaling(m_weightPredTable);1228 }1229 1230 /** set WP tables1231 * \param wpScalingParam1232 * \returns Void1233 */1234 Void TComSlice::initWpScaling(wpScalingParam wp[2][MAX_NUM_REF][3])1235 {1236 1350 for ( Int e=0 ; e<2 ; e++ ) 1237 1351 { … … 1240 1354 for ( Int yuv=0 ; yuv<3 ; yuv++ ) 1241 1355 { 1242 wpScalingParam *pwp = &(wp[e][i][yuv]); 1243 if ( !pwp->bPresentFlag ) { 1356 wpScalingParam *pwp = &(m_weightPredTable[e][i][yuv]); 1357 if ( !pwp->bPresentFlag ) 1358 { 1244 1359 // Inferring values not present : 1245 1360 pwp->iWeight = (1 << pwp->uiLog2WeightDenom); … … 1275 1390 , m_cprmsPresentFlag (NULL) 1276 1391 { 1277 1278 1392 for( Int i = 0; i < MAX_TLAYER; i++) 1279 1393 { 1280 1394 m_numReorderPics[i] = 0; 1395 #if L0323_DPB 1396 m_uiMaxDecPicBuffering[i] = 1; 1397 #else 1281 1398 m_uiMaxDecPicBuffering[i] = 0; 1399 #endif 1282 1400 m_uiMaxLatencyIncrease[i] = 0; 1283 1401 } … … 1333 1451 TComVPS::~TComVPS() 1334 1452 { 1335 if( m_hrdParameters != NULL ) deletem_hrdParameters;1336 if( m_hrdOpSetIdx != NULL ) delete m_hrdOpSetIdx;1337 if( m_cprmsPresentFlag != NULL ) delete m_cprmsPresentFlag;1453 if( m_hrdParameters != NULL ) delete[] m_hrdParameters; 1454 if( m_hrdOpSetIdx != NULL ) delete[] m_hrdOpSetIdx; 1455 if( m_cprmsPresentFlag != NULL ) delete[] m_cprmsPresentFlag; 1338 1456 } 1339 1457 … … 1438 1556 , m_picWidthInLumaSamples (352) 1439 1557 , m_picHeightInLumaSamples (288) 1558 , m_log2MinCodingBlockSize ( 0) 1559 , m_log2DiffMaxMinCodingBlockSize (0) 1440 1560 , m_uiMaxCUWidth ( 32) 1441 1561 , m_uiMaxCUHeight ( 32) 1442 1562 , m_uiMaxCUDepth ( 3) 1443 , m_uiMinTrDepth ( 0)1444 , m_uiMaxTrDepth ( 1)1445 1563 , m_bLongTermRefsPresent (false) 1446 1564 , m_uiQuadtreeTULog2MaxSize ( 0) … … 1452 1570 , m_pcmLog2MaxSize ( 5) 1453 1571 , m_uiPCMLog2MinSize ( 7) 1572 #if !L0034_COMBINED_LIST_CLEANUP 1454 1573 , m_bUseLComb (false) 1574 #endif 1455 1575 , m_bitDepthY ( 8) 1456 1576 , m_bitDepthC ( 8) … … 1477 1597 { 1478 1598 m_uiMaxLatencyIncrease[i] = 0; 1599 #if L0323_DPB 1600 m_uiMaxDecPicBuffering[i] = 1; 1601 #else 1479 1602 m_uiMaxDecPicBuffering[i] = 0; 1603 #endif 1480 1604 m_numReorderPics[i] = 0; 1481 1605 } … … 1496 1620 m_RPSList.create(numRPS); 1497 1621 } 1622 1498 1623 Void TComSPS::setHrdParameters( UInt frameRate, UInt numDU, UInt bitRate, Bool randomAccess ) 1499 1624 { … … 1740 1865 return m_POC[bufferNum]; 1741 1866 } 1867 1742 1868 Void TComReferencePictureSet::setPOC(Int bufferNum, Int POC) 1743 1869 { 1744 1870 m_POC[bufferNum] = POC; 1745 1871 } 1872 1746 1873 Bool TComReferencePictureSet::getCheckLTMSBPresent(Int bufferNum) 1747 1874 { 1748 1875 return m_bCheckLTMSB[bufferNum]; 1749 1876 } 1877 1750 1878 Void TComReferencePictureSet::setCheckLTMSBPresent(Int bufferNum, Bool b) 1751 1879 { … … 2025 2153 ::memcpy(getScalingListAddress(sizeId, listId),((listId == refListId)? getScalingListDefaultAddress(sizeId, refListId): getScalingListAddress(sizeId, refListId)),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])); 2026 2154 } 2155 2027 2156 /** parse syntax infomation 2028 2157 * \param pchFile syntax infomation … … 2117 2246 m_scalingListCoef[SCALING_LIST_32x32][3] = m_scalingListCoef[SCALING_LIST_32x32][1]; // copy address for 32x32 2118 2247 } 2248 2119 2249 /** destroy quantization matrix array 2120 2250 */ … … 2129 2259 } 2130 2260 } 2261 2131 2262 /** get default address of quantization matrix 2132 2263 * \param sizeId size index … … 2158 2289 return src; 2159 2290 } 2291 2160 2292 /** process of default matrix 2161 2293 * \param sizeId size index … … 2167 2299 setScalingListDC(sizeId,listId,SCALING_LIST_DC); 2168 2300 } 2301 2169 2302 /** check DC value of matrix for default matrix signaling 2170 2303 */ … … 2227 2360 //! activate a PPS and depending on isIDR parameter also SPS and VPS 2228 2361 //! \returns true, if activation is successful 2229 Bool ParameterSetManager::activatePPS(Int ppsId, Bool isI DR)2362 Bool ParameterSetManager::activatePPS(Int ppsId, Bool isIRAP) 2230 2363 { 2231 2364 TComPPS *pps = m_ppsMap.getPS(ppsId); … … 2236 2369 // active parameter sets per layer should be used here 2237 2370 #else 2238 if (!isI DR&& (spsId != m_activeSPSId))2239 { 2240 printf("Warning: tried to activate PPS referring to a inactive SPS at non-I DR.");2371 if (!isIRAP && (spsId != m_activeSPSId)) 2372 { 2373 printf("Warning: tried to activate PPS referring to a inactive SPS at non-IRAP."); 2241 2374 return false; 2242 2375 } … … 2246 2379 { 2247 2380 Int vpsId = sps->getVPSId(); 2248 if (!isI DR&& (vpsId != m_activeVPSId))2249 { 2250 printf("Warning: tried to activate PPS referring to a inactive VPS at non-I DR.");2381 if (!isIRAP && (vpsId != m_activeVPSId)) 2382 { 2383 printf("Warning: tried to activate PPS referring to a inactive VPS at non-IRAP."); 2251 2384 return false; 2252 2385 } … … 2307 2440 } 2308 2441 #endif 2309 2310 2442 #if SIGNAL_BITRATE_PICRATE_IN_VPS 2311 2443 TComBitRatePicRateInfo::TComBitRatePicRateInfo() -
branches/HTM-DEV-0.1-dev/source/Lib/TLibCommon/TComSlice.h
r331 r362 905 905 UInt m_picHeightInLumaSamples; 906 906 907 Window m_conformanceWindow;908 907 Int m_log2MinCodingBlockSize; 908 Int m_log2DiffMaxMinCodingBlockSize; 909 909 UInt m_uiMaxCUWidth; 910 910 UInt m_uiMaxCUHeight; 911 911 UInt m_uiMaxCUDepth; 912 UInt m_uiMinTrDepth; 913 UInt m_uiMaxTrDepth; 912 913 Window m_conformanceWindow; 914 914 915 TComRPSList m_RPSList; 915 916 Bool m_bLongTermRefsPresent; … … 927 928 Bool m_useAMP; 928 929 930 #if !L0034_COMBINED_LIST_CLEANUP 929 931 Bool m_bUseLComb; 932 #endif 930 933 931 934 // Parameter … … 1004 1007 Bool getUsedByCurrPicLtSPSFlag(Int i) {return m_usedByCurrPicLtSPSFlag[i];} 1005 1008 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 1006 1015 Void setMaxCUWidth ( UInt u ) { m_uiMaxCUWidth = u; } 1007 1016 UInt getMaxCUWidth () { return m_uiMaxCUWidth; } … … 1020 1029 Bool getUseAMP() { return m_useAMP; } 1021 1030 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; }1026 1031 Void setQuadtreeTULog2MaxSize( UInt u ) { m_uiQuadtreeTULog2MaxSize = u; } 1027 1032 UInt getQuadtreeTULog2MaxSize() { return m_uiQuadtreeTULog2MaxSize; } … … 1045 1050 1046 1051 // Tool list 1052 #if !L0034_COMBINED_LIST_CLEANUP 1047 1053 Void setUseLComb (Bool b) { m_bUseLComb = b; } 1048 1054 Bool getUseLComb () { return m_bUseLComb; } 1055 #endif 1049 1056 1050 1057 Bool getUseLossless () { return m_useLossless; } … … 1130 1137 Void setRefPicSetIdxL1(UInt idx, UInt refPicSetIdx) { m_RefPicSetIdxL1[idx] = refPicSetIdx; } 1131 1138 UInt getRefPicSetIdxL1(UInt idx) { return m_RefPicSetIdxL1[idx]; } 1132 1133 1139 #if H_MV 1134 1140 // Why not an listIdx for all members, would avoid code duplication?? … … 1367 1373 Int m_deblockingFilterBetaOffsetDiv2; //< beta offset for deblocking filter 1368 1374 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 1370 1379 Int m_aiNumRefIdx [3]; // for multiple reference of current slice 1371 1380 … … 1377 1386 Bool m_bRefPicListModificationFlagLC; 1378 1387 Bool m_bRefPicListCombinationFlag; 1388 #endif 1379 1389 1380 1390 Bool m_bCheckLDC; … … 1417 1427 1418 1428 Bool m_abEqualRef [2][MAX_NUM_REF][MAX_NUM_REF]; 1419 1429 #if !L0034_COMBINED_LIST_CLEANUP 1420 1430 Bool m_bNoBackPredFlag; 1431 #endif 1421 1432 UInt m_uiTLayer; 1422 1433 Bool m_bTLayerSwitchingFlag; … … 1526 1537 Bool getMvdL1ZeroFlag () { return m_bLMvdL1Zero; } 1527 1538 Int getNumRpsCurrTempList(); 1539 #if L0034_COMBINED_LIST_CLEANUP 1540 Int getList1IdxToList0Idx ( Int list1Idx ) { return m_list1IdxToList0Idx[list1Idx]; } 1541 #else 1528 1542 Int getRefIdxOfLC (RefPicList e, Int iRefIdx) { return m_iRefIdxOfLC[e][iRefIdx]; } 1529 1543 Int getListIdFromIdxOfLC(Int iRefIdx) { return m_eListIdFromIdxOfLC[iRefIdx]; } … … 1535 1549 Bool getRefPicListCombinationFlag() {return m_bRefPicListCombinationFlag;} 1536 1550 Void setRefPicListCombinationFlag(Bool bflag) {m_bRefPicListCombinationFlag=bflag;} 1551 #endif 1537 1552 Void setReferenced(Bool b) { m_bRefenced = b; } 1538 1553 Bool isReferenced() { return m_bRefenced; } 1539 1554 Void setPOC ( Int i ) { m_iPOC = i; if(getTLayer()==0) m_prevPOC=i; } 1540 1555 Void setNalUnitType ( NalUnitType e ) { m_eNalUnitType = e; } 1541 NalUnitType getNalUnitType () 1556 NalUnitType getNalUnitType () const { return m_eNalUnitType; } 1542 1557 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); 1545 1561 Void decodingRefreshMarking(Int& pocCRA, Bool& bRefreshPending, TComList<TComPic*>& rcListPic); 1546 1562 Void setSliceType ( SliceType e ) { m_eSliceType = e; } … … 1568 1584 #endif 1569 1585 #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 ); 1571 1590 #else 1572 1591 Void setRefPicList ( TComList<TComPic*>& rcListPic ); 1592 #endif 1593 1573 1594 #endif 1574 1595 Void setRefPOCList (); … … 1604 1625 1605 1626 static Void sortPicList ( TComList<TComPic*>& rcListPic ); 1606 1627 #if L0034_COMBINED_LIST_CLEANUP 1628 Void setList1IdxToList0Idx(); 1629 #else 1607 1630 Bool getNoBackPredFlag() { return m_bNoBackPredFlag; } 1608 1631 Void setNoBackPredFlag( Bool b ) { m_bNoBackPredFlag = b; } 1609 1632 Void generateCombinedList (); 1633 #endif 1610 1634 1611 1635 UInt getTLayer () { return m_uiTLayer; } … … 1665 1689 Void getWpScaling ( RefPicList e, Int iRefIdx, wpScalingParam *&wp); 1666 1690 1667 Void resetWpScaling (wpScalingParam wp[2][MAX_NUM_REF][3]); 1668 Void initWpScaling (wpScalingParam wp[2][MAX_NUM_REF][3]); 1691 Void resetWpScaling (); 1669 1692 Void initWpScaling (); 1670 1693 inline Bool applyWP () { return( (m_eSliceType==P_SLICE && m_pcPPS->getUseWP()) || (m_eSliceType==B_SLICE && m_pcPPS->getWPBiPred()) ); } … … 1712 1735 #endif 1713 1736 #endif 1714 1715 1737 protected: 1716 1738 TComPic* xGetRefPic (TComList<TComPic*>& rcListPic, 1717 1739 Int poc); 1718 TComPic* xGetLongTermRefPic (TComList<TComPic*>& rcListPic, 1719 Int poc); 1740 TComPic* xGetLongTermRefPic(TComList<TComPic*>& rcListPic, Int poc, Bool pocHasMsb); 1720 1741 #if H_MV 1721 1742 TComPic* xGetInterLayerRefPic( std::vector<TComPic*>& rcListIlPic, Int layerId ); … … 1804 1825 //! activate a PPS and depending on isIDR parameter also SPS and VPS 1805 1826 //! \returns true, if activation is successful 1806 Bool activatePPS(Int ppsId, Bool isI DR);1827 Bool activatePPS(Int ppsId, Bool isIRAP); 1807 1828 1808 1829 TComVPS* getActiveVPS(){ return m_vpsMap.getPS(m_activeVPSId); }; -
branches/HTM-DEV-0.1-dev/source/Lib/TLibCommon/TComTrQuant.cpp
r324 r362 1986 1986 } 1987 1987 1988 if(pi QCoef[minPos] == 32767 || piQCoef[minPos] == -32768)1988 if(piDstCoeff[minPos] == 32767 || piDstCoeff[minPos] == -32768) 1989 1989 { 1990 1990 finalChange = -1; -
branches/HTM-DEV-0.1-dev/source/Lib/TLibCommon/TypeDef.h
r324 r362 49 49 #endif 50 50 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 53 62 #define L0363_DU_BIT_RATE 1 ///< L0363: add bit_rate_du_value_minus1 to HRD parameters 54 63 #define L0328_SPLICING 1 ///< L0328: splicing support in HRD … … 75 84 #define SIGNAL_BITRATE_PICRATE_IN_VPS 0 ///< K0125: Signal bit_rate and pic_rate in VPS 76 85 #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 77 90 78 91 #define MAX_VPS_NUM_HRD_PARAMETERS 1 … … 412 425 REF_PIC_LIST_0 = 0, ///< reference list 0 413 426 REF_PIC_LIST_1 = 1, ///< reference list 1 427 #if !L0034_COMBINED_LIST_CLEANUP 414 428 REF_PIC_LIST_C = 2, ///< combined reference list for uni-prediction in B-Slices 429 #endif 415 430 REF_PIC_LIST_X = 100 ///< special mark 416 431 }; -
branches/HTM-DEV-0.1-dev/source/Lib/TLibDecoder/NALread.cpp
r324 r362 50 50 //! \ingroup TLibDecoder 51 51 //! \{ 52 static void convertPayloadToRBSP(vector<uint8_t>& nalUnitBuf, Bool isVclNalUnit)52 static void convertPayloadToRBSP(vector<uint8_t>& nalUnitBuf, TComInputBitstream *bitstream, Bool isVclNalUnit) 53 53 { 54 54 UInt zeroCount = 0; 55 55 vector<uint8_t>::iterator it_read, it_write; 56 56 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++) 58 60 { 59 61 assert(zeroCount < 2 || *it_read >= 0x03); 60 62 if (zeroCount == 2 && *it_read == 0x03) 61 63 { 64 bitstream->pushEmulationPreventionByteLocation( pos ); 65 pos++; 62 66 it_read++; 63 67 zeroCount = 0; … … 109 113 if ( nalu.m_temporalId ) 110 114 { 111 assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA 112 && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA NT115 assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA_W_LP 116 && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA_W_RADL 113 117 && 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 115 119 && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_IDR_N_LP 116 120 && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_CRA … … 122 126 else 123 127 { 124 assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_TLA 128 assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_TLA_R 125 129 && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_TSA_N 126 130 && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_STSA_R … … 136 140 /* perform anti-emulation prevention */ 137 141 TComInputBitstream *pcBitstream = new TComInputBitstream(NULL); 138 convertPayloadToRBSP(nalUnitBuf, (nalUnitBuf[0] & 64) == 0);142 convertPayloadToRBSP(nalUnitBuf, pcBitstream, (nalUnitBuf[0] & 64) == 0); 139 143 140 144 nalu.m_Bitstream = new TComInputBitstream(&nalUnitBuf); 145 nalu.m_Bitstream->setEmulationPreventionByteLocation(pcBitstream->getEmulationPreventionByteLocation()); 141 146 delete pcBitstream; 142 147 readNalUnitHeader(nalu); -
branches/HTM-DEV-0.1-dev/source/Lib/TLibDecoder/SEIread.cpp
r324 r362 90 90 fprintf( g_hTrace, "=========== Decoding Unit Information SEI message ===========\n"); 91 91 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 92 107 default: 93 108 fprintf( g_hTrace, "=========== Unknown SEI message ===========\n"); … … 154 169 SEI *sei = NULL; 155 170 156 if(nalUnitType == NAL_UNIT_ SEI)171 if(nalUnitType == NAL_UNIT_PREFIX_SEI) 157 172 { 158 173 switch (payloadType) … … 219 234 xParseSEIGradualDecodingRefreshInfo((SEIGradualDecodingRefreshInfo&) *sei, payloadSize); 220 235 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 221 254 default: 222 255 for (UInt i = 0; i < payloadSize; i++) … … 284 317 { 285 318 UInt reservedPayloadExtensionData; 286 READ_ CODE (1,reservedPayloadExtensionData, "reserved_payload_extension_data");319 READ_FLAG (reservedPayloadExtensionData, "reserved_payload_extension_data"); 287 320 } 288 321 289 322 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 } 292 328 } 293 329 … … 632 668 } 633 669 670 #if J0149_TONE_MAPPING_SEI 671 Void 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 754 Void 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 780 Void 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 634 828 Void SEIReader::xParseByteAlign() 635 829 { -
branches/HTM-DEV-0.1-dev/source/Lib/TLibDecoder/SEIread.h
r324 r362 70 70 Void xParseSEITemporalLevel0Index (SEITemporalLevel0Index &sei, UInt payloadSize); 71 71 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 72 81 Void xParseByteAlign(); 73 82 }; -
branches/HTM-DEV-0.1-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp
r331 r362 175 175 } 176 176 177 /** copy SAO parameter178 * \param dst179 * \param src180 */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 else196 {197 dst->length = 0;198 for (i=0;i<SAO_BO_LEN;i++)199 {200 dst->offset[i] = 0;201 }202 }203 }204 205 177 Void TDecCavlc::parsePPS(TComPPS* pcPPS) 206 178 { … … 400 372 401 373 READ_FLAG( uiCode, "field_seq_flag"); pcVUI->setFieldSeqFlag(uiCode); 402 assert(pcVUI->getFieldSeqFlag() == false); // not supported yet403 374 404 375 READ_FLAG(uiCode, "frame_field_info_present_flag"); pcVUI->setFrameFieldInfoPresentFlag(uiCode); … … 593 564 594 565 READ_UVLC( uiCode, "bit_depth_luma_minus8" ); 595 g_bitDepthY = 8 + uiCode; 596 pcSPS->setBitDepthY(g_bitDepthY); 566 pcSPS->setBitDepthY( uiCode + 8 ); 597 567 pcSPS->setQpBDOffsetY( (Int) (6*uiCode) ); 598 568 599 569 READ_UVLC( uiCode, "bit_depth_chroma_minus8" ); 600 g_bitDepthC = 8 + uiCode; 601 pcSPS->setBitDepthC(g_bitDepthC); 570 pcSPS->setBitDepthC( uiCode + 8 ); 602 571 pcSPS->setQpBDOffsetC( (Int) (6*uiCode) ); 603 572 … … 608 577 for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++) 609 578 { 579 #if L0323_DPB 580 READ_UVLC ( uiCode, "sps_max_dec_pic_buffering_minus1"); 581 pcSPS->setMaxDecPicBuffering( uiCode + 1, i); 582 #else 610 583 READ_UVLC ( uiCode, "sps_max_dec_pic_buffering"); 611 584 pcSPS->setMaxDecPicBuffering( uiCode, i); 585 #endif 612 586 READ_UVLC ( uiCode, "sps_num_reorder_pics" ); 613 587 pcSPS->setNumReorderPics(uiCode, i); … … 628 602 629 603 READ_UVLC( uiCode, "log2_min_coding_block_size_minus3" ); 630 UInt log2MinCUSize = uiCode + 3; 604 Int log2MinCUSize = uiCode + 3; 605 pcSPS->setLog2MinCodingBlockSize(log2MinCUSize); 631 606 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) ); 635 611 READ_UVLC( uiCode, "log2_min_transform_block_size_minus2" ); pcSPS->setQuadtreeTULog2MinSize( uiCode + 2 ); 636 612 … … 640 616 READ_UVLC( uiCode, "max_transform_hierarchy_depth_inter" ); pcSPS->setQuadtreeTUMaxDepthInter( uiCode+1 ); 641 617 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 652 622 READ_FLAG( uiCode, "scaling_list_enabled_flag" ); pcSPS->setScalingListFlag ( uiCode ); 653 623 if(pcSPS->getScalingListFlag()) … … 748 718 for(UInt i = 0; i <= pcVPS->getMaxTLayers()-1; i++) 749 719 { 720 #if L0323_DPB 721 READ_UVLC( uiCode, "vps_max_dec_pic_buffering_minus1[i]" ); pcVPS->setMaxDecPicBuffering( uiCode + 1, i ); 722 #else 750 723 READ_UVLC( uiCode, "vps_max_dec_pic_buffering[i]" ); pcVPS->setMaxDecPicBuffering( uiCode, i ); 724 #endif 751 725 READ_UVLC( uiCode, "vps_num_reorder_pics[i]" ); pcVPS->setNumReorderPics( uiCode, i ); 752 726 READ_UVLC( uiCode, "vps_max_latency_increase[i]" ); pcVPS->setMaxLatencyIncrease( uiCode, i ); … … 1056 1030 iPOCmsb = iPrevPOCmsb; 1057 1031 } 1058 if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA 1059 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA NT1032 if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 1033 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL 1060 1034 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) 1061 1035 { … … 1066 1040 1067 1041 TComReferencePictureSet* rps; 1042 rps = rpcSlice->getLocalRPS(); 1043 rpcSlice->setRPS(rps); 1068 1044 READ_FLAG( uiCode, "short_term_ref_pic_set_sps_flag" ); 1069 1045 if(uiCode == 0) // use short-term reference picture set explicitly signalled in slice header 1070 1046 { 1071 rps = rpcSlice->getLocalRPS();1072 1047 parseShortTermRefPicSet(sps,rps, sps->getRPSList()->getNumberOfReferencePictureSets()); 1073 rpcSlice->setRPS(rps);1074 1048 } 1075 1049 else // use reference to short-term reference picture set in PPS … … 1088 1062 uiCode = 0; 1089 1063 } 1090 rpcSlice->setRPS(sps->getRPSList()->getReferencePictureSet(uiCode)); 1091 1092 rps = rpcSlice->getRPS(); 1064 memcpy(rps,sps->getRPSList()->getReferencePictureSet(uiCode),sizeof(TComReferencePictureSet)); 1093 1065 } 1094 1066 if(sps->getLongTermRefsPresent()) … … 1113 1085 rps->setNumberOfLongtermPictures(numOfLtrp); 1114 1086 Int maxPicOrderCntLSB = 1 << rpcSlice->getSPS()->getBitsForPOC(); 1115 Int prev LSB = 0, prevDeltaMSB = 0, deltaPocMSBCycleLT = 0;;1087 Int prevDeltaMSB = 0, deltaPocMSBCycleLT = 0;; 1116 1088 for(Int j=offset+rps->getNumberOfLongtermPictures()-1, k = 0; k < numOfLtrp; j--, k++) 1117 1089 { … … 1140 1112 READ_UVLC( uiCode, "delta_poc_msb_cycle_lt[i]" ); 1141 1113 Bool deltaFlag = false; 1142 // First LTRP || First LTRP from SH || curr LSB != prev LSB1143 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) ) 1144 1116 { 1145 1117 deltaFlag = true; … … 1166 1138 rps->setCheckLTMSBPresent(j,false); 1167 1139 } 1168 prevLSB = pocLsbLt;1169 1140 prevDeltaMSB = deltaPocMSBCycleLT; 1170 1141 } … … 1172 1143 rps->setNumberOfPictures(offset); 1173 1144 } 1174 if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA 1175 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA NT1145 if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 1146 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL 1176 1147 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) 1177 1148 { … … 1405 1376 if(!rpcSlice->getDeblockingFilterDisable()) 1406 1377 { 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); 1409 1384 } 1410 1385 } … … 1438 1413 } 1439 1414 1440 if( pps->getTilesEnabledFlag() || pps->getEntropyCodingSyncEnabledFlag() )1441 {1442 1415 UInt *entryPointOffset = NULL; 1443 1416 UInt numEntryPointOffsets, offsetLenMinus1; 1444 1417 if( pps->getTilesEnabledFlag() || pps->getEntropyCodingSyncEnabledFlag() ) 1418 { 1445 1419 READ_UVLC(numEntryPointOffsets, "num_entry_point_offsets"); rpcSlice->setNumEntryPointOffsets ( numEntryPointOffsets ); 1446 1420 if (numEntryPointOffsets>0) … … 1459 1433 #endif 1460 1434 } 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 } 1461 1474 1462 1475 if ( pps->getTilesEnabledFlag() ) … … 1494 1507 } 1495 1508 } 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 1511 1510 return; 1512 1511 } … … 1759 1758 // ==================================================================================================================== 1760 1759 1761 1762 /** Parse PCM alignment zero bits.1763 * \returns Void1764 */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 do1801 {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 do1820 {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 1869 1760 /** parse explicit wp tables 1870 1761 * \param TComSlice* pcSlice … … 1883 1774 // decode delta_luma_log2_weight_denom : 1884 1775 READ_UVLC( uiLog2WeightDenomLuma, "luma_log2_weight_denom" ); // ue(v): luma_log2_weight_denom 1776 assert( uiLog2WeightDenomLuma <= 7 ); 1885 1777 if( bChroma ) 1886 1778 { 1887 1779 READ_SVLC( iDeltaDenom, "delta_chroma_log2_weight_denom" ); // se(v): delta_chroma_log2_weight_denom 1888 1780 assert((iDeltaDenom + (Int)uiLog2WeightDenomLuma)>=0); 1781 assert((iDeltaDenom + (Int)uiLog2WeightDenomLuma)<=7); 1889 1782 uiLog2WeightDenomChroma = (UInt)(iDeltaDenom + uiLog2WeightDenomLuma); 1890 1783 } … … 1925 1818 Int iDeltaWeight; 1926 1819 READ_SVLC( iDeltaWeight, "delta_luma_weight_lX" ); // se(v): delta_luma_weight_l0[i] 1820 assert( iDeltaWeight >= -128 ); 1821 assert( iDeltaWeight <= 127 ); 1927 1822 wp[0].iWeight = (iDeltaWeight + (1<<wp[0].uiLog2WeightDenom)); 1928 1823 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 ); 1929 1826 } 1930 1827 else … … 1941 1838 Int iDeltaWeight; 1942 1839 READ_SVLC( iDeltaWeight, "delta_chroma_weight_lX" ); // se(v): chroma_weight_l0[i][j] 1840 assert( iDeltaWeight >= -128 ); 1841 assert( iDeltaWeight <= 127 ); 1943 1842 wp[j].iWeight = (iDeltaWeight + (1<<wp[1].uiLog2WeightDenom)); 1944 1843 1945 1844 Int iDeltaChroma; 1946 1845 READ_SVLC( iDeltaChroma, "delta_chroma_offset_lX" ); // se(v): delta_chroma_offset_l0[i][j] 1846 assert( iDeltaChroma >= -512 ); 1847 assert( iDeltaChroma <= 511 ); 1947 1848 Int pred = ( 128 - ( ( 128*wp[j].iWeight)>>(wp[j].uiLog2WeightDenom) ) ); 1948 1849 wp[j].iOffset = Clip3(-128, 127, (iDeltaChroma + pred) ); -
branches/HTM-DEV-0.1-dev/source/Lib/TLibDecoder/TDecCAVLC.h
r324 r362 61 61 62 62 protected: 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 71 63 void parseShortTermRefPicSet (TComSPS* pcSPS, TComReferencePictureSet* pcRPS, Int idx); 72 private:73 64 74 65 public: -
branches/HTM-DEV-0.1-dev/source/Lib/TLibDecoder/TDecSlice.h
r324 r362 84 84 Void initCtxMem( UInt i ); 85 85 Void setCtxMem( TDecSbac* sb, Int b ) { CTXMem[b] = sb; } 86 Int getCtxMemSize( ) { return (Int)CTXMem.size(); } 86 87 }; 87 88 -
branches/HTM-DEV-0.1-dev/source/Lib/TLibDecoder/TDecTop.cpp
r324 r362 42 42 ParameterSetManagerDecoder TDecTop::m_parameterSetManagerDecoder; 43 43 #endif 44 45 44 //! \ingroup TLibDecoder 46 45 //! \{ … … 149 148 } 150 149 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 151 153 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 152 155 if (m_cListPic.size() < (UInt)m_iMaxRefPicNum) 153 156 { … … 290 293 assert (sps != 0); 291 294 292 if (false == m_parameterSetManagerDecoder.activatePPS(m_apcSlicePilot->getPPSId(),m_apcSlicePilot-> getIdrPicFlag()))295 if (false == m_parameterSetManagerDecoder.activatePPS(m_apcSlicePilot->getPPSId(),m_apcSlicePilot->isIRAP())) 293 296 { 294 297 printf ("Parameter set activation failed!"); … … 296 299 } 297 300 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 298 318 m_apcSlicePilot->setPPS(pps); 299 319 m_apcSlicePilot->setSPS(sps); 300 301 #if H_MV302 m_apcSlicePilot->setVPS( m_parameterSetManagerDecoder.getActiveVPS() );303 #endif304 305 320 pps->setSPS(sps); 306 321 pps->setNumSubstreams(pps->getEntropyCodingSyncEnabledFlag() ? ((sps->getPicHeightInLumaSamples() + sps->getMaxCUHeight() - 1) / sps->getMaxCUHeight()) * (pps->getNumColumnsMinus1() + 1) : 1); 307 322 pps->setMinCuDQPSize( sps->getMaxCUWidth() >> ( pps->getMaxCuDQPDepth()) ); 308 323 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++) 310 332 { 311 333 sps->setAMPAcc( i, sps->getUseAMP() ); 312 334 } 313 335 314 for (Int i = sps->get MaxCUDepth() - g_uiAddCUDepth; i < sps->getMaxCUDepth(); i++)336 for (Int i = sps->getLog2DiffMaxMinCodingBlockSize(); i < sps->getMaxCUDepth(); i++) 315 337 { 316 338 sps->setAMPAcc( i, 0 ); … … 318 340 319 341 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() ); 322 344 } 323 345 … … 345 367 346 368 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 353 376 m_apcSlicePilot->setReferenced(true); // Putting this as true ensures that picture is referenced the first time it is in an RPS 354 377 m_apcSlicePilot->setTLayerInfo(nalu.m_temporalId); … … 371 394 #endif 372 395 #endif 373 374 if (m_apcSlicePilot->isNextSlice())375 {376 396 // Skip pictures due to random access 377 397 if (isRandomAccessSkipPicture(iSkipFrame, iPOCLastDisplay)) … … 384 404 return false; 385 405 } 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 } 388 412 // 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 ) 390 414 { 391 415 if (m_prevPOC >= m_pocRandomAccess) … … 396 420 m_prevPOC = m_apcSlicePilot->getPOC(); 397 421 } 398 399 422 #if H_MV 400 423 if ( newLayerFlag ) … … 403 426 } 404 427 #endif 405 406 407 428 // actual decoding starts here 408 429 xActivateParameterSets(); … … 419 440 xCreateLostPicture(lostPoc-1); 420 441 } 421 422 442 if (m_bFirstSliceInPicture) 423 443 { … … 425 445 m_cPrediction.initTempBuff(); 426 446 m_apcSlicePilot->applyReferencePictureSet(m_cListPic, m_apcSlicePilot->getRPS()); 427 428 447 #if H_MV 429 448 m_apcSlicePilot->createAndApplyIvReferencePictureSet( m_ivPicLists, m_refPicSetInterLayer ); 430 449 #endif 431 432 433 450 // Get a new picture buffer 434 451 xGetNewPicBuffer (m_apcSlicePilot, pcPic); … … 569 586 #endif 570 587 #endif 571 572 588 if (bNextSlice) 573 589 { 574 pcSlice->checkCRA(pcSlice->getRPS(), m_pocCRA, m_prevRAPisBLA );590 pcSlice->checkCRA(pcSlice->getRPS(), m_pocCRA, m_prevRAPisBLA, m_cListPic ); 575 591 // Set reference list 576 577 592 #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 ); 579 597 #else 580 598 pcSlice->setRefPicList( m_cListPic ); 581 599 #endif 582 600 601 #endif 583 602 // For generalized B 584 603 // note: maybe not existed case (always L0 is copied to L1 if L1 is empty) … … 622 641 //--------------- 623 642 pcSlice->setRefPOCList(); 643 #if !L0034_COMBINED_LIST_CLEANUP 624 644 pcSlice->setNoBackPredFlag( false ); 625 645 if ( pcSlice->getSliceType() == B_SLICE ) … … 638 658 } 639 659 } 660 #endif 640 661 } 641 662 … … 691 712 m_cEntropyDecoder.decodePPS( pps ); 692 713 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 }706 714 } 707 715 708 716 Void TDecTop::xDecodeSEI( TComInputBitstream* bs, const NalUnitType nalUnitType ) 709 717 { 710 if(nalUnitType == NAL_UNIT_S EI_SUFFIX)718 if(nalUnitType == NAL_UNIT_SUFFIX_SEI) 711 719 { 712 720 m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveSPS() ); … … 753 761 return false; 754 762 755 case NAL_UNIT_ SEI:756 case NAL_UNIT_S EI_SUFFIX:763 case NAL_UNIT_PREFIX_SEI: 764 case NAL_UNIT_SUFFIX_SEI: 757 765 xDecodeSEI( nalu.m_Bitstream, nalu.m_nalUnitType ); 758 766 return false; … … 760 768 case NAL_UNIT_CODED_SLICE_TRAIL_R: 761 769 case NAL_UNIT_CODED_SLICE_TRAIL_N: 762 case NAL_UNIT_CODED_SLICE_TLA :770 case NAL_UNIT_CODED_SLICE_TLA_R: 763 771 case NAL_UNIT_CODED_SLICE_TSA_N: 764 772 case NAL_UNIT_CODED_SLICE_STSA_R: 765 773 case NAL_UNIT_CODED_SLICE_STSA_N: 766 case NAL_UNIT_CODED_SLICE_BLA :767 case NAL_UNIT_CODED_SLICE_BLA NT:774 case NAL_UNIT_CODED_SLICE_BLA_W_LP: 775 case NAL_UNIT_CODED_SLICE_BLA_W_RADL: 768 776 case NAL_UNIT_CODED_SLICE_BLA_N_LP: 769 case NAL_UNIT_CODED_SLICE_IDR :777 case NAL_UNIT_CODED_SLICE_IDR_W_RADL: 770 778 case NAL_UNIT_CODED_SLICE_IDR_N_LP: 771 779 case NAL_UNIT_CODED_SLICE_CRA: 772 780 case NAL_UNIT_CODED_SLICE_RADL_N: 773 case NAL_UNIT_CODED_SLICE_ DLP:781 case NAL_UNIT_CODED_SLICE_RADL_R: 774 782 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: 779 784 return xDecodeSlice(nalu, iSkipFrame, iPOCLastDisplay); 780 #endif781 785 break; 782 786 default: … … 795 799 Bool TDecTop::isSkipPictureForBLA(Int& iPOCLastDisplay) 796 800 { 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)) 798 802 { 799 803 iPOCLastDisplay++; … … 826 830 { 827 831 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 829 833 || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP 830 || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA NT)834 || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL ) 831 835 { 832 836 // set the POC random access since we need to skip the reordered pictures in the case of CRA/CRANT/BLA/BLANT. 833 837 m_pocRandomAccess = m_apcSlicePilot->getPOC(); 834 838 } 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 ) 836 840 { 837 841 m_pocRandomAccess = -MAX_INT; // no need to skip the reordered pictures in IDR, they are decodable. … … 849 853 } 850 854 // 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)) 852 856 { 853 857 iPOCLastDisplay++; … … 881 885 882 886 #endif 883 884 887 //! \} -
branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/SEIwrite.cpp
r324 r362 84 84 fprintf( g_hTrace, "=========== Decoding Unit Information SEI message ===========\n"); 85 85 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 86 101 default: 87 102 fprintf( g_hTrace, "=========== Unknown SEI message ===========\n"); … … 91 106 #endif 92 107 108 #if K0180_SCALABLE_NESTING_SEI 109 void SEIWriter::xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComSPS *sps) 110 #else 93 111 void SEIWriter::xWriteSEIpayloadData(const SEI& sei, TComSPS *sps) 112 #endif 94 113 { 95 114 switch (sei.payloadType()) … … 128 147 xWriteSEIGradualDecodingRefreshInfo(*static_cast<const SEIGradualDecodingRefreshInfo*>(&sei)); 129 148 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 130 164 default: 131 165 assert(!"Unhandled SEI message"); … … 145 179 setBitstream(&bs_count); 146 180 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 147 195 #if ENC_DEC_TRACE 148 196 g_HLSTraceEnable = false; … … 152 200 g_HLSTraceEnable = true; 153 201 #endif 202 203 #endif 204 154 205 UInt payload_data_num_bits = bs_count.getNumberOfWrittenBits(); 155 206 assert(0 == payload_data_num_bits % 8); … … 158 209 159 210 #if ENC_DEC_TRACE 211 #if K0180_SCALABLE_NESTING_SEI 212 if (g_HLSTraceEnable) 213 #endif 160 214 xTraceSEIHeader(); 161 215 #endif … … 177 231 /* payloadData */ 178 232 #if ENC_DEC_TRACE 233 #if K0180_SCALABLE_NESTING_SEI 234 if (g_HLSTraceEnable) 235 #endif 179 236 xTraceSEIMessageType(sei.payloadType()); 180 237 #endif 181 238 239 #if K0180_SCALABLE_NESTING_SEI 240 xWriteSEIpayloadData(bs, sei, sps); 241 #else 182 242 xWriteSEIpayloadData(sei, sps); 243 #endif 183 244 } 184 245 … … 421 482 xWriteByteAlign(); 422 483 } 484 485 #if J0149_TONE_MAPPING_SEI 486 Void 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 423 559 Void SEIWriter::xWriteSEIDisplayOrientation(const SEIDisplayOrientation &sei) 424 560 { … … 455 591 } 456 592 593 #if L0208_SOP_DESCRIPTION_SEI 594 Void 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 617 Void 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 457 660 Void SEIWriter::xWriteByteAlign() 458 661 { -
branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/SEIwrite.h
r324 r362 50 50 51 51 protected: 52 #if K0180_SCALABLE_NESTING_SEI 53 Void xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComSPS *sps); 54 #else 52 55 Void xWriteSEIpayloadData(const SEI& sei, TComSPS *sps); 56 #endif 53 57 Void xWriteSEIuserDataUnregistered(const SEIuserDataUnregistered &sei); 54 58 Void xWriteSEIActiveParameterSets(const SEIActiveParameterSets& sei); … … 63 67 Void xWriteSEITemporalLevel0Index(const SEITemporalLevel0Index &sei); 64 68 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 65 78 Void xWriteByteAlign(); 66 79 }; -
branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/TEncCavlc.cpp
r331 r362 285 285 WRITE_FLAG(pcVUI->getNeutralChromaIndicationFlag(), "neutral_chroma_indication_flag"); 286 286 WRITE_FLAG(pcVUI->getFieldSeqFlag(), "field_seq_flag"); 287 assert(pcVUI->getFieldSeqFlag() == 0); // not currently supported288 287 WRITE_FLAG(pcVUI->getFrameFieldInfoPresentFlag(), "frame_field_info_present_flag"); 289 288 … … 474 473 for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++) 475 474 { 475 #if L0323_DPB 476 WRITE_UVLC( pcSPS->getMaxDecPicBuffering(i) - 1, "sps_max_dec_pic_buffering_minus1[i]" ); 477 #else 476 478 WRITE_UVLC( pcSPS->getMaxDecPicBuffering(i), "sps_max_dec_pic_buffering[i]" ); 479 #endif 477 480 WRITE_UVLC( pcSPS->getNumReorderPics(i), "sps_num_reorder_pics[i]" ); 478 481 WRITE_UVLC( pcSPS->getMaxLatencyIncrease(i), "sps_max_latency_increase[i]" ); … … 484 487 assert( pcSPS->getMaxCUWidth() == pcSPS->getMaxCUHeight() ); 485 488 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" ); 496 491 WRITE_UVLC( pcSPS->getQuadtreeTULog2MinSize() - 2, "log2_min_transform_block_size_minus2" ); 497 492 WRITE_UVLC( pcSPS->getQuadtreeTULog2MaxSize() - pcSPS->getQuadtreeTULog2MinSize(), "log2_diff_max_min_transform_block_size" ); … … 575 570 WRITE_FLAG( pcVPS->getTemporalNestingFlag(), "vps_temporal_id_nesting_flag" ); 576 571 assert (pcVPS->getMaxTLayers()>1||pcVPS->getTemporalNestingFlag()); 572 #if H_MV 577 573 WRITE_CODE( 0xffff, 16, "vps_extension_offset" ); 574 #else 575 WRITE_CODE( 0xffff, 16, "vps_reserved_ffff_16bits" ); 576 #endif 578 577 codePTL( pcVPS->getPTL(), true, pcVPS->getMaxTLayers() - 1 ); 579 578 #if SIGNAL_BITRATE_PICRATE_IN_VPS … … 584 583 for(UInt i=0; i <= pcVPS->getMaxTLayers()-1; i++) 585 584 { 585 #if L0323_DPB 586 WRITE_UVLC( pcVPS->getMaxDecPicBuffering(i) - 1, "vps_max_dec_pic_buffering_minus1[i]" ); 587 #else 586 588 WRITE_UVLC( pcVPS->getMaxDecPicBuffering(i), "vps_max_dec_pic_buffering[i]" ); 589 #endif 587 590 WRITE_UVLC( pcVPS->getNumReorderPics(i), "vps_num_reorder_pics[i]" ); 588 591 WRITE_UVLC( pcVPS->getMaxLatencyIncrease(i), "vps_max_latency_increase[i]" ); … … 790 793 WRITE_CODE( picOrderCntLSB, pcSlice->getSPS()->getBitsForPOC(), "pic_order_cnt_lsb"); 791 794 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 792 821 if(pcSlice->getRPSidx() < 0) 822 #endif 793 823 { 794 824 WRITE_FLAG( 0, "short_term_ref_pic_set_sps_flag"); … … 1373 1403 // ==================================================================================================================== 1374 1404 1375 1376 /** Write PCM alignment bits.1377 * \returns Void1378 */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 else1426 {1427 xWriteEpExGolomb( uiSymbol, 0 );1428 }1429 }1430 else1431 {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 1453 1405 /** code explicit wp tables 1454 1406 * \param TComSlice* pcSlice -
branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/TEncCavlc.h
r324 r362 68 68 TComSlice* m_pcSlice; 69 69 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 );75 70 76 71 Void codeShortTermRefPicSet ( TComSPS* pcSPS, TComReferencePictureSet* pcRPS, Bool calledFromSliceHeader, Int idx ); -
branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/TEncCfg.h
r324 r362 74 74 Int m_interViewRefPosL[2][MAX_NUM_REF_PICS]; 75 75 #endif 76 77 76 GOPEntry() 78 77 : m_POC(-1) … … 98 97 #if H_MV 99 98 ::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 103 100 } 104 101 }; … … 172 169 Int m_loopFilterTcOffsetDiv2; 173 170 Bool m_DeblockingFilterControlPresent; 171 #if L0386_DB_METRIC 172 Bool m_DeblockingFilterMetric; 173 #endif 174 174 Bool m_bUseSAO; 175 175 Int m_maxNumOffsetsPerPic; … … 202 202 Bool m_bUseASR; 203 203 Bool m_bUseHADME; 204 #if !L0034_COMBINED_LIST_CLEANUP 204 205 Bool m_bUseLComb; 206 #endif 205 207 Bool m_useRDOQ; 206 208 Bool m_useRDOQTS; … … 248 250 Int m_pictureTimingSEIEnabled; 249 251 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 250 279 Int m_framePackingSEIEnabled; 251 280 Int m_framePackingSEIType; … … 257 286 Int m_gradualDecodingRefreshInfoEnabled; 258 287 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 259 294 //====== Weighted Prediction ======== 260 295 Bool m_useWeightedPred; //< Use of Weighting Prediction (P_SLICE) … … 325 360 #endif 326 361 #endif 327 328 362 public: 329 363 TEncCfg() … … 409 443 Void setLoopFilterTcOffset ( Int i ) { m_loopFilterTcOffsetDiv2 = i; } 410 444 Void setDeblockingFilterControlPresent ( Bool b ) { m_DeblockingFilterControlPresent = b; } 445 #if L0386_DB_METRIC 446 Void setDeblockingFilterMetric ( Bool b ) { m_DeblockingFilterMetric = b; } 447 #endif 411 448 412 449 //====== Motion search ======== … … 463 500 Int getLoopFilterTcOffset () { return m_loopFilterTcOffsetDiv2; } 464 501 Bool getDeblockingFilterControlPresent() { return m_DeblockingFilterControlPresent; } 502 #if L0386_DB_METRIC 503 Bool getDeblockingFilterMetric () { return m_DeblockingFilterMetric; } 504 #endif 465 505 466 506 //==== Motion search ======== … … 480 520 Void setUseASR ( Bool b ) { m_bUseASR = b; } 481 521 Void setUseHADME ( Bool b ) { m_bUseHADME = b; } 522 #if !L0034_COMBINED_LIST_CLEANUP 482 523 Void setUseLComb ( Bool b ) { m_bUseLComb = b; } 524 #endif 483 525 Void setUseRDOQ ( Bool b ) { m_useRDOQ = b; } 484 526 Void setUseRDOQTS ( Bool b ) { m_useRDOQTS = b; } … … 502 544 Bool getUseASR () { return m_bUseASR; } 503 545 Bool getUseHADME () { return m_bUseHADME; } 546 #if !L0034_COMBINED_LIST_CLEANUP 504 547 Bool getUseLComb () { return m_bUseLComb; } 548 #endif 505 549 Bool getUseRDOQ () { return m_useRDOQ; } 506 550 Bool getUseRDOQTS () { return m_useRDOQTS; } … … 599 643 Void setRecoveryPointSEIEnabled(Int b) { m_recoveryPointSEIEnabled = b; } 600 644 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 601 697 Void setFramePackingArrangementSEIEnabled(Int b) { m_framePackingSEIEnabled = b; } 602 698 Int getFramePackingArrangementSEIEnabled() { return m_framePackingSEIEnabled; } … … 617 713 Void setDecodingUnitInfoSEIEnabled(Int b) { m_decodingUnitInfoSEIEnabled = b; } 618 714 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 619 723 Void setUseWP ( Bool b ) { m_useWeightedPred = b; } 620 724 Void setWPBiPred ( Bool b ) { m_useWeightedBiPred = b; } -
branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/TEncGOP.cpp
r324 r362 96 96 #if L0045_NON_NESTED_SEI_RESTRICTIONS 97 97 xResetNonNestedSEIPresentFlags(); 98 #endif 99 98 #if K0180_SCALABLE_NESTING_SEI 99 xResetNestedSEIPresentFlags(); 100 #endif 101 #endif 100 102 #if H_MV 101 103 m_layerId = 0; … … 106 108 #endif 107 109 #endif 108 109 110 return; 110 111 } … … 211 212 } 212 213 214 #if J0149_TONE_MAPPING_SEI 215 SEIToneMappingInfo* 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 213 301 Void TEncGOP::xCreateLeadingSEIMessages (/*SEIMessages seiMessages,*/ AccessUnit &accessUnit, TComSPS *sps) 214 302 { 215 OutputNALUnit nalu(NAL_UNIT_ SEI);303 OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI); 216 304 217 305 if(m_pcCfg->getActiveParameterSetsSEIEnabled()) … … 234 322 SEIFramePacking *sei = xCreateSEIFramePacking (); 235 323 236 nalu = NALUnit(NAL_UNIT_ SEI);324 nalu = NALUnit(NAL_UNIT_PREFIX_SEI); 237 325 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); 238 326 m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps); … … 245 333 SEIDisplayOrientation *sei = xCreateSEIDisplayOrientation(); 246 334 247 nalu = NALUnit(NAL_UNIT_ SEI);335 nalu = NALUnit(NAL_UNIT_PREFIX_SEI); 248 336 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); 249 337 m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps); … … 252 340 delete sei; 253 341 } 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 254 355 } 255 356 … … 275 376 TComPicYuv* pcPicYuvRecOut; 276 377 TComSlice* pcSlice; 277 TComOutputBitstream* pcBitstreamRedirect = new TComOutputBitstream; 378 TComOutputBitstream *pcBitstreamRedirect; 379 pcBitstreamRedirect = new TComOutputBitstream; 278 380 AccessUnit::iterator itLocationToPushSliceHeaderNALU; // used to store location where NALU containing slice header is to be inserted 279 381 UInt uiOneBitstreamPerSliceLength = 0; … … 286 388 m_iNumPicCoded = 0; 287 389 #endif 288 289 390 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 290 406 #if L0044_DU_DPB_OUTPUT_DELAY_HRD 291 407 Int picSptDpbOutputDuDelay = 0; … … 298 414 for ( Int iGOPid=0; iGOPid < m_iGopSize; iGOPid++ ) 299 415 #endif 300 301 416 { 302 417 UInt uiColDir = 1; … … 364 479 continue; 365 480 #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 ) 370 484 { 371 485 m_iLastIDR = pocCurr; … … 385 499 pcSlice->setLastIDR(m_iLastIDR); 386 500 pcSlice->setSliceIdx(0); 387 388 501 #if H_MV 389 502 pcPic ->setLayerId ( getLayerId() ); … … 397 510 #endif 398 511 #endif 399 400 512 //set default slice level flag to the same as SPS level flag 401 513 pcSlice->setLFCrossSliceBoundaryFlag( pcSlice->getPPS()->getLoopFilterAcrossSlicesEnabledFlag() ); … … 437 549 #if H_MV 438 550 // Set the nal unit type 439 pcSlice->setNalUnitType(getNalUnitType(pocCurr ));551 pcSlice->setNalUnitType(getNalUnitType(pocCurr, m_iLastIDR)); 440 552 if( pcSlice->getSliceType() == B_SLICE ) 441 553 { … … 451 563 } 452 564 // Set the nal unit type 453 pcSlice->setNalUnitType(getNalUnitType(pocCurr ));454 #endif 455 if(pcSlice->get NalUnitType()==NAL_UNIT_CODED_SLICE_TRAIL_R)456 { 457 if(pcSlice->get TemporalLayerNonReferenceFlag())565 pcSlice->setNalUnitType(getNalUnitType(pocCurr, m_iLastIDR)); 566 #endif 567 if(pcSlice->getTemporalLayerNonReferenceFlag()) 568 { 569 if(pcSlice->getNalUnitType()==NAL_UNIT_CODED_SLICE_TRAIL_R) 458 570 { 459 571 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); 460 580 } 461 581 } … … 482 602 else 483 603 { 484 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_TLA );604 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_TLA_R); 485 605 } 486 606 } … … 568 688 } 569 689 #endif 570 690 #if !L0034_COMBINED_LIST_CLEANUP 571 691 if (pcSlice->getSliceType() != B_SLICE || !pcSlice->getSPS()->getUseLComb()) 572 692 { … … 580 700 pcSlice->setNumRefIdx(REF_PIC_LIST_C, pcSlice->getNumRefIdx(REF_PIC_LIST_0)); 581 701 } 702 #endif 582 703 583 704 if (pcSlice->getSliceType() == B_SLICE) … … 605 726 pcSlice->setCheckLDC(bLowDelay); 606 727 } 728 else 729 { 730 pcSlice->setCheckLDC(true); 731 } 607 732 608 733 uiColDir = 1-uiColDir; … … 611 736 pcSlice->setRefPOCList(); 612 737 738 #if L0034_COMBINED_LIST_CLEANUP 739 pcSlice->setList1IdxToList0Idx(); 740 #else 613 741 pcSlice->setNoBackPredFlag( false ); 614 742 if ( pcSlice->getSliceType() == B_SLICE && !pcSlice->getRefPicListCombinationFlag()) … … 634 762 } 635 763 pcSlice->generateCombinedList(); 764 #endif 636 765 637 766 if (m_pcEncTop->getTMVPModeId() == 2) … … 939 1068 Bool bLFCrossTileBoundary = pcSlice->getPPS()->getLoopFilterAcrossTilesEnabledFlag(); 940 1069 m_pcLoopFilter->setCfg(bLFCrossTileBoundary); 1070 #if L0386_DB_METRIC 1071 if ( m_pcCfg->getDeblockingFilterMetric() ) 1072 { 1073 dblMetric(pcPic, uiNumSlices); 1074 } 1075 #endif 941 1076 m_pcLoopFilter->loopFilterPic( pcPic ); 942 1077 … … 1037 1172 } 1038 1173 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 1039 1214 if( ( m_pcCfg->getPictureTimingSEIEnabled() || m_pcCfg->getDecodingUnitInfoSEIEnabled() ) && 1040 1215 ( pcSlice->getSPS()->getVuiParametersPresentFlag() ) && … … 1082 1257 || ( pcSlice->getSPS()->getVuiParameters()->getHrdParameters()->getVclHrdParametersPresentFlag() ) ) ) 1083 1258 { 1084 OutputNALUnit nalu(NAL_UNIT_ SEI);1259 OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI); 1085 1260 m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice); 1086 1261 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); … … 1123 1298 writeRBSPTrailingBits(nalu.m_Bitstream); 1124 1299 #if L0045_NON_NESTED_SEI_RESTRICTIONS 1300 { 1125 1301 UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit); 1126 1302 UInt offsetPosition = m_activeParameterSetSEIPresentInAU; // Insert BP SEI after APS SEI … … 1132 1308 accessUnit.insert(it, new NALUnitEBSP(nalu)); 1133 1309 m_bufferingPeriodSEIPresentInAU = true; 1310 } 1134 1311 #else 1135 1312 accessUnit.push_back(new NALUnitEBSP(nalu)); 1136 1313 #endif 1137 1314 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 1138 1341 m_lastBPSEI = m_totalCoded; 1139 1342 m_cpbRemovalDelay = 0; … … 1145 1348 { 1146 1349 // Gradual decoding refresh SEI 1147 OutputNALUnit nalu(NAL_UNIT_ SEI);1350 OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI); 1148 1351 m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice); 1149 1352 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); … … 1157 1360 } 1158 1361 // Recovery point SEI 1159 OutputNALUnit nalu(NAL_UNIT_ SEI);1362 OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI); 1160 1363 m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice); 1161 1364 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); … … 1348 1551 1349 1552 pcSlice->setTileOffstForMultES( uiOneBitstreamPerSliceLength ); 1350 if (!sliceSegment)1351 {1352 1553 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); 1359 1555 1360 1556 { … … 1388 1584 if (ui+1 < pcSlice->getPPS()->getNumSubstreams()) 1389 1585 { 1390 puiSubstreamSizes[ui] = pcSubstreamsOut[ui].getNumberOfWrittenBits() ;1586 puiSubstreamSizes[ui] = pcSubstreamsOut[ui].getNumberOfWrittenBits() + (pcSubstreamsOut[ui].countStartCodeEmulations()<<3); 1391 1587 } 1392 1588 } … … 1420 1616 // 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. 1421 1617 Bool bNALUAlignedWrittenToList = false; // used to ensure current NALU is not written more than once to the NALU list. 1422 x WriteTileLocationToSliceHeader(nalu, pcBitstreamRedirect, pcSlice);1618 xAttachSliceDataToNalUnit(nalu, pcBitstreamRedirect); 1423 1619 accessUnit.push_back(new NALUnitEBSP(nalu)); 1424 1620 #if RATE_CONTROL_LAMBDA_DOMAIN … … 1448 1644 { 1449 1645 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) 1451 1647 { 1452 1648 numRBSPBytes += numRBSPBytes_nal; … … 1549 1745 digestStr = digestToString(sei_recon_picture_digest.digest, 4); 1550 1746 } 1551 OutputNALUnit nalu(NAL_UNIT_S EI_SUFFIX, pcSlice->getTLayer());1747 OutputNALUnit nalu(NAL_UNIT_SUFFIX_SEI, pcSlice->getTLayer()); 1552 1748 1553 1749 /* write the SEI messages */ … … 1573 1769 sei_temporal_level0_index.rapIdx = m_rapIdx; 1574 1770 1575 OutputNALUnit nalu(NAL_UNIT_ SEI);1771 OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI); 1576 1772 1577 1773 /* write the SEI messages */ … … 1713 1909 if( m_pcCfg->getPictureTimingSEIEnabled() ) 1714 1910 { 1715 OutputNALUnit nalu(NAL_UNIT_SEI, pcSlice->getTLayer()); 1911 { 1912 OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI, pcSlice->getTLayer()); 1716 1913 m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice); 1717 1914 m_seiWriter.writeSEImessage(nalu.m_Bitstream, pictureTimingSEI, pcSlice->getSPS()); … … 1733 1930 #endif 1734 1931 } 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 } 1735 1960 if( m_pcCfg->getDecodingUnitInfoSEIEnabled() && hrd->getSubPicCpbParamsPresentFlag() ) 1736 1961 { … … 1738 1963 for( Int i = 0; i < ( pictureTimingSEI.m_numDecodingUnitsMinus1 + 1 ); i ++ ) 1739 1964 { 1740 OutputNALUnit nalu(NAL_UNIT_ SEI, pcSlice->getTLayer());1965 OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI, pcSlice->getTLayer()); 1741 1966 1742 1967 SEIDecodingUnitInfo tempSEI; … … 1786 2011 break; 1787 2012 } 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) 1789 2014 { 1790 2015 ctr++; … … 1797 2022 #if L0045_NON_NESTED_SEI_RESTRICTIONS 1798 2023 xResetNonNestedSEIPresentFlags(); 2024 #if K0180_SCALABLE_NESTING_SEI 2025 xResetNestedSEIPresentFlags(); 2026 #endif 1799 2027 #endif 1800 2028 pcPic->getPicYuvRec()->copyToPic(pcPicYuvRecOut); … … 2023 2251 case NAL_UNIT_CODED_SLICE_TRAIL_R: return "TRAIL_R"; 2024 2252 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"; 2026 2254 case NAL_UNIT_CODED_SLICE_TSA_N: return "TSA_N"; 2027 2255 case NAL_UNIT_CODED_SLICE_STSA_R: return "STSA_R"; 2028 2256 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_BLA NT: 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"; 2031 2259 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"; 2033 2261 case NAL_UNIT_CODED_SLICE_IDR_N_LP: return "IDR_N_LP"; 2034 2262 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"; 2037 2265 case NAL_UNIT_VPS: return "VPS"; 2038 2266 case NAL_UNIT_SPS: return "SPS"; … … 2042 2270 case NAL_UNIT_EOB: return "EOB"; 2043 2271 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"; 2045 2274 default: return "UNK"; 2046 2275 } … … 2133 2362 printf("*** %6s numBytesInNALunit: %u\n", nalUnitTypeToString((*it)->m_nalUnitType), numRBSPBytes_nal); 2134 2363 #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) 2136 2365 { 2137 2366 numRBSPBytes += numRBSPBytes_nal; … … 2143 2372 2144 2373 //===== add PSNR ===== 2145 2146 2374 #if H_MV 2147 2375 m_pcEncTop->getAnalyzeAll()->addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits); … … 2153 2381 if (pcSlice->isIntra()) 2154 2382 { 2155 2156 2383 #if H_MV 2157 2384 m_pcEncTop->getAnalyzeI()->addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits); … … 2163 2390 if (pcSlice->isInterP()) 2164 2391 { 2165 2166 2392 #if H_MV 2167 2393 m_pcEncTop->getAnalyzeP()->addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits); … … 2169 2395 m_gcAnalyzeP.addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits); 2170 2396 #endif 2171 2172 2397 } 2173 2398 if (pcSlice->isInterB()) 2174 2399 { 2175 2176 2400 #if H_MV 2177 2401 m_pcEncTop->getAnalyzeB()->addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits); … … 2179 2403 m_gcAnalyzeB.addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits); 2180 2404 #endif 2181 2182 2405 } 2183 2406 … … 2186 2409 2187 2410 #if ADAPTIVE_QP_SELECTION 2188 2189 2411 #if H_MV 2190 2412 printf("Layer %3d POC %4d TId: %1d ( %c-SLICE, nQP %d QP %d ) %10d bits", … … 2205 2427 uibits ); 2206 2428 #endif 2207 2208 2429 #else 2209 2210 2430 #if H_MV 2211 2431 printf("Layer %3d POC %4d TId: %1d ( %c-SLICE, QP %d ) %10d bits", … … 2226 2446 2227 2447 #endif 2228 2229 2448 printf(" [Y %6.4lf dB U %6.4lf dB V %6.4lf dB]", dYPSNR, dUPSNR, dVPSNR ); 2230 2449 printf(" [ET %5.0f ]", dEncTime ); … … 2257 2476 * This function checks the configuration and returns the appropriate nal_unit_type for the picture. 2258 2477 */ 2259 NalUnitType TEncGOP::getNalUnitType(Int pocCurr )2478 NalUnitType TEncGOP::getNalUnitType(Int pocCurr, Int lastIDR) 2260 2479 { 2261 2480 if (pocCurr == 0) 2262 2481 { 2263 return NAL_UNIT_CODED_SLICE_IDR ;2482 return NAL_UNIT_CODED_SLICE_IDR_W_RADL; 2264 2483 } 2265 2484 if (pocCurr % m_pcCfg->getIntraPeriod() == 0) … … 2271 2490 else if (m_pcCfg->getDecodingRefreshType() == 2) 2272 2491 { 2273 return NAL_UNIT_CODED_SLICE_IDR ;2492 return NAL_UNIT_CODED_SLICE_IDR_W_RADL; 2274 2493 } 2275 2494 } … … 2283 2502 // controlling the reference pictures used for encoding that leading picture. Such a leading 2284 2503 // 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; 2286 2512 } 2287 2513 } … … 2334 2560 } 2335 2561 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 2339 2566 */ 2340 Void TEncGOP::x WriteTileLocationToSliceHeader (OutputNALUnit& rNalu, TComOutputBitstream*& rpcBitstreamRedirect, TComSlice*& rpcSlice)2567 Void TEncGOP::xAttachSliceDataToNalUnit (OutputNALUnit& rNalu, TComOutputBitstream*& codedSliceData) 2341 2568 { 2342 2569 // Byte-align … … 2344 2571 2345 2572 // 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); 2366 2576 } 2367 2577 2368 2578 m_pcEntropyCoder->setBitstream(&rNalu.m_Bitstream); 2369 2579 2370 delete rpcBitstreamRedirect; 2371 rpcBitstreamRedirect = new TComOutputBitstream; 2580 codedSliceData->clear(); 2372 2581 } 2373 2582 … … 2494 2703 } 2495 2704 } 2496 assert(it != accessUnit.end()); 2705 // assert(it != accessUnit.end()); // Triggers with some legit configurations 2497 2706 return seiStartPos; 2498 2707 } 2499 2708 #endif 2500 2709 2710 #if L0386_DB_METRIC 2711 Void 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 2501 2833 #if H_MV 2502 2834 Void TEncGOP::xSetRefPicListModificationsMvc( TComSlice* pcSlice, UInt uiPOCCurr, UInt iGOPid ) … … 2578 2910 } 2579 2911 #endif 2580 2581 2912 //! \} -
branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/TEncGOP.h
r324 r362 132 132 Bool m_bufferingPeriodSEIPresentInAU; 133 133 Bool m_pictureTimingSEIPresentInAU; 134 #if K0180_SCALABLE_NESTING_SEI 135 Bool m_nestedBufferingPeriodSEIPresentInAU; 136 Bool m_nestedPictureTimingSEIPresentInAU; 137 #endif 134 138 #endif 135 139 public: … … 141 145 142 146 Void init ( TEncTop* pcTEncTop ); 143 144 147 #if H_MV 145 148 Void initGOP ( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsInGOP); … … 148 151 Void compressGOP( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRec, std::list<AccessUnit>& accessUnitsInGOP ); 149 152 #endif 150 151 Void xWriteTileLocationToSliceHeader (OutputNALUnit& rNalu, TComOutputBitstream*& rpcBitstreamRedirect, TComSlice*& rpcSlice); 153 Void xAttachSliceDataToNalUnit (OutputNALUnit& rNalu, TComOutputBitstream*& rpcBitstreamRedirect); 152 154 153 155 #if H_MV … … 167 169 Void printOutSummary ( UInt uiNumAllPicCoded ); 168 170 #endif 169 170 171 Void preLoopFilterPicAll ( TComPic* pcPic, UInt64& ruiDist, UInt64& ruiBits ); 171 172 172 173 TEncSlice* getSliceEncoder() { return m_pcSliceEncoder; } 173 NalUnitType getNalUnitType( Int pocCurr );174 NalUnitType getNalUnitType( Int pocCurr, Int lastIdr ); 174 175 Void arrangeLongtermPicturesInRPS(TComSlice *, TComList<TComPic*>& ); 175 176 protected: … … 189 190 SEIFramePacking* xCreateSEIFramePacking(); 190 191 SEIDisplayOrientation* xCreateSEIDisplayOrientation(); 192 193 #if J0149_TONE_MAPPING_SEI 194 SEIToneMappingInfo* xCreateSEIToneMappingInfo(); 195 #endif 191 196 192 197 Void xCreateLeadingSEIMessages (/*SEIMessages seiMessages,*/ AccessUnit &accessUnit, TComSPS *sps); … … 199 204 m_pictureTimingSEIPresentInAU = false; 200 205 } 201 #endif 202 206 #if K0180_SCALABLE_NESTING_SEI 207 Void xResetNestedSEIPresentFlags() 208 { 209 m_nestedBufferingPeriodSEIPresentInAU = false; 210 m_nestedPictureTimingSEIPresentInAU = false; 211 } 212 #endif 203 213 #if H_MV 204 214 Void xSetRefPicListModificationsMvc( TComSlice* pcSlice, UInt uiPOCCurr, UInt iGOPid ); 205 215 #endif 206 216 #if L0386_DB_METRIC 217 Void dblMetric( TComPic* pcPic, UInt uiNumSlices ); 218 #endif 207 219 };// END CLASS DEFINITION TEncGOP 208 220 -
branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp
r324 r362 1677 1677 #endif 1678 1678 { 1679 #if SAO_CHROMA_LAMBDA1680 m_dLambdaLuma = dLambdaLuma;1681 m_dLambdaChroma = dLambdaChroma;1682 #else1683 m_dLambdaLuma = dLambda;1684 m_dLambdaChroma = dLambda;1685 #endif1686 1687 1679 if(m_bUseNIF) 1688 1680 { -
branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.h
r324 r362 57 57 { 58 58 private: 59 Double m_dLambdaLuma;60 Double m_dLambdaChroma;61 62 59 TEncEntropy* m_pcEntropyCoder; 63 60 TEncSbac*** m_pppcRDSbacCoder; ///< for CABAC -
branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/TEncSbac.h
r324 r362 109 109 Void xWriteEpExGolomb ( UInt uiSymbol, UInt uiCount ); 110 110 Void xWriteCoefRemainExGolomb ( UInt symbol, UInt &rParam ); 111 Void xWriteTerminatingBit ( UInt uiBit );112 111 113 112 Void xCopyFrom ( TEncSbac* pSrc ); -
branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/TEncSearch.cpp
r324 r362 3209 3209 UInt uiBitsTempL0[MAX_NUM_REF]; 3210 3210 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 3211 3218 xGetBlkBits( ePartSize, pcCU->getSlice()->isInterP(), iPartIdx, uiLastMode, uiMbBits); 3212 3219 … … 3255 3262 uiBitsTemp += m_auiMVPIdxCost[aaiMvpIdx[iRefList][iRefIdxTemp]][AMVP_MAX_NUM_CANDS]; 3256 3263 #if ZERO_MVD_EST 3264 #if L0034_COMBINED_LIST_CLEANUP 3265 if ( iRefList == 0 || pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp ) < 0 ) 3266 #else 3257 3267 if ((iRefList != 1 || !pcCU->getSlice()->getNoBackPredFlag()) && 3258 3268 (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) <= 0 || pcCU->getSlice()->getRefIdxOfLC(eRefPicList, iRefIdxTemp)>=0)) 3269 #endif 3259 3270 { 3260 3271 uiZeroMvdBitsTemp = uiBitsTemp; … … 3276 3287 3277 3288 #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 3278 3314 if ( pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0) 3279 3315 { … … 3317 3353 } 3318 3354 } 3355 #endif 3319 3356 #else 3320 3357 xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp ); … … 3323 3360 xCheckBestMVP(pcCU, eRefPicList, cMvTemp[iRefList][iRefIdxTemp], cMvPred[iRefList][iRefIdxTemp], aaiMvpIdx[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp); 3324 3361 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 3325 3388 if(pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && !pcCU->getSlice()->getNoBackPredFlag()) 3326 3389 { … … 3372 3435 } 3373 3436 } 3437 #endif 3374 3438 } 3375 3439 } … … 3435 3499 3436 3500 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 3437 3525 if ( m_pcEncCfg->getUseFastEnc() && (pcCU->getSlice()->getNoBackPredFlag() || (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(0)==0 )) ) 3438 3526 { 3439 3527 iRefList = 1; 3440 3528 } 3529 #endif 3441 3530 RefPicList eRefPicList = ( iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0 ); 3442 3531 … … 3573 3662 UInt uiMEBits = 0; 3574 3663 // 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 3575 3670 if ( pcCU->getSlice()->getNoBackPredFlag() || (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(0)==0 ) ) 3576 3671 { 3577 3672 uiCost[1] = MAX_UINT; 3578 3673 } 3674 #endif 3579 3675 #if AMP_MRG 3580 3676 if (bTestNormalMC) … … 4522 4618 while( pcCU->getWidth(0) > (pcCU->getSlice()->getSPS()->getMaxTrSize()<<uiTrLevel) ) uiTrLevel++; 4523 4619 } 4524 UInt uiMaxTrMode = pcCU->getSlice()->getSPS()->getMaxTrDepth()+ uiTrLevel;4620 UInt uiMaxTrMode = 1 + uiTrLevel; 4525 4621 4526 4622 while((uiWidth>>uiMaxTrMode) < (g_uiMaxCUWidth>>g_uiMaxCUDepth)) uiMaxTrMode--; -
branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/TEncSlice.cpp
r324 r362 438 438 #endif 439 439 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 440 449 if (rpcSlice->getPPS()->getDeblockingFilterControlPresentFlag()) 441 450 { … … 1223 1232 \retval rpcBitstream bitstream class 1224 1233 */ 1225 Void TEncSlice::encodeSlice ( TComPic*& rpcPic, TComOutputBitstream* pc Bitstream, TComOutputBitstream* pcSubstreams )1234 Void TEncSlice::encodeSlice ( TComPic*& rpcPic, TComOutputBitstream* pcSubstreams ) 1226 1235 { 1227 1236 UInt uiCUAddr; … … 1403 1412 } 1404 1413 { 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(); 1438 1415 UInt uiAccumulatedSubstreamLength = 0; 1439 1416 for (Int iSubstrmIdx=0; iSubstrmIdx < iNumSubstreams; iSubstrmIdx++) … … 1443 1420 // add bits coded in previous dependent slices + bits coded so far 1444 1421 // 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 ); 1446 1423 } 1447 1424 } -
branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/TEncSlice.h
r324 r362 122 122 Void precompressSlice ( TComPic*& rpcPic ); ///< precompress slice for multi-loop opt. 123 123 Void compressSlice ( TComPic*& rpcPic ); ///< analysis stage of slice 124 Void encodeSlice ( TComPic*& rpcPic, TComOutputBitstream* rpcBitstream, TComOutputBitstream*pcSubstreams );124 Void encodeSlice ( TComPic*& rpcPic, TComOutputBitstream* pcSubstreams ); 125 125 126 126 // misc. functions -
branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/TEncTop.cpp
r324 r362 81 81 m_pcBitCounters = NULL; 82 82 m_pcRdCosts = NULL; 83 84 83 #if H_MV 85 84 m_ivPicLists = NULL; … … 96 95 Void TEncTop::create () 97 96 { 98 99 97 #if !H_MV 100 98 // initialize global variables … … 288 286 Void TEncTop::init() 289 287 { 290 291 288 // initialize SPS 292 289 xInitSPS(); … … 348 345 } 349 346 #endif 350 351 347 Void TEncTop::deletePicBuffer() 352 348 { … … 375 371 \retval iNumEncoded number of encoded pictures 376 372 */ 377 Void TEncTop::encode(Bool flush, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded378 373 #if H_MV 379 , Int gopId 380 #endif 381 ) 382 { 383 374 Void TEncTop::encode(Bool flush, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded , Int gopId ) 375 { 376 #else 377 Void TEncTop::encode(Bool flush, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded ) 378 { 379 #endif 384 380 #if H_3D 385 381 TComPic* picLastCoded = getPic( getGOPEncoder()->getPocLastCoded() ); … … 389 385 } 390 386 #endif 391 392 387 #if H_MV 393 388 if( gopId == 0) … … 547 542 m_cSPS.setMaxCUHeight ( g_uiMaxCUHeight ); 548 543 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); 551 555 552 556 m_cSPS.setPCMLog2MinSize (m_uiPCMLog2MinSize); … … 563 567 564 568 m_cSPS.setMaxTrSize ( 1 << m_uiQuadtreeTULog2MaxSize ); 565 569 #if !L0034_COMBINED_LIST_CLEANUP 566 570 m_cSPS.setUseLComb ( m_bUseLComb ); 571 #endif 567 572 568 573 Int i; … … 716 721 m_cPPS.setOutputFlagPresentFlag( false ); 717 722 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 { 718 734 m_cPPS.setDeblockingFilterControlPresentFlag (m_DeblockingFilterControlPresent ); 735 } 736 #else 737 m_cPPS.setDeblockingFilterControlPresentFlag (m_DeblockingFilterControlPresent ); 738 #endif 719 739 m_cPPS.setLog2ParallelMergeLevelMinus2 (m_log2ParallelMergeLevelMinus2 ); 720 740 m_cPPS.setCabacInitPresentFlag(CABAC_INIT_PRESENT_FLAG); … … 990 1010 } 991 1011 1012 #if L0208_SOP_DESCRIPTION_SEI 1013 Int 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 992 1044 Void TEncTop::xInitPPSforTiles() 993 1045 { -
branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/TEncTop.h
r324 r362 195 195 TComPPS* getPPS () { return &m_cPPS; } 196 196 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 197 200 TComScalingList* getScalingList () { return &m_scalingList; } 198 199 201 #if H_MV 200 202 TEncAnalyze* getAnalyzeAll () { return &m_cAnalyzeAll; } … … 210 212 Void setIvPicLists ( TComPicLists* picLists) { m_ivPicLists = picLists; } 211 213 #endif 212 213 214 214 // ------------------------------------------------------------------------------------------------------------------- 215 215 // encoder function … … 217 217 218 218 /// 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 219 222 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 ); 228 228 #else 229 229 void printSummary() { m_cGOPEncoder.printOutSummary (m_uiNumAllPicCoded); } 230 230 #endif 231 232 231 }; 233 232 -
branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/WeightPredAnalysis.cpp
r324 r362 235 235 Int offset = (Int)( ((currDC<<log2Denom) - ((Int64)weight * refDC) + (Int64)realOffset) >> realLog2Denom ); 236 236 237 // Chroma offset range limi nation237 // Chroma offset range limitation 238 238 if(comp) 239 239 { 240 Int shift = 1 << (g_bitDepthC - 1); 241 Int pred = ( shift - ( ( shift*weight)>>(log2Denom) ) ); 240 Int pred = ( 128 - ( ( 128*weight)>>(log2Denom) ) ); 242 241 Int deltaOffset = Clip3( -512, 511, (offset - pred) ); // signed 10bit 243 242 offset = Clip3( -128, 127, (deltaOffset + pred) ); // signed 8bit 243 } 244 // Luma offset range limitation 245 else 246 { 247 offset = Clip3( -128, 127, offset); 244 248 } 245 249
Note: See TracChangeset for help on using the changeset viewer.