Changeset 302 in SHVCSoftware
- Timestamp:
- 28 Jun 2013, 00:40:00 (12 years ago)
- Location:
- branches/SHM-2.1-dev/source
- Files:
-
- 48 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-2.1-dev/source/App/TAppDecoder/decmain.cpp
r191 r302 56 56 // print information 57 57 fprintf( stdout, "\n" ); 58 #if SVC_EXTENSION 58 59 fprintf( stdout, "SHM software: Decoder Version [%s]", NV_VERSION ); 60 #else 61 fprintf( stdout, "HM software: Decoder Version [%s]", NV_VERSION ); 62 #endif 59 63 fprintf( stdout, NVM_ONOS ); 60 64 fprintf( stdout, NVM_COMPILEDBY ); -
branches/SHM-2.1-dev/source/App/TAppEncoder/TAppEncCfg.cpp
r298 r302 96 96 { 97 97 m_aidQP = NULL; 98 #if J0149_TONE_MAPPING_SEI99 98 m_startOfCodedInterval = NULL; 100 99 m_codedPivotValue = NULL; 101 100 m_targetPivotValue = NULL; 102 #endif103 101 } 104 102 #endif … … 114 112 delete[] m_aidQP; 115 113 } 116 #if J0149_TONE_MAPPING_SEI117 114 if ( m_startOfCodedInterval ) 118 115 { … … 130 127 m_targetPivotValue = NULL; 131 128 } 132 #endif133 129 free(m_pchInputFile); 134 130 #endif … … 326 322 } 327 323 328 #if SIGNAL_BITRATE_PICRATE_IN_VPS329 Void readBoolString(const string inpString, const Int numEntries, Bool* &memberArray, const char *elementName);330 Void readIntString(const string inpString, const Int numEntries, Int* &memberArray, const char *elementName);331 #endif332 324 // ==================================================================================================================== 333 325 // Public member functions … … 450 442 string cfg_RowHeight; 451 443 string cfg_ScalingListFile; 452 #if J0149_TONE_MAPPING_SEI453 444 string cfg_startOfCodedInterval; 454 445 string cfg_codedPivotValue; 455 446 string cfg_targetPivotValue; 456 #endif457 #if SIGNAL_BITRATE_PICRATE_IN_VPS458 string cfg_bitRateInfoPresentFlag;459 string cfg_picRateInfoPresentFlag;460 string cfg_avgBitRate;461 string cfg_maxBitRate;462 string cfg_avgPicRate;463 string cfg_constantPicRateIdc;464 #endif465 447 po::Options opts; 466 448 opts.addOptions() … … 556 538 ("Tier", m_levelTier, Level::MAIN, "Tier to use for interpretation of --Level") 557 539 558 #if L0046_CONSTRAINT_FLAGS559 540 ("ProgressiveSource", m_progressiveSourceFlag, false, "Indicate that source is progressive") 560 541 ("InterlacedSource", m_interlacedSourceFlag, false, "Indicate that source is interlaced") 561 542 ("NonPackedSource", m_nonPackedConstraintFlag, false, "Indicate that source does not contain frame packing") 562 543 ("FrameOnly", m_frameOnlyConstraintFlag, false, "Indicate that the bitstream contains only frames") 563 #endif564 544 565 545 // Unit definition parameters … … 585 565 ("DecodingRefreshType,-dr", m_iDecodingRefreshType, 0, "Intra refresh type (0:none 1:CRA 2:IDR)") 586 566 ("GOPSize,g", m_iGOPSize, 1, "GOP size of temporal structure") 587 #if !L0034_COMBINED_LIST_CLEANUP588 ("ListCombination,-lc", m_bUseLComb, true, "Combined reference list for uni-prediction estimation in B-slices")589 #endif590 567 // motion options 591 568 ("FastSearch", m_iFastSearch, 1, "0:Full search 1:Diamond 2:PMVFAST") … … 633 610 ("RDOQ", m_useRDOQ, true ) 634 611 ("RDOQTS", m_useRDOQTS, true ) 635 #if L0232_RD_PENALTY636 612 ("RDpenalty", m_rdPenalty, 0, "RD-penalty for 32x32 TU for intra in non-intra slices. 0:disbaled 1:RD-penalty 2:maximum RD-penalty") 637 #endif638 613 // Entropy coding parameters 639 614 ("SBACRD", m_bUseSBACRD, true, "SBAC based RD estimation") … … 645 620 ("LoopFilterTcOffset_div2", m_loopFilterTcOffsetDiv2, 0 ) 646 621 ("DeblockingFilterControlPresent", m_DeblockingFilterControlPresent, false ) 647 #if L0386_DB_METRIC648 622 ("DeblockingFilterMetric", m_DeblockingFilterMetric, false ) 649 #endif650 623 651 624 // Coding tools … … 722 695 ( "RateControl", m_RCEnableRateControl, false, "Rate control: enable rate control" ) 723 696 ( "TargetBitrate", m_RCTargetBitrate, 0, "Rate control: target bitrate" ) 697 #if M0036_RC_IMPROVEMENT 698 ( "KeepHierarchicalBit", m_RCKeepHierarchicalBit, 0, "Rate control: 0: equal bit allocation; 1: fixed ratio bit allocation; 2: adaptive ratio bit allocation" ) 699 #else 724 700 ( "KeepHierarchicalBit", m_RCKeepHierarchicalBit, false, "Rate control: keep hierarchical bit allocation in rate control algorithm" ) 701 #endif 725 702 ( "LCULevelRateControl", m_RCLCULevelRC, true, "Rate control: true: LCU level RC; false: picture level RC" ) 726 703 ( "RCLCUSeparateModel", m_RCUseLCUSeparateModel, true, "Rate control: use LCU level separate R-lambda model" ) … … 775 752 ("SEIBufferingPeriod", m_bufferingPeriodSEIEnabled, 0, "Control generation of buffering period SEI messages") 776 753 ("SEIPictureTiming", m_pictureTimingSEIEnabled, 0, "Control generation of picture timing SEI messages") 777 #if J0149_TONE_MAPPING_SEI778 754 ("SEIToneMappingInfo", m_toneMappingInfoSEIEnabled, false, "Control generation of Tone Mapping SEI messages") 779 755 ("SEIToneMapId", m_toneMapId, 0, "Specifies Id of Tone Mapping SEI message for a given session") … … 806 782 ("SEIToneMapNominalWhiteLevelLumaCodeValue", m_nominalWhiteLevelLumaCodeValue, 235, "Specifies luma sample value of the nominal white level assigned decoded pictures") 807 783 ("SEIToneMapExtendedWhiteLevelLumaCodeValue", m_extendedWhiteLevelLumaCodeValue, 300, "Specifies luma sample value of the extended dynamic range assigned decoded pictures") 808 #endif809 784 ("SEIFramePacking", m_framePackingSEIEnabled, 0, "Control generation of frame packing SEI messages") 810 785 ("SEIFramePackingType", m_framePackingSEIType, 0, "Define frame packing arrangement\n" … … 830 805 ("SEILayersPresent", m_layersPresentSEIEnabled, 0, "Control generation of layers present SEI message") 831 806 #endif 832 #if L0208_SOP_DESCRIPTION_SEI833 807 ("SEISOPDescription", m_SOPDescriptionSEIEnabled, 0, "Control generation of SOP description SEI messages") 834 #endif835 #if K0180_SCALABLE_NESTING_SEI836 808 ("SEIScalableNesting", m_scalableNestingSEIEnabled, 0, "Control generation of scalable nesting SEI messages") 837 #endif838 #if SIGNAL_BITRATE_PICRATE_IN_VPS839 ("BitRatePicRateMaxTLayers", m_bitRatePicRateMaxTLayers, 0, "Maximum number of sub-layers signalled; can be inferred otherwise; here for easy parsing of config. file")840 ("BitRateInfoPresent", cfg_bitRateInfoPresentFlag, string(""), "Control signalling of bit rate information of avg. bit rate and max. bit rate in VPS\n"841 "\t0: Do not sent bit rate info\n"842 "\tN (N > 0): Send bit rate info for N sub-layers. N should equal maxTempLayers.")843 ("PicRateInfoPresent", cfg_picRateInfoPresentFlag, string(""), "Control signalling of picture rate information of avg. bit rate and max. bit rate in VPS\n"844 "\t0: Do not sent picture rate info\n"845 "\tN (N > 0): Send picture rate info for N sub-layers. N should equal maxTempLayers.")846 ("AvgBitRate", cfg_avgBitRate, string(""), "List of avg. bit rates for the different sub-layers; include non-negative number even if corresponding flag is 0")847 ("MaxBitRate", cfg_maxBitRate, string(""), "List of max. bit rates for the different sub-layers; include non-negative number even if corresponding flag is 0")848 ("AvgPicRate", cfg_avgPicRate, string(""), "List of avg. picture rates for the different sub-layers; include non-negative number even if corresponding flag is 0")849 ("ConstantPicRateIdc", cfg_constantPicRateIdc, string(""), "List of constant picture rate IDCs; include non-negative number even if corresponding flag is 0")850 #endif851 809 #if M0040_ADAPTIVE_RESOLUTION_CHANGE 852 810 ("AdaptiveResolutionChange", m_adaptiveResolutionChange, 0, "Adaptive resolution change frame number. Should coincide with EL RAP picture. (0: disable)") … … 1153 1111 } 1154 1112 #endif 1155 #if SIGNAL_BITRATE_PICRATE_IN_VPS1156 readBoolString(cfg_bitRateInfoPresentFlag, m_bitRatePicRateMaxTLayers, m_bitRateInfoPresentFlag, "bit rate info. present flag" );1157 readIntString (cfg_avgBitRate, m_bitRatePicRateMaxTLayers, m_avgBitRate, "avg. bit rate" );1158 readIntString (cfg_maxBitRate, m_bitRatePicRateMaxTLayers, m_maxBitRate, "max. bit rate" );1159 readBoolString(cfg_picRateInfoPresentFlag, m_bitRatePicRateMaxTLayers, m_picRateInfoPresentFlag, "bit rate info. present flag" );1160 readIntString (cfg_avgPicRate, m_bitRatePicRateMaxTLayers, m_avgPicRate, "avg. pic rate" );1161 readIntString (cfg_constantPicRateIdc, m_bitRatePicRateMaxTLayers, m_constantPicRateIdc, "constant pic rate Idc" );1162 #endif1163 1113 m_scalingListFile = cfg_ScalingListFile.empty() ? NULL : strdup(cfg_ScalingListFile.c_str()); 1164 1114 … … 1269 1219 m_iWaveFrontSubstreams = m_iWaveFrontSynchro ? (m_iSourceHeight + m_uiMaxCUHeight - 1) / m_uiMaxCUHeight : 1; 1270 1220 #endif 1271 #if J0149_TONE_MAPPING_SEI1272 1221 if( m_toneMappingInfoSEIEnabled && !m_toneMapCancelFlag ) 1273 1222 { … … 1328 1277 } 1329 1278 } 1330 #endif1331 1279 // check validity of input parameters 1332 1280 xCheckParameter(); … … 1340 1288 return true; 1341 1289 } 1342 #if SIGNAL_BITRATE_PICRATE_IN_VPS1343 Void readBoolString(const string inpString, const Int numEntries, Bool* &memberArray, const char *elementName)1344 {1345 Char* inpArray = inpString.empty() ? NULL : strdup(inpString.c_str());1346 Int i = 0;1347 if(numEntries)1348 {1349 Char* tempArray = strtok(inpArray, " ,-");1350 memberArray = new Bool[numEntries];1351 while( tempArray != NULL )1352 {1353 if( i >= numEntries )1354 {1355 printf( "The number of %s defined is larger than the allowed number\n", elementName );1356 exit( EXIT_FAILURE );1357 }1358 assert( (atoi(tempArray) == 0) || (atoi(tempArray) == 1) );1359 *( memberArray + i ) = atoi(tempArray);1360 tempArray = strtok(NULL, " ,-");1361 i++;1362 }1363 if( i < numEntries )1364 {1365 printf( "Some %s are not defined\n", elementName );1366 exit( EXIT_FAILURE );1367 }1368 }1369 else1370 {1371 memberArray = NULL;1372 }1373 }1374 1375 Void readIntString(const string inpString, const Int numEntries, Int* &memberArray, const char *elementName)1376 {1377 Char* inpArray = inpString.empty() ? NULL : strdup(inpString.c_str());1378 Int i = 0;1379 if(numEntries)1380 {1381 Char* tempArray = strtok(inpArray, " ,-");1382 memberArray = new Int[numEntries];1383 while( tempArray != NULL )1384 {1385 if( i >= numEntries )1386 {1387 printf( "The number of %s defined is larger than the allowed number\n", elementName );1388 exit( EXIT_FAILURE );1389 }1390 *( memberArray + i ) = atoi(tempArray);1391 tempArray = strtok(NULL, " ,-");1392 i++;1393 }1394 if( i < numEntries )1395 {1396 printf( "Some %s are not defined\n", elementName );1397 exit( EXIT_FAILURE );1398 }1399 }1400 else1401 {1402 memberArray = NULL;1403 }1404 }1405 #endif1406 1290 // ==================================================================================================================== 1407 1291 // Private member functions … … 1419 1303 fprintf(stderr, "** decoder requires this option to be enabled. **\n"); 1420 1304 fprintf(stderr, "******************************************************************\n"); 1305 } 1306 if( m_profile==Profile::NONE ) 1307 { 1308 fprintf(stderr, "***************************************************************************\n"); 1309 fprintf(stderr, "** WARNING: For conforming bitstreams a valid Profile value must be set! **\n"); 1310 fprintf(stderr, "***************************************************************************\n"); 1311 } 1312 if( m_level==Level::NONE ) 1313 { 1314 fprintf(stderr, "***************************************************************************\n"); 1315 fprintf(stderr, "** WARNING: For conforming bitstreams a valid Level value must be set! **\n"); 1316 fprintf(stderr, "***************************************************************************\n"); 1421 1317 } 1422 1318 … … 1439 1335 xConfirmPara( m_iQP < -6 * (m_internalBitDepthY - 8) || m_iQP > 51, "QP exceeds supported range (-QpBDOffsety to 51)" ); 1440 1336 #endif 1441 xConfirmPara( m_loopFilterBetaOffsetDiv2 < - 13 || m_loopFilterBetaOffsetDiv2 > 13, "Loop Filter Beta Offset div. 2 exceeds supported range (-13 to 13)");1442 xConfirmPara( m_loopFilterTcOffsetDiv2 < - 13 || m_loopFilterTcOffsetDiv2 > 13, "Loop Filter Tc Offset div. 2 exceeds supported range (-13 to 13)");1337 xConfirmPara( m_loopFilterBetaOffsetDiv2 < -6 || m_loopFilterBetaOffsetDiv2 > 6, "Loop Filter Beta Offset div. 2 exceeds supported range (-6 to 6)"); 1338 xConfirmPara( m_loopFilterTcOffsetDiv2 < -6 || m_loopFilterTcOffsetDiv2 > 6, "Loop Filter Tc Offset div. 2 exceeds supported range (-6 to 6)"); 1443 1339 xConfirmPara( m_iFastSearch < 0 || m_iFastSearch > 2, "Fast Search Mode is not supported value (0:Full search 1:Diamond 2:PMVFAST)" ); 1444 1340 xConfirmPara( m_iSearchRange < 0 , "Search Range must be more than 0" ); … … 1601 1497 } 1602 1498 } 1603 #endif 1604 1605 #if SVC_EXTENSION 1499 1606 1500 // verify layer configuration parameters 1607 1501 for(UInt layer=0; layer<m_numLayers; layer++) … … 1828 1722 { 1829 1723 m_numReorderPics[i] = 0; 1830 #if L0323_DPB1831 1724 m_maxDecPicBuffering[i] = 1; 1832 #else1833 m_maxDecPicBuffering[i] = 0;1834 #endif1835 1725 } 1836 1726 for(Int i=0; i<m_iGOPSize; i++) 1837 1727 { 1838 #if L0323_DPB1839 1728 if(m_GOPList[i].m_numRefPics+1 > m_maxDecPicBuffering[m_GOPList[i].m_temporalId]) 1840 #else 1841 if(m_GOPList[i].m_numRefPics > m_maxDecPicBuffering[m_GOPList[i].m_temporalId]) 1842 #endif 1843 { 1844 #if L0323_DPB 1729 { 1845 1730 m_maxDecPicBuffering[m_GOPList[i].m_temporalId] = m_GOPList[i].m_numRefPics + 1; 1846 #else1847 m_maxDecPicBuffering[m_GOPList[i].m_temporalId] = m_GOPList[i].m_numRefPics;1848 #endif1849 1731 } 1850 1732 Int highestDecodingNumberWithLowerPOC = 0; … … 1877 1759 m_numReorderPics[i+1] = m_numReorderPics[i]; 1878 1760 } 1879 #if L0323_DPB1880 1761 // the value of num_reorder_pics[ i ] shall be in the range of 0 to max_dec_pic_buffering[ i ] - 1, inclusive 1881 1762 if(m_numReorderPics[i] > m_maxDecPicBuffering[i] - 1) … … 1883 1764 m_maxDecPicBuffering[i] = m_numReorderPics[i] + 1; 1884 1765 } 1885 #else1886 // the value of num_reorder_pics[ i ] shall be in the range of 0 to max_dec_pic_buffering[ i ], inclusive1887 if(m_numReorderPics[i] > m_maxDecPicBuffering[i])1888 {1889 m_maxDecPicBuffering[i] = m_numReorderPics[i];1890 }1891 #endif1892 1766 // a lower layer can not have higher value of m_uiMaxDecPicBuffering than a higher layer 1893 1767 if(m_maxDecPicBuffering[i+1] < m_maxDecPicBuffering[i]) … … 1898 1772 1899 1773 1900 #if L0323_DPB1901 1774 // the value of num_reorder_pics[ i ] shall be in the range of 0 to max_dec_pic_buffering[ i ] - 1, inclusive 1902 1775 if(m_numReorderPics[MAX_TLAYER-1] > m_maxDecPicBuffering[MAX_TLAYER-1] - 1) … … 1904 1777 m_maxDecPicBuffering[MAX_TLAYER-1] = m_numReorderPics[MAX_TLAYER-1] + 1; 1905 1778 } 1906 #else1907 // the value of num_reorder_pics[ i ] shall be in the range of 0 to max_dec_pic_buffering[ i ], inclusive1908 if(m_numReorderPics[MAX_TLAYER-1] > m_maxDecPicBuffering[MAX_TLAYER-1])1909 {1910 m_maxDecPicBuffering[MAX_TLAYER-1] = m_numReorderPics[MAX_TLAYER-1];1911 }1912 #endif1913 1779 1914 1780 #if SVC_EXTENSION // ToDo: it should be checked for the case when parameters are different for the layers … … 1994 1860 } 1995 1861 #endif 1996 #if !L0034_COMBINED_LIST_CLEANUP1997 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.1998 #endif1999 1862 xConfirmPara( m_iWaveFrontSynchro < 0, "WaveFrontSynchro cannot be negative" ); 2000 1863 #if !SVC_EXTENSION … … 2005 1868 xConfirmPara( m_decodedPictureHashSEIEnabled<0 || m_decodedPictureHashSEIEnabled>3, "this hash type is not correct!\n"); 2006 1869 2007 #if J0149_TONE_MAPPING_SEI2008 1870 if (m_toneMappingInfoSEIEnabled) 2009 1871 { … … 2016 1878 xConfirmPara( m_extendedWhiteLevelLumaCodeValue < m_nominalWhiteLevelLumaCodeValue, "SEIToneMapExtendedWhiteLevelLumaCodeValue shall be greater than or equal to SEIToneMapNominalWhiteLevelLumaCodeValue"); 2017 1879 } 2018 #endif2019 1880 2020 1881 #if RATE_CONTROL_LAMBDA_DOMAIN … … 2066 1927 2067 1928 xConfirmPara(m_log2ParallelMergeLevel < 2, "Log2ParallelMergeLevel should be larger than or equal to 2"); 2068 #if L0444_FPA_TYPE2069 1929 if (m_framePackingSEIEnabled) 2070 1930 { 2071 1931 xConfirmPara(m_framePackingSEIType < 3 || m_framePackingSEIType > 5 , "SEIFramePackingType must be in rage 3 to 5"); 2072 1932 } 2073 #endif2074 1933 #if VPS_EXTN_DIRECT_REF_LAYERS 2075 1934 #if M0457_PREDICTION_INDICATIONS … … 2266 2125 printf("RDQ:%d ", m_useRDOQ ); 2267 2126 printf("RDQTS:%d ", m_useRDOQTS ); 2268 #if L0232_RD_PENALTY2269 2127 printf("RDpenalty:%d ", m_rdPenalty ); 2270 #endif2271 2128 printf("SQP:%d ", m_uiDeltaQpRD ); 2272 2129 printf("ASR:%d ", m_bUseASR ); 2273 #if !L0034_COMBINED_LIST_CLEANUP2274 printf("LComb:%d ", m_bUseLComb );2275 #endif2276 2130 printf("FEN:%d ", m_bUseFastEnc ); 2277 2131 printf("ECU:%d ", m_bUseEarlyCU ); -
branches/SHM-2.1-dev/source/App/TAppEncoder/TAppEncCfg.h
r297 r302 99 99 Level::Tier m_levelTier; 100 100 Level::Name m_level; 101 #if L0046_CONSTRAINT_FLAGS102 101 Bool m_progressiveSourceFlag; 103 102 Bool m_interlacedSourceFlag; 104 103 Bool m_nonPackedConstraintFlag; 105 104 Bool m_frameOnlyConstraintFlag; 106 #endif107 105 108 106 // coding structure … … 115 113 GOPEntry m_GOPList[MAX_GOP]; ///< the coding structure entries from the config file 116 114 Int m_numReorderPics[MAX_TLAYER]; ///< total number of reorder pictures 117 #if L0323_DPB118 115 Int m_maxDecPicBuffering[MAX_TLAYER]; ///< total number of pictures in the decoded picture buffer 119 #else120 Int m_maxDecPicBuffering[MAX_TLAYER]; ///< total number of reference pictures needed for decoding121 #endif122 #if !L0034_COMBINED_LIST_CLEANUP123 Bool m_bUseLComb; ///< flag for using combined reference list for uni-prediction in B-slices (JCTVC-D421)124 #endif125 116 Bool m_useTransformSkip; ///< flag for enabling intra transform skipping 126 117 Bool m_useTransformSkipFast; ///< flag for enabling fast intra transform skipping … … 184 175 Int m_loopFilterTcOffsetDiv2; ///< tc offset for deblocking filter 185 176 Bool m_DeblockingFilterControlPresent; ///< deblocking filter control present flag in PPS 186 #if L0386_DB_METRIC187 177 Bool m_DeblockingFilterMetric; ///< blockiness metric in encoder 188 #endif189 178 190 179 // coding tools (PCM) … … 200 189 Bool m_useRDOQ; ///< flag for using RD optimized quantization 201 190 Bool m_useRDOQTS; ///< flag for using RD optimized quantization for transform skip 202 #if L0232_RD_PENALTY203 191 Int m_rdPenalty; ///< RD-penalty for 32x32 TU for intra in non-intra slices (0: no RD-penalty, 1: RD-penalty, 2: maximum RD-penalty) 204 #endif205 192 Int m_iFastSearch; ///< ME mode, 0 = full, 1 = diamond, 2 = PMVFAST 206 193 Int m_iSearchRange; ///< ME search range … … 241 228 Int m_bufferingPeriodSEIEnabled; 242 229 Int m_pictureTimingSEIEnabled; 243 #if J0149_TONE_MAPPING_SEI244 230 Bool m_toneMappingInfoSEIEnabled; 245 231 Int m_toneMapId; … … 267 253 Int* m_codedPivotValue; 268 254 Int* m_targetPivotValue; 269 #endif270 255 Int m_framePackingSEIEnabled; 271 256 Int m_framePackingSEIType; … … 280 265 Int m_layersPresentSEIEnabled; 281 266 #endif 282 #if L0208_SOP_DESCRIPTION_SEI283 267 Int m_SOPDescriptionSEIEnabled; 284 #endif285 #if K0180_SCALABLE_NESTING_SEI286 268 Int m_scalableNestingSEIEnabled; 287 #endif288 269 // weighted prediction 289 270 Bool m_useWeightedPred; ///< Use of weighted prediction in P slices … … 299 280 Bool m_RCEnableRateControl; ///< enable rate control or not 300 281 Int m_RCTargetBitrate; ///< target bitrate when rate control is enabled 282 #if M0036_RC_IMPROVEMENT 283 Int m_RCKeepHierarchicalBit; ///< 0: equal bit allocation; 1: fixed ratio bit allocation; 2: adaptive ratio bit allocation 284 #else 301 285 Bool m_RCKeepHierarchicalBit; ///< whether keeping hierarchical bit allocation structure or not 286 #endif 302 287 Bool m_RCLCULevelRC; ///< true: LCU level rate control; false: picture level rate control 303 288 Bool m_RCUseLCUSeparateModel; ///< use separate R-lambda model at LCU level … … 363 348 Void xPrintParameter (); ///< print configuration values 364 349 Void xPrintUsage (); ///< print usage 365 #if SIGNAL_BITRATE_PICRATE_IN_VPS366 Int m_bitRatePicRateMaxTLayers; ///< Indicates max. number of sub-layers for which bit rate is signalled.367 Bool* m_bitRateInfoPresentFlag; ///< Indicates whether bit rate information is signalled368 Bool* m_picRateInfoPresentFlag; ///< Indicates whether pic rate information is signalled369 Int* m_avgBitRate; ///< Indicates avg. bit rate information for various sub-layers370 Int* m_maxBitRate; ///< Indicates max. bit rate information for various sub-layers371 Int* m_avgPicRate; ///< Indicates avg. picture rate information for various sub-layers372 Int* m_constantPicRateIdc; ///< Indicates constant picture rate idc for various sub-layers373 #endif374 350 #if M0040_ADAPTIVE_RESOLUTION_CHANGE 375 351 Int m_adaptiveResolutionChange; ///< Indicate adaptive resolution change frame -
branches/SHM-2.1-dev/source/App/TAppEncoder/TAppEncTop.cpp
r297 r302 104 104 m_acTEncTop[layer].setProfile(m_profile); 105 105 m_acTEncTop[layer].setLevel(m_levelTier, m_level); 106 #if L0046_CONSTRAINT_FLAGS107 106 m_acTEncTop[layer].setProgressiveSourceFlag(m_progressiveSourceFlag); 108 107 m_acTEncTop[layer].setInterlacedSourceFlag(m_interlacedSourceFlag); 109 108 m_acTEncTop[layer].setNonPackedConstraintFlag(m_nonPackedConstraintFlag); 110 109 m_acTEncTop[layer].setFrameOnlyConstraintFlag(m_frameOnlyConstraintFlag); 111 #endif112 110 113 111 #if REF_IDX_MFM … … 244 242 m_acTEncTop[layer].setLoopFilterTcOffset ( m_loopFilterTcOffsetDiv2 ); 245 243 m_acTEncTop[layer].setDeblockingFilterControlPresent( m_DeblockingFilterControlPresent); 246 #if L0386_DB_METRIC247 244 m_acTEncTop[layer].setDeblockingFilterMetric ( m_DeblockingFilterMetric ); 248 #endif249 245 250 246 //====== Motion search ======== … … 280 276 m_acTEncTop[layer].setUseHADME ( m_bUseHADME ); 281 277 m_acTEncTop[layer].setUseLossless ( m_useLossless ); 282 #if !L0034_COMBINED_LIST_CLEANUP283 m_cTEncTop.setUseLComb ( m_bUseLComb );284 #endif285 278 m_acTEncTop[layer].setdQPs ( m_acLayerCfg[layer].getdQPs() ); 286 279 m_acTEncTop[layer].setUseRDOQ ( m_useRDOQ ); 287 280 m_acTEncTop[layer].setUseRDOQTS ( m_useRDOQTS ); 288 #if L0232_RD_PENALTY289 281 m_acTEncTop[layer].setRDpenalty ( m_rdPenalty ); 290 #endif291 282 m_acTEncTop[layer].setQuadtreeTULog2MaxSize ( m_uiQuadtreeTULog2MaxSize ); 292 283 m_acTEncTop[layer].setQuadtreeTULog2MinSize ( m_uiQuadtreeTULog2MinSize ); … … 355 346 m_acTEncTop[layer].setBufferingPeriodSEIEnabled( m_bufferingPeriodSEIEnabled ); 356 347 m_acTEncTop[layer].setPictureTimingSEIEnabled( m_pictureTimingSEIEnabled ); 357 #if J0149_TONE_MAPPING_SEI358 348 m_acTEncTop[layer].setToneMappingInfoSEIEnabled ( m_toneMappingInfoSEIEnabled ); 359 349 m_acTEncTop[layer].setTMISEIToneMapId ( m_toneMapId ); … … 381 371 m_acTEncTop[layer].setTMISEINominalWhiteLevelLumaCodeValue ( m_nominalWhiteLevelLumaCodeValue ); 382 372 m_acTEncTop[layer].setTMISEIExtendedWhiteLevelLumaCodeValue ( m_extendedWhiteLevelLumaCodeValue ); 383 #endif384 373 m_acTEncTop[layer].setFramePackingArrangementSEIEnabled( m_framePackingSEIEnabled ); 385 374 m_acTEncTop[layer].setFramePackingArrangementSEIType( m_framePackingSEIType ); … … 394 383 m_acTEncTop[layer].setLayersPresentSEIEnabled( m_layersPresentSEIEnabled ); 395 384 #endif 396 #if L0208_SOP_DESCRIPTION_SEI397 385 m_acTEncTop[layer].setSOPDescriptionSEIEnabled( m_SOPDescriptionSEIEnabled ); 398 #endif399 #if K0180_SCALABLE_NESTING_SEI400 386 m_acTEncTop[layer].setScalableNestingSEIEnabled( m_scalableNestingSEIEnabled ); 401 #endif402 387 m_acTEncTop[layer].setUniformSpacingIdr ( m_iUniformSpacingIdr ); 403 388 m_acTEncTop[layer].setNumColumnsMinus1 ( m_iNumColumnsMinus1 ); … … 478 463 m_acTEncTop[layer].setLog2MaxMvLengthHorizontal( m_log2MaxMvLengthHorizontal ); 479 464 m_acTEncTop[layer].setLog2MaxMvLengthVertical( m_log2MaxMvLengthVertical ); 480 #if SIGNAL_BITRATE_PICRATE_IN_VPS481 TComBitRatePicRateInfo *bitRatePicRateInfo = m_cTEncTop[layer].getVPS()->getBitratePicrateInfo();482 // The number of bit rate/pic rate have to equal to number of sub-layers.483 if(m_bitRatePicRateMaxTLayers)484 {485 assert(m_bitRatePicRateMaxTLayers == m_cTEncTop[layer].getVPS()->getMaxTLayers());486 }487 for(Int i = 0; i < m_bitRatePicRateMaxTLayers; i++)488 {489 bitRatePicRateInfo->setBitRateInfoPresentFlag( i, m_bitRateInfoPresentFlag[i] );490 if( bitRatePicRateInfo->getBitRateInfoPresentFlag(i) )491 {492 bitRatePicRateInfo->setAvgBitRate(i, m_avgBitRate[i]);493 bitRatePicRateInfo->setMaxBitRate(i, m_maxBitRate[i]);494 }495 }496 for(Int i = 0; i < m_bitRatePicRateMaxTLayers; i++)497 {498 bitRatePicRateInfo->setPicRateInfoPresentFlag( i, m_picRateInfoPresentFlag[i] );499 if( bitRatePicRateInfo->getPicRateInfoPresentFlag(i) )500 {501 bitRatePicRateInfo->setAvgPicRate (i, m_avgPicRate[i]);502 bitRatePicRateInfo->setConstantPicRateIdc(i, m_constantPicRateIdc[i]);503 }504 }505 #endif506 465 #if REF_IDX_FRAMEWORK 507 466 m_acTEncTop[layer].setElRapSliceTypeB(layer == 0? 0 : m_elRapSliceBEnabled); … … 543 502 m_cTEncTop.setProfile(m_profile); 544 503 m_cTEncTop.setLevel(m_levelTier, m_level); 545 #if L0046_CONSTRAINT_FLAGS546 504 m_cTEncTop.setProgressiveSourceFlag(m_progressiveSourceFlag); 547 505 m_cTEncTop.setInterlacedSourceFlag(m_interlacedSourceFlag); 548 506 m_cTEncTop.setNonPackedConstraintFlag(m_nonPackedConstraintFlag); 549 507 m_cTEncTop.setFrameOnlyConstraintFlag(m_frameOnlyConstraintFlag); 550 #endif551 508 552 509 m_cTEncTop.setFrameRate ( m_iFrameRate ); … … 587 544 m_cTEncTop.setLoopFilterTcOffset ( m_loopFilterTcOffsetDiv2 ); 588 545 m_cTEncTop.setDeblockingFilterControlPresent( m_DeblockingFilterControlPresent); 589 #if L0386_DB_METRIC590 546 m_cTEncTop.setDeblockingFilterMetric ( m_DeblockingFilterMetric ); 591 #endif592 547 593 548 //====== Motion search ======== … … 623 578 m_cTEncTop.setUseHADME ( m_bUseHADME ); 624 579 m_cTEncTop.setUseLossless ( m_useLossless ); 625 #if !L0034_COMBINED_LIST_CLEANUP626 m_cTEncTop.setUseLComb ( m_bUseLComb );627 #endif628 580 m_cTEncTop.setdQPs ( m_aidQP ); 629 581 m_cTEncTop.setUseRDOQ ( m_useRDOQ ); 630 582 m_cTEncTop.setUseRDOQTS ( m_useRDOQTS ); 631 #if L0232_RD_PENALTY632 583 m_cTEncTop.setRDpenalty ( m_rdPenalty ); 633 #endif634 584 m_cTEncTop.setQuadtreeTULog2MaxSize ( m_uiQuadtreeTULog2MaxSize ); 635 585 m_cTEncTop.setQuadtreeTULog2MinSize ( m_uiQuadtreeTULog2MinSize ); … … 698 648 m_cTEncTop.setBufferingPeriodSEIEnabled( m_bufferingPeriodSEIEnabled ); 699 649 m_cTEncTop.setPictureTimingSEIEnabled( m_pictureTimingSEIEnabled ); 700 #if J0149_TONE_MAPPING_SEI701 650 m_cTEncTop.setToneMappingInfoSEIEnabled ( m_toneMappingInfoSEIEnabled ); 702 651 m_cTEncTop.setTMISEIToneMapId ( m_toneMapId ); … … 724 673 m_cTEncTop.setTMISEINominalWhiteLevelLumaCodeValue ( m_nominalWhiteLevelLumaCodeValue ); 725 674 m_cTEncTop.setTMISEIExtendedWhiteLevelLumaCodeValue ( m_extendedWhiteLevelLumaCodeValue ); 726 #endif727 675 m_cTEncTop.setFramePackingArrangementSEIEnabled( m_framePackingSEIEnabled ); 728 676 m_cTEncTop.setFramePackingArrangementSEIType( m_framePackingSEIType ); … … 737 685 m_cTEncTop.setLayersPresentSEIEnabled( m_layersPresentSEIEnabled ); 738 686 #endif 739 #if L0208_SOP_DESCRIPTION_SEI740 687 m_cTEncTop.setSOPDescriptionSEIEnabled( m_SOPDescriptionSEIEnabled ); 741 #endif742 #if K0180_SCALABLE_NESTING_SEI743 688 m_cTEncTop.setScalableNestingSEIEnabled( m_scalableNestingSEIEnabled ); 744 #endif745 689 m_cTEncTop.setUniformSpacingIdr ( m_iUniformSpacingIdr ); 746 690 m_cTEncTop.setNumColumnsMinus1 ( m_iNumColumnsMinus1 ); … … 811 755 m_cTEncTop.setLog2MaxMvLengthHorizontal( m_log2MaxMvLengthHorizontal ); 812 756 m_cTEncTop.setLog2MaxMvLengthVertical( m_log2MaxMvLengthVertical ); 813 #if SIGNAL_BITRATE_PICRATE_IN_VPS814 TComBitRatePicRateInfo *bitRatePicRateInfo = m_cTEncTop.getVPS()->getBitratePicrateInfo();815 // The number of bit rate/pic rate have to equal to number of sub-layers.816 if(m_bitRatePicRateMaxTLayers)817 {818 assert(m_bitRatePicRateMaxTLayers == m_cTEncTop.getVPS()->getMaxTLayers());819 }820 for(Int i = 0; i < m_bitRatePicRateMaxTLayers; i++)821 {822 bitRatePicRateInfo->setBitRateInfoPresentFlag( i, m_bitRateInfoPresentFlag[i] );823 if( bitRatePicRateInfo->getBitRateInfoPresentFlag(i) )824 {825 bitRatePicRateInfo->setAvgBitRate(i, m_avgBitRate[i]);826 bitRatePicRateInfo->setMaxBitRate(i, m_maxBitRate[i]);827 }828 }829 for(Int i = 0; i < m_bitRatePicRateMaxTLayers; i++)830 {831 bitRatePicRateInfo->setPicRateInfoPresentFlag( i, m_picRateInfoPresentFlag[i] );832 if( bitRatePicRateInfo->getPicRateInfoPresentFlag(i) )833 {834 bitRatePicRateInfo->setAvgPicRate (i, m_avgPicRate[i]);835 bitRatePicRateInfo->setConstantPicRateIdc(i, m_constantPicRateIdc[i]);836 }837 }838 #endif839 757 } 840 758 #endif -
branches/SHM-2.1-dev/source/App/TAppEncoder/encmain.cpp
r191 r302 57 57 // print information 58 58 fprintf( stdout, "\n" ); 59 #if SVC_EXTENSION 59 60 fprintf( stdout, "SHM software: Encoder Version [%s]", NV_VERSION ); 61 #else 62 fprintf( stdout, "HM software: Encoder Version [%s]", NV_VERSION ); 63 #endif 60 64 fprintf( stdout, NVM_ONOS ); 61 65 fprintf( stdout, NVM_COMPILEDBY ); -
branches/SHM-2.1-dev/source/Lib/TLibCommon/CommonDef.h
r194 r302 56 56 // ==================================================================================================================== 57 57 58 #if SVC_EXTENSION 58 59 #define NV_VERSION "2.1" ///< Current software version 60 #else 61 #define NV_VERSION "11.0" ///< Current software version 62 #endif 59 63 60 64 // ==================================================================================================================== … … 110 114 #define MAX_NUM_REF_PICS 16 ///< max. number of pictures used for reference 111 115 #define MAX_NUM_REF 16 ///< max. number of entries in picture reference list 112 #if !L0034_COMBINED_LIST_CLEANUP113 #define MAX_NUM_REF_LC MAX_NUM_REF_PICS // TODO: remove this macro definition (leftover from combined list concept)114 #endif115 116 116 117 #define MAX_UINT 0xFFFFFFFFU ///< max. value of unsigned 32-bit integer -
branches/SHM-2.1-dev/source/Lib/TLibCommon/NAL.h
r191 r302 91 91 || m_nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R; 92 92 } 93 #if L0045_NON_NESTED_SEI_RESTRICTIONS94 93 Bool isSei() 95 94 { … … 102 101 return ( (UInt)m_nalUnitType < 32 ); 103 102 } 104 #endif105 103 }; 106 104 -
branches/SHM-2.1-dev/source/Lib/TLibCommon/SEI.cpp
r189 r302 39 39 #include "SEI.h" 40 40 41 #if J0149_TONE_MAPPING_SEI42 41 //Table D-7 Meaning of camera iso sensitivity indicator and exposure index rating indicator 43 42 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 #endif45 43 46 44 SEIMessages getSeisByType(SEIMessages &seiList, SEI::PayloadType seiType) -
branches/SHM-2.1-dev/source/Lib/TLibCommon/SEI.h
r292 r302 127 127 128 128 SEIActiveParameterSets() 129 #if !L0047_APS_FLAGS130 :numSpsIdsMinus1(0)131 #else132 129 : activeVPSId (0) 133 130 , m_fullRandomAccessFlag (false) 134 131 , m_noParamSetUpdateFlag (false) 135 132 , numSpsIdsMinus1 (0) 136 #endif137 133 {} 138 134 virtual ~SEIActiveParameterSets() {} 139 135 140 136 Int activeVPSId; 141 #if L0047_APS_FLAGS142 137 Bool m_fullRandomAccessFlag; 143 138 Bool m_noParamSetUpdateFlag; 144 #endif145 139 Int numSpsIdsMinus1; 146 140 std::vector<Int> activeSeqParamSetId; … … 153 147 154 148 SEIBufferingPeriod() 155 #if L0044_CPB_DPB_DELAY_OFFSET156 149 : m_bpSeqParameterSetId (0) 157 150 , m_rapCpbParamsPresentFlag (false) … … 164 157 ::memset(m_initialAltCpbRemovalDelayOffset, 0, sizeof(m_initialAltCpbRemovalDelayOffset)); 165 158 } 166 #else167 {}168 #endif169 159 virtual ~SEIBufferingPeriod() {} 170 160 171 161 UInt m_bpSeqParameterSetId; 172 162 Bool m_rapCpbParamsPresentFlag; 173 #if L0044_CPB_DPB_DELAY_OFFSET174 163 Bool m_cpbDelayOffset; 175 164 Bool m_dpbDelayOffset; 176 #endif177 165 UInt m_initialCpbRemovalDelay [MAX_CPB_CNT][2]; 178 166 UInt m_initialCpbRemovalDelayOffset [MAX_CPB_CNT][2]; 179 167 UInt m_initialAltCpbRemovalDelay [MAX_CPB_CNT][2]; 180 168 UInt m_initialAltCpbRemovalDelayOffset[MAX_CPB_CNT][2]; 181 #if L0328_SPLICING182 169 Bool m_concatenationFlag; 183 170 UInt m_auCpbRemovalDelayDelta; 184 #endif185 171 }; 186 172 class SEIPictureTiming : public SEI … … 191 177 SEIPictureTiming() 192 178 : m_picStruct (0) 193 #if L0046_RENAME_PROG_SRC_IDC194 179 , m_sourceScanType (0) 195 #else196 , m_progressiveSourceIdc (0)197 #endif198 180 , m_duplicateFlag (false) 199 #if L0044_DU_DPB_OUTPUT_DELAY_HRD200 181 , m_picDpbOutputDuDelay (0) 201 #endif202 182 , m_numNalusInDuMinus1 (NULL) 203 183 , m_duCpbRemovalDelayMinus1 (NULL) … … 216 196 217 197 UInt m_picStruct; 218 #if L0046_RENAME_PROG_SRC_IDC219 198 UInt m_sourceScanType; 220 #else221 UInt m_progressiveSourceIdc;222 #endif223 199 Bool m_duplicateFlag; 224 200 225 201 UInt m_auCpbRemovalDelay; 226 202 UInt m_picDpbOutputDelay; 227 #if L0044_DU_DPB_OUTPUT_DELAY_HRD228 203 UInt m_picDpbOutputDuDelay; 229 #endif230 204 UInt m_numDecodingUnitsMinus1; 231 205 Bool m_duCommonCpbRemovalDelayFlag; … … 243 217 : m_decodingUnitIdx(0) 244 218 , m_duSptCpbRemovalDelay(0) 245 #if L0044_DU_DPB_OUTPUT_DELAY_HRD246 219 , m_dpbOutputDuDelayPresentFlag(false) 247 220 , m_picSptDpbOutputDuDelay(0) 248 #endif249 221 {} 250 222 virtual ~SEIDecodingUnitInfo() {} 251 223 Int m_decodingUnitIdx; 252 224 Int m_duSptCpbRemovalDelay; 253 #if L0044_DU_DPB_OUTPUT_DELAY_HRD254 225 Bool m_dpbOutputDuDelayPresentFlag; 255 226 Int m_picSptDpbOutputDuDelay; 256 #endif257 227 }; 258 228 … … 293 263 Int m_frame1GridPositionY; 294 264 Int m_arrangementReservedByte; 295 #if L0045_PERSISTENCE_FLAGS296 265 Bool m_arrangementPersistenceFlag; 297 #else298 Int m_arrangementRepetetionPeriod;299 #endif300 266 Bool m_upsampledAspectRatio; 301 267 }; … … 308 274 SEIDisplayOrientation() 309 275 : cancelFlag(true) 310 #if L0045_PERSISTENCE_FLAGS311 276 , persistenceFlag(0) 312 #else313 , repetitionPeriod(1)314 #endif315 277 , extensionFlag(false) 316 278 {} … … 322 284 323 285 UInt anticlockwiseRotation; 324 #if L0045_PERSISTENCE_FLAGS325 286 Bool persistenceFlag; 326 #else327 UInt repetitionPeriod;328 #endif329 287 Bool extensionFlag; 330 288 }; … … 373 331 #endif 374 332 375 #if L0208_SOP_DESCRIPTION_SEI376 333 class SEISOPDescription : public SEI 377 334 { … … 390 347 Int m_sopDescPocDelta[MAX_NUM_PICS_IN_SOP]; 391 348 }; 392 #endif 393 394 #if J0149_TONE_MAPPING_SEI 349 395 350 class SEIToneMappingInfo : public SEI 396 351 { … … 425 380 Int m_extendedWhiteLevelLumaCodeValue; 426 381 }; 427 #endif428 382 429 383 typedef std::list<SEI*> SEIMessages; … … 438 392 Void deleteSEIs (SEIMessages &seiList); 439 393 440 #if K0180_SCALABLE_NESTING_SEI441 394 class SEIScalableNesting : public SEI 442 395 { … … 468 421 SEIMessages m_nestedSEIs; 469 422 }; 470 #endif471 423 472 424 //! \} -
branches/SHM-2.1-dev/source/Lib/TLibCommon/TComBitStream.h
r191 r302 193 193 } 194 194 195 Void peekPreviousByte( UInt &byte ) 196 { 197 assert(m_fifo_idx > 0); 198 byte = (*m_fifo)[m_fifo_idx - 1]; 199 } 200 195 201 Void readOutTrailingBits (); 196 202 UChar getHeldBits () { return m_held_bits; } -
branches/SHM-2.1-dev/source/Lib/TLibCommon/TComDataCU.cpp
r291 r302 589 589 } 590 590 591 UInt uiTmp = uhWidth*uhHeight;592 593 591 if(getPic()->getPicSym()->getInverseCUOrderMap(getAddr())*m_pcPic->getNumPartInCU()+m_uiAbsIdxInLCU >= getSlice()->getSliceSegmentCurStartCUAddr()) 594 592 { 595 593 m_acCUMvField[0].clearMvField(); 596 594 m_acCUMvField[1].clearMvField(); 597 uiTmp = uhWidth*uhHeight;595 UInt uiTmp = uhWidth*uhHeight; 598 596 599 597 memset( m_pcTrCoeffY, 0, uiTmp * sizeof( *m_pcTrCoeffY ) ); … … 794 792 m_uiCUPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ]; 795 793 796 UInt uiWidth = g_uiMaxCUWidth >> uiDepth;797 UInt uiHeight = g_uiMaxCUHeight >> uiDepth;798 799 794 m_skipFlag=pcCU->getSkipFlag() + uiPart; 800 795 … … 838 833 m_apcCUColocated[1] = pcCU->getCUColocated(REF_PIC_LIST_1); 839 834 840 UInt uiTmp = uiWidth*uiHeight;841 835 UInt uiMaxCuWidth=pcCU->getSlice()->getSPS()->getMaxCUWidth(); 842 836 UInt uiMaxCuHeight=pcCU->getSlice()->getSPS()->getMaxCUHeight(); … … 850 844 m_pcIPCMSampleY = pcCU->getPCMSampleY() + uiCoffOffset; 851 845 852 uiTmp >>= 2;853 846 uiCoffOffset >>=2; 854 847 m_pcTrCoeffCb=pcCU->getCoeffCb() + uiCoffOffset; … … 1577 1570 return getSlice()->getSliceQp(); 1578 1571 } 1579 else 1580 if ( iLastValidPartIdx >= 0 ) 1572 else if ( iLastValidPartIdx >= 0 ) 1581 1573 { 1582 1574 return getQP( iLastValidPartIdx ); … … 2860 2852 //>> MTK colocated-RightBottom 2861 2853 UInt uiPartIdxRB; 2862 Int uiLCUIdx = getAddr();2863 2854 2864 2855 deriveRightBottomIdx( uiPUIdx, uiPartIdxRB ); … … 2869 2860 TComMv cColMv; 2870 2861 Int iRefIdx; 2862 Int uiLCUIdx = -1; 2871 2863 2872 2864 if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() ) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples() ) // image boundary check 2873 2865 { 2874 uiLCUIdx = -1;2875 2866 } 2876 2867 else if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples() ) 2877 2868 { 2878 uiLCUIdx = -1;2879 2869 } 2880 2870 else … … 2889 2879 { 2890 2880 uiAbsPartAddr = g_auiRasterToZscan[ (uiAbsPartIdxTmp + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ]; 2891 uiLCUIdx = -1 ;2892 2881 } 2893 2882 else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU … … 2899 2888 { 2900 2889 uiAbsPartAddr = 0; 2901 uiLCUIdx = -1 ;2902 2890 } 2903 2891 } … … 3163 3151 if (!bAdded) 3164 3152 { 3165 bAdded =xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxLB, MD_LEFT );3153 xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxLB, MD_LEFT ); 3166 3154 } 3167 3155 } … … 3176 3164 if(!bAdded) 3177 3165 { 3178 bAdded =xAddMVPCand( pInfo, eRefPicList, iRefIdx, uiPartIdxLT, MD_ABOVE_LEFT);3166 xAddMVPCand( pInfo, eRefPicList, iRefIdx, uiPartIdxLT, MD_ABOVE_LEFT); 3179 3167 } 3180 3168 bAdded = bAddedSmvp; … … 3191 3179 if(!bAdded) 3192 3180 { 3193 bAdded =xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxLT, MD_ABOVE_LEFT);3181 xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxLT, MD_ABOVE_LEFT); 3194 3182 } 3195 3183 } … … 3211 3199 UInt uiAbsPartIdx; 3212 3200 UInt uiAbsPartAddr; 3213 Int uiLCUIdx = getAddr();3214 3201 3215 3202 deriveRightBottomIdx( uiPartIdx, uiPartIdxRB ); … … 3218 3205 //---- co-located RightBottom Temporal Predictor (H) ---// 3219 3206 uiAbsPartIdx = g_auiZscanToRaster[uiPartIdxRB]; 3207 Int uiLCUIdx = -1; 3220 3208 if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdx] + m_pcPic->getMinCUWidth() ) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples() ) // image boundary check 3221 3209 { 3222 uiLCUIdx = -1;3223 3210 } 3224 3211 else if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdx] + m_pcPic->getMinCUHeight() ) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples() ) 3225 3212 { 3226 uiLCUIdx = -1;3227 3213 } 3228 3214 else … … 3237 3223 { 3238 3224 uiAbsPartAddr = g_auiRasterToZscan[ (uiAbsPartIdx + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ]; 3239 uiLCUIdx = -1 ;3240 3225 } 3241 3226 else if ( uiAbsPartIdx / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU … … 3247 3232 { 3248 3233 uiAbsPartAddr = 0; 3249 uiLCUIdx = -1 ;3250 3234 } 3251 3235 } … … 3309 3293 UInt TComDataCU::getIntraSizeIdx(UInt uiAbsPartIdx) 3310 3294 { 3311 UInt uiShift = ( (m_puhTrIdx[uiAbsPartIdx]==0) && (m_pePartSize[uiAbsPartIdx]==SIZE_NxN) ) ? m_puhTrIdx[uiAbsPartIdx]+1 : m_puhTrIdx[uiAbsPartIdx]; 3312 uiShift = ( m_pePartSize[uiAbsPartIdx]==SIZE_NxN ? 1 : 0 ); 3295 UInt uiShift = ( m_pePartSize[uiAbsPartIdx]==SIZE_NxN ? 1 : 0 ); 3313 3296 3314 3297 UChar uiWidth = m_puhWidth[uiAbsPartIdx]>>uiShift; … … 3396 3379 } 3397 3380 3398 #if L0363_MVP_POC3399 3381 if ( pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) >= 0 && m_pcSlice->getRefPic( eRefPicList, iRefIdx)->getPOC() == pcTmpCU->getSlice()->getRefPOC( eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) )) 3400 #else3401 if ( m_pcSlice->isEqualRef(eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx), iRefIdx) )3402 #endif3403 3382 { 3404 3383 TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx); … … 3602 3581 } 3603 3582 iCurrPOC = m_pcSlice->getPOC(); 3604 iCurrRefPOC = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getPOC();3605 3583 iColPOC = pColCU->getSlice()->getPOC(); 3606 3584 -
branches/SHM-2.1-dev/source/Lib/TLibCommon/TComLoopFilter.cpp
r191 r302 461 461 if ( ((piRefP0==piRefQ0)&&(piRefP1==piRefQ1)) || ((piRefP0==piRefQ1)&&(piRefP1==piRefQ0)) ) 462 462 { 463 uiBs = 0;464 463 if ( piRefP0 != piRefP1 ) // Different L0 & L1 465 464 { … … 694 693 for ( UInt iIdx = 0; iIdx < uiNumParts; iIdx++ ) 695 694 { 696 ucBs = 0;697 698 695 uiBsAbsIdx = xCalcBsIdx( pcCU, uiAbsZorderIdx, iDir, iEdge, iIdx); 699 696 ucBs = m_aapucBS[iDir][uiBsAbsIdx]; -
branches/SHM-2.1-dev/source/Lib/TLibCommon/TComPrediction.cpp
r282 r302 122 122 Pel TComPrediction::predIntraGetPredValDC( Int* pSrc, Int iSrcStride, UInt iWidth, UInt iHeight, Bool bAbove, Bool bLeft ) 123 123 { 124 assert(iWidth > 0 && iHeight > 0); 124 125 Int iInd, iSum = 0; 125 126 Pel pDcVal; -
branches/SHM-2.1-dev/source/Lib/TLibCommon/TComRdCost.cpp
r191 r302 485 485 } 486 486 487 #if RATE_CONTROL_LAMBDA_DOMAIN 487 #if RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT 488 488 UInt TComRdCost::getSADPart ( Int bitDepth, Pel* pelCur, Int curStride, Pel* pelOrg, Int orgStride, UInt width, UInt height ) 489 489 { -
branches/SHM-2.1-dev/source/Lib/TLibCommon/TComRdCost.h
r191 r302 168 168 #if RATE_CONTROL_LAMBDA_DOMAIN 169 169 Double getLambda() { return m_dLambda; } 170 #if M0036_RC_IMPROVEMENT 171 Double getChromaWeight () {return((m_cbDistortionWeight+m_crDistortionWeight)/2.0);} 172 #endif 170 173 #endif 171 174 … … 264 267 #endif 265 268 266 #if RATE_CONTROL_LAMBDA_DOMAIN 269 #if RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT 267 270 UInt getSADPart ( Int bitDepth, Pel* pelCur, Int curStride, Pel* pelOrg, Int orgStride, UInt width, UInt height ); 268 271 #endif -
branches/SHM-2.1-dev/source/Lib/TLibCommon/TComSlice.cpp
r300 r302 65 65 , m_deblockingFilterBetaOffsetDiv2 ( 0 ) 66 66 , m_deblockingFilterTcOffsetDiv2 ( 0 ) 67 #if !L0034_COMBINED_LIST_CLEANUP68 , m_bRefPicListModificationFlagLC ( false )69 , m_bRefPicListCombinationFlag ( false )70 #endif71 67 , m_bCheckLDC ( false ) 72 68 , m_iSliceQpDelta ( 0 ) … … 88 84 #else 89 85 , m_dLambda ( 0.0 ) 90 #endif91 #if !L0034_COMBINED_LIST_CLEANUP92 , m_bNoBackPredFlag ( false )93 86 #endif 94 87 , m_uiTLayer ( 0 ) … … 119 112 , m_enableTMVPFlag ( true ) 120 113 { 121 #if L0034_COMBINED_LIST_CLEANUP122 114 m_aiNumRefIdx[0] = m_aiNumRefIdx[1] = 0; 123 #else124 m_aiNumRefIdx[0] = m_aiNumRefIdx[1] = m_aiNumRefIdx[2] = 0;125 #endif126 115 127 116 #if SVC_EXTENSION … … 148 137 initEqualRef(); 149 138 150 #if L0034_COMBINED_LIST_CLEANUP151 139 for ( Int idx = 0; idx < MAX_NUM_REF; idx++ ) 152 140 { 153 141 m_list1IdxToList0Idx[idx] = -1; 154 142 } 155 #else156 for(Int iNumCount = 0; iNumCount < MAX_NUM_REF_LC; iNumCount++)157 {158 m_iRefIdxOfLC[REF_PIC_LIST_0][iNumCount]=-1;159 m_iRefIdxOfLC[REF_PIC_LIST_1][iNumCount]=-1;160 m_eListIdFromIdxOfLC[iNumCount]=0;161 m_iRefIdxFromIdxOfLC[iNumCount]=0;162 m_iRefIdxOfL0FromRefIdxOfL1[iNumCount] = -1;163 m_iRefIdxOfL1FromRefIdxOfL0[iNumCount] = -1;164 }165 #endif166 143 for(Int iNumCount = 0; iNumCount < MAX_NUM_REF; iNumCount++) 167 144 { … … 210 187 m_colRefIdx = 0; 211 188 initEqualRef(); 212 #if !L0034_COMBINED_LIST_CLEANUP213 m_bNoBackPredFlag = false;214 m_bRefPicListCombinationFlag = false;215 m_bRefPicListModificationFlagLC = false;216 #endif217 189 m_bCheckLDC = false; 218 190 m_iSliceQpDeltaCb = 0; 219 191 m_iSliceQpDeltaCr = 0; 220 221 #if !L0034_COMBINED_LIST_CLEANUP222 m_aiNumRefIdx[REF_PIC_LIST_C] = 0;223 #endif224 192 225 193 m_maxNumMergeCand = MRG_MAX_NUM_CANDS; … … 364 332 } 365 333 366 #if L0034_COMBINED_LIST_CLEANUP367 334 Void TComSlice::setList1IdxToList0Idx() 368 335 { … … 381 348 } 382 349 } 383 #else384 Void TComSlice::generateCombinedList()385 {386 if(m_aiNumRefIdx[REF_PIC_LIST_C] > 0)387 {388 m_aiNumRefIdx[REF_PIC_LIST_C]=0;389 for(Int iNumCount = 0; iNumCount < MAX_NUM_REF_LC; iNumCount++)390 {391 m_iRefIdxOfLC[REF_PIC_LIST_0][iNumCount]=-1;392 m_iRefIdxOfLC[REF_PIC_LIST_1][iNumCount]=-1;393 m_eListIdFromIdxOfLC[iNumCount]=0;394 m_iRefIdxFromIdxOfLC[iNumCount]=0;395 m_iRefIdxOfL0FromRefIdxOfL1[iNumCount] = -1;396 m_iRefIdxOfL1FromRefIdxOfL0[iNumCount] = -1;397 }398 399 for (Int iNumRefIdx = 0; iNumRefIdx < MAX_NUM_REF; iNumRefIdx++)400 {401 if(iNumRefIdx < m_aiNumRefIdx[REF_PIC_LIST_0])402 {403 Bool bTempRefIdxInL2 = true;404 for ( Int iRefIdxLC = 0; iRefIdxLC < m_aiNumRefIdx[REF_PIC_LIST_C]; iRefIdxLC++ )405 {406 if ( m_apcRefPicList[REF_PIC_LIST_0][iNumRefIdx]->getPOC() == m_apcRefPicList[m_eListIdFromIdxOfLC[iRefIdxLC]][m_iRefIdxFromIdxOfLC[iRefIdxLC]]->getPOC() )407 {408 m_iRefIdxOfL1FromRefIdxOfL0[iNumRefIdx] = m_iRefIdxFromIdxOfLC[iRefIdxLC];409 m_iRefIdxOfL0FromRefIdxOfL1[m_iRefIdxFromIdxOfLC[iRefIdxLC]] = iNumRefIdx;410 bTempRefIdxInL2 = false;411 break;412 }413 }414 415 if(bTempRefIdxInL2 == true)416 {417 m_eListIdFromIdxOfLC[m_aiNumRefIdx[REF_PIC_LIST_C]] = REF_PIC_LIST_0;418 m_iRefIdxFromIdxOfLC[m_aiNumRefIdx[REF_PIC_LIST_C]] = iNumRefIdx;419 m_iRefIdxOfLC[REF_PIC_LIST_0][iNumRefIdx] = m_aiNumRefIdx[REF_PIC_LIST_C]++;420 }421 }422 423 if(iNumRefIdx < m_aiNumRefIdx[REF_PIC_LIST_1])424 {425 Bool bTempRefIdxInL2 = true;426 for ( Int iRefIdxLC = 0; iRefIdxLC < m_aiNumRefIdx[REF_PIC_LIST_C]; iRefIdxLC++ )427 {428 if ( m_apcRefPicList[REF_PIC_LIST_1][iNumRefIdx]->getPOC() == m_apcRefPicList[m_eListIdFromIdxOfLC[iRefIdxLC]][m_iRefIdxFromIdxOfLC[iRefIdxLC]]->getPOC() )429 {430 m_iRefIdxOfL0FromRefIdxOfL1[iNumRefIdx] = m_iRefIdxFromIdxOfLC[iRefIdxLC];431 m_iRefIdxOfL1FromRefIdxOfL0[m_iRefIdxFromIdxOfLC[iRefIdxLC]] = iNumRefIdx;432 bTempRefIdxInL2 = false;433 break;434 }435 }436 if(bTempRefIdxInL2 == true)437 {438 m_eListIdFromIdxOfLC[m_aiNumRefIdx[REF_PIC_LIST_C]] = REF_PIC_LIST_1;439 m_iRefIdxFromIdxOfLC[m_aiNumRefIdx[REF_PIC_LIST_C]] = iNumRefIdx;440 m_iRefIdxOfLC[REF_PIC_LIST_1][iNumRefIdx] = m_aiNumRefIdx[REF_PIC_LIST_C]++;441 }442 }443 }444 }445 }446 #endif447 350 448 351 #if FIX1071 352 #if SVC_EXTENSION 449 353 Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic, Bool checkNumPocTotalCurr, TComPic** ilpPic) 354 #else 355 Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic, Bool checkNumPocTotalCurr ) 356 #endif 450 357 #else 451 358 Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic ) … … 456 363 #endif 457 364 { 458 if ( m_eSliceType == I_SLICE)365 if (m_eSliceType == I_SLICE) 459 366 { 460 367 ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList)); 461 368 ::memset( m_aiNumRefIdx, 0, sizeof ( m_aiNumRefIdx )); 369 462 370 return; 463 371 } … … 672 580 } 673 581 674 assert(numPocTotalCurr !=0);582 assert(numPocTotalCurr > 0); 675 583 676 584 m_aiNumRefIdx[0] = getNumRefIdx(REF_PIC_LIST_0); … … 699 607 { 700 608 rpsCurrList0[cIdx] = RefPicSetLtCurr[i]; 701 } 609 } 610 702 611 #if REF_IDX_FRAMEWORK 703 612 if( m_layerId > 0 ) … … 718 627 } 719 628 #endif 629 assert(cIdx == numPocTotalCurr); 630 720 631 if (m_eSliceType==B_SLICE) 721 632 { … … 732 643 { 733 644 rpsCurrList1[cIdx] = RefPicSetLtCurr[i]; 734 } 645 } 646 735 647 #if REF_IDX_FRAMEWORK 736 648 if( m_layerId > 0 ) … … 751 663 } 752 664 #endif 665 666 assert(cIdx == numPocTotalCurr); 753 667 } 754 668 755 669 ::memset(m_bIsUsedAsLongTerm, 0, sizeof(m_bIsUsedAsLongTerm)); 756 670 757 for (Int rIdx = 0; rIdx <= (m_aiNumRefIdx[0]-1); rIdx ++) 758 { 759 m_apcRefPicList[0][rIdx] = m_RefPicListModification.getRefPicListModificationFlagL0() ? rpsCurrList0[ m_RefPicListModification.getRefPicSetIdxL0(rIdx) ] : rpsCurrList0[rIdx % numPocTotalCurr]; 760 m_bIsUsedAsLongTerm[0][rIdx] = m_RefPicListModification.getRefPicListModificationFlagL0() ? (m_RefPicListModification.getRefPicSetIdxL0(rIdx) >= (NumPocStCurr0 + NumPocStCurr1)) 761 : ((rIdx % numPocTotalCurr) >= (NumPocStCurr0 + NumPocStCurr1)); 762 } 763 if ( m_eSliceType == P_SLICE ) 671 for (Int rIdx = 0; rIdx < m_aiNumRefIdx[0]; rIdx ++) 672 { 673 cIdx = m_RefPicListModification.getRefPicListModificationFlagL0() ? m_RefPicListModification.getRefPicSetIdxL0(rIdx) : rIdx % numPocTotalCurr; 674 assert(cIdx >= 0 && cIdx < numPocTotalCurr); 675 m_apcRefPicList[0][rIdx] = rpsCurrList0[ cIdx ]; 676 m_bIsUsedAsLongTerm[0][rIdx] = ( cIdx >= NumPocStCurr0 + NumPocStCurr1 ); 677 } 678 if ( m_eSliceType != B_SLICE ) 764 679 { 765 680 m_aiNumRefIdx[1] = 0; … … 768 683 else 769 684 { 770 for (Int rIdx = 0; rIdx <= (m_aiNumRefIdx[1]-1); rIdx ++) 771 { 772 m_apcRefPicList[1][rIdx] = m_RefPicListModification.getRefPicListModificationFlagL1() ? rpsCurrList1[ m_RefPicListModification.getRefPicSetIdxL1(rIdx) ] : rpsCurrList1[rIdx % numPocTotalCurr]; 773 m_bIsUsedAsLongTerm[1][rIdx] = m_RefPicListModification.getRefPicListModificationFlagL1() ? 774 (m_RefPicListModification.getRefPicSetIdxL1(rIdx) >= (NumPocStCurr0 + NumPocStCurr1)): ((rIdx % numPocTotalCurr) >= (NumPocStCurr0 + NumPocStCurr1)); 685 for (Int rIdx = 0; rIdx < m_aiNumRefIdx[1]; rIdx ++) 686 { 687 cIdx = m_RefPicListModification.getRefPicListModificationFlagL1() ? m_RefPicListModification.getRefPicSetIdxL1(rIdx) : rIdx % numPocTotalCurr; 688 assert(cIdx >= 0 && cIdx < numPocTotalCurr); 689 m_apcRefPicList[1][rIdx] = rpsCurrList1[ cIdx ]; 690 m_bIsUsedAsLongTerm[1][rIdx] = ( cIdx >= NumPocStCurr0 + NumPocStCurr1 ); 775 691 } 776 692 } … … 1071 987 m_deblockingFilterTcOffsetDiv2 = pSrc->m_deblockingFilterTcOffsetDiv2; 1072 988 1073 #if L0034_COMBINED_LIST_CLEANUP1074 989 for (i = 0; i < 2; i++) 1075 #else1076 for (i = 0; i < 3; i++)1077 #endif1078 990 { 1079 991 m_aiNumRefIdx[i] = pSrc->m_aiNumRefIdx[i]; 1080 992 } 1081 993 1082 #if L0034_COMBINED_LIST_CLEANUP1083 994 for (i = 0; i < MAX_NUM_REF; i++) 1084 995 { 1085 996 m_list1IdxToList0Idx[i] = pSrc->m_list1IdxToList0Idx[i]; 1086 997 } 1087 #else1088 for (i = 0; i < 2; i++)1089 {1090 for (j = 0; j < MAX_NUM_REF_LC; j++)1091 {1092 m_iRefIdxOfLC[i][j] = pSrc->m_iRefIdxOfLC[i][j];1093 }1094 }1095 for (i = 0; i < MAX_NUM_REF_LC; i++)1096 {1097 m_eListIdFromIdxOfLC[i] = pSrc->m_eListIdFromIdxOfLC[i];1098 m_iRefIdxFromIdxOfLC[i] = pSrc->m_iRefIdxFromIdxOfLC[i];1099 m_iRefIdxOfL1FromRefIdxOfL0[i] = pSrc->m_iRefIdxOfL1FromRefIdxOfL0[i];1100 m_iRefIdxOfL0FromRefIdxOfL1[i] = pSrc->m_iRefIdxOfL0FromRefIdxOfL1[i];1101 }1102 m_bRefPicListModificationFlagLC = pSrc->m_bRefPicListModificationFlagLC;1103 m_bRefPicListCombinationFlag = pSrc->m_bRefPicListCombinationFlag;1104 #endif1105 998 m_bCheckLDC = pSrc->m_bCheckLDC; 1106 999 m_iSliceQpDelta = pSrc->m_iSliceQpDelta; … … 1164 1057 } 1165 1058 1166 #if !L0034_COMBINED_LIST_CLEANUP1167 m_bNoBackPredFlag = pSrc->m_bNoBackPredFlag;1168 #endif1169 1059 m_uiTLayer = pSrc->m_uiTLayer; 1170 1060 m_bTLayerSwitchingFlag = pSrc->m_bTLayerSwitchingFlag; … … 1471 1361 /** Function for constructing an explicit Reference Picture Set out of the available pictures in a referenced Reference Picture Set 1472 1362 */ 1363 #if FIX1071 1364 Void TComSlice::createExplicitReferencePictureSetFromReference( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool isRAP) 1365 #else 1473 1366 Void TComSlice::createExplicitReferencePictureSetFromReference( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet) 1367 #endif 1474 1368 { 1475 1369 TComPic* rpcPic; … … 1496 1390 // and should be added to the explicit Reference Picture Set 1497 1391 pcRPS->setDeltaPOC(k, pReferencePictureSet->getDeltaPOC(i)); 1392 #if FIX1071 1393 pcRPS->setUsed(k, pReferencePictureSet->getUsed(i) && (!isRAP)); 1394 #else 1498 1395 pcRPS->setUsed(k, pReferencePictureSet->getUsed(i)); 1396 #endif 1499 1397 if(pcRPS->getDeltaPOC(k) < 0) 1500 1398 { … … 1674 1572 { 1675 1573 m_numReorderPics[i] = 0; 1676 #if L0323_DPB1677 1574 m_uiMaxDecPicBuffering[i] = 1; 1678 #else1679 m_uiMaxDecPicBuffering[i] = 0;1680 #endif1681 1575 m_uiMaxLatencyIncrease[i] = 0; 1682 1576 } … … 1786 1680 , m_pcmLog2MaxSize ( 5) 1787 1681 , m_uiPCMLog2MinSize ( 7) 1788 #if !L0034_COMBINED_LIST_CLEANUP1789 , m_bUseLComb (false)1790 #endif1791 1682 , m_bitDepthY ( 8) 1792 1683 , m_bitDepthC ( 8) … … 1820 1711 { 1821 1712 m_uiMaxLatencyIncrease[i] = 0; 1822 #if L0323_DPB1823 1713 m_uiMaxDecPicBuffering[i] = 1; 1824 #else1825 m_uiMaxDecPicBuffering[i] = 0;1826 #endif1827 1714 m_numReorderPics[i] = 0; 1828 1715 } … … 1862 1749 TComHRD *hrd = vui->getHrdParameters(); 1863 1750 1864 #if L0043_TIMING_INFO1865 1751 TimingInfo *timingInfo = vui->getTimingInfo(); 1866 1752 timingInfo->setTimingInfoPresentFlag( true ); … … 1886 1772 break; 1887 1773 } 1888 #else1889 hrd->setTimingInfoPresentFlag( true );1890 switch( frameRate )1891 {1892 case 24:1893 hrd->setNumUnitsInTick( 1125000 ); hrd->setTimeScale ( 27000000 );1894 break;1895 case 25:1896 hrd->setNumUnitsInTick( 1080000 ); hrd->setTimeScale ( 27000000 );1897 break;1898 case 30:1899 hrd->setNumUnitsInTick( 900900 ); hrd->setTimeScale ( 27000000 );1900 break;1901 case 50:1902 hrd->setNumUnitsInTick( 540000 ); hrd->setTimeScale ( 27000000 );1903 break;1904 case 60:1905 hrd->setNumUnitsInTick( 450450 ); hrd->setTimeScale ( 27000000 );1906 break;1907 default:1908 hrd->setNumUnitsInTick( 1001 ); hrd->setTimeScale ( 60000 );1909 break;1910 }1911 #endif1912 1774 1913 1775 Bool rateCnt = ( bitRate > 0 ); … … 1922 1784 hrd->setDuCpbRemovalDelayLengthMinus1( 7 ); // 8-bit precision ( plus 1 for last DU in AU ) 1923 1785 hrd->setSubPicCpbParamsInPicTimingSEIFlag( true ); 1924 #if L0044_DU_DPB_OUTPUT_DELAY_HRD1925 1786 hrd->setDpbOutputDelayDuLengthMinus1( 5 + 7 ); // With sub-clock tick factor of 100, at least 7 bits to have the same value as AU dpb delay 1926 #endif1927 1787 } 1928 1788 else … … 1953 1813 UInt birateValue, cpbSizeValue; 1954 1814 UInt ducpbSizeValue; 1955 #if L0363_DU_BIT_RATE1956 1815 UInt duBitRateValue = 0; 1957 #endif1958 1816 1959 1817 for( i = 0; i < MAX_TLAYER; i ++ ) … … 1967 1825 cpbSizeValue = bitRate; // 1 second 1968 1826 ducpbSizeValue = bitRate/numDU; 1969 #if L0363_DU_BIT_RATE1970 1827 duBitRateValue = bitRate; 1971 #endif1972 1828 for( j = 0; j < ( hrd->getCpbCntMinus1( i ) + 1 ); j ++ ) 1973 1829 { … … 1980 1836 hrd->setCpbSizeValueMinus1( i, j, 1, ( cpbSizeValue - 1 ) ); 1981 1837 hrd->setDuCpbSizeValueMinus1( i, j, 1, ( ducpbSizeValue - 1 ) ); 1982 #if L0363_DU_BIT_RATE1983 1838 hrd->setDuBitRateValueMinus1( i, j, 1, ( duBitRateValue - 1 ) ); 1984 #endif1985 1839 hrd->setCbrFlag( i, j, 1, ( j == 0 ) ); 1986 1840 } … … 2559 2413 , m_profileIdc (0) 2560 2414 , m_levelIdc (0) 2561 #if L0046_CONSTRAINT_FLAGS2562 2415 , m_progressiveSourceFlag (false) 2563 2416 , m_interlacedSourceFlag (false) 2564 2417 , m_nonPackedConstraintFlag(false) 2565 2418 , m_frameOnlyConstraintFlag(false) 2566 #endif2567 2419 { 2568 2420 ::memset(m_profileCompatibilityFlag, 0, sizeof(m_profileCompatibilityFlag)); … … 2595 2447 // Copy all information related to general profile 2596 2448 this->getGeneralPTL()->copyProfileInfo(ptl->getGeneralPTL()); 2597 }2598 #endif2599 #if SIGNAL_BITRATE_PICRATE_IN_VPS2600 TComBitRatePicRateInfo::TComBitRatePicRateInfo()2601 {2602 ::memset(m_bitRateInfoPresentFlag, 0, sizeof(m_bitRateInfoPresentFlag));2603 ::memset(m_picRateInfoPresentFlag, 0, sizeof(m_picRateInfoPresentFlag));2604 ::memset(m_avgBitRate, 0, sizeof(m_avgBitRate));2605 ::memset(m_maxBitRate, 0, sizeof(m_maxBitRate));2606 ::memset(m_constantPicRateIdc, 0, sizeof(m_constantPicRateIdc));2607 ::memset(m_avgPicRate, 0, sizeof(m_avgPicRate));2608 2449 } 2609 2450 #endif -
branches/SHM-2.1-dev/source/Lib/TLibCommon/TComSlice.h
r300 r302 191 191 Int m_levelIdc; 192 192 193 #if L0046_CONSTRAINT_FLAGS194 193 Bool m_progressiveSourceFlag; 195 194 Bool m_interlacedSourceFlag; 196 195 Bool m_nonPackedConstraintFlag; 197 196 Bool m_frameOnlyConstraintFlag; 198 #endif199 197 200 198 public: … … 216 214 Void setLevelIdc(Int x) { m_levelIdc = x; } 217 215 218 #if L0046_CONSTRAINT_FLAGS219 216 Bool getProgressiveSourceFlag() const { return m_progressiveSourceFlag; } 220 217 Void setProgressiveSourceFlag(Bool b) { m_progressiveSourceFlag = b; } … … 228 225 Bool getFrameOnlyConstraintFlag() const { return m_frameOnlyConstraintFlag; } 229 226 Void setFrameOnlyConstraintFlag(Bool b) { m_frameOnlyConstraintFlag = b; } 230 #endif231 227 #if VPS_EXTN_PROFILE_INFO 232 228 Void copyProfileInfo(ProfileTierLevel *ptl); … … 257 253 }; 258 254 /// VPS class 259 260 #if SIGNAL_BITRATE_PICRATE_IN_VPS261 class TComBitRatePicRateInfo262 {263 Bool m_bitRateInfoPresentFlag[MAX_TLAYER];264 Bool m_picRateInfoPresentFlag[MAX_TLAYER];265 Int m_avgBitRate[MAX_TLAYER];266 Int m_maxBitRate[MAX_TLAYER];267 Int m_constantPicRateIdc[MAX_TLAYER];268 Int m_avgPicRate[MAX_TLAYER];269 public:270 TComBitRatePicRateInfo();271 Bool getBitRateInfoPresentFlag(Int i) {return m_bitRateInfoPresentFlag[i];}272 Void setBitRateInfoPresentFlag(Int i, Bool x) {m_bitRateInfoPresentFlag[i] = x;}273 274 Bool getPicRateInfoPresentFlag(Int i) {return m_picRateInfoPresentFlag[i];}275 Void setPicRateInfoPresentFlag(Int i, Bool x) {m_picRateInfoPresentFlag[i] = x;}276 277 Int getAvgBitRate(Int i) {return m_avgBitRate[i];}278 Void setAvgBitRate(Int i, Int x) {m_avgBitRate[i] = x;}279 280 Int getMaxBitRate(Int i) {return m_maxBitRate[i];}281 Void setMaxBitRate(Int i, Int x) {m_maxBitRate[i] = x;}282 283 Int getConstantPicRateIdc(Int i) {return m_constantPicRateIdc[i];}284 Void setConstantPicRateIdc(Int i, Int x) {m_constantPicRateIdc[i] = x;}285 286 Int getAvgPicRate(Int i) {return m_avgPicRate[i];}287 Void setAvgPicRate(Int i, Int x) {m_avgPicRate[i] = x;}288 };289 #endif290 255 291 256 struct HrdSubLayerInfo … … 300 265 UInt ducpbSizeValue [MAX_CPB_CNT][2]; 301 266 UInt cbrFlag [MAX_CPB_CNT][2]; 302 #if L0363_DU_BIT_RATE303 267 UInt duBitRateValue [MAX_CPB_CNT][2]; 304 #endif305 268 }; 306 269 … … 308 271 { 309 272 private: 310 #if !L0043_TIMING_INFO311 Bool m_timingInfoPresentFlag;312 UInt m_numUnitsInTick;313 UInt m_timeScale;314 #endif315 273 Bool m_nalHrdParametersPresentFlag; 316 274 Bool m_vclHrdParametersPresentFlag; … … 319 277 UInt m_duCpbRemovalDelayLengthMinus1; 320 278 Bool m_subPicCpbParamsInPicTimingSEIFlag; 321 #if L0044_DU_DPB_OUTPUT_DELAY_HRD322 279 UInt m_dpbOutputDelayDuLengthMinus1; 323 #endif324 280 UInt m_bitRateScale; 325 281 UInt m_cpbSizeScale; … … 333 289 public: 334 290 TComHRD() 335 #if !L0043_TIMING_INFO336 :m_timingInfoPresentFlag(false)337 ,m_numUnitsInTick(1001)338 ,m_timeScale(60000)339 ,m_nalHrdParametersPresentFlag(0)340 #else341 291 :m_nalHrdParametersPresentFlag(0) 342 #endif343 292 ,m_vclHrdParametersPresentFlag(0) 344 293 ,m_subPicCpbParamsPresentFlag(false) … … 346 295 ,m_duCpbRemovalDelayLengthMinus1(0) 347 296 ,m_subPicCpbParamsInPicTimingSEIFlag(false) 348 #if L0044_DU_DPB_OUTPUT_DELAY_HRD349 297 ,m_dpbOutputDelayDuLengthMinus1(0) 350 #endif351 298 ,m_bitRateScale(0) 352 299 ,m_cpbSizeScale(0) … … 357 304 358 305 virtual ~TComHRD() {} 359 #if !L0043_TIMING_INFO360 Void setTimingInfoPresentFlag ( Bool flag ) { m_timingInfoPresentFlag = flag; }361 Bool getTimingInfoPresentFlag ( ) { return m_timingInfoPresentFlag; }362 363 Void setNumUnitsInTick ( UInt value ) { m_numUnitsInTick = value; }364 UInt getNumUnitsInTick ( ) { return m_numUnitsInTick; }365 366 Void setTimeScale ( UInt value ) { m_timeScale = value; }367 UInt getTimeScale ( ) { return m_timeScale; }368 #endif369 306 370 307 Void setNalHrdParametersPresentFlag ( Bool flag ) { m_nalHrdParametersPresentFlag = flag; } … … 386 323 Bool getSubPicCpbParamsInPicTimingSEIFlag () { return m_subPicCpbParamsInPicTimingSEIFlag; } 387 324 388 #if L0044_DU_DPB_OUTPUT_DELAY_HRD389 325 Void setDpbOutputDelayDuLengthMinus1 (UInt value ) { m_dpbOutputDelayDuLengthMinus1 = value; } 390 326 UInt getDpbOutputDelayDuLengthMinus1 () { return m_dpbOutputDelayDuLengthMinus1; } 391 #endif392 327 393 328 Void setBitRateScale ( UInt value ) { m_bitRateScale = value; } … … 430 365 Void setDuCpbSizeValueMinus1 ( Int layer, Int cpbcnt, Int nalOrVcl, UInt value ) { m_HRD[layer].ducpbSizeValue[cpbcnt][nalOrVcl] = value; } 431 366 UInt getDuCpbSizeValueMinus1 ( Int layer, Int cpbcnt, Int nalOrVcl ) { return m_HRD[layer].ducpbSizeValue[cpbcnt][nalOrVcl]; } 432 #if L0363_DU_BIT_RATE433 367 Void setDuBitRateValueMinus1 ( Int layer, Int cpbcnt, Int nalOrVcl, UInt value ) { m_HRD[layer].duBitRateValue[cpbcnt][nalOrVcl] = value; } 434 368 UInt getDuBitRateValueMinus1 (Int layer, Int cpbcnt, Int nalOrVcl ) { return m_HRD[layer].duBitRateValue[cpbcnt][nalOrVcl]; } 435 #endif436 369 Void setCbrFlag ( Int layer, Int cpbcnt, Int nalOrVcl, UInt value ) { m_HRD[layer].cbrFlag[cpbcnt][nalOrVcl] = value; } 437 370 Bool getCbrFlag ( Int layer, Int cpbcnt, Int nalOrVcl ) { return m_HRD[layer].cbrFlag[cpbcnt][nalOrVcl]; } … … 439 372 Void setNumDU ( UInt value ) { m_numDU = value; } 440 373 UInt getNumDU ( ) { return m_numDU; } 441 #if L0045_CONDITION_SIGNALLING442 374 Bool getCpbDpbDelaysPresentFlag() { return getNalHrdParametersPresentFlag() || getVclHrdParametersPresentFlag(); } 443 #endif444 375 }; 445 376 446 #if L0043_TIMING_INFO447 377 class TimingInfo 448 378 { … … 475 405 Void setNumTicksPocDiffOneMinus1 (Int x ) { m_numTicksPocDiffOneMinus1 = x; } 476 406 }; 477 #endif478 407 479 408 class TComVPS … … 487 416 UInt m_numReorderPics[MAX_TLAYER]; 488 417 UInt m_uiMaxDecPicBuffering[MAX_TLAYER]; 489 UInt m_uiMaxLatencyIncrease[MAX_TLAYER]; 418 UInt m_uiMaxLatencyIncrease[MAX_TLAYER]; // Really max latency increase plus 1 (value 0 expresses no limit) 490 419 491 420 UInt m_numHrdParameters; … … 509 438 #endif 510 439 TComPTL m_pcPTL; 511 #if SIGNAL_BITRATE_PICRATE_IN_VPS512 TComBitRatePicRateInfo m_bitRatePicRateInfo;513 #endif514 #if L0043_TIMING_INFO515 440 TimingInfo m_timingInfo; 516 #endif517 441 518 442 // ------------------------------------------ … … 636 560 #endif 637 561 TComPTL* getPTL() { return &m_pcPTL; } 638 #if SIGNAL_BITRATE_PICRATE_IN_VPS639 TComBitRatePicRateInfo *getBitratePicrateInfo() { return &m_bitRatePicRateInfo; }640 #endif641 #if L0043_TIMING_INFO642 562 TimingInfo* getTimingInfo() { return &m_timingInfo; } 643 #endif644 563 #if VPS_EXTN_MASK_AND_DIM_INFO 645 564 Bool getAvcBaseLayerFlag() { return m_avcBaseLayerFlag; } … … 814 733 Int m_log2MaxMvLengthVertical; 815 734 TComHRD m_hrdParameters; 816 #if L0043_TIMING_INFO817 735 TimingInfo m_timingInfo; 818 #else819 Bool m_pocProportionalToTimingFlag;820 Int m_numTicksPocDiffOneMinus1;821 #endif822 736 #if M0464_TILE_BOUNDARY_ALIGNED_FLAG 823 737 Bool m_tileBoundariesAlignedFlag; … … 856 770 ,m_log2MaxMvLengthHorizontal(15) 857 771 ,m_log2MaxMvLengthVertical(15) 858 #if !L0043_TIMING_INFO859 ,m_pocProportionalToTimingFlag(false)860 ,m_numTicksPocDiffOneMinus1(0)861 #endif862 772 #if M0464_TILE_BOUNDARY_ALIGNED_FLAG 863 773 ,m_tileBoundariesAlignedFlag(true) … … 957 867 958 868 TComHRD* getHrdParameters () { return &m_hrdParameters; } 959 #if L0043_TIMING_INFO960 869 TimingInfo* getTimingInfo() { return &m_timingInfo; } 961 #else962 Bool getPocProportionalToTimingFlag() {return m_pocProportionalToTimingFlag; }963 Void setPocProportionalToTimingFlag(Bool x) {m_pocProportionalToTimingFlag = x;}964 Int getNumTicksPocDiffOneMinus1() {return m_numTicksPocDiffOneMinus1;}965 Void setNumTicksPocDiffOneMinus1(Int x) { m_numTicksPocDiffOneMinus1 = x;}966 #endif967 870 #if M0464_TILE_BOUNDARY_ALIGNED_FLAG 968 871 Bool getTileBoundariesAlignedFlag( ) { return m_tileBoundariesAlignedFlag; } … … 1008 911 Bool m_useAMP; 1009 912 1010 #if !L0034_COMBINED_LIST_CLEANUP1011 Bool m_bUseLComb;1012 #endif1013 1014 913 // Parameter 1015 914 Int m_bitDepthY; … … 1040 939 TComScalingList* m_scalingList; //!< ScalingList class pointer 1041 940 UInt m_uiMaxDecPicBuffering[MAX_TLAYER]; 1042 UInt m_uiMaxLatencyIncrease[MAX_TLAYER]; 941 UInt m_uiMaxLatencyIncrease[MAX_TLAYER]; // Really max latency increase plus 1 (value 0 expresses no limit) 1043 942 1044 943 Bool m_useDF; … … 1146 1045 1147 1046 // Tool list 1148 #if !L0034_COMBINED_LIST_CLEANUP1149 Void setUseLComb (Bool b) { m_bUseLComb = b; }1150 Bool getUseLComb () { return m_bUseLComb; }1151 #endif1152 1153 1047 Bool getUseLossless () { return m_useLossless; } 1154 1048 Void setUseLossless ( Bool b ) { m_useLossless = b; } … … 1504 1398 Bool m_interLayerSamplePredOnlyFlag; 1505 1399 #endif 1506 #if L0034_COMBINED_LIST_CLEANUP1507 1400 Int m_list1IdxToList0Idx[MAX_NUM_REF]; 1508 1401 Int m_aiNumRefIdx [2]; // for multiple reference of current slice 1509 #else1510 Int m_aiNumRefIdx [3]; // for multiple reference of current slice1511 Int m_iRefIdxOfLC[2][MAX_NUM_REF_LC];1512 Int m_eListIdFromIdxOfLC[MAX_NUM_REF_LC];1513 Int m_iRefIdxFromIdxOfLC[MAX_NUM_REF_LC];1514 Int m_iRefIdxOfL1FromRefIdxOfL0[MAX_NUM_REF_LC];1515 Int m_iRefIdxOfL0FromRefIdxOfL1[MAX_NUM_REF_LC];1516 Bool m_bRefPicListModificationFlagLC;1517 Bool m_bRefPicListCombinationFlag;1518 #endif1519 1402 1520 1403 Bool m_bCheckLDC; … … 1558 1441 1559 1442 Bool m_abEqualRef [2][MAX_NUM_REF][MAX_NUM_REF]; 1560 #if !L0034_COMBINED_LIST_CLEANUP1561 Bool m_bNoBackPredFlag;1562 #endif1563 1443 UInt m_uiTLayer; 1564 1444 #if SVC_EXTENSION … … 1680 1560 Bool getMvdL1ZeroFlag () { return m_bLMvdL1Zero; } 1681 1561 Int getNumRpsCurrTempList(); 1682 #if L0034_COMBINED_LIST_CLEANUP1683 1562 Int getList1IdxToList0Idx ( Int list1Idx ) { return m_list1IdxToList0Idx[list1Idx]; } 1684 #else1685 Int getRefIdxOfLC (RefPicList e, Int iRefIdx) { return m_iRefIdxOfLC[e][iRefIdx]; }1686 Int getListIdFromIdxOfLC(Int iRefIdx) { return m_eListIdFromIdxOfLC[iRefIdx]; }1687 Int getRefIdxFromIdxOfLC(Int iRefIdx) { return m_iRefIdxFromIdxOfLC[iRefIdx]; }1688 Int getRefIdxOfL0FromRefIdxOfL1(Int iRefIdx) { return m_iRefIdxOfL0FromRefIdxOfL1[iRefIdx];}1689 Int getRefIdxOfL1FromRefIdxOfL0(Int iRefIdx) { return m_iRefIdxOfL1FromRefIdxOfL0[iRefIdx];}1690 Bool getRefPicListModificationFlagLC() {return m_bRefPicListModificationFlagLC;}1691 Void setRefPicListModificationFlagLC(Bool bflag) {m_bRefPicListModificationFlagLC=bflag;}1692 Bool getRefPicListCombinationFlag() {return m_bRefPicListCombinationFlag;}1693 Void setRefPicListCombinationFlag(Bool bflag) {m_bRefPicListCombinationFlag=bflag;}1694 #endif1695 1563 Void setReferenced(Bool b) { m_bRefenced = b; } 1696 1564 Bool isReferenced() { return m_bRefenced; } … … 1733 1601 1734 1602 #if FIX1071 1603 #if SVC_EXTENSION 1735 1604 Void setRefPicList ( TComList<TComPic*>& rcListPic, Bool checkNumPocTotalCurr = false, TComPic** ilpPic = NULL ); 1605 #else 1606 Void setRefPicList ( TComList<TComPic*>& rcListPic, Bool checkNumPocTotalCurr = false ); 1607 #endif 1736 1608 #else 1737 1609 Void setRefPicList ( TComList<TComPic*>& rcListPic ); … … 1769 1641 1770 1642 static Void sortPicList ( TComList<TComPic*>& rcListPic ); 1771 #if L0034_COMBINED_LIST_CLEANUP1772 1643 Void setList1IdxToList0Idx(); 1773 #else1774 Bool getNoBackPredFlag() { return m_bNoBackPredFlag; }1775 Void setNoBackPredFlag( Bool b ) { m_bNoBackPredFlag = b; }1776 Void generateCombinedList ();1777 #endif1778 1644 1779 1645 UInt getTLayer () { return m_uiTLayer; } … … 1786 1652 Bool isStepwiseTemporalLayerSwitchingPointCandidate( TComList<TComPic*>& rcListPic ); 1787 1653 Int checkThatAllRefPicsAreAvailable( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool printErrors, Int pocRandomAccess = 0); 1654 #if FIX1071 1655 Void createExplicitReferencePictureSetFromReference( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool isRAP); 1656 #else 1788 1657 Void createExplicitReferencePictureSetFromReference( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet); 1658 #endif 1789 1659 1790 1660 Void setMaxNumMergeCand (UInt val ) { m_maxNumMergeCand = val; } -
branches/SHM-2.1-dev/source/Lib/TLibCommon/TComTrQuant.cpp
r191 r302 1075 1075 Int iTransformShift = MAX_TR_DYNAMIC_RANGE - uiBitDepth - uiLog2TrSize; // Represents scaling through forward transform 1076 1076 1077 Int iQBits = QUANT_SHIFT + m_cQP.m_iPer + iTransformShift; // Right shift of non-RDOQ quantizer; level = (coeff*uiQ + offset)>>q_bits1078 1079 iAdd = (pcCU->getSlice()->getSliceType()==I_SLICE ? 171 : 85) << (iQBits-9);1080 1081 1077 #if ADAPTIVE_QP_SELECTION 1082 iQBits = QUANT_SHIFT + cQpBase.m_iPer + iTransformShift;1078 Int iQBits = QUANT_SHIFT + cQpBase.m_iPer + iTransformShift; 1083 1079 iAdd = (pcCU->getSlice()->getSliceType()==I_SLICE ? 171 : 85) << (iQBits-9); 1084 1080 Int iQBitsC = QUANT_SHIFT + cQpBase.m_iPer + iTransformShift - ARL_C_PRECISION; 1085 1081 Int iAddC = 1 << (iQBitsC-1); 1082 #else 1083 Int iQBits = QUANT_SHIFT + m_cQP.m_iPer + iTransformShift; // Right shift of non-RDOQ quantizer; level = (coeff*uiQ + offset)>>q_bits 1084 iAdd = (pcCU->getSlice()->getSliceType()==I_SLICE ? 171 : 85) << (iQBits-9); 1086 1085 #endif 1087 1086 … … 1364 1363 #else 1365 1364 Int j; 1366 { 1367 Short block[ 64 * 64 ]; 1368 Short coeff[ 64 * 64 ]; 1369 { 1370 for (j = 0; j < iHeight; j++) 1371 { 1372 memcpy( block + j * iWidth, piBlkResi + j * uiStride, iWidth * sizeof( Short ) ); 1373 } 1374 } 1375 xTrMxN(bitDepth, block, coeff, iWidth, iHeight, uiMode ); 1376 for ( j = 0; j < iHeight * iWidth; j++ ) 1377 { 1378 psCoeff[ j ] = coeff[ j ]; 1379 } 1380 return ; 1365 Short block[ 32 * 32 ]; 1366 Short coeff[ 32 * 32 ]; 1367 for (j = 0; j < iHeight; j++) 1368 { 1369 memcpy( block + j * iWidth, piBlkResi + j * uiStride, iWidth * sizeof( Short ) ); 1370 } 1371 xTrMxN(bitDepth, block, coeff, iWidth, iHeight, uiMode ); 1372 for ( j = 0; j < iHeight * iWidth; j++ ) 1373 { 1374 psCoeff[ j ] = coeff[ j ]; 1381 1375 } 1382 1376 #endif … … 1399 1393 Int j; 1400 1394 { 1401 Short block[ 64 * 64];1402 Short coeff[ 64 * 64];1395 Short block[ 32 * 32 ]; 1396 Short coeff[ 32 * 32 ]; 1403 1397 for ( j = 0; j < iHeight * iWidth; j++ ) 1404 1398 { … … 1522 1516 UInt uiAbsPartIdx ) 1523 1517 { 1524 Int iQBits = m_cQP.m_iBits;1525 Double dTemp = 0;1526 1518 UInt uiLog2TrSize = g_aucConvertToBit[ uiWidth ] + 2; 1527 Int uiQ = g_quantScales[m_cQP.rem()];1528 1519 1529 1520 UInt uiBitDepth = eTType == TEXT_LUMA ? g_bitDepthY : g_bitDepthC; … … 1536 1527 assert(scalingListType < 6); 1537 1528 1538 iQBits = QUANT_SHIFT + m_cQP.m_iPer + iTransformShift; // Right shift of non-RDOQ quantizer; level = (coeff*uiQ + offset)>>q_bits 1539 Double dErrScale = 0; 1529 Int iQBits = QUANT_SHIFT + m_cQP.m_iPer + iTransformShift; // Right shift of non-RDOQ quantizer; level = (coeff*uiQ + offset)>>q_bits 1540 1530 Double *pdErrScaleOrg = getErrScaleCoeff(scalingListType,uiLog2TrSize-2,m_cQP.m_iRem); 1541 1531 Int *piQCoefOrg = getQuantCoeff(scalingListType,m_cQP.m_iRem,uiLog2TrSize-2); … … 1589 1579 Double d64BaseCost = 0; 1590 1580 Int iLastScanPos = -1; 1591 dTemp = dErrScale;1592 1581 1593 1582 UInt c1Idx = 0; … … 1618 1607 UInt uiBlkPos = scan[iScanPos]; 1619 1608 // set coeff 1620 uiQ = piQCoef[uiBlkPos];1621 dTemp = pdErrScale[uiBlkPos];1609 Int uiQ = piQCoef[uiBlkPos]; 1610 Double dTemp = pdErrScale[uiBlkPos]; 1622 1611 Int lLevelDouble = plSrcCoeff[ uiBlkPos ]; 1623 1612 lLevelDouble = (Int)min<Int64>((Int64)abs((Int)lLevelDouble) * uiQ , MAX_INT - (1 << (iQBits - 1))); -
branches/SHM-2.1-dev/source/Lib/TLibCommon/TComWeightPrediction.cpp
r191 r302 271 271 Void TComWeightPrediction::getWpScaling( TComDataCU* pcCU, Int iRefIdx0, Int iRefIdx1, wpScalingParam *&wp0, wpScalingParam *&wp1) 272 272 { 273 assert(iRefIdx0 >= 0 || iRefIdx1 >= 0); 274 273 275 TComSlice* pcSlice = pcCU->getSlice(); 274 276 TComPPS* pps = pcCU->getSlice()->getPPS(); -
branches/SHM-2.1-dev/source/Lib/TLibCommon/TypeDef.h
r300 r302 44 44 45 45 #if SVC_EXTENSION 46 #define MAX_LAYERS 2 ///< max number of layers the codec is supposed to handle 47 46 48 #define M0464_TILE_BOUNDARY_ALIGNED_FLAG 1 ///< VUI flag to indicate tile boundary alignment 47 49 #define M0463_VUI_EXT_ILP_REF 1 ///< VUI extension inter-layer dependency offset signalling … … 49 51 #define SCALED_REF_LAYER_OFFSET_FLAG 0 ///< M0309: Signal scaled reference layer offsets in SPS 50 52 #define SCALED_REF_LAYER_OFFSETS 1 ///< M0309: Signal scaled reference layer offsets in SPS 51 #define MAX_LAYERS 2 ///< max number of layers the codec is supposed to handle52 53 53 54 #define VPS_RENAME 1 ///< Rename variables max_layer_id and num_layer_sets_minus1 in VPS … … 73 74 #define SVC_COL_BLK 1 ///< get co-located block 74 75 #define SVC_UPSAMPLING 1 ///< upsampling filters 75 #define ENCODER_BUGFIX 1 ///< L0167: encoder bug fix for inter mode76 76 #define CHROMA_UPSAMPLING 1 ///< L0335: Chroma upsampling with 5 bits coefficients 77 77 … … 129 129 #endif 130 130 #endif 131 #else132 #define ILP_DECODED_PICTURE 0133 #define SYNTAX_OUTPUT 0134 #endif135 131 136 132 #define FAST_INTRA_SHVC 1 ///< M0115: reduction number of intra modes in the EL (encoder only) … … 139 135 #endif 140 136 137 #define RC_SHVC_HARMONIZATION 1 ///< JCTVC-M0037, rate control for SHVC 138 139 #else 140 #define ILP_DECODED_PICTURE 0 141 #define SYNTAX_OUTPUT 0 142 #endif // SVC_EXTENSION 143 144 141 145 //! \ingroup TLibCommon 142 146 //! \{ 143 147 144 #define FIX1071 1 ///< Temporary fix for issue #1071 145 146 147 #define M0043_LAYERS_PRESENT_SEI 0 ///< M0043: add layers present SEI 148 #define L0208_SOP_DESCRIPTION_SEI 1 ///< L0208: add SOP descrioption SEI 148 #define FIX1071 1 ///< fix for issue #1071 149 149 150 #define MAX_NUM_PICS_IN_SOP 1024 150 151 151 #define K0180_SCALABLE_NESTING_SEI 1 ///JCTVC-K0180 scalable nesting sei message152 152 #define MAX_NESTING_NUM_OPS 1024 153 153 #define MAX_NESTING_NUM_LAYER 64 154 155 #define J0149_TONE_MAPPING_SEI 1 ///< J0149: Tone mapping information SEI156 #define L0363_DU_BIT_RATE 1 ///< L0363: add bit_rate_du_value_minus1 to HRD parameters157 #define L0328_SPLICING 1 ///< L0328: splicing support in HRD158 #define L0044_DU_DPB_OUTPUT_DELAY_HRD 1 ///< L0044: Include dpb_output_delay_du_length_minus1 in hrd_parameters(), dpb_output_du_delay in159 ///< picture timing SEI and DU information SEI160 #define L0045_PERSISTENCE_FLAGS 1 ///< L0045: Replace "repetition_period" syntax elements in SEI with "persistence_flag"161 #define L0045_NON_NESTED_SEI_RESTRICTIONS 1 ///< L0045; Include restriction on the order of APS and non-nested BP, PT and DU info SEI messages162 #define L0044_CPB_DPB_DELAY_OFFSET 1 ///< L0044: Include syntax elements cpb_delay_offset and dpb_delay_offset in the BP SEI message163 #define L0047_APS_FLAGS 1 ///< L0047: Include full_random_access_flag and no_param_set_update_flag in the active parameter set SEI message164 #define L0043_TIMING_INFO 1 ///< L0043: Timing information is signalled in VUI outside hrd_parameters()165 #define L0046_RENAME_PROG_SRC_IDC 1 ///< L0046: Rename progressive_source_idc to source_scan_type166 #define L0045_CONDITION_SIGNALLING 1 ///< L0045: Condition the signaling of some syntax elements in picture timing SEI message167 #define L0043_MSS_IDC 1168 #define L0116_ENTRY_POINT 1169 #define L0363_MORE_BITS 1170 #define L0363_MVP_POC 1171 #define L0363_BYTE_ALIGN 1172 #define L0363_SEI_ALLOW_SUFFIX 1173 #define L0323_LIMIT_DEFAULT_LIST_SIZE 1174 #define L0046_CONSTRAINT_FLAGS 1175 #define L0255_MOVE_PPS_FLAGS 1 ///< move some flags to earlier positions in the PPS176 #define L0444_FPA_TYPE 1 ///< allow only FPA types 3, 4 and 5177 #define L0372 1178 #define SIGNAL_BITRATE_PICRATE_IN_VPS 0 ///< K0125: Signal bit_rate and pic_rate in VPS179 #define L0232_RD_PENALTY 1 ///< L0232: RD-penalty for 32x32 TU for intra in non-intra slices180 #define L0386_DB_METRIC 1 ///< L0386: non-normative blockiness metric (automatically configures deblocking parameters in bitstream)181 #define L0323_DPB 1 ///< L0323: Specification of active reference indices and decoded picture buffer182 183 #define L0034_COMBINED_LIST_CLEANUP 1184 154 185 155 #if VPS_EXTN_MASK_AND_DIM_INFO … … 195 165 #endif 196 166 #define RATE_CONTROL_LAMBDA_DOMAIN 1 ///< JCTVC-K0103, rate control by R-lambda model 197 #define L0033_RC_BUGFIX 1 ///< JCTVC-L0033, bug fix for R-lambda model based rate control 198 #define RC_SHVC_HARMONIZATION 1 ///< JCTVC-M0037, rate control for SHVC 167 #define M0036_RC_IMPROVEMENT 1 ///< JCTVC-M0036, improvement for R-lambda model based rate control 168 #define TICKET_1090_FIX 1 169 170 #define RC_FIX 1 /// suggested fix for M0036 171 #define RATE_CONTROL_INTRA 1 ///< JCTVC-M0257, rate control for intra 199 172 200 173 #define MAX_CPB_CNT 32 ///< Upper bound of (cpb_cnt_minus1 + 1) … … 217 190 218 191 #define REMOVE_SAO_LCU_ENC_CONSTRAINTS_3 1 ///< disable the encoder constraint that conditionally disable SAO for chroma for entire slice in interleaved mode 219 220 #define REMOVE_SINGLE_SEI_EXTENSION_FLAGS 1 ///< remove display orientation SEI extension flag (there is a generic SEI extension mechanism now)221 192 222 193 #define SAO_ENCODING_CHOICE 1 ///< I0184: picture early termination … … 232 203 #define MAX_NUM_SPS 16 233 204 #define MAX_NUM_PPS 64 234 235 236 205 237 206 #define WEIGHTED_CHROMA_DISTORTION 1 ///< F386: weighting of chroma for RDO … … 522 491 REF_PIC_LIST_0 = 0, ///< reference list 0 523 492 REF_PIC_LIST_1 = 1, ///< reference list 1 524 #if !L0034_COMBINED_LIST_CLEANUP525 REF_PIC_LIST_C = 2, ///< combined reference list for uni-prediction in B-Slices526 #endif527 493 REF_PIC_LIST_X = 100 ///< special mark 528 494 }; -
branches/SHM-2.1-dev/source/Lib/TLibDecoder/SEIread.cpp
r292 r302 90 90 fprintf( g_hTrace, "=========== Decoding Unit Information SEI message ===========\n"); 91 91 break; 92 #if J0149_TONE_MAPPING_SEI93 92 case SEI::TONE_MAPPING_INFO: 94 93 fprintf( g_hTrace, "===========Tone Mapping Info SEI message ===========\n"); 95 94 break; 96 #endif97 95 #if M0043_LAYERS_PRESENT_SEI 98 96 case SEI::LAYERS_PRESENT: … … 100 98 break; 101 99 #endif 102 #if L0208_SOP_DESCRIPTION_SEI103 100 case SEI::SOP_DESCRIPTION: 104 101 fprintf( g_hTrace, "=========== SOP Description SEI message ===========\n"); 105 102 break; 106 #endif107 #if K0180_SCALABLE_NESTING_SEI108 103 case SEI::SCALABLE_NESTING: 109 104 fprintf( g_hTrace, "=========== Scalable Nesting SEI message ===========\n"); 110 105 break; 111 #endif112 106 default: 113 107 fprintf( g_hTrace, "=========== Unknown SEI message ===========\n"); … … 251 245 xParseSEIGradualDecodingRefreshInfo((SEIGradualDecodingRefreshInfo&) *sei, payloadSize); 252 246 break; 253 #if J0149_TONE_MAPPING_SEI254 247 case SEI::TONE_MAPPING_INFO: 255 248 sei = new SEIToneMappingInfo; 256 249 xParseSEIToneMappingInfo((SEIToneMappingInfo&) *sei, payloadSize); 257 250 break; 258 #endif259 251 #if M0043_LAYERS_PRESENT_SEI 260 252 case SEI::LAYERS_PRESENT: … … 270 262 break; 271 263 #endif 272 #if L0208_SOP_DESCRIPTION_SEI273 264 case SEI::SOP_DESCRIPTION: 274 265 sei = new SEISOPDescription; 275 266 xParseSEISOPDescription((SEISOPDescription&) *sei, payloadSize); 276 267 break; 277 #endif278 #if K0180_SCALABLE_NESTING_SEI279 268 case SEI::SCALABLE_NESTING: 280 269 sei = new SEIScalableNesting; … … 285 274 #endif 286 275 break; 287 #endif288 276 default: 289 277 for (UInt i = 0; i < payloadSize; i++) … … 299 287 switch (payloadType) 300 288 { 301 #if L0363_SEI_ALLOW_SUFFIX302 289 case SEI::USER_DATA_UNREGISTERED: 303 290 sei = new SEIuserDataUnregistered; 304 291 xParseSEIuserDataUnregistered((SEIuserDataUnregistered&) *sei, payloadSize); 305 292 break; 306 #endif307 293 case SEI::DECODED_PICTURE_HASH: 308 294 sei = new SEIDecodedPictureHash; … … 436 422 UInt val; 437 423 READ_CODE(4, val, "active_vps_id"); sei.activeVPSId = val; 438 #if L0047_APS_FLAGS439 424 READ_FLAG( val, "full_random_access_flag"); sei.m_fullRandomAccessFlag = val ? true : false; 440 425 READ_FLAG( val, "no_param_set_update_flag"); sei.m_noParamSetUpdateFlag = val ? true : false; 441 #endif442 426 READ_UVLC( val, "num_sps_ids_minus1"); sei.numSpsIdsMinus1 = val; 443 427 … … 472 456 sei.m_duSptCpbRemovalDelay = 0; 473 457 } 474 #if L0044_DU_DPB_OUTPUT_DELAY_HRD475 458 READ_FLAG( val, "dpb_output_du_delay_present_flag"); sei.m_dpbOutputDuDelayPresentFlag = val ? true : false; 476 459 if(sei.m_dpbOutputDuDelayPresentFlag) … … 479 462 sei.m_picSptDpbOutputDuDelay = val; 480 463 } 481 #endif482 464 xParseByteAlign(); 483 465 } … … 496 478 READ_FLAG( code, "rap_cpb_params_present_flag" ); sei.m_rapCpbParamsPresentFlag = code; 497 479 } 498 #if L0328_SPLICING499 480 //read splicing flag and cpb_removal_delay_delta 500 481 READ_FLAG( code, "concatenation_flag"); … … 502 483 READ_CODE( ( pHRD->getCpbRemovalDelayLengthMinus1() + 1 ), code, "au_cpb_removal_delay_delta_minus1" ); 503 484 sei.m_auCpbRemovalDelayDelta = code + 1; 504 #endif505 #if L0044_CPB_DPB_DELAY_OFFSET506 485 if( sei.m_rapCpbParamsPresentFlag ) 507 486 { … … 509 488 READ_CODE( pHRD->getDpbOutputDelayLengthMinus1() + 1, code, "dpb_delay_offset" ); sei.m_dpbDelayOffset = code; 510 489 } 511 #endif512 490 for( nalOrVcl = 0; nalOrVcl < 2; nalOrVcl ++ ) 513 491 { … … 541 519 TComHRD *hrd = vui->getHrdParameters(); 542 520 543 #if !L0045_CONDITION_SIGNALLING544 // This condition was probably OK before the pic_struct, progressive_source_idc, duplicate_flag were added545 if( !hrd->getNalHrdParametersPresentFlag() && !hrd->getVclHrdParametersPresentFlag() )546 {547 return;548 }549 #endif550 551 521 if( vui->getFrameFieldInfoPresentFlag() ) 552 522 { 553 523 READ_CODE( 4, code, "pic_struct" ); sei.m_picStruct = code; 554 #if L0046_RENAME_PROG_SRC_IDC555 524 READ_CODE( 2, code, "source_scan_type" ); sei.m_sourceScanType = code; 556 #else557 READ_CODE( 2, code, "progressive_source_idc" ); sei.m_progressiveSourceIdc = code;558 #endif559 525 READ_FLAG( code, "duplicate_flag" ); sei.m_duplicateFlag = ( code == 1 ? true : false ); 560 526 } 561 527 562 #if L0045_CONDITION_SIGNALLING563 528 if( hrd->getCpbDpbDelaysPresentFlag()) 564 529 { 565 #endif566 530 READ_CODE( ( hrd->getCpbRemovalDelayLengthMinus1() + 1 ), code, "au_cpb_removal_delay_minus1" ); 567 531 sei.m_auCpbRemovalDelay = code + 1; … … 569 533 sei.m_picDpbOutputDelay = code; 570 534 571 #if L0044_DU_DPB_OUTPUT_DELAY_HRD572 535 if(hrd->getSubPicCpbParamsPresentFlag()) 573 536 { … … 575 538 sei.m_picDpbOutputDuDelay = code; 576 539 } 577 #endif578 540 if( hrd->getSubPicCpbParamsPresentFlag() && hrd->getSubPicCpbParamsInPicTimingSEIFlag() ) 579 541 { … … 609 571 } 610 572 } 611 #if L0045_CONDITION_SIGNALLING 612 } 613 #endif 573 } 614 574 xParseByteAlign(); 615 575 } … … 632 592 { 633 593 READ_CODE( 7, val, "frame_packing_arrangement_type" ); sei.m_arrangementType = val; 634 #if L0444_FPA_TYPE635 594 assert((sei.m_arrangementType > 2) && (sei.m_arrangementType < 6) ); 636 #endif637 595 READ_FLAG( val, "quincunx_sampling_flag" ); sei.m_quincunxSamplingFlag = val; 638 596 … … 654 612 655 613 READ_CODE( 8, val, "frame_packing_arrangement_reserved_byte" ); sei.m_arrangementReservedByte = val; 656 #if L0045_PERSISTENCE_FLAGS657 614 READ_FLAG( val, "frame_packing_arrangement_persistence_flag" ); sei.m_arrangementPersistenceFlag = val ? true : false; 658 #else659 READ_UVLC( val, "frame_packing_arrangement_repetition_period" ); sei.m_arrangementRepetetionPeriod = val;660 #endif661 615 } 662 616 READ_FLAG( val, "upsampled_aspect_ratio" ); sei.m_upsampledAspectRatio = val; … … 674 628 READ_FLAG( val, "ver_flip" ); sei.verFlip = val; 675 629 READ_CODE( 16, val, "anticlockwise_rotation" ); sei.anticlockwiseRotation = val; 676 #if L0045_PERSISTENCE_FLAGS677 630 READ_FLAG( val, "display_orientation_persistence_flag" ); sei.persistenceFlag = val; 678 #else679 READ_UVLC( val, "display_orientation_repetition_period" ); sei.repetitionPeriod = val;680 #endif681 #if !REMOVE_SINGLE_SEI_EXTENSION_FLAGS682 READ_FLAG( val, "display_orientation_extension_flag" ); sei.extensionFlag = val;683 assert( !sei.extensionFlag );684 #endif685 631 } 686 632 xParseByteAlign(); … … 702 648 } 703 649 704 #if J0149_TONE_MAPPING_SEI705 650 Void SEIReader::xParseSEIToneMappingInfo(SEIToneMappingInfo& sei, UInt /*payloadSize*/) 706 651 { … … 783 728 xParseByteAlign(); 784 729 } 785 #endif786 730 787 731 #if M0043_LAYERS_PRESENT_SEI … … 806 750 #endif 807 751 808 #if L0208_SOP_DESCRIPTION_SEI809 752 Void SEIReader::xParseSEISOPDescription(SEISOPDescription &sei, UInt payloadSize) 810 753 { … … 830 773 xParseByteAlign(); 831 774 } 832 #endif 833 834 835 #if K0180_SCALABLE_NESTING_SEI 775 836 776 #if M0043_LAYERS_PRESENT_SEI 837 777 Void SEIReader::xParseSEIScalableNesting(SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, TComVPS *vps, TComSPS *sps) … … 888 828 889 829 } 890 #endif891 830 892 831 Void SEIReader::xParseByteAlign() -
branches/SHM-2.1-dev/source/Lib/TLibDecoder/SEIread.h
r292 r302 78 78 Void xParseSEITemporalLevel0Index (SEITemporalLevel0Index &sei, UInt payloadSize); 79 79 Void xParseSEIGradualDecodingRefreshInfo (SEIGradualDecodingRefreshInfo &sei, UInt payloadSize); 80 #if J0149_TONE_MAPPING_SEI81 80 Void xParseSEIToneMappingInfo (SEIToneMappingInfo& sei, UInt payloadSize); 82 #endif 81 Void xParseSEISOPDescription (SEISOPDescription &sei, UInt payloadSize); 83 82 #if M0043_LAYERS_PRESENT_SEI 84 83 Void xParseSEILayersPresent (SEILayersPresent &sei, UInt payloadSize, TComVPS *vps); 85 #endif86 #if L0208_SOP_DESCRIPTION_SEI87 Void xParseSEISOPDescription (SEISOPDescription &sei, UInt payloadSize);88 #endif89 #if K0180_SCALABLE_NESTING_SEI90 #if M0043_LAYERS_PRESENT_SEI91 84 Void xParseSEIScalableNesting (SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, TComVPS *vps, TComSPS *sps); 92 85 #else 93 86 Void xParseSEIScalableNesting (SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, TComSPS *sps); 94 #endif95 87 #endif 96 88 Void xParseByteAlign(); -
branches/SHM-2.1-dev/source/Lib/TLibDecoder/TDecBinCoder.h
r191 r302 54 54 virtual Void start () = 0; 55 55 virtual Void finish () = 0; 56 virtual Void flush () = 0;57 56 58 57 virtual Void decodeBin ( UInt& ruiBin, ContextModel& rcCtxModel ) = 0; … … 61 60 virtual Void decodeBinTrm ( UInt& ruiBin ) = 0; 62 61 63 virtual Void resetBac () = 0;64 virtual Void decodePCMAlignBits() = 0;65 62 virtual Void xReadPCMCode ( UInt uiLength, UInt& ruiCode) = 0; 66 63 -
branches/SHM-2.1-dev/source/Lib/TLibDecoder/TDecBinCoderCABAC.cpp
r191 r302 75 75 TDecBinCABAC::finish() 76 76 { 77 } 78 79 Void 80 TDecBinCABAC::flush() 81 { 82 while (m_pcTComBitstream->getNumBitsLeft() > 0 && m_pcTComBitstream->getNumBitsUntilByteAligned() != 0) 83 { 84 UInt uiBits; 85 m_pcTComBitstream->read ( 1, uiBits ); 86 } 87 start(); 77 UInt lastByte; 78 79 m_pcTComBitstream->peekPreviousByte( lastByte ); 80 // Check for proper stop/alignment pattern 81 assert( ((lastByte << (8 + m_bitsNeeded)) & 0xff) == 0x80 ); 88 82 } 89 83 … … 241 235 } 242 236 243 /** Reset BAC register values.244 * \returns Void245 */246 Void TDecBinCABAC::resetBac()247 {248 m_uiRange = 510;249 m_bitsNeeded = -8;250 m_uiValue = m_pcTComBitstream->read( 16 );251 }252 253 /** Decode PCM alignment zero bits.254 * \returns Void255 */256 Void TDecBinCABAC::decodePCMAlignBits()257 {258 Int iNum = m_pcTComBitstream->getNumBitsUntilByteAligned();259 260 UInt uiBit = 0;261 m_pcTComBitstream->read( iNum, uiBit );262 }263 264 237 /** Read a PCM code. 265 238 * \param uiLength code bit-depth -
branches/SHM-2.1-dev/source/Lib/TLibDecoder/TDecBinCoderCABAC.h
r191 r302 56 56 Void start (); 57 57 Void finish (); 58 Void flush ();59 58 60 59 Void decodeBin ( UInt& ruiBin, ContextModel& rcCtxModel ); … … 63 62 Void decodeBinTrm ( UInt& ruiBin ); 64 63 65 Void resetBac ();66 Void decodePCMAlignBits();67 64 Void xReadPCMCode ( UInt uiLength, UInt& ruiCode ); 68 65 -
branches/SHM-2.1-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp
r300 r302 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 { … … 212 184 Int iCode; 213 185 214 READ_UVLC( uiCode, "pps_pic_parameter_set_id"); pcPPS->setPPSId (uiCode); 215 READ_UVLC( uiCode, "pps_seq_parameter_set_id"); pcPPS->setSPSId (uiCode); 186 READ_UVLC( uiCode, "pps_pic_parameter_set_id"); 187 assert(uiCode <= 63); 188 pcPPS->setPPSId (uiCode); 189 190 READ_UVLC( uiCode, "pps_seq_parameter_set_id"); 191 assert(uiCode <= 15); 192 pcPPS->setSPSId (uiCode); 193 216 194 READ_FLAG( uiCode, "dependent_slice_segments_enabled_flag" ); pcPPS->setDependentSliceSegmentsEnabledFlag ( uiCode == 1 ); 217 #if L0255_MOVE_PPS_FLAGS218 195 READ_FLAG( uiCode, "output_flag_present_flag" ); pcPPS->setOutputFlagPresentFlag( uiCode==1 ); 219 196 220 197 READ_CODE(3, uiCode, "num_extra_slice_header_bits"); pcPPS->setNumExtraSliceHeaderBits(uiCode); 221 #endif222 198 READ_FLAG ( uiCode, "sign_data_hiding_flag" ); pcPPS->setSignHideFlag( uiCode ); 223 199 224 200 READ_FLAG( uiCode, "cabac_init_present_flag" ); pcPPS->setCabacInitPresentFlag( uiCode ? true : false ); 225 201 226 #if L0323_LIMIT_DEFAULT_LIST_SIZE227 202 READ_UVLC(uiCode, "num_ref_idx_l0_default_active_minus1"); 228 203 assert(uiCode <= 14); … … 232 207 assert(uiCode <= 14); 233 208 pcPPS->setNumRefIdxL1DefaultActive(uiCode+1); 234 #else235 READ_UVLC(uiCode, "num_ref_idx_l0_default_active_minus1"); pcPPS->setNumRefIdxL0DefaultActive(uiCode+1);236 READ_UVLC(uiCode, "num_ref_idx_l1_default_active_minus1"); pcPPS->setNumRefIdxL1DefaultActive(uiCode+1);237 #endif238 209 239 210 READ_SVLC(iCode, "init_qp_minus26" ); pcPPS->setPicInitQPMinus26(iCode); … … 270 241 pcPPS->setWPBiPred( uiCode==1 ); 271 242 272 #if !L0255_MOVE_PPS_FLAGS273 READ_FLAG( uiCode, "output_flag_present_flag" );274 pcPPS->setOutputFlagPresentFlag( uiCode==1 );275 #endif276 243 READ_FLAG( uiCode, "transquant_bypass_enable_flag"); 277 244 pcPPS->setTransquantBypassEnableFlag(uiCode ? true : false); … … 335 302 pcPPS->setLog2ParallelMergeLevelMinus2 (uiCode); 336 303 337 #if !L0255_MOVE_PPS_FLAGS338 READ_CODE(3, uiCode, "num_extra_slice_header_bits");339 pcPPS->setNumExtraSliceHeaderBits(uiCode);340 #endif341 304 READ_FLAG( uiCode, "slice_segment_header_extension_present_flag"); 342 305 pcPPS->setSliceHeaderExtensionPresentFlag(uiCode); … … 400 363 401 364 READ_FLAG( uiCode, "field_seq_flag"); pcVUI->setFieldSeqFlag(uiCode); 402 assert(pcVUI->getFieldSeqFlag() == false); // not supported yet403 365 404 366 READ_FLAG(uiCode, "frame_field_info_present_flag"); pcVUI->setFrameFieldInfoPresentFlag(uiCode); … … 413 375 READ_UVLC( uiCode, "def_disp_win_bottom_offset" ); defDisp.setWindowBottomOffset( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc()) ); 414 376 } 415 #if L0043_TIMING_INFO416 377 TimingInfo *timingInfo = pcVUI->getTimingInfo(); 417 378 READ_FLAG( uiCode, "vui_timing_info_present_flag"); timingInfo->setTimingInfoPresentFlag (uiCode ? true : false); … … 425 386 READ_UVLC( uiCode, "vui_num_ticks_poc_diff_one_minus1"); timingInfo->setNumTicksPocDiffOneMinus1 (uiCode); 426 387 } 427 #endif428 388 READ_FLAG( uiCode, "hrd_parameters_present_flag"); pcVUI->setHrdParametersPresentFlag(uiCode); 429 389 if( pcVUI->getHrdParametersPresentFlag() ) … … 431 391 parseHrdParameters( pcVUI->getHrdParameters(), 1, pcSPS->getMaxTLayers() - 1 ); 432 392 } 433 #if L0043_TIMING_INFO 434 } 435 #endif 436 #if !L0043_TIMING_INFO 437 READ_FLAG( uiCode, "poc_proportional_to_timing_flag" ); pcVUI->setPocProportionalToTimingFlag(uiCode ? true : false); 438 if( pcVUI->getPocProportionalToTimingFlag() && pcVUI->getHrdParameters()->getTimingInfoPresentFlag() ) 439 { 440 READ_UVLC( uiCode, "num_ticks_poc_diff_one_minus1" ); pcVUI->setNumTicksPocDiffOneMinus1(uiCode); 441 } 442 #endif 393 } 443 394 READ_FLAG( uiCode, "bitstream_restriction_flag"); pcVUI->setBitstreamRestrictionFlag(uiCode); 444 395 if (pcVUI->getBitstreamRestrictionFlag()) … … 453 404 READ_FLAG( uiCode, "motion_vectors_over_pic_boundaries_flag"); pcVUI->setMotionVectorsOverPicBoundariesFlag(uiCode); 454 405 READ_FLAG( uiCode, "restricted_ref_pic_lists_flag"); pcVUI->setRestrictedRefPicListsFlag(uiCode); 455 #if L0043_MSS_IDC456 406 READ_UVLC( uiCode, "min_spatial_segmentation_idc"); pcVUI->setMinSpatialSegmentationIdc(uiCode); 457 407 assert(uiCode < 4096); 458 #else459 READ_CODE( 8, uiCode, "min_spatial_segmentation_idc"); pcVUI->setMinSpatialSegmentationIdc(uiCode);460 #endif461 408 READ_UVLC( uiCode, "max_bytes_per_pic_denom" ); pcVUI->setMaxBytesPerPicDenom(uiCode); 462 409 READ_UVLC( uiCode, "max_bits_per_mincu_denom" ); pcVUI->setMaxBitsPerMinCuDenom(uiCode); … … 471 418 if( commonInfPresentFlag ) 472 419 { 473 #if !L0043_TIMING_INFO474 READ_FLAG( uiCode, "timing_info_present_flag" ); hrd->setTimingInfoPresentFlag( uiCode == 1 ? true : false );475 if( hrd->getTimingInfoPresentFlag() )476 {477 READ_CODE( 32, uiCode, "num_units_in_tick" ); hrd->setNumUnitsInTick( uiCode );478 READ_CODE( 32, uiCode, "time_scale" ); hrd->setTimeScale( uiCode );479 }480 #endif481 420 READ_FLAG( uiCode, "nal_hrd_parameters_present_flag" ); hrd->setNalHrdParametersPresentFlag( uiCode == 1 ? true : false ); 482 421 READ_FLAG( uiCode, "vcl_hrd_parameters_present_flag" ); hrd->setVclHrdParametersPresentFlag( uiCode == 1 ? true : false ); … … 489 428 READ_CODE( 5, uiCode, "du_cpb_removal_delay_length_minus1" ); hrd->setDuCpbRemovalDelayLengthMinus1( uiCode ); 490 429 READ_FLAG( uiCode, "sub_pic_cpb_params_in_pic_timing_sei_flag" ); hrd->setSubPicCpbParamsInPicTimingSEIFlag( uiCode == 1 ? true : false ); 491 #if L0044_DU_DPB_OUTPUT_DELAY_HRD492 430 READ_CODE( 5, uiCode, "dpb_output_delay_du_length_minus1" ); hrd->setDpbOutputDelayDuLengthMinus1( uiCode ); 493 #endif494 431 } 495 432 READ_CODE( 4, uiCode, "bit_rate_scale" ); hrd->setBitRateScale( uiCode ); … … 516 453 hrd->setFixedPicRateWithinCvsFlag( i, true ); 517 454 } 518 #if L0372519 455 hrd->setLowDelayHrdFlag( i, 0 ); // Infered to be 0 when not present 520 456 hrd->setCpbCntMinus1 ( i, 0 ); // Infered to be 0 when not present 521 #endif522 457 if( hrd->getFixedPicRateWithinCvsFlag( i ) ) 523 458 { 524 459 READ_UVLC( uiCode, "elemental_duration_in_tc_minus1" ); hrd->setPicDurationInTcMinus1( i, uiCode ); 525 460 } 526 #if L0372527 461 else 528 462 { … … 533 467 READ_UVLC( uiCode, "cpb_cnt_minus1" ); hrd->setCpbCntMinus1( i, uiCode ); 534 468 } 535 #else536 READ_FLAG( uiCode, "low_delay_hrd_flag" ); hrd->setLowDelayHrdFlag( i, uiCode == 1 ? true : false );537 READ_UVLC( uiCode, "cpb_cnt_minus1" ); hrd->setCpbCntMinus1( i, uiCode );538 #endif539 469 for( nalOrVcl = 0; nalOrVcl < 2; nalOrVcl ++ ) 540 470 { … … 548 478 if( hrd->getSubPicCpbParamsPresentFlag() ) 549 479 { 550 #if L0363_DU_BIT_RATE 480 READ_UVLC( uiCode, "cpb_size_du_value_minus1" ); hrd->setDuCpbSizeValueMinus1( i, j, nalOrVcl, uiCode ); 551 481 READ_UVLC( uiCode, "bit_rate_du_value_minus1" ); hrd->setDuBitRateValueMinus1( i, j, nalOrVcl, uiCode ); 552 #endif553 READ_UVLC( uiCode, "cpb_size_du_value_minus1" ); hrd->setDuCpbSizeValueMinus1( i, j, nalOrVcl, uiCode );554 482 } 555 483 READ_FLAG( uiCode, "cbr_flag" ); hrd->setCbrFlag( i, j, nalOrVcl, uiCode == 1 ? true : false ); … … 577 505 #endif 578 506 READ_CODE( 3, uiCode, "sps_max_sub_layers_minus1" ); pcSPS->setMaxTLayers ( uiCode+1 ); 507 assert(uiCode <= 6); 508 579 509 READ_FLAG( uiCode, "sps_temporal_id_nesting_flag" ); pcSPS->setTemporalIdNestingFlag ( uiCode > 0 ? true : false ); 580 510 #if SPS_SUB_LAYER_INFO … … 598 528 parsePTL(pcSPS->getPTL(), 1, pcSPS->getMaxTLayers() - 1); 599 529 READ_UVLC( uiCode, "sps_seq_parameter_set_id" ); pcSPS->setSPSId( uiCode ); 530 assert(uiCode <= 15); 531 600 532 READ_UVLC( uiCode, "chroma_format_idc" ); pcSPS->setChromaFormatIdc( uiCode ); 533 assert(uiCode <= 3); 601 534 // in the first version we only support chroma_format_idc equal to 1 (4:2:0), so separate_colour_plane_flag cannot appear in the bitstream 602 535 assert (uiCode == 1); … … 619 552 620 553 READ_UVLC( uiCode, "bit_depth_luma_minus8" ); 554 assert(uiCode <= 6); 621 555 pcSPS->setBitDepthY( uiCode + 8 ); 622 556 pcSPS->setQpBDOffsetY( (Int) (6*uiCode) ); 623 557 624 558 READ_UVLC( uiCode, "bit_depth_chroma_minus8" ); 559 assert(uiCode <= 6); 625 560 pcSPS->setBitDepthC( uiCode + 8 ); 626 561 pcSPS->setQpBDOffsetC( (Int) (6*uiCode) ); 627 562 628 563 READ_UVLC( uiCode, "log2_max_pic_order_cnt_lsb_minus4" ); pcSPS->setBitsForPOC( 4 + uiCode ); 564 assert(uiCode <= 12); 629 565 630 566 UInt subLayerOrderingInfoPresentFlag; 631 567 READ_FLAG(subLayerOrderingInfoPresentFlag, "sps_sub_layer_ordering_info_present_flag"); 568 632 569 for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++) 633 570 { 634 #if L0323_DPB635 571 READ_UVLC ( uiCode, "sps_max_dec_pic_buffering_minus1"); 636 572 pcSPS->setMaxDecPicBuffering( uiCode + 1, i); 637 #else638 READ_UVLC ( uiCode, "sps_max_dec_pic_buffering");639 pcSPS->setMaxDecPicBuffering( uiCode, i);640 #endif641 573 READ_UVLC ( uiCode, "sps_num_reorder_pics" ); 642 574 pcSPS->setNumReorderPics(uiCode, i); 643 READ_UVLC ( uiCode, "sps_max_latency_increase ");575 READ_UVLC ( uiCode, "sps_max_latency_increase_plus1"); 644 576 pcSPS->setMaxLatencyIncrease( uiCode, i ); 645 577 … … 698 630 699 631 READ_UVLC( uiCode, "num_short_term_ref_pic_sets" ); 632 assert(uiCode <= 64); 700 633 pcSPS->createRPSList(uiCode); 701 634 … … 823 756 READ_CODE( 16, uiCode, "vps_reserved_ffff_16bits" ); assert(uiCode == 0xffff); 824 757 parsePTL ( pcVPS->getPTL(), true, pcVPS->getMaxTLayers()-1); 825 #if SIGNAL_BITRATE_PICRATE_IN_VPS826 parseBitratePicRateInfo( pcVPS->getBitratePicrateInfo(), 0, pcVPS->getMaxTLayers() - 1);827 #endif828 758 UInt subLayerOrderingInfoPresentFlag; 829 759 READ_FLAG(subLayerOrderingInfoPresentFlag, "vps_sub_layer_ordering_info_present_flag"); 830 760 for(UInt i = 0; i <= pcVPS->getMaxTLayers()-1; i++) 831 761 { 832 #if L0323_DPB833 762 READ_UVLC( uiCode, "vps_max_dec_pic_buffering_minus1[i]" ); pcVPS->setMaxDecPicBuffering( uiCode + 1, i ); 834 #else835 READ_UVLC( uiCode, "vps_max_dec_pic_buffering[i]" ); pcVPS->setMaxDecPicBuffering( uiCode, i );836 #endif837 763 READ_UVLC( uiCode, "vps_num_reorder_pics[i]" ); pcVPS->setNumReorderPics( uiCode, i ); 838 READ_UVLC( uiCode, "vps_max_latency_increase [i]" ); pcVPS->setMaxLatencyIncrease( uiCode, i );764 READ_UVLC( uiCode, "vps_max_latency_increase_plus1[i]" ); pcVPS->setMaxLatencyIncrease( uiCode, i ); 839 765 840 766 if (!subLayerOrderingInfoPresentFlag) … … 876 802 pcVPS->deriveLayerIdListVariables(); 877 803 #endif 878 #if L0043_TIMING_INFO879 804 TimingInfo *timingInfo = pcVPS->getTimingInfo(); 880 805 READ_FLAG( uiCode, "vps_timing_info_present_flag"); timingInfo->setTimingInfoPresentFlag (uiCode ? true : false); … … 888 813 READ_UVLC( uiCode, "vps_num_ticks_poc_diff_one_minus1"); timingInfo->setNumTicksPocDiffOneMinus1 (uiCode); 889 814 } 890 #endif891 815 READ_UVLC( uiCode, "vps_num_hrd_parameters" ); pcVPS->setNumHrdParameters( uiCode ); 892 816 … … 904 828 parseHrdParameters(pcVPS->getHrdParameters(i), pcVPS->getCprmsPresentFlag( i ), pcVPS->getMaxTLayers() - 1); 905 829 } 906 #if L0043_TIMING_INFO 907 } 908 #endif 830 } 909 831 READ_FLAG( uiCode, "vps_extension_flag" ); 910 832 if (uiCode) … … 1353 1275 uiCode = 0; 1354 1276 } 1355 memcpy(rps,sps->getRPSList()->getReferencePictureSet(uiCode),sizeof(TComReferencePictureSet));1277 *rps = *(sps->getRPSList()->getReferencePictureSet(uiCode)); 1356 1278 } 1357 1279 if(sps->getLongTermRefsPresent()) … … 1446 1368 rpcSlice->setRPS(rps); 1447 1369 } 1448 1449 1450 1370 if (rpcSlice->getSPS()->getTMVPFlagsPresent()) 1451 1371 { … … 1794 1714 for (UInt idx=0; idx<numEntryPointOffsets; idx++) 1795 1715 { 1796 #if L0116_ENTRY_POINT1797 1716 READ_CODE(offsetLenMinus1+1, uiCode, "entry_point_offset_minus1"); 1798 1717 entryPointOffset[ idx ] = uiCode + 1; 1799 #else1800 READ_CODE(offsetLenMinus1+1, uiCode, "entry_point_offset");1801 entryPointOffset[ idx ] = uiCode;1802 #endif1803 1718 } 1804 1719 } … … 1822 1737 { 1823 1738 Int endOfSliceHeaderLocation = m_pcBitstream->getByteLocation(); 1739 1740 // Adjust endOfSliceHeaderLocation to account for emulation prevention bytes in the slice segment header 1741 for ( UInt curByteIdx = 0; curByteIdx<m_pcBitstream->numEmulationPreventionBytesRead(); curByteIdx++ ) 1742 { 1743 if ( m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) < endOfSliceHeaderLocation ) 1744 { 1745 endOfSliceHeaderLocation++; 1746 } 1747 } 1748 1824 1749 Int curEntryPointOffset = 0; 1825 1750 Int prevEntryPointOffset = 0; … … 1889 1814 READ_CODE( 8, uiCode, "general_level_idc" ); rpcPTL->getGeneralPTL()->setLevelIdc(uiCode); 1890 1815 1891 #if L0363_BYTE_ALIGN1892 1816 for (Int i = 0; i < maxNumSubLayersMinus1; i++) 1893 1817 { … … 1907 1831 } 1908 1832 } 1909 #endif1910 1833 1911 1834 for(Int i = 0; i < maxNumSubLayersMinus1; i++) 1912 1835 { 1913 #if !L0363_BYTE_ALIGN1914 if(profilePresentFlag)1915 {1916 READ_FLAG( uiCode, "sub_layer_profile_present_flag[i]" ); rpcPTL->setSubLayerProfilePresentFlag(i, uiCode);1917 }1918 READ_FLAG( uiCode, "sub_layer_level_present_flag[i]" ); rpcPTL->setSubLayerLevelPresentFlag (i, uiCode);1919 #endif1920 1836 if( profilePresentFlag && rpcPTL->getSubLayerProfilePresentFlag(i) ) 1921 1837 { … … 1939 1855 READ_FLAG( uiCode, "XXX_profile_compatibility_flag[][j]"); ptl->setProfileCompatibilityFlag(j, uiCode ? 1 : 0); 1940 1856 } 1941 #if L0046_CONSTRAINT_FLAGS1942 1857 READ_FLAG(uiCode, "general_progressive_source_flag"); 1943 1858 ptl->setProgressiveSourceFlag(uiCode ? true : false); … … 1955 1870 READ_CODE(16, uiCode, "XXX_reserved_zero_44bits[16..31]"); 1956 1871 READ_CODE(12, uiCode, "XXX_reserved_zero_44bits[32..43]"); 1957 #elif L0363_MORE_BITS 1958 READ_CODE(16, uiCode, "XXX_reserved_zero_48bits[0..15]"); 1959 READ_CODE(16, uiCode, "XXX_reserved_zero_48bits[16..31]"); 1960 READ_CODE(16, uiCode, "XXX_reserved_zero_48bits[32..47]"); 1961 #else 1962 READ_CODE(16, uiCode, "XXX_reserved_zero_16bits[]"); assert( uiCode == 0 ); 1963 #endif 1964 } 1965 #if SIGNAL_BITRATE_PICRATE_IN_VPS 1966 Void TDecCavlc::parseBitratePicRateInfo(TComBitRatePicRateInfo *info, Int tempLevelLow, Int tempLevelHigh) 1967 { 1968 UInt uiCode; 1969 for(Int i = tempLevelLow; i <= tempLevelHigh; i++) 1970 { 1971 READ_FLAG( uiCode, "bit_rate_info_present_flag[i]" ); info->setBitRateInfoPresentFlag(i, uiCode ? true : false); 1972 READ_FLAG( uiCode, "pic_rate_info_present_flag[i]" ); info->setPicRateInfoPresentFlag(i, uiCode ? true : false); 1973 if(info->getBitRateInfoPresentFlag(i)) 1974 { 1975 READ_CODE( 16, uiCode, "avg_bit_rate[i]" ); info->setAvgBitRate(i, uiCode); 1976 READ_CODE( 16, uiCode, "max_bit_rate[i]" ); info->setMaxBitRate(i, uiCode); 1977 } 1978 if(info->getPicRateInfoPresentFlag(i)) 1979 { 1980 READ_CODE( 2, uiCode, "constant_pic_rate_idc[i]" ); info->setConstantPicRateIdc(i, uiCode); 1981 READ_CODE( 16, uiCode, "avg_pic_rate[i]" ); info->setAvgPicRate(i, uiCode); 1982 } 1983 } 1984 } 1985 #endif 1872 } 1873 1986 1874 Void TDecCavlc::parseTerminatingBit( UInt& ruiBit ) 1987 1875 { -
branches/SHM-2.1-dev/source/Lib/TLibDecoder/TDecCAVLC.h
r226 r302 88 88 Void parsePTL ( TComPTL *rpcPTL, Bool profilePresentFlag, Int maxNumSubLayersMinus1 ); 89 89 Void parseProfileTier (ProfileTierLevel *ptl); 90 #if SIGNAL_BITRATE_PICRATE_IN_VPS91 Void parseBitratePicRateInfo(TComBitRatePicRateInfo *info, Int tempLevelLow, Int tempLevelHigh);92 #endif93 90 Void parseHrdParameters (TComHRD *hrd, Bool cprms_present_flag, UInt tempLevelHigh); 94 91 Void parseSliceHeader ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager); -
branches/SHM-2.1-dev/source/Lib/TLibDecoder/TDecEntropy.cpp
r191 r302 188 188 decodeMergeIndex( pcCU, uiPartIdx, uiSubPartIdx, uiDepth ); 189 189 UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx); 190 #if 0 //REF_IDX_FRAMEWORK // HM bug fix191 if(uiPartIdx)192 {193 for(UInt ui=0; ui<uiMergeIndex+1; ui++)194 {195 cMvFieldNeighbours[(ui<<1)].setMvField(TComMv(), NOT_VALID);196 cMvFieldNeighbours[(ui<<1)+1].setMvField(TComMv(), NOT_VALID);197 }198 }199 #endif200 190 if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && ePartSize != SIZE_2Nx2N && pcSubCU->getWidth( 0 ) <= 8 ) 201 191 { -
branches/SHM-2.1-dev/source/Lib/TLibDecoder/TDecSbac.cpp
r191 r302 158 158 UInt uiBit; 159 159 m_pcTDecBinIf->decodeBinTrm(uiBit); 160 assert(uiBit); // end_of_sub_stream_one_bit must be equal to 1 160 161 m_pcTDecBinIf->finish(); 161 162 m_pcBitstream->readOutTrailingBits(); … … 196 197 { 197 198 m_pcTDecBinIf->decodeBinTrm( ruiBit ); 199 if ( ruiBit ) 200 { 201 m_pcTDecBinIf->finish(); 202 } 198 203 } 199 204 … … 318 323 { 319 324 UInt uiSymbol; 320 Bool readPCMSampleFlag = false;321 325 322 326 m_pcTDecBinIf->decodeBinTrm(uiSymbol); … … 324 328 if (uiSymbol) 325 329 { 326 readPCMSampleFlag = true;327 m_pcTDecBinIf->decodePCMAlignBits();328 }329 330 if (readPCMSampleFlag == true)331 {332 330 Bool bIpcmFlag = true; 333 331 … … 395 393 } 396 394 397 m_pcTDecBinIf->resetBac();395 m_pcTDecBinIf->start(); 398 396 } 399 397 } … … 681 679 else 682 680 { 683 intraPredMode = 0;684 681 m_pcTDecBinIf->decodeBinsEP( symbol, 5 ); 685 682 intraPredMode = symbol; … … 917 914 else 918 915 { 919 iDQp=0;920 916 qp = pcCU->getRefQP(uiAbsPartIdx); 921 917 } … … 1102 1098 1103 1099 //===== decode significance flags ===== 1104 UInt uiScanPosLast = uiBlkPosLast;1100 UInt uiScanPosLast; 1105 1101 const UInt *scan = g_auiSigLastScan[ uiScanIdx ][ uiLog2BlockSize-1 ]; 1106 1102 for( uiScanPosLast = 0; uiScanPosLast < uiMaxNumCoeffM1; uiScanPosLast++ ) -
branches/SHM-2.1-dev/source/Lib/TLibDecoder/TDecSlice.cpp
r191 r302 384 384 pcSbacDecoders[uiSubStrm].load(pcSbacDecoder); 385 385 386 if ( uiCol == rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(iCUAddr))->getRightEdgePosInCU() 387 && pcSlice->getPPS()->getEntropyCodingSyncEnabledFlag() 388 && !uiIsLast ) 389 { 390 // Parse end_of_substream_one_bit for WPP case 391 UInt binVal; 392 pcSbacDecoder->parseTerminatingBit( binVal ); 393 assert( binVal ); 394 } 395 386 396 //Store probabilities of second LCU in line into buffer 387 397 if ( (uiCol == uiTileLCUX+1)&& (depSliceSegmentsEnabled || (pcSlice->getPPS()->getNumSubstreams() > 1)) && (pcSlice->getPPS()->getEntropyCodingSyncEnabledFlag()) ) -
branches/SHM-2.1-dev/source/Lib/TLibDecoder/TDecTop.cpp
r297 r302 241 241 } 242 242 243 #if L0323_DPB 244 m_iMaxRefPicNum = pcSlice->getSPS()->getMaxDecPicBuffering(pcSlice->getTLayer())+pcSlice->getSPS()->getNumReorderPics(pcSlice->getTLayer()); // m_uiMaxDecPicBuffering has the space for the picture currently being decoded 245 #else 246 m_iMaxRefPicNum = pcSlice->getSPS()->getMaxDecPicBuffering(pcSlice->getTLayer())+pcSlice->getSPS()->getNumReorderPics(pcSlice->getTLayer()) + 1; // +1 to have space for the picture currently being decoded 247 #endif 243 m_iMaxRefPicNum = pcSlice->getSPS()->getMaxDecPicBuffering(pcSlice->getTLayer()); // m_uiMaxDecPicBuffering has the space for the picture currently being decoded 248 244 if (m_cListPic.size() < (UInt)m_iMaxRefPicNum) 249 245 { … … 476 472 m_apcSlicePilot->setPPS(pps); 477 473 m_apcSlicePilot->setSPS(sps); 478 479 474 pps->setSPS(sps); 480 475 pps->setNumSubstreams(pps->getEntropyCodingSyncEnabledFlag() ? ((sps->getPicHeightInLumaSamples() + sps->getMaxCUHeight() - 1) / sps->getMaxCUHeight()) * (pps->getNumColumnsMinus1() + 1) : 1); … … 991 986 //--------------- 992 987 pcSlice->setRefPOCList(); 993 #if !L0034_COMBINED_LIST_CLEANUP994 pcSlice->setNoBackPredFlag( false );995 if ( pcSlice->getSliceType() == B_SLICE )996 {997 if ( pcSlice->getNumRefIdx(RefPicList( 0 ) ) == pcSlice->getNumRefIdx(RefPicList( 1 ) ) )998 {999 pcSlice->setNoBackPredFlag( true );1000 for ( i=0; i < pcSlice->getNumRefIdx(RefPicList( 1 ) ); i++ )1001 {1002 if ( pcSlice->getRefPOC(RefPicList(1), i) != pcSlice->getRefPOC(RefPicList(0), i) )1003 {1004 pcSlice->setNoBackPredFlag( false );1005 break;1006 }1007 }1008 }1009 }1010 #endif1011 988 } 1012 989 -
branches/SHM-2.1-dev/source/Lib/TLibEncoder/SEIwrite.cpp
r292 r302 84 84 fprintf( g_hTrace, "=========== Decoding Unit Information SEI message ===========\n"); 85 85 break; 86 #if J0149_TONE_MAPPING_SEI87 86 case SEI::TONE_MAPPING_INFO: 88 87 fprintf( g_hTrace, "=========== Tone Mapping Info SEI message ===========\n"); 89 88 break; 90 #endif91 89 #if M0043_LAYERS_PRESENT_SEI 92 90 case SEI::LAYERS_PRESENT: … … 94 92 break; 95 93 #endif 96 #if L0208_SOP_DESCRIPTION_SEI97 94 case SEI::SOP_DESCRIPTION: 98 95 fprintf( g_hTrace, "=========== SOP Description SEI message ===========\n"); 99 96 break; 100 #endif101 #if K0180_SCALABLE_NESTING_SEI102 97 case SEI::SCALABLE_NESTING: 103 98 fprintf( g_hTrace, "=========== Scalable Nesting SEI message ===========\n"); 104 99 break; 105 #endif106 100 default: 107 101 fprintf( g_hTrace, "=========== Unknown SEI message ===========\n"); … … 111 105 #endif 112 106 113 #if K0180_SCALABLE_NESTING_SEI114 107 void SEIWriter::xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComSPS *sps) 115 #else116 void SEIWriter::xWriteSEIpayloadData(const SEI& sei, TComSPS *sps)117 #endif118 108 { 119 109 switch (sei.payloadType()) … … 152 142 xWriteSEIGradualDecodingRefreshInfo(*static_cast<const SEIGradualDecodingRefreshInfo*>(&sei)); 153 143 break; 154 #if J0149_TONE_MAPPING_SEI155 144 case SEI::TONE_MAPPING_INFO: 156 145 xWriteSEIToneMappingInfo(*static_cast<const SEIToneMappingInfo*>(&sei)); 157 146 break; 158 #endif159 147 #if M0043_LAYERS_PRESENT_SEI 160 148 case SEI::LAYERS_PRESENT: … … 162 150 break; 163 151 #endif 164 #if L0208_SOP_DESCRIPTION_SEI165 152 case SEI::SOP_DESCRIPTION: 166 153 xWriteSEISOPDescription(*static_cast<const SEISOPDescription*>(&sei)); 167 154 break; 168 #endif169 #if K0180_SCALABLE_NESTING_SEI170 155 case SEI::SCALABLE_NESTING: 171 156 xWriteSEIScalableNesting(bs, *static_cast<const SEIScalableNesting*>(&sei), sps); 172 157 break; 173 #endif174 158 default: 175 159 assert(!"Unhandled SEI message"); … … 190 174 191 175 192 #if K0180_SCALABLE_NESTING_SEI193 194 176 #if ENC_DEC_TRACE 195 177 Bool traceEnable = g_HLSTraceEnable; … … 201 183 #endif 202 184 203 #else204 205 #if ENC_DEC_TRACE206 g_HLSTraceEnable = false;207 #endif208 xWriteSEIpayloadData(sei, sps);209 #if ENC_DEC_TRACE210 g_HLSTraceEnable = true;211 #endif212 213 #endif214 215 185 UInt payload_data_num_bits = bs_count.getNumberOfWrittenBits(); 216 186 assert(0 == payload_data_num_bits % 8); … … 219 189 220 190 #if ENC_DEC_TRACE 221 #if K0180_SCALABLE_NESTING_SEI222 191 if (g_HLSTraceEnable) 223 #endif224 192 xTraceSEIHeader(); 225 193 #endif … … 241 209 /* payloadData */ 242 210 #if ENC_DEC_TRACE 243 #if K0180_SCALABLE_NESTING_SEI244 211 if (g_HLSTraceEnable) 245 #endif246 212 xTraceSEIMessageType(sei.payloadType()); 247 213 #endif 248 214 249 #if K0180_SCALABLE_NESTING_SEI250 215 xWriteSEIpayloadData(bs, sei, sps); 251 #else252 xWriteSEIpayloadData(sei, sps);253 #endif254 216 } 255 217 … … 306 268 { 307 269 WRITE_CODE(sei.activeVPSId, 4, "active_vps_id"); 308 #if L0047_APS_FLAGS309 270 WRITE_FLAG(sei.m_fullRandomAccessFlag, "full_random_access_flag"); 310 271 WRITE_FLAG(sei.m_noParamSetUpdateFlag, "no_param_set_update_flag"); 311 #endif312 272 WRITE_UVLC(sei.numSpsIdsMinus1, "num_sps_ids_minus1"); 313 273 … … 340 300 WRITE_CODE( sei.m_duSptCpbRemovalDelay, (vui->getHrdParameters()->getDuCpbRemovalDelayLengthMinus1() + 1), "du_spt_cpb_removal_delay"); 341 301 } 342 #if L0044_DU_DPB_OUTPUT_DELAY_HRD343 302 WRITE_FLAG( sei.m_dpbOutputDuDelayPresentFlag, "dpb_output_du_delay_present_flag"); 344 303 if(sei.m_dpbOutputDuDelayPresentFlag) … … 346 305 WRITE_CODE(sei.m_picSptDpbOutputDuDelay, vui->getHrdParameters()->getDpbOutputDelayDuLengthMinus1() + 1, "pic_spt_dpb_output_du_delay"); 347 306 } 348 #endif349 307 xWriteByteAlign(); 350 308 } … … 361 319 WRITE_FLAG( sei.m_rapCpbParamsPresentFlag, "rap_cpb_params_present_flag" ); 362 320 } 363 #if L0328_SPLICING364 321 WRITE_FLAG( sei.m_concatenationFlag, "concatenation_flag"); 365 322 WRITE_CODE( sei.m_auCpbRemovalDelayDelta - 1, ( hrd->getCpbRemovalDelayLengthMinus1() + 1 ), "au_cpb_removal_delay_delta_minus1" ); 366 #endif367 #if L0044_CPB_DPB_DELAY_OFFSET368 323 if( sei.m_rapCpbParamsPresentFlag ) 369 324 { … … 371 326 WRITE_CODE( sei.m_dpbDelayOffset, hrd->getDpbOutputDelayLengthMinus1() + 1, "dpb_delay_offset" ); 372 327 } 373 #endif374 328 for( nalOrVcl = 0; nalOrVcl < 2; nalOrVcl ++ ) 375 329 { … … 397 351 TComHRD *hrd = vui->getHrdParameters(); 398 352 399 #if !L0045_CONDITION_SIGNALLING400 // This condition was probably OK before the pic_struct, progressive_source_idc, duplicate_flag were added401 if( !hrd->getNalHrdParametersPresentFlag() && !hrd->getVclHrdParametersPresentFlag() )402 return;403 #endif404 353 if( vui->getFrameFieldInfoPresentFlag() ) 405 354 { 406 355 WRITE_CODE( sei.m_picStruct, 4, "pic_struct" ); 407 #if L0046_RENAME_PROG_SRC_IDC408 356 WRITE_CODE( sei.m_sourceScanType, 2, "source_scan_type" ); 409 #else410 WRITE_CODE( sei.m_progressiveSourceIdc, 2, "progressive_source_idc" );411 #endif412 357 WRITE_FLAG( sei.m_duplicateFlag ? 1 : 0, "duplicate_flag" ); 413 358 } 414 359 415 #if L0045_CONDITION_SIGNALLING416 360 if( hrd->getCpbDpbDelaysPresentFlag() ) 417 361 { 418 #endif419 362 WRITE_CODE( sei.m_auCpbRemovalDelay - 1, ( hrd->getCpbRemovalDelayLengthMinus1() + 1 ), "au_cpb_removal_delay_minus1" ); 420 363 WRITE_CODE( sei.m_picDpbOutputDelay, ( hrd->getDpbOutputDelayLengthMinus1() + 1 ), "pic_dpb_output_delay" ); 421 #if L0044_DU_DPB_OUTPUT_DELAY_HRD422 364 if(hrd->getSubPicCpbParamsPresentFlag()) 423 365 { 424 366 WRITE_CODE(sei.m_picDpbOutputDuDelay, hrd->getDpbOutputDelayDuLengthMinus1()+1, "pic_dpb_output_du_delay" ); 425 367 } 426 #endif427 368 if( hrd->getSubPicCpbParamsPresentFlag() && hrd->getSubPicCpbParamsInPicTimingSEIFlag() ) 428 369 { … … 442 383 } 443 384 } 444 #if L0045_CONDITION_SIGNALLING 445 } 446 #endif 385 } 447 386 xWriteByteAlign(); 448 387 } … … 481 420 482 421 WRITE_CODE( sei.m_arrangementReservedByte, 8, "frame_packing_arrangement_reserved_byte" ); 483 #if L0045_PERSISTENCE_FLAGS484 422 WRITE_FLAG( sei.m_arrangementPersistenceFlag, "frame_packing_arrangement_persistence_flag" ); 485 #else486 WRITE_UVLC( sei.m_arrangementRepetetionPeriod, "frame_packing_arrangement_repetition_period" );487 #endif488 423 } 489 424 … … 493 428 } 494 429 495 #if J0149_TONE_MAPPING_SEI496 430 Void SEIWriter::xWriteSEIToneMappingInfo(const SEIToneMappingInfo& sei) 497 431 { … … 565 499 xWriteByteAlign(); 566 500 } 567 #endif568 501 569 502 Void SEIWriter::xWriteSEIDisplayOrientation(const SEIDisplayOrientation &sei) … … 575 508 WRITE_FLAG( sei.verFlip, "ver_flip" ); 576 509 WRITE_CODE( sei.anticlockwiseRotation, 16, "anticlockwise_rotation" ); 577 #if L0045_PERSISTENCE_FLAGS578 510 WRITE_FLAG( sei.persistenceFlag, "display_orientation_persistence_flag" ); 579 #else580 WRITE_UVLC( sei.repetitionPeriod, "display_orientation_repetition_period" );581 #endif582 #if !REMOVE_SINGLE_SEI_EXTENSION_FLAGS583 WRITE_FLAG( sei.extensionFlag, "display_orientation_extension_flag" );584 assert( !sei.extensionFlag );585 #endif586 511 } 587 512 xWriteByteAlign(); … … 613 538 #endif 614 539 615 #if L0208_SOP_DESCRIPTION_SEI616 540 Void SEIWriter::xWriteSEISOPDescription(const SEISOPDescription& sei) 617 541 { … … 634 558 xWriteByteAlign(); 635 559 } 636 #endif 637 638 #if K0180_SCALABLE_NESTING_SEI 560 639 561 Void SEIWriter::xWriteSEIScalableNesting(TComBitIf& bs, const SEIScalableNesting& sei, TComSPS *sps) 640 562 { … … 678 600 } 679 601 } 680 #endif681 602 682 603 Void SEIWriter::xWriteByteAlign() -
branches/SHM-2.1-dev/source/Lib/TLibEncoder/SEIwrite.h
r292 r302 50 50 51 51 protected: 52 #if K0180_SCALABLE_NESTING_SEI53 52 Void xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComSPS *sps); 54 #else55 Void xWriteSEIpayloadData(const SEI& sei, TComSPS *sps);56 #endif57 53 Void xWriteSEIuserDataUnregistered(const SEIuserDataUnregistered &sei); 58 54 Void xWriteSEIActiveParameterSets(const SEIActiveParameterSets& sei); … … 67 63 Void xWriteSEITemporalLevel0Index(const SEITemporalLevel0Index &sei); 68 64 Void xWriteSEIGradualDecodingRefreshInfo(const SEIGradualDecodingRefreshInfo &sei); 69 #if J0149_TONE_MAPPING_SEI70 65 Void xWriteSEIToneMappingInfo(const SEIToneMappingInfo& sei); 71 #endif72 66 #if M0043_LAYERS_PRESENT_SEI 73 67 Void xWriteSEILayersPresent(const SEILayersPresent& sei); 74 68 #endif 75 #if L0208_SOP_DESCRIPTION_SEI76 69 Void xWriteSEISOPDescription(const SEISOPDescription& sei); 77 #endif78 #if K0180_SCALABLE_NESTING_SEI79 70 Void xWriteSEIScalableNesting(TComBitIf& bs, const SEIScalableNesting& sei, TComSPS *sps); 80 #endif81 71 Void xWriteByteAlign(); 82 72 }; -
branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncCavlc.cpp
r300 r302 39 39 #include "TEncCavlc.h" 40 40 #include "SEIwrite.h" 41 #include <iostream> 41 42 42 //! \ingroup TLibEncoder 43 43 //! \{ … … 163 163 WRITE_UVLC( pcPPS->getSPSId(), "pps_seq_parameter_set_id" ); 164 164 WRITE_FLAG( pcPPS->getDependentSliceSegmentsEnabledFlag() ? 1 : 0, "dependent_slice_segments_enabled_flag" ); 165 #if L0255_MOVE_PPS_FLAGS166 165 WRITE_FLAG( pcPPS->getOutputFlagPresentFlag() ? 1 : 0, "output_flag_present_flag" ); 167 166 WRITE_CODE( pcPPS->getNumExtraSliceHeaderBits(), 3, "num_extra_slice_header_bits"); 168 #endif169 167 WRITE_FLAG( pcPPS->getSignHideFlag(), "sign_data_hiding_flag" ); 170 168 WRITE_FLAG( pcPPS->getCabacInitPresentFlag() ? 1 : 0, "cabac_init_present_flag" ); … … 186 184 WRITE_FLAG( pcPPS->getUseWP() ? 1 : 0, "weighted_pred_flag" ); // Use of Weighting Prediction (P_SLICE) 187 185 WRITE_FLAG( pcPPS->getWPBiPred() ? 1 : 0, "weighted_bipred_flag" ); // Use of Weighting Bi-Prediction (B_SLICE) 188 #if !L0255_MOVE_PPS_FLAGS189 WRITE_FLAG( pcPPS->getOutputFlagPresentFlag() ? 1 : 0, "output_flag_present_flag" );190 #endif191 186 WRITE_FLAG( pcPPS->getTransquantBypassEnableFlag() ? 1 : 0, "transquant_bypass_enable_flag" ); 192 187 WRITE_FLAG( pcPPS->getTilesEnabledFlag() ? 1 : 0, "tiles_enabled_flag" ); … … 235 230 WRITE_FLAG( pcPPS->getListsModificationPresentFlag(), "lists_modification_present_flag"); 236 231 WRITE_UVLC( pcPPS->getLog2ParallelMergeLevelMinus2(), "log2_parallel_merge_level_minus2"); 237 #if !L0255_MOVE_PPS_FLAGS238 WRITE_CODE( pcPPS->getNumExtraSliceHeaderBits(), 3, "num_extra_slice_header_bits");239 #endif240 232 WRITE_FLAG( pcPPS->getSliceHeaderExtensionPresentFlag() ? 1 : 0, "slice_segment_header_extension_present_flag"); 241 233 WRITE_FLAG( 0, "pps_extension_flag" ); … … 296 288 WRITE_UVLC(defaultDisplayWindow.getWindowBottomOffset(), "def_disp_win_bottom_offset"); 297 289 } 298 #if L0043_TIMING_INFO299 290 TimingInfo *timingInfo = pcVUI->getTimingInfo(); 300 291 WRITE_FLAG(timingInfo->getTimingInfoPresentFlag(), "vui_timing_info_present_flag"); … … 308 299 WRITE_UVLC(timingInfo->getNumTicksPocDiffOneMinus1(), "vui_num_ticks_poc_diff_one_minus1"); 309 300 } 310 #endif311 301 WRITE_FLAG(pcVUI->getHrdParametersPresentFlag(), "hrd_parameters_present_flag"); 312 302 if( pcVUI->getHrdParametersPresentFlag() ) … … 314 304 codeHrdParameters(pcVUI->getHrdParameters(), 1, pcSPS->getMaxTLayers() - 1 ); 315 305 } 316 #if L0043_TIMING_INFO 317 } 318 #endif 319 #if !L0043_TIMING_INFO 320 WRITE_FLAG( pcVUI->getPocProportionalToTimingFlag(), "poc_proportional_to_timing_flag" ); 321 if( pcVUI->getPocProportionalToTimingFlag() && pcVUI->getHrdParameters()->getTimingInfoPresentFlag() ) 322 { 323 WRITE_UVLC( pcVUI->getNumTicksPocDiffOneMinus1(), "num_ticks_poc_diff_one_minus1" ); 324 } 325 #endif 306 } 326 307 327 308 WRITE_FLAG(pcVUI->getBitstreamRestrictionFlag(), "bitstream_restriction_flag"); … … 337 318 WRITE_FLAG(pcVUI->getMotionVectorsOverPicBoundariesFlag(), "motion_vectors_over_pic_boundaries_flag"); 338 319 WRITE_FLAG(pcVUI->getRestrictedRefPicListsFlag(), "restricted_ref_pic_lists_flag"); 339 #if L0043_MSS_IDC340 320 WRITE_UVLC(pcVUI->getMinSpatialSegmentationIdc(), "min_spatial_segmentation_idc"); 341 #else342 WRITE_CODE(pcVUI->getMinSpatialSegmentationIdc(), 8, "min_spatial_segmentation_idc");343 #endif344 321 WRITE_UVLC(pcVUI->getMaxBytesPerPicDenom(), "max_bytes_per_pic_denom"); 345 322 WRITE_UVLC(pcVUI->getMaxBitsPerMinCuDenom(), "max_bits_per_mincu_denom"); … … 353 330 if( commonInfPresentFlag ) 354 331 { 355 #if !L0043_TIMING_INFO356 WRITE_FLAG( hrd->getTimingInfoPresentFlag() ? 1 : 0, "timing_info_present_flag" );357 if( hrd->getTimingInfoPresentFlag() )358 {359 WRITE_CODE( hrd->getNumUnitsInTick(), 32, "num_units_in_tick" );360 WRITE_CODE( hrd->getTimeScale(), 32, "time_scale" );361 }362 #endif363 332 WRITE_FLAG( hrd->getNalHrdParametersPresentFlag() ? 1 : 0 , "nal_hrd_parameters_present_flag" ); 364 333 WRITE_FLAG( hrd->getVclHrdParametersPresentFlag() ? 1 : 0 , "vcl_hrd_parameters_present_flag" ); … … 371 340 WRITE_CODE( hrd->getDuCpbRemovalDelayLengthMinus1(), 5, "du_cpb_removal_delay_length_minus1" ); 372 341 WRITE_FLAG( hrd->getSubPicCpbParamsInPicTimingSEIFlag() ? 1 : 0, "sub_pic_cpb_params_in_pic_timing_sei_flag" ); 373 #if L0044_DU_DPB_OUTPUT_DELAY_HRD374 342 WRITE_CODE( hrd->getDpbOutputDelayDuLengthMinus1(), 5, "dpb_output_delay_du_length_minus1" ); 375 #endif376 343 } 377 344 WRITE_CODE( hrd->getBitRateScale(), 4, "bit_rate_scale" ); … … 402 369 WRITE_UVLC( hrd->getPicDurationInTcMinus1( i ), "elemental_duration_in_tc_minus1"); 403 370 } 404 #if L0372405 371 else 406 372 { … … 411 377 WRITE_UVLC( hrd->getCpbCntMinus1( i ), "cpb_cnt_minus1"); 412 378 } 413 #else414 WRITE_FLAG( hrd->getLowDelayHrdFlag( i ) ? 1 : 0, "low_delay_hrd_flag");415 WRITE_UVLC( hrd->getCpbCntMinus1( i ), "cpb_cnt_minus1");416 #endif417 379 418 380 for( nalOrVcl = 0; nalOrVcl < 2; nalOrVcl ++ ) … … 427 389 if( hrd->getSubPicCpbParamsPresentFlag() ) 428 390 { 429 #if L0363_DU_BIT_RATE 391 WRITE_UVLC( hrd->getDuCpbSizeValueMinus1( i, j, nalOrVcl ), "cpb_size_du_value_minus1"); 430 392 WRITE_UVLC( hrd->getDuBitRateValueMinus1( i, j, nalOrVcl ), "bit_rate_du_value_minus1"); 431 #endif432 WRITE_UVLC( hrd->getDuCpbSizeValueMinus1( i, j, nalOrVcl ), "cpb_size_du_value_minus1");433 393 } 434 394 WRITE_FLAG( hrd->getCbrFlag( i, j, nalOrVcl ) ? 1 : 0, "cbr_flag"); … … 486 446 for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++) 487 447 { 488 #if L0323_DPB489 448 WRITE_UVLC( pcSPS->getMaxDecPicBuffering(i) - 1, "sps_max_dec_pic_buffering_minus1[i]" ); 490 #else491 WRITE_UVLC( pcSPS->getMaxDecPicBuffering(i), "sps_max_dec_pic_buffering[i]" );492 #endif493 449 WRITE_UVLC( pcSPS->getNumReorderPics(i), "sps_num_reorder_pics[i]" ); 494 WRITE_UVLC( pcSPS->getMaxLatencyIncrease(i), "sps_max_latency_increase [i]" );450 WRITE_UVLC( pcSPS->getMaxLatencyIncrease(i), "sps_max_latency_increase_plus1[i]" ); 495 451 if (!subLayerOrderingInfoPresentFlag) 496 452 { … … 639 595 WRITE_CODE( 0xffff, 16, "vps_reserved_ffff_16bits" ); 640 596 codePTL( pcVPS->getPTL(), true, pcVPS->getMaxTLayers() - 1 ); 641 #if SIGNAL_BITRATE_PICRATE_IN_VPS642 codeBitratePicRateInfo(pcVPS->getBitratePicrateInfo(), 0, pcVPS->getMaxTLayers() - 1);643 #endif644 597 const Bool subLayerOrderingInfoPresentFlag = 1; 645 598 WRITE_FLAG(subLayerOrderingInfoPresentFlag, "vps_sub_layer_ordering_info_present_flag"); 646 599 for(UInt i=0; i <= pcVPS->getMaxTLayers()-1; i++) 647 600 { 648 #if L0323_DPB649 601 WRITE_UVLC( pcVPS->getMaxDecPicBuffering(i) - 1, "vps_max_dec_pic_buffering_minus1[i]" ); 650 #else651 WRITE_UVLC( pcVPS->getMaxDecPicBuffering(i), "vps_max_dec_pic_buffering[i]" );652 #endif653 602 WRITE_UVLC( pcVPS->getNumReorderPics(i), "vps_num_reorder_pics[i]" ); 654 WRITE_UVLC( pcVPS->getMaxLatencyIncrease(i), "vps_max_latency_increase [i]" );603 WRITE_UVLC( pcVPS->getMaxLatencyIncrease(i), "vps_max_latency_increase_plus1[i]" ); 655 604 if (!subLayerOrderingInfoPresentFlag) 656 605 { … … 693 642 pcVPS->deriveLayerIdListVariables(); 694 643 #endif 695 #if L0043_TIMING_INFO696 644 TimingInfo *timingInfo = pcVPS->getTimingInfo(); 697 645 WRITE_FLAG(timingInfo->getTimingInfoPresentFlag(), "vps_timing_info_present_flag"); … … 705 653 WRITE_UVLC(timingInfo->getNumTicksPocDiffOneMinus1(), "vps_num_ticks_poc_diff_one_minus1"); 706 654 } 707 #endif708 655 pcVPS->setNumHrdParameters( 0 ); 709 656 WRITE_UVLC( pcVPS->getNumHrdParameters(), "vps_num_hrd_parameters" ); … … 724 671 codeHrdParameters(pcVPS->getHrdParameters(i), pcVPS->getCprmsPresentFlag( i ), pcVPS->getMaxTLayers() - 1); 725 672 } 726 #if L0043_TIMING_INFO 727 } 728 #endif 673 } 729 674 #if !VPS_EXTNS 730 675 WRITE_FLAG( 0, "vps_extension_flag" ); … … 994 939 995 940 #if FIX1071 996 // Deal withbitstream restriction stating that:997 // –If the current picture is a BLA or CRA picture, the value of NumPocTotalCurr shall be equal to 0.941 // check for bitstream restriction stating that: 942 // If the current picture is a BLA or CRA picture, the value of NumPocTotalCurr shall be equal to 0. 998 943 // Ideally this process should not be repeated for each slice in a picture 999 TComReferencePictureSet altRps;1000 Bool useAltRps = false;1001 944 #if SVC_EXTENSION 1002 945 if( pcSlice->getLayerId() == 0 ) 1003 946 #endif 1004 if (pcSlice->getRapPicFlag()) 1005 { 1006 for (Int picIdx = 0; !useAltRps && picIdx < rps->getNumberOfPictures(); picIdx++) 1007 { 1008 useAltRps = rps->getUsed(picIdx); 1009 } 1010 if (useAltRps) 1011 { 1012 memcpy(&altRps, rps, sizeof(TComReferencePictureSet)); 1013 rps = &altRps; 1014 for (Int picIdx = 0; picIdx < rps->getNumberOfPictures(); picIdx++) 1015 { 1016 rps->setUsed(picIdx, false); 1017 } 1018 } 1019 } 1020 1021 if(pcSlice->getRPSidx() < 0 || useAltRps) 1022 #else 947 if (pcSlice->isIRAP()) 948 { 949 for (Int picIdx = 0; picIdx < rps->getNumberOfPictures(); picIdx++) 950 { 951 assert (!rps->getUsed(picIdx)); 952 } 953 } 954 #endif 955 1023 956 if(pcSlice->getRPSidx() < 0) 1024 #endif1025 957 { 1026 958 WRITE_FLAG( 0, "short_term_ref_pic_set_sps_flag"); … … 1114 1046 } 1115 1047 } 1116 1117 1048 if (pcSlice->getSPS()->getTMVPFlagsPresent()) 1118 1049 { … … 1326 1257 } 1327 1258 } 1328 1329 1259 if(pcSlice->getPPS()->getSliceHeaderExtensionPresentFlag()) 1330 1260 { … … 1341 1271 WRITE_CODE( pcPTL->getGeneralPTL()->getLevelIdc(), 8, "general_level_idc" ); 1342 1272 1343 #if L0363_BYTE_ALIGN1344 1273 for (Int i = 0; i < maxNumSubLayersMinus1; i++) 1345 1274 { … … 1359 1288 } 1360 1289 } 1361 #endif1362 1290 1363 1291 for(Int i = 0; i < maxNumSubLayersMinus1; i++) 1364 1292 { 1365 #if !L0363_BYTE_ALIGN1366 if(profilePresentFlag)1367 {1368 WRITE_FLAG( pcPTL->getSubLayerProfilePresentFlag(i), "sub_layer_profile_present_flag[i]" );1369 }1370 1371 WRITE_FLAG( pcPTL->getSubLayerLevelPresentFlag(i), "sub_layer_level_present_flag[i]" );1372 #endif1373 1293 if( profilePresentFlag && pcPTL->getSubLayerProfilePresentFlag(i) ) 1374 1294 { … … 1391 1311 } 1392 1312 1393 #if L0046_CONSTRAINT_FLAGS1394 1313 WRITE_FLAG(ptl->getProgressiveSourceFlag(), "general_progressive_source_flag"); 1395 1314 WRITE_FLAG(ptl->getInterlacedSourceFlag(), "general_interlaced_source_flag"); … … 1400 1319 WRITE_CODE(0 , 16, "XXX_reserved_zero_44bits[16..31]"); 1401 1320 WRITE_CODE(0 , 12, "XXX_reserved_zero_44bits[32..43]"); 1402 #elif L0363_MORE_BITS 1403 WRITE_CODE(0 , 16, "XXX_reserved_zero_48bits[0..15]"); 1404 WRITE_CODE(0 , 16, "XXX_reserved_zero_48bits[16..31]"); 1405 WRITE_CODE(0 , 16, "XXX_reserved_zero_48bits[32..47]"); 1406 #else 1407 WRITE_CODE(0 , 16, "XXX_reserved_zero_16bits[]"); 1408 #endif 1409 } 1410 #if SIGNAL_BITRATE_PICRATE_IN_VPS 1411 Void TEncCavlc::codeBitratePicRateInfo(TComBitRatePicRateInfo *info, Int tempLevelLow, Int tempLevelHigh) 1412 { 1413 for(Int i = tempLevelLow; i <= tempLevelHigh; i++) 1414 { 1415 WRITE_FLAG( info->getBitRateInfoPresentFlag(i), "bit_rate_info_present_flag[i]" ); 1416 WRITE_FLAG( info->getPicRateInfoPresentFlag(i), "pic_rate_info_present_flag[i]" ); 1417 if(info->getBitRateInfoPresentFlag(i)) 1418 { 1419 WRITE_CODE( info->getAvgBitRate(i), 16, "avg_bit_rate[i]" ); 1420 WRITE_CODE( info->getMaxBitRate(i), 16, "max_bit_rate[i]" ); 1421 } 1422 if(info->getPicRateInfoPresentFlag(i)) 1423 { 1424 WRITE_CODE( info->getConstantPicRateIdc(i), 2, "constant_pic_rate_idc[i]" ); 1425 WRITE_CODE( info->getAvgPicRate(i), 16, "avg_pic_rate[i]" ); 1426 } 1427 } 1428 } 1429 #endif 1321 } 1322 1430 1323 /** 1431 1324 - write wavefront substreams sizes for the slice header. … … 1497 1390 for (UInt idx=0; idx<numEntryPointOffsets; idx++) 1498 1391 { 1499 #if L0116_ENTRY_POINT1500 1392 WRITE_CODE(entryPointOffset[ idx ]-1, offsetLenMinus1+1, "entry_point_offset_minus1"); 1501 #else1502 WRITE_CODE(entryPointOffset[ idx ], offsetLenMinus1+1, "entry_point_offset");1503 #endif1504 1393 } 1505 1394 -
branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncCavlc.h
r226 r302 96 96 Void codePTL ( TComPTL* pcPTL, Bool profilePresentFlag, Int maxNumSubLayersMinus1); 97 97 Void codeProfileTier ( ProfileTierLevel* ptl ); 98 #if SIGNAL_BITRATE_PICRATE_IN_VPS99 Void codeBitratePicRateInfo(TComBitRatePicRateInfo *info, Int tempLevelLow, Int tempLevelHigh);100 #endif101 98 Void codeHrdParameters ( TComHRD *hrd, Bool commonInfPresentFlag, UInt maxNumSubLayersMinus1 ); 102 99 Void codeTilesWPPEntryPoint( TComSlice* pSlice ); -
branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncCfg.h
r296 r302 116 116 Level::Tier m_levelTier; 117 117 Level::Name m_level; 118 #if L0046_CONSTRAINT_FLAGS119 118 Bool m_progressiveSourceFlag; 120 119 Bool m_interlacedSourceFlag; 121 120 Bool m_nonPackedConstraintFlag; 122 121 Bool m_frameOnlyConstraintFlag; 123 #endif124 122 125 123 //====== Coding Structure ======== … … 169 167 Int m_loopFilterTcOffsetDiv2; 170 168 Bool m_DeblockingFilterControlPresent; 171 #if L0386_DB_METRIC172 169 Bool m_DeblockingFilterMetric; 173 #endif174 170 Bool m_bUseSAO; 175 171 Int m_maxNumOffsetsPerPic; … … 202 198 Bool m_bUseASR; 203 199 Bool m_bUseHADME; 204 #if !L0034_COMBINED_LIST_CLEANUP205 Bool m_bUseLComb;206 #endif207 200 Bool m_useRDOQ; 208 201 Bool m_useRDOQTS; 209 #if L0232_RD_PENALTY210 202 UInt m_rdPenalty; 211 #endif212 203 Bool m_bUseFastEnc; 213 204 Bool m_bUseEarlyCU; … … 253 244 Int m_pictureTimingSEIEnabled; 254 245 Int m_recoveryPointSEIEnabled; 255 #if J0149_TONE_MAPPING_SEI256 246 Bool m_toneMappingInfoSEIEnabled; 257 247 Int m_toneMapId; … … 279 269 Int* m_codedPivotValue; 280 270 Int* m_targetPivotValue; 281 #endif282 271 Int m_framePackingSEIEnabled; 283 272 Int m_framePackingSEIType; … … 292 281 Int m_layersPresentSEIEnabled; 293 282 #endif 294 #if L0208_SOP_DESCRIPTION_SEI295 283 Int m_SOPDescriptionSEIEnabled; 296 #endif297 #if K0180_SCALABLE_NESTING_SEI298 284 Int m_scalableNestingSEIEnabled; 299 #endif300 285 //====== Weighted Prediction ======== 301 286 Bool m_useWeightedPred; //< Use of Weighting Prediction (P_SLICE) … … 310 295 Bool m_RCEnableRateControl; 311 296 Int m_RCTargetBitrate; 297 #if M0036_RC_IMPROVEMENT 298 Int m_RCKeepHierarchicalBit; 299 #else 312 300 Bool m_RCKeepHierarchicalBit; 301 #endif 313 302 Bool m_RCLCULevelRC; 314 303 Bool m_RCUseLCUSeparateModel; … … 463 452 Void setLoopFilterTcOffset ( Int i ) { m_loopFilterTcOffsetDiv2 = i; } 464 453 Void setDeblockingFilterControlPresent ( Bool b ) { m_DeblockingFilterControlPresent = b; } 465 #if L0386_DB_METRIC466 454 Void setDeblockingFilterMetric ( Bool b ) { m_DeblockingFilterMetric = b; } 467 #endif468 455 469 456 //====== Motion search ======== … … 520 507 Int getLoopFilterTcOffset () { return m_loopFilterTcOffsetDiv2; } 521 508 Bool getDeblockingFilterControlPresent() { return m_DeblockingFilterControlPresent; } 522 #if L0386_DB_METRIC523 509 Bool getDeblockingFilterMetric () { return m_DeblockingFilterMetric; } 524 #endif525 510 526 511 //==== Motion search ======== … … 540 525 Void setUseASR ( Bool b ) { m_bUseASR = b; } 541 526 Void setUseHADME ( Bool b ) { m_bUseHADME = b; } 542 #if !L0034_COMBINED_LIST_CLEANUP543 Void setUseLComb ( Bool b ) { m_bUseLComb = b; }544 #endif545 527 Void setUseRDOQ ( Bool b ) { m_useRDOQ = b; } 546 528 Void setUseRDOQTS ( Bool b ) { m_useRDOQTS = b; } 547 #if L0232_RD_PENALTY548 529 Void setRDpenalty ( UInt b ) { m_rdPenalty = b; } 549 #endif550 530 Void setUseFastEnc ( Bool b ) { m_bUseFastEnc = b; } 551 531 Void setUseEarlyCU ( Bool b ) { m_bUseEarlyCU = b; } … … 567 547 Bool getUseASR () { return m_bUseASR; } 568 548 Bool getUseHADME () { return m_bUseHADME; } 569 #if !L0034_COMBINED_LIST_CLEANUP570 Bool getUseLComb () { return m_bUseLComb; }571 #endif572 549 Bool getUseRDOQ () { return m_useRDOQ; } 573 550 Bool getUseRDOQTS () { return m_useRDOQTS; } 574 #if L0232_RD_PENALTY575 551 Int getRDpenalty () { return m_rdPenalty; } 576 #endif577 552 Bool getUseFastEnc () { return m_bUseFastEnc; } 578 553 Bool getUseEarlyCU () { return m_bUseEarlyCU; } … … 669 644 Void setRecoveryPointSEIEnabled(Int b) { m_recoveryPointSEIEnabled = b; } 670 645 Int getRecoveryPointSEIEnabled() { return m_recoveryPointSEIEnabled; } 671 #if J0149_TONE_MAPPING_SEI672 646 Void setToneMappingInfoSEIEnabled(Bool b) { m_toneMappingInfoSEIEnabled = b; } 673 647 Bool getToneMappingInfoSEIEnabled() { return m_toneMappingInfoSEIEnabled; } … … 720 694 Void setTMISEIExtendedWhiteLevelLumaCodeValue(Int b) { m_extendedWhiteLevelLumaCodeValue =b; } 721 695 Int getTMISEIExtendedWhiteLevelLumaCodeValue() { return m_extendedWhiteLevelLumaCodeValue; } 722 #endif723 696 Void setFramePackingArrangementSEIEnabled(Int b) { m_framePackingSEIEnabled = b; } 724 697 Int getFramePackingArrangementSEIEnabled() { return m_framePackingSEIEnabled; } … … 743 716 Int getLayersPresentSEIEnabled() { return m_layersPresentSEIEnabled; } 744 717 #endif 745 #if L0208_SOP_DESCRIPTION_SEI746 718 Void setSOPDescriptionSEIEnabled(Int b) { m_SOPDescriptionSEIEnabled = b; } 747 719 Int getSOPDescriptionSEIEnabled() { return m_SOPDescriptionSEIEnabled; } 748 #endif749 #if K0180_SCALABLE_NESTING_SEI750 720 Void setScalableNestingSEIEnabled(Int b) { m_scalableNestingSEIEnabled = b; } 751 721 Int getScalableNestingSEIEnabled() { return m_scalableNestingSEIEnabled; } 752 #endif753 722 Void setUseWP ( Bool b ) { m_useWeightedPred = b; } 754 723 Void setWPBiPred ( Bool b ) { m_useWeightedBiPred = b; } … … 772 741 Int getTargetBitrate () { return m_RCTargetBitrate; } 773 742 Void setTargetBitrate ( Int bitrate ) { m_RCTargetBitrate = bitrate; } 743 #if M0036_RC_IMPROVEMENT 744 Int getKeepHierBit () { return m_RCKeepHierarchicalBit; } 745 Void setKeepHierBit ( Int i ) { m_RCKeepHierarchicalBit = i; } 746 #else 774 747 Bool getKeepHierBit () { return m_RCKeepHierarchicalBit; } 775 748 Void setKeepHierBit ( Bool b ) { m_RCKeepHierarchicalBit = b; } 749 #endif 776 750 Bool getLCULevelRC () { return m_RCLCULevelRC; } 777 751 Void setLCULevelRC ( Bool b ) { m_RCLCULevelRC = b; } … … 865 839 Void setLog2MaxMvLengthVertical(Int i) { m_log2MaxMvLengthVertical = i; } 866 840 867 #if L0046_CONSTRAINT_FLAGS868 841 Bool getProgressiveSourceFlag() const { return m_progressiveSourceFlag; } 869 842 Void setProgressiveSourceFlag(Bool b) { m_progressiveSourceFlag = b; } … … 877 850 Bool getFrameOnlyConstraintFlag() const { return m_frameOnlyConstraintFlag; } 878 851 Void setFrameOnlyConstraintFlag(Bool b) { m_frameOnlyConstraintFlag = b; } 879 #endif880 852 881 853 #if SVC_EXTENSION -
branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncCu.cpp
r297 r302 95 95 96 96 m_bEncodeDQP = false; 97 #if RATE_CONTROL_LAMBDA_DOMAIN 97 #if RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT 98 98 m_LCUPredictionSAD = 0; 99 99 m_addSADDepth = 0; … … 108 108 // initialize conversion matrix from partition index to pel 109 109 initRasterToPelXY( uiMaxWidth, uiMaxHeight, m_uhTotalDepth ); 110 111 110 } 112 111 … … 245 244 m_ppcTempCU[0]->initCU( rpcCU->getPic(), rpcCU->getAddr() ); 246 245 247 #if RATE_CONTROL_LAMBDA_DOMAIN 246 #if RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT 248 247 m_addSADDepth = 0; 249 248 m_LCUPredictionSAD = 0; … … 548 547 } 549 548 550 #if RATE_CONTROL_LAMBDA_DOMAIN 549 #if RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT 551 550 if ( uiDepth <= m_addSADDepth ) 552 551 { … … 822 821 { 823 822 bBoundary = true; 824 #if RATE_CONTROL_LAMBDA_DOMAIN 823 #if RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT 825 824 m_addSADDepth++; 826 825 #endif … … 1252 1251 } 1253 1252 1253 #if RATE_CONTROL_INTRA 1254 Int xCalcHADs8x8_ISlice(Pel *piOrg, Int iStrideOrg) 1255 { 1256 Int k, i, j, jj; 1257 Int diff[64], m1[8][8], m2[8][8], m3[8][8], iSumHad = 0; 1258 1259 for( k = 0; k < 64; k += 8 ) 1260 { 1261 diff[k+0] = piOrg[0] ; 1262 diff[k+1] = piOrg[1] ; 1263 diff[k+2] = piOrg[2] ; 1264 diff[k+3] = piOrg[3] ; 1265 diff[k+4] = piOrg[4] ; 1266 diff[k+5] = piOrg[5] ; 1267 diff[k+6] = piOrg[6] ; 1268 diff[k+7] = piOrg[7] ; 1269 1270 piOrg += iStrideOrg; 1271 } 1272 1273 //horizontal 1274 for (j=0; j < 8; j++) 1275 { 1276 jj = j << 3; 1277 m2[j][0] = diff[jj ] + diff[jj+4]; 1278 m2[j][1] = diff[jj+1] + diff[jj+5]; 1279 m2[j][2] = diff[jj+2] + diff[jj+6]; 1280 m2[j][3] = diff[jj+3] + diff[jj+7]; 1281 m2[j][4] = diff[jj ] - diff[jj+4]; 1282 m2[j][5] = diff[jj+1] - diff[jj+5]; 1283 m2[j][6] = diff[jj+2] - diff[jj+6]; 1284 m2[j][7] = diff[jj+3] - diff[jj+7]; 1285 1286 m1[j][0] = m2[j][0] + m2[j][2]; 1287 m1[j][1] = m2[j][1] + m2[j][3]; 1288 m1[j][2] = m2[j][0] - m2[j][2]; 1289 m1[j][3] = m2[j][1] - m2[j][3]; 1290 m1[j][4] = m2[j][4] + m2[j][6]; 1291 m1[j][5] = m2[j][5] + m2[j][7]; 1292 m1[j][6] = m2[j][4] - m2[j][6]; 1293 m1[j][7] = m2[j][5] - m2[j][7]; 1294 1295 m2[j][0] = m1[j][0] + m1[j][1]; 1296 m2[j][1] = m1[j][0] - m1[j][1]; 1297 m2[j][2] = m1[j][2] + m1[j][3]; 1298 m2[j][3] = m1[j][2] - m1[j][3]; 1299 m2[j][4] = m1[j][4] + m1[j][5]; 1300 m2[j][5] = m1[j][4] - m1[j][5]; 1301 m2[j][6] = m1[j][6] + m1[j][7]; 1302 m2[j][7] = m1[j][6] - m1[j][7]; 1303 } 1304 1305 //vertical 1306 for (i=0; i < 8; i++) 1307 { 1308 m3[0][i] = m2[0][i] + m2[4][i]; 1309 m3[1][i] = m2[1][i] + m2[5][i]; 1310 m3[2][i] = m2[2][i] + m2[6][i]; 1311 m3[3][i] = m2[3][i] + m2[7][i]; 1312 m3[4][i] = m2[0][i] - m2[4][i]; 1313 m3[5][i] = m2[1][i] - m2[5][i]; 1314 m3[6][i] = m2[2][i] - m2[6][i]; 1315 m3[7][i] = m2[3][i] - m2[7][i]; 1316 1317 m1[0][i] = m3[0][i] + m3[2][i]; 1318 m1[1][i] = m3[1][i] + m3[3][i]; 1319 m1[2][i] = m3[0][i] - m3[2][i]; 1320 m1[3][i] = m3[1][i] - m3[3][i]; 1321 m1[4][i] = m3[4][i] + m3[6][i]; 1322 m1[5][i] = m3[5][i] + m3[7][i]; 1323 m1[6][i] = m3[4][i] - m3[6][i]; 1324 m1[7][i] = m3[5][i] - m3[7][i]; 1325 1326 m2[0][i] = m1[0][i] + m1[1][i]; 1327 m2[1][i] = m1[0][i] - m1[1][i]; 1328 m2[2][i] = m1[2][i] + m1[3][i]; 1329 m2[3][i] = m1[2][i] - m1[3][i]; 1330 m2[4][i] = m1[4][i] + m1[5][i]; 1331 m2[5][i] = m1[4][i] - m1[5][i]; 1332 m2[6][i] = m1[6][i] + m1[7][i]; 1333 m2[7][i] = m1[6][i] - m1[7][i]; 1334 } 1335 1336 for (i = 0; i < 8; i++) 1337 { 1338 for (j = 0; j < 8; j++) 1339 { 1340 iSumHad += abs(m2[i][j]); 1341 } 1342 } 1343 iSumHad -= abs(m2[0][0]); 1344 iSumHad =(iSumHad+2)>>2; 1345 return(iSumHad); 1346 } 1347 1348 Int TEncCu::updateLCUDataISlice(TComDataCU* pcCU, Int LCUIdx, Int width, Int height) 1349 { 1350 Int xBl, yBl; 1351 const Int iBlkSize = 8; 1352 1353 Pel* pOrgInit = pcCU->getPic()->getPicYuvOrg()->getLumaAddr(pcCU->getAddr(), 0); 1354 Int iStrideOrig = pcCU->getPic()->getPicYuvOrg()->getStride(); 1355 Pel *pOrg; 1356 1357 Int iSumHad = 0; 1358 for ( yBl=0; (yBl+iBlkSize)<=height; yBl+= iBlkSize) 1359 { 1360 for ( xBl=0; (xBl+iBlkSize)<=width; xBl+= iBlkSize) 1361 { 1362 pOrg = pOrgInit + iStrideOrig*yBl + xBl; 1363 iSumHad += xCalcHADs8x8_ISlice(pOrg, iStrideOrig); 1364 } 1365 } 1366 return(iSumHad); 1367 } 1368 #endif 1369 1254 1370 /** check RD costs for a CU block encoded with merge 1255 1371 * \param rpcBestCU … … 1260 1376 { 1261 1377 assert( rpcTempCU->getSlice()->getSliceType() != I_SLICE ); 1262 TComMvField cMvFieldNeighbours[ MRG_MAX_NUM_CANDS << 1]; // double length for mv of both lists1378 TComMvField cMvFieldNeighbours[ 2 * MRG_MAX_NUM_CANDS ]; // double length for mv of both lists 1263 1379 UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS]; 1264 1380 Int numValidMergeCand = 0; … … 1274 1390 1275 1391 Int mergeCandBuffer[MRG_MAX_NUM_CANDS]; 1276 for( UInt ui = 0; ui < rpcTempCU->getSlice()->getMaxNumMergeCand(); ++ui )1392 for( UInt ui = 0; ui < numValidMergeCand; ++ui ) 1277 1393 { 1278 1394 mergeCandBuffer[ui] = 0; … … 1300 1416 { 1301 1417 #endif 1302 if(!(uiNoResidual==1 && mergeCandBuffer[uiMergeCand]==1)) 1303 { 1304 1418 if(!(uiNoResidual==1 && mergeCandBuffer[uiMergeCand]==1)) 1419 { 1305 1420 if( !(bestIsSkip && uiNoResidual == 0) ) 1306 1421 { … … 1314 1429 rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level 1315 1430 rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level 1316 1317 // do MC 1318 m_pcPredSearch->motionCompensation ( rpcTempCU, m_ppcPredYuvTemp[uhDepth] ); 1319 // estimate residual and encode everything 1320 m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU, 1321 m_ppcOrigYuv [uhDepth], 1322 m_ppcPredYuvTemp[uhDepth], 1323 m_ppcResiYuvTemp[uhDepth], 1324 m_ppcResiYuvBest[uhDepth], 1325 m_ppcRecoYuvTemp[uhDepth], 1326 (uiNoResidual? true:false)); 1327 1328 1329 if(uiNoResidual==0) 1330 { 1331 if(rpcTempCU->getQtRootCbf(0) == 0) 1332 { 1333 mergeCandBuffer[uiMergeCand] = 1; 1334 } 1335 } 1336 1337 rpcTempCU->setSkipFlagSubParts( rpcTempCU->getQtRootCbf(0) == 0, 0, uhDepth ); 1431 1432 // do MC 1433 m_pcPredSearch->motionCompensation ( rpcTempCU, m_ppcPredYuvTemp[uhDepth] ); 1434 // estimate residual and encode everything 1435 m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU, 1436 m_ppcOrigYuv [uhDepth], 1437 m_ppcPredYuvTemp[uhDepth], 1438 m_ppcResiYuvTemp[uhDepth], 1439 m_ppcResiYuvBest[uhDepth], 1440 m_ppcRecoYuvTemp[uhDepth], 1441 (uiNoResidual? true:false)); 1442 1443 1444 if ( uiNoResidual == 0 && rpcTempCU->getQtRootCbf(0) == 0 ) 1445 { 1446 // If no residual when allowing for one, then set mark to not try case where residual is forced to 0 1447 mergeCandBuffer[uiMergeCand] = 1; 1448 } 1449 1450 rpcTempCU->setSkipFlagSubParts( rpcTempCU->getQtRootCbf(0) == 0, 0, uhDepth ); 1338 1451 Int orgQP = rpcTempCU->getQP( 0 ); 1339 1452 xCheckDQP( rpcTempCU ); 1340 1453 xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth); 1341 1454 rpcTempCU->initEstData( uhDepth, orgQP ); 1342 1343 1344 if( m_pcEncCfg->getUseFastDecisionForMerge() && !bestIsSkip ) 1345 { 1346 bestIsSkip = rpcBestCU->getQtRootCbf(0) == 0; 1347 } 1348 1349 } 1350 } 1455 1456 if( m_pcEncCfg->getUseFastDecisionForMerge() && !bestIsSkip ) 1457 { 1458 bestIsSkip = rpcBestCU->getQtRootCbf(0) == 0; 1459 } 1460 } 1351 1461 #if REF_IDX_ME_ZEROMV 1352 } 1353 #endif 1462 } 1463 #endif 1464 } 1354 1465 } 1355 1466 … … 1417 1528 #endif 1418 1529 1419 #if RATE_CONTROL_LAMBDA_DOMAIN 1530 #if RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT 1420 1531 if ( m_pcEncCfg->getUseRateCtrl() && m_pcEncCfg->getLCULevelRC() && ePartSize == SIZE_2Nx2N && uhDepth <= m_addSADDepth ) 1421 1532 { -
branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncCu.h
r282 r302 106 106 Bool m_bUseSBACRD; 107 107 TEncRateCtrl* m_pcRateCtrl; 108 #if RATE_CONTROL_LAMBDA_DOMAIN 108 #if RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT 109 109 UInt m_LCUPredictionSAD; 110 110 Int m_addSADDepth; … … 128 128 129 129 Void setBitCounter ( TComBitCounter* pcBitCounter ) { m_pcBitCounter = pcBitCounter; } 130 #if RATE_CONTROL_LAMBDA_DOMAIN 130 #if RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT 131 131 UInt getLCUPredictionSAD() { return m_LCUPredictionSAD; } 132 #endif 133 #if RATE_CONTROL_INTRA 134 Int updateLCUDataISlice ( TComDataCU* pcCU, Int LCUIdx, Int width, Int height ); 132 135 #endif 133 136 #if INTRA_BL -
branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncGOP.cpp
r297 r302 94 94 m_cpbRemovalDelay = 0; 95 95 m_lastBPSEI = 0; 96 #if L0045_NON_NESTED_SEI_RESTRICTIONS97 96 xResetNonNestedSEIPresentFlags(); 98 #if K0180_SCALABLE_NESTING_SEI99 97 xResetNestedSEIPresentFlags(); 100 #endif101 #endif102 98 #if SVC_UPSAMPLING 103 99 m_pcPredSearch = NULL; … … 163 159 SEIActiveParameterSets *seiActiveParameterSets = new SEIActiveParameterSets(); 164 160 seiActiveParameterSets->activeVPSId = m_pcCfg->getVPS()->getVPSId(); 165 #if L0047_APS_FLAGS166 161 seiActiveParameterSets->m_fullRandomAccessFlag = false; 167 162 seiActiveParameterSets->m_noParamSetUpdateFlag = false; 168 #endif169 163 seiActiveParameterSets->numSpsIdsMinus1 = 0; 170 164 seiActiveParameterSets->activeSeqParamSetId.resize(seiActiveParameterSets->numSpsIdsMinus1 + 1); … … 198 192 seiFramePacking->m_arrangementCancelFlag = 0; 199 193 seiFramePacking->m_arrangementType = m_pcCfg->getFramePackingArrangementSEIType(); 200 #if L0444_FPA_TYPE201 194 assert((seiFramePacking->m_arrangementType > 2) && (seiFramePacking->m_arrangementType < 6) ); 202 #endif203 195 seiFramePacking->m_quincunxSamplingFlag = m_pcCfg->getFramePackingArrangementSEIQuincunx(); 204 196 seiFramePacking->m_contentInterpretationType = m_pcCfg->getFramePackingArrangementSEIInterpretation(); … … 214 206 seiFramePacking->m_frame1GridPositionY = 0; 215 207 seiFramePacking->m_arrangementReservedByte = 0; 216 #if L0045_PERSISTENCE_FLAGS217 208 seiFramePacking->m_arrangementPersistenceFlag = true; 218 #else219 seiFramePacking->m_arrangementRepetetionPeriod = 1;220 #endif221 209 seiFramePacking->m_upsampledAspectRatio = 0; 222 210 return seiFramePacking; … … 233 221 } 234 222 235 #if J0149_TONE_MAPPING_SEI236 223 SEIToneMappingInfo* TEncGOP::xCreateSEIToneMappingInfo() 237 224 { … … 244 231 assert(seiToneMappingInfo->m_codedDataBitDepth >= 8 && seiToneMappingInfo->m_codedDataBitDepth <= 14); 245 232 seiToneMappingInfo->m_targetBitDepth = m_pcCfg->getTMISEITargetBitDepth(); 246 assert( (seiToneMappingInfo->m_targetBitDepth >= 1 && seiToneMappingInfo->m_targetBitDepth <= 17) || (seiToneMappingInfo->m_targetBitDepth == 255));233 assert( seiToneMappingInfo->m_targetBitDepth >= 1 && seiToneMappingInfo->m_targetBitDepth <= 17 ); 247 234 seiToneMappingInfo->m_modelId = m_pcCfg->getTMISEIModelID(); 248 235 assert(seiToneMappingInfo->m_modelId >=0 &&seiToneMappingInfo->m_modelId<=4); … … 319 306 return seiToneMappingInfo; 320 307 } 321 #endif 308 322 309 Void TEncGOP::xCreateLeadingSEIMessages (/*SEIMessages seiMessages,*/ AccessUnit &accessUnit, TComSPS *sps) 323 310 { … … 334 321 accessUnit.push_back(new NALUnitEBSP(nalu)); 335 322 delete sei; 336 #if L0045_NON_NESTED_SEI_RESTRICTIONS337 323 m_activeParameterSetSEIPresentInAU = true; 338 #endif339 324 } 340 325 … … 373 358 delete sei; 374 359 } 375 #if J0149_TONE_MAPPING_SEI376 360 if(m_pcCfg->getToneMappingInfoSEIEnabled()) 377 361 { … … 385 369 delete sei; 386 370 } 387 #endif388 371 } 389 372 … … 411 394 m_iNumPicCoded = 0; 412 395 SEIPictureTiming pictureTimingSEI; 413 #if L0208_SOP_DESCRIPTION_SEI414 396 Bool writeSOP = m_pcCfg->getSOPDescriptionSEIEnabled(); 415 #endif416 #if K0180_SCALABLE_NESTING_SEI417 397 // Initialize Scalable Nesting SEI with single layer values 418 398 SEIScalableNesting scalableNestingSEI; … … 425 405 scalableNestingSEI.m_nestingLayerId[0] = 0; 426 406 scalableNestingSEI.m_callerOwnsSEIs = true; 427 #endif428 #if L0044_DU_DPB_OUTPUT_DELAY_HRD429 407 Int picSptDpbOutputDuDelay = 0; 430 #endif431 408 UInt *accumBitsDU = NULL; 432 409 UInt *accumNalsDU = NULL; … … 706 683 pcSlice->getRPS()->setNumberOfLongtermPictures(0); 707 684 685 #if FIX1071 686 if ((pcSlice->checkThatAllRefPicsAreAvailable(rcListPic, pcSlice->getRPS(), false) != 0) || (pcSlice->isIRAP())) 687 { 688 pcSlice->createExplicitReferencePictureSetFromReference(rcListPic, pcSlice->getRPS(), pcSlice->isIRAP()); 689 } 690 #else 708 691 if(pcSlice->checkThatAllRefPicsAreAvailable(rcListPic, pcSlice->getRPS(), false) != 0) 709 692 { 710 693 pcSlice->createExplicitReferencePictureSetFromReference(rcListPic, pcSlice->getRPS()); 711 694 } 695 #endif 712 696 pcSlice->applyReferencePictureSet(rcListPic, pcSlice->getRPS()); 713 697 … … 921 905 pcSlice->setSliceType ( P_SLICE ); 922 906 } 923 #if !L0034_COMBINED_LIST_CLEANUP924 if (pcSlice->getSliceType() != B_SLICE || !pcSlice->getSPS()->getUseLComb())925 {926 pcSlice->setNumRefIdx(REF_PIC_LIST_C, 0);927 pcSlice->setRefPicListCombinationFlag(false);928 pcSlice->setRefPicListModificationFlagLC(false);929 }930 else931 {932 pcSlice->setRefPicListCombinationFlag(pcSlice->getSPS()->getUseLComb());933 pcSlice->setNumRefIdx(REF_PIC_LIST_C, pcSlice->getNumRefIdx(REF_PIC_LIST_0));934 }935 #endif936 907 937 908 #if M0457_IL_SAMPLE_PRED_ONLY_FLAG … … 975 946 pcSlice->setRefPOCList(); 976 947 977 #if L0034_COMBINED_LIST_CLEANUP978 948 pcSlice->setList1IdxToList0Idx(); 979 #else980 pcSlice->setNoBackPredFlag( false );981 if ( pcSlice->getSliceType() == B_SLICE && !pcSlice->getRefPicListCombinationFlag())982 {983 if ( pcSlice->getNumRefIdx(RefPicList( 0 ) ) == pcSlice->getNumRefIdx(RefPicList( 1 ) ) )984 {985 pcSlice->setNoBackPredFlag( true );986 Int i;987 for ( i=0; i < pcSlice->getNumRefIdx(RefPicList( 1 ) ); i++ )988 {989 if ( pcSlice->getRefPOC(RefPicList(1), i) != pcSlice->getRefPOC(RefPicList(0), i) )990 {991 pcSlice->setNoBackPredFlag( false );992 break;993 }994 }995 }996 }997 998 if(pcSlice->getNoBackPredFlag())999 {1000 pcSlice->setNumRefIdx(REF_PIC_LIST_C, 0);1001 }1002 pcSlice->generateCombinedList();1003 #endif1004 949 1005 950 if (m_pcEncTop->getTMVPModeId() == 2) … … 1068 1013 1069 1014 #if RATE_CONTROL_LAMBDA_DOMAIN 1070 Int sliceQP = pcSlice->getSliceQp();1071 1015 Double lambda = 0.0; 1072 1016 Int actualHeadBits = 0; … … 1084 1028 estimatedBits = m_pcRateCtrl->getRCPic()->getTargetBits(); 1085 1029 1030 Int sliceQP = m_pcCfg->getInitialQP(); 1086 1031 if ( ( pcSlice->getPOC() == 0 && m_pcCfg->getInitialQP() > 0 ) || ( frameLevel == 0 && m_pcCfg->getForceIntraQP() ) ) // QP is specified 1087 1032 { 1088 sliceQP = m_pcCfg->getInitialQP();1089 1033 Int NumberBFrames = ( m_pcCfg->getGOPSize() - 1 ); 1090 1034 Double dLambda_scale = 1.0 - Clip3( 0.0, 0.5, 0.05*(Double)NumberBFrames ); … … 1097 1041 else if ( frameLevel == 0 ) // intra case, but use the model 1098 1042 { 1043 #if RATE_CONTROL_INTRA 1044 m_pcSliceEncoder->calCostSliceI(pcPic); 1045 #endif 1099 1046 if ( m_pcCfg->getIntraPeriod() != 1 ) // do not refine allocated bits for all intra case 1100 1047 { 1101 1048 Int bits = m_pcRateCtrl->getRCSeq()->getLeftAverageBits(); 1049 #if RATE_CONTROL_INTRA 1050 bits = m_pcRateCtrl->getRCPic()->getRefineBitsForIntra( bits ); 1051 #else 1102 1052 bits = m_pcRateCtrl->getRCSeq()->getRefineBitsForIntra( bits ); 1053 #endif 1103 1054 if ( bits < 200 ) 1104 1055 { … … 1109 1060 1110 1061 list<TEncRCPic*> listPreviousPicture = m_pcRateCtrl->getPicList(); 1062 #if RATE_CONTROL_INTRA 1063 m_pcRateCtrl->getRCPic()->getLCUInitTargetBits(); 1064 lambda = m_pcRateCtrl->getRCPic()->estimatePicLambda( listPreviousPicture, pcSlice->getSliceType()); 1065 #else 1111 1066 lambda = m_pcRateCtrl->getRCPic()->estimatePicLambda( listPreviousPicture ); 1067 #endif 1112 1068 sliceQP = m_pcRateCtrl->getRCPic()->estimatePicQP( lambda, listPreviousPicture ); 1113 1069 } … … 1115 1071 { 1116 1072 list<TEncRCPic*> listPreviousPicture = m_pcRateCtrl->getPicList(); 1073 #if RATE_CONTROL_INTRA 1074 lambda = m_pcRateCtrl->getRCPic()->estimatePicLambda( listPreviousPicture, pcSlice->getSliceType()); 1075 #else 1117 1076 lambda = m_pcRateCtrl->getRCPic()->estimatePicLambda( listPreviousPicture ); 1077 #endif 1118 1078 sliceQP = m_pcRateCtrl->getRCPic()->estimatePicQP( lambda, listPreviousPicture ); 1119 1079 } … … 1324 1284 Bool bLFCrossTileBoundary = pcSlice->getPPS()->getLoopFilterAcrossTilesEnabledFlag(); 1325 1285 m_pcLoopFilter->setCfg(bLFCrossTileBoundary); 1326 #if L0386_DB_METRIC1327 1286 if ( m_pcCfg->getDeblockingFilterMetric() ) 1328 1287 { 1329 1288 dblMetric(pcPic, uiNumSlices); 1330 1289 } 1331 #endif1332 1290 m_pcLoopFilter->loopFilterPic( pcPic ); 1333 1291 … … 1400 1358 UInt maxCU = m_pcCfg->getSliceArgument() >> ( pcSlice->getSPS()->getMaxCUDepth() << 1); 1401 1359 UInt numDU = ( m_pcCfg->getSliceMode() == 1 ) ? ( pcPic->getNumCUsInFrame() / maxCU ) : ( 0 ); 1402 if( pcPic->getNumCUsInFrame() % maxCU != 0 )1360 if( pcPic->getNumCUsInFrame() % maxCU != 0 || numDU == 0 ) 1403 1361 { 1404 1362 numDU ++; … … 1436 1394 } 1437 1395 1438 #if L0208_SOP_DESCRIPTION_SEI1439 1396 if (writeSOP) // write SOP description SEI (if enabled) at the beginning of GOP 1440 1397 { … … 1474 1431 writeSOP = false; 1475 1432 } 1476 #endif1477 1433 1478 1434 if( ( m_pcCfg->getPictureTimingSEIEnabled() || m_pcCfg->getDecodingUnitInfoSEIEnabled() ) && … … 1506 1462 pictureTimingSEI.m_auCpbRemovalDelay = std::max<Int>(1, m_totalCoded - m_lastBPSEI); // Syntax element signalled as minus, hence the . 1507 1463 pictureTimingSEI.m_picDpbOutputDelay = pcSlice->getSPS()->getNumReorderPics(0) + pcSlice->getPOC() - m_totalCoded; 1508 #if L0044_DU_DPB_OUTPUT_DELAY_HRD1509 1464 Int factor = pcSlice->getSPS()->getVuiParameters()->getHrdParameters()->getTickDivisorMinus2() + 2; 1510 1465 pictureTimingSEI.m_picDpbOutputDuDelay = factor * pictureTimingSEI.m_picDpbOutputDelay; … … 1513 1468 picSptDpbOutputDuDelay = factor * pictureTimingSEI.m_picDpbOutputDelay; 1514 1469 } 1515 #endif1516 1470 } 1517 1471 … … 1533 1487 sei_buffering_period.m_initialCpbRemovalDelayOffset[0][1] = uiInitialCpbRemovalDelay; 1534 1488 1535 #if L0043_TIMING_INFO1536 1489 Double dTmp = (Double)pcSlice->getSPS()->getVuiParameters()->getTimingInfo()->getNumUnitsInTick() / (Double)pcSlice->getSPS()->getVuiParameters()->getTimingInfo()->getTimeScale(); 1537 #else1538 Double dTmp = (Double)pcSlice->getSPS()->getVuiParameters()->getHrdParameters()->getNumUnitsInTick() / (Double)pcSlice->getSPS()->getVuiParameters()->getHrdParameters()->getTimeScale();1539 #endif1540 1490 1541 1491 UInt uiTmp = (UInt)( dTmp * 90000.0 ); … … 1548 1498 1549 1499 sei_buffering_period.m_rapCpbParamsPresentFlag = 0; 1550 #if L0328_SPLICING1551 1500 //for the concatenation, it can be set to one during splicing. 1552 1501 sei_buffering_period.m_concatenationFlag = 0; 1553 1502 //since the temporal layer HRD is not ready, we assumed it is fixed 1554 1503 sei_buffering_period.m_auCpbRemovalDelayDelta = 1; 1555 #endif1556 #if L0044_CPB_DPB_DELAY_OFFSET1557 1504 sei_buffering_period.m_cpbDelayOffset = 0; 1558 1505 sei_buffering_period.m_dpbDelayOffset = 0; 1559 #endif1560 1506 1561 1507 m_seiWriter.writeSEImessage( nalu.m_Bitstream, sei_buffering_period, pcSlice->getSPS()); 1562 1508 writeRBSPTrailingBits(nalu.m_Bitstream); 1563 #if L0045_NON_NESTED_SEI_RESTRICTIONS1564 1509 { 1565 1510 UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit); … … 1573 1518 m_bufferingPeriodSEIPresentInAU = true; 1574 1519 } 1575 #else 1576 accessUnit.push_back(new NALUnitEBSP(nalu)); 1577 #endif 1578 1579 #if K0180_SCALABLE_NESTING_SEI 1520 1580 1521 if (m_pcCfg->getScalableNestingSEIEnabled()) 1581 1522 { … … 1587 1528 m_seiWriter.writeSEImessage( naluTmp.m_Bitstream, scalableNestingSEI, pcSlice->getSPS()); 1588 1529 writeRBSPTrailingBits(naluTmp.m_Bitstream); 1589 #if L0045_NON_NESTED_SEI_RESTRICTIONS1590 1530 UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit); 1591 1531 UInt offsetPosition = m_activeParameterSetSEIPresentInAU + m_bufferingPeriodSEIPresentInAU + m_pictureTimingSEIPresentInAU; // Insert BP SEI after non-nested APS, BP and PT SEIs … … 1597 1537 accessUnit.insert(it, new NALUnitEBSP(naluTmp)); 1598 1538 m_nestedBufferingPeriodSEIPresentInAU = true; 1599 #else 1600 accessUnit.push_back(new NALUnitEBSP(naluTmp)); 1601 #endif 1602 } 1603 #endif 1539 } 1604 1540 1605 1541 m_lastBPSEI = m_totalCoded; … … 2065 2001 if ( m_pcCfg->getUseRateCtrl() ) 2066 2002 { 2003 #if !M0036_RC_IMPROVEMENT 2067 2004 Double effectivePercentage = m_pcRateCtrl->getRCPic()->getEffectivePercentage(); 2005 #endif 2068 2006 Double avgQP = m_pcRateCtrl->getRCPic()->calAverageQP(); 2069 2007 Double avgLambda = m_pcRateCtrl->getRCPic()->calAverageLambda(); … … 2072 2010 avgLambda = lambda; 2073 2011 } 2012 #if M0036_RC_IMPROVEMENT 2013 #if RATE_CONTROL_INTRA 2014 m_pcRateCtrl->getRCPic()->updateAfterPicture( actualHeadBits, actualTotalBits, avgQP, avgLambda, pcSlice->getSliceType()); 2015 #else 2016 m_pcRateCtrl->getRCPic()->updateAfterPicture( actualHeadBits, actualTotalBits, avgQP, avgLambda ); 2017 #endif 2018 #else 2074 2019 m_pcRateCtrl->getRCPic()->updateAfterPicture( actualHeadBits, actualTotalBits, avgQP, avgLambda, effectivePercentage ); 2020 #endif 2075 2021 m_pcRateCtrl->getRCPic()->addToPictureLsit( m_pcRateCtrl->getPicList() ); 2076 2022 … … 2092 2038 } 2093 2039 #endif 2040 2094 2041 if( ( m_pcCfg->getPictureTimingSEIEnabled() || m_pcCfg->getDecodingUnitInfoSEIEnabled() ) && 2095 2042 ( pcSlice->getSPS()->getVuiParametersPresentFlag() ) && … … 2126 2073 for( i = ( numDU - 2 ); i >= 0; i -- ) 2127 2074 { 2128 #if L0043_TIMING_INFO2129 2075 ui64Tmp = ( ( ( accumBitsDU[ numDU - 1 ] - accumBitsDU[ i ] ) * ( vui->getTimingInfo()->getTimeScale() / vui->getTimingInfo()->getNumUnitsInTick() ) * ( hrd->getTickDivisorMinus2() + 2 ) ) / ( m_pcCfg->getTargetBitrate() ) ); 2130 #else2131 ui64Tmp = ( ( ( accumBitsDU[ numDU - 1 ] - accumBitsDU[ i ] ) * ( hrd->getTimeScale() / hrd->getNumUnitsInTick() ) * ( hrd->getTickDivisorMinus2() + 2 ) ) / ( m_pcCfg->getTargetBitrate() ) );2132 #endif2133 2076 if( (UInt)ui64Tmp > maxDiff ) 2134 2077 { … … 2142 2085 { 2143 2086 flag = 0; 2144 #if L0043_TIMING_INFO2145 2087 ui64Tmp = ( ( ( accumBitsDU[ numDU - 1 ] - accumBitsDU[ i ] ) * ( vui->getTimingInfo()->getTimeScale() / vui->getTimingInfo()->getNumUnitsInTick() ) * ( hrd->getTickDivisorMinus2() + 2 ) ) / ( m_pcCfg->getTargetBitrate() ) ); 2146 #else2147 ui64Tmp = ( ( ( accumBitsDU[ numDU - 1 ] - accumBitsDU[ i ] ) * ( hrd->getTimeScale() / hrd->getNumUnitsInTick() ) * ( hrd->getTickDivisorMinus2() + 2 ) ) / ( m_pcCfg->getTargetBitrate() ) );2148 #endif2149 2088 2150 2089 if( (UInt)ui64Tmp > maxDiff ) … … 2178 2117 m_seiWriter.writeSEImessage(nalu.m_Bitstream, pictureTimingSEI, pcSlice->getSPS()); 2179 2118 writeRBSPTrailingBits(nalu.m_Bitstream); 2180 #if L0045_NON_NESTED_SEI_RESTRICTIONS2181 2119 UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit); 2182 2120 UInt offsetPosition = m_activeParameterSetSEIPresentInAU … … 2189 2127 accessUnit.insert(it, new NALUnitEBSP(nalu)); 2190 2128 m_pictureTimingSEIPresentInAU = true; 2191 #else 2192 AccessUnit::iterator it = find_if(accessUnit.begin(), accessUnit.end(), mem_fun(&NALUnit::isSlice)); 2193 accessUnit.insert(it, new NALUnitEBSP(nalu)); 2194 #endif 2195 } 2196 #if K0180_SCALABLE_NESTING_SEI 2129 } 2197 2130 if ( m_pcCfg->getScalableNestingSEIEnabled() ) // put picture timing SEI into scalable nesting SEI 2198 2131 { … … 2203 2136 m_seiWriter.writeSEImessage(nalu.m_Bitstream, scalableNestingSEI, pcSlice->getSPS()); 2204 2137 writeRBSPTrailingBits(nalu.m_Bitstream); 2205 #if L0045_NON_NESTED_SEI_RESTRICTIONS2206 2138 UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit); 2207 2139 UInt offsetPosition = m_activeParameterSetSEIPresentInAU … … 2214 2146 accessUnit.insert(it, new NALUnitEBSP(nalu)); 2215 2147 m_nestedPictureTimingSEIPresentInAU = true; 2216 #else2217 AccessUnit::iterator it = find_if(accessUnit.begin(), accessUnit.end(), mem_fun(&NALUnit::isSlice));2218 accessUnit.insert(it, new NALUnitEBSP(nalu));2219 #endif2220 2148 } 2221 #endif2222 2223 2149 } 2224 2150 if( m_pcCfg->getDecodingUnitInfoSEIEnabled() && hrd->getSubPicCpbParamsPresentFlag() ) … … 2232 2158 tempSEI.m_decodingUnitIdx = i; 2233 2159 tempSEI.m_duSptCpbRemovalDelay = pictureTimingSEI.m_duCpbRemovalDelayMinus1[i] + 1; 2234 #if L0044_DU_DPB_OUTPUT_DELAY_HRD2235 2160 tempSEI.m_dpbOutputDuDelayPresentFlag = false; 2236 2161 tempSEI.m_picSptDpbOutputDuDelay = picSptDpbOutputDuDelay; 2237 #endif2238 2162 2239 2163 AccessUnit::iterator it; … … 2245 2169 writeRBSPTrailingBits(nalu.m_Bitstream); 2246 2170 2247 #if L0045_NON_NESTED_SEI_RESTRICTIONS2248 2171 UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit); 2249 2172 UInt offsetPosition = m_activeParameterSetSEIPresentInAU … … 2255 2178 } 2256 2179 accessUnit.insert(it, new NALUnitEBSP(nalu)); 2257 #else2258 it = find_if(accessUnit.begin(), accessUnit.end(), mem_fun(&NALUnit::isSlice));2259 accessUnit.insert(it, new NALUnitEBSP(nalu));2260 #endif2261 2180 } 2262 2181 else … … 2284 2203 } 2285 2204 } 2286 #if L0045_NON_NESTED_SEI_RESTRICTIONS2287 2205 xResetNonNestedSEIPresentFlags(); 2288 #if K0180_SCALABLE_NESTING_SEI2289 2206 xResetNestedSEIPresentFlags(); 2290 #endif2291 #endif2292 2207 pcPic->getPicYuvRec()->copyToPic(pcPicYuvRecOut); 2293 2208 … … 2445 2360 } 2446 2361 2447 assert (rpcPic->getPOC() == pocCurr); 2362 assert( rpcPic != NULL ); 2363 assert( rpcPic->getPOC() == pocCurr ); 2448 2364 2449 2365 return; … … 2945 2861 } 2946 2862 2947 #if L0045_NON_NESTED_SEI_RESTRICTIONS2948 2863 /** Function for finding the position to insert the first of APS and non-nested BP, PT, DU info SEI messages. 2949 2864 * \param accessUnit Access Unit of the current picture … … 2965 2880 return seiStartPos; 2966 2881 } 2967 #endif 2968 2969 #if L0386_DB_METRIC 2882 2970 2883 Void TEncGOP::dblMetric( TComPic* pcPic, UInt uiNumSlices ) 2971 2884 { … … 2981 2894 const UInt noCol = (picWidth>>log2maxTB); 2982 2895 const UInt noRows = (picHeight>>log2maxTB); 2896 assert(noCol > 1); 2897 assert(noRows > 1); 2983 2898 UInt64 *colSAD = (UInt64*)malloc(noCol*sizeof(UInt64)); 2984 2899 UInt64 *rowSAD = (UInt64*)malloc(noRows*sizeof(UInt64)); … … 3089 3004 free(rowSAD); 3090 3005 } 3091 #endif3092 3006 3093 3007 #if M0457_COL_PICTURE_SIGNALING -
branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncGOP.h
r292 r302 127 127 UInt m_tl0Idx; 128 128 UInt m_rapIdx; 129 #if L0045_NON_NESTED_SEI_RESTRICTIONS130 129 Bool m_activeParameterSetSEIPresentInAU; 131 130 Bool m_bufferingPeriodSEIPresentInAU; 132 131 Bool m_pictureTimingSEIPresentInAU; 133 #if K0180_SCALABLE_NESTING_SEI134 132 Bool m_nestedBufferingPeriodSEIPresentInAU; 135 133 Bool m_nestedPictureTimingSEIPresentInAU; 136 #endif137 #endif138 134 public: 139 135 TEncGOP(); … … 186 182 SEIDisplayOrientation* xCreateSEIDisplayOrientation(); 187 183 188 #if J0149_TONE_MAPPING_SEI189 184 SEIToneMappingInfo* xCreateSEIToneMappingInfo(); 190 #endif191 185 192 186 Void xCreateLeadingSEIMessages (/*SEIMessages seiMessages,*/ AccessUnit &accessUnit, TComSPS *sps); 193 #if L0045_NON_NESTED_SEI_RESTRICTIONS194 187 Int xGetFirstSeiLocation (AccessUnit &accessUnit); 195 188 Void xResetNonNestedSEIPresentFlags() … … 199 192 m_pictureTimingSEIPresentInAU = false; 200 193 } 201 #if K0180_SCALABLE_NESTING_SEI202 194 Void xResetNestedSEIPresentFlags() 203 195 { … … 205 197 m_nestedPictureTimingSEIPresentInAU = false; 206 198 } 207 #endif208 #endif209 #if L0386_DB_METRIC210 199 Void dblMetric( TComPic* pcPic, UInt uiNumSlices ); 211 #endif212 200 #if M0457_COL_PICTURE_SIGNALING 213 201 TComPic* getMotionPredIlp(TComSlice* pcSlice); -
branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncRateCtrl.cpp
r191 r302 67 67 m_bitsLeft = 0; 68 68 m_useLCUSeparateModel = false; 69 #if M0036_RC_IMPROVEMENT 70 m_adaptiveBit = 0; 71 m_lastLambda = 0.0; 72 #endif 69 73 } 70 74 … … 74 78 } 75 79 80 #if M0036_RC_IMPROVEMENT 81 Void TEncRCSeq::create( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Int numberOfLevel, Bool useLCUSeparateModel, Int adaptiveBit ) 82 #else 76 83 Void TEncRCSeq::create( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Int numberOfLevel, Bool useLCUSeparateModel ) 84 #endif 77 85 { 78 86 destroy(); … … 101 109 m_betaUpdate = 0.025; 102 110 } 103 else 111 #if M0036_RC_IMPROVEMENT 112 else if ( m_seqTargetBpp < 0.2 ) 104 113 { 105 114 m_alphaUpdate = 0.1; 106 115 m_betaUpdate = 0.05; 107 116 } 117 else if ( m_seqTargetBpp < 0.5 ) 118 { 119 m_alphaUpdate = 0.2; 120 m_betaUpdate = 0.1; 121 } 122 else 123 { 124 m_alphaUpdate = 0.4; 125 m_betaUpdate = 0.2; 126 } 127 #else 128 else 129 { 130 m_alphaUpdate = 0.1; 131 m_betaUpdate = 0.05; 132 } 133 #endif 108 134 m_averageBits = (Int)(m_targetBits / totalFrames); 109 135 Int picWidthInBU = ( m_picWidth % m_LCUWidth ) == 0 ? m_picWidth / m_LCUWidth : m_picWidth / m_LCUWidth + 1; … … 146 172 m_framesLeft = m_totalFrames; 147 173 m_bitsLeft = m_targetBits; 174 #if M0036_RC_IMPROVEMENT 175 m_adaptiveBit = adaptiveBit; 176 m_lastLambda = 0.0; 177 #endif 148 178 } 149 179 … … 203 233 for ( Int i=0; i<m_numberOfLevel; i++ ) 204 234 { 235 #if RATE_CONTROL_INTRA 236 if (i>0) 237 { 205 238 m_picPara[i].m_alpha = 3.2003; 206 239 m_picPara[i].m_beta = -1.367; 207 240 } 241 else 242 { 243 m_picPara[i].m_alpha = ALPHA; 244 m_picPara[i].m_beta = BETA2; 245 } 246 #else 247 m_picPara[i].m_alpha = 3.2003; 248 m_picPara[i].m_beta = -1.367; 249 #endif 250 } 208 251 } 209 252 else … … 228 271 for ( Int j=0; j<m_numberOfLCU; j++) 229 272 { 273 #if RATE_CONTROL_INTRA 274 m_LCUPara[i][j].m_alpha = m_picPara[i].m_alpha; 275 m_LCUPara[i][j].m_beta = m_picPara[i].m_beta; 276 #else 230 277 m_LCUPara[i][j].m_alpha = 3.2003; 231 278 m_LCUPara[i][j].m_beta = -1.367; 279 #endif 232 280 } 233 281 } … … 251 299 } 252 300 301 #if !RATE_CONTROL_INTRA 253 302 Int TEncRCSeq::getRefineBitsForIntra( Int orgBits ) 254 303 { … … 264 313 return orgBits * 10; 265 314 } 315 #endif 316 317 #if M0036_RC_IMPROVEMENT 318 Void TEncRCSeq::setAllBitRatio( Double basicLambda, Double* equaCoeffA, Double* equaCoeffB ) 319 { 320 Int* bitsRatio = new Int[m_GOPSize]; 321 for ( Int i=0; i<m_GOPSize; i++ ) 322 { 323 bitsRatio[i] = (Int)( equaCoeffA[i] * pow( basicLambda, equaCoeffB[i] ) * m_numberOfPixel ); 324 } 325 initBitsRatio( bitsRatio ); 326 delete[] bitsRatio; 327 } 328 #endif 266 329 267 330 //GOP level … … 286 349 Int targetBits = xEstGOPTargetBits( encRCSeq, numPic ); 287 350 351 #if M0036_RC_IMPROVEMENT 352 if ( encRCSeq->getAdaptiveBits() > 0 && encRCSeq->getLastLambda() > 0.1 ) 353 { 354 Double targetBpp = (Double)targetBits / encRCSeq->getNumPixel(); 355 Double basicLambda = 0.0; 356 Double* lambdaRatio = new Double[encRCSeq->getGOPSize()]; 357 Double* equaCoeffA = new Double[encRCSeq->getGOPSize()]; 358 Double* equaCoeffB = new Double[encRCSeq->getGOPSize()]; 359 360 if ( encRCSeq->getAdaptiveBits() == 1 ) // for GOP size =4, low delay case 361 { 362 if ( encRCSeq->getLastLambda() < 120.0 ) 363 { 364 lambdaRatio[1] = 0.725 * log( encRCSeq->getLastLambda() ) + 0.5793; 365 lambdaRatio[0] = 1.3 * lambdaRatio[1]; 366 lambdaRatio[2] = 1.3 * lambdaRatio[1]; 367 lambdaRatio[3] = 1.0; 368 } 369 else 370 { 371 lambdaRatio[0] = 5.0; 372 lambdaRatio[1] = 4.0; 373 lambdaRatio[2] = 5.0; 374 lambdaRatio[3] = 1.0; 375 } 376 } 377 else if ( encRCSeq->getAdaptiveBits() == 2 ) // for GOP size = 8, random access case 378 { 379 if ( encRCSeq->getLastLambda() < 90.0 ) 380 { 381 lambdaRatio[0] = 1.0; 382 lambdaRatio[1] = 0.725 * log( encRCSeq->getLastLambda() ) + 0.7963; 383 lambdaRatio[2] = 1.3 * lambdaRatio[1]; 384 lambdaRatio[3] = 3.25 * lambdaRatio[1]; 385 lambdaRatio[4] = 3.25 * lambdaRatio[1]; 386 lambdaRatio[5] = 1.3 * lambdaRatio[1]; 387 lambdaRatio[6] = 3.25 * lambdaRatio[1]; 388 lambdaRatio[7] = 3.25 * lambdaRatio[1]; 389 } 390 else 391 { 392 lambdaRatio[0] = 1.0; 393 lambdaRatio[1] = 4.0; 394 lambdaRatio[2] = 5.0; 395 lambdaRatio[3] = 12.3; 396 lambdaRatio[4] = 12.3; 397 lambdaRatio[5] = 5.0; 398 lambdaRatio[6] = 12.3; 399 lambdaRatio[7] = 12.3; 400 } 401 } 402 403 xCalEquaCoeff( encRCSeq, lambdaRatio, equaCoeffA, equaCoeffB, encRCSeq->getGOPSize() ); 404 basicLambda = xSolveEqua( targetBpp, equaCoeffA, equaCoeffB, encRCSeq->getGOPSize() ); 405 encRCSeq->setAllBitRatio( basicLambda, equaCoeffA, equaCoeffB ); 406 407 delete []lambdaRatio; 408 delete []equaCoeffA; 409 delete []equaCoeffB; 410 } 411 #endif 412 288 413 m_picTargetBitInGOP = new Int[numPic]; 289 414 Int i; … … 297 422 { 298 423 currPicRatio = encRCSeq->getBitRatio( i ); 424 #if M0036_RC_IMPROVEMENT 425 m_picTargetBitInGOP[i] = (Int)( ((Double)targetBits) * currPicRatio / totalPicRatio ); 426 #else 299 427 m_picTargetBitInGOP[i] = targetBits * currPicRatio / totalPicRatio; 428 #endif 300 429 } 301 430 … … 306 435 m_bitsLeft = m_targetBits; 307 436 } 437 438 #if M0036_RC_IMPROVEMENT 439 Void TEncRCGOP::xCalEquaCoeff( TEncRCSeq* encRCSeq, Double* lambdaRatio, Double* equaCoeffA, Double* equaCoeffB, Int GOPSize ) 440 { 441 for ( Int i=0; i<GOPSize; i++ ) 442 { 443 Int frameLevel = encRCSeq->getGOPID2Level(i); 444 Double alpha = encRCSeq->getPicPara(frameLevel).m_alpha; 445 Double beta = encRCSeq->getPicPara(frameLevel).m_beta; 446 equaCoeffA[i] = pow( 1.0/alpha, 1.0/beta ) * pow( lambdaRatio[i], 1.0/beta ); 447 equaCoeffB[i] = 1.0/beta; 448 } 449 } 450 451 Double TEncRCGOP::xSolveEqua( Double targetBpp, Double* equaCoeffA, Double* equaCoeffB, Int GOPSize ) 452 { 453 Double solution = 100.0; 454 Double minNumber = 0.1; 455 Double maxNumber = 10000.0; 456 for ( Int i=0; i<g_RCIterationNum; i++ ) 457 { 458 Double fx = 0.0; 459 for ( Int j=0; j<GOPSize; j++ ) 460 { 461 fx += equaCoeffA[j] * pow( solution, equaCoeffB[j] ); 462 } 463 464 if ( fabs( fx - targetBpp ) < 0.000001 ) 465 { 466 break; 467 } 468 469 if ( fx > targetBpp ) 470 { 471 minNumber = solution; 472 solution = ( solution + maxNumber ) / 2.0; 473 } 474 else 475 { 476 maxNumber = solution; 477 solution = ( solution + minNumber ) / 2.0; 478 } 479 } 480 481 solution = Clip3( 0.1, 10000.0, solution ); 482 return solution; 483 } 484 #endif 308 485 309 486 Void TEncRCGOP::destroy() … … 357 534 358 535 m_LCUs = NULL; 536 #if !M0036_RC_IMPROVEMENT 359 537 m_lastPicture = NULL; 538 #endif 360 539 m_picActualHeaderBits = 0; 540 #if !M0036_RC_IMPROVEMENT 361 541 m_totalMAD = 0.0; 542 #endif 362 543 m_picActualBits = 0; 363 544 m_picQP = 0; … … 384 565 } 385 566 567 #if M0036_RC_IMPROVEMENT 568 targetBits = Int( ((Double)GOPbitsLeft) * currPicRatio / totalPicRatio ); 569 #else 386 570 targetBits = Int( GOPbitsLeft * currPicRatio / totalPicRatio ); 571 #endif 387 572 388 573 if ( targetBits < 100 ) … … 480 665 m_LCUs[LCUIdx].m_lambda = 0.0; 481 666 m_LCUs[LCUIdx].m_targetBits = 0; 667 #if M0036_RC_IMPROVEMENT 668 m_LCUs[LCUIdx].m_bitWeight = 1.0; 669 #else 482 670 m_LCUs[LCUIdx].m_MAD = 0.0; 671 #endif 483 672 Int currWidth = ( (i == picWidthInLCU -1) ? picWidth - LCUWidth *(picWidthInLCU -1) : LCUWidth ); 484 673 Int currHeight = ( (j == picHeightInLCU-1) ? picHeight - LCUHeight*(picHeightInLCU-1) : LCUHeight ); … … 487 676 } 488 677 m_picActualHeaderBits = 0; 678 #if !M0036_RC_IMPROVEMENT 489 679 m_totalMAD = 0.0; 680 #endif 490 681 m_picActualBits = 0; 491 682 m_picQP = 0; 492 683 m_picLambda = 0.0; 493 684 685 #if !M0036_RC_IMPROVEMENT 494 686 m_lastPicture = NULL; 495 687 list<TEncRCPic*>::reverse_iterator it; … … 502 694 } 503 695 } 696 #endif 504 697 } 505 698 … … 515 708 } 516 709 710 711 #if RATE_CONTROL_INTRA 712 Double TEncRCPic::estimatePicLambda( list<TEncRCPic*>& listPreviousPictures, SliceType eSliceType) 713 #else 517 714 Double TEncRCPic::estimatePicLambda( list<TEncRCPic*>& listPreviousPictures ) 715 #endif 518 716 { 519 717 Double alpha = m_encRCSeq->getPicPara( m_frameLevel ).m_alpha; 520 718 Double beta = m_encRCSeq->getPicPara( m_frameLevel ).m_beta; 521 719 Double bpp = (Double)m_targetBits/(Double)m_numberOfPixel; 720 #if RATE_CONTROL_INTRA 721 Double estLambda; 722 if (eSliceType == I_SLICE) 723 { 724 estLambda = calculateLambdaIntra(alpha, beta, pow(m_totalCostIntra/(Double)m_numberOfPixel, BETA1), bpp); 725 } 726 else 727 { 728 estLambda = alpha * pow( bpp, beta ); 729 } 730 #else 522 731 Double estLambda = alpha * pow( bpp, beta ); 732 #endif 733 523 734 Double lastLevelLambda = -1.0; 524 735 Double lastPicLambda = -1.0; … … 566 777 567 778 m_estPicLambda = estLambda; 779 780 #if M0036_RC_IMPROVEMENT 781 Double totalWeight = 0.0; 782 // initial BU bit allocation weight 783 for ( Int i=0; i<m_numberOfLCU; i++ ) 784 { 785 #if RC_FIX 786 Double alphaLCU, betaLCU; 787 if ( m_encRCSeq->getUseLCUSeparateModel() ) 788 { 789 alphaLCU = m_encRCSeq->getLCUPara( m_frameLevel, i ).m_alpha; 790 betaLCU = m_encRCSeq->getLCUPara( m_frameLevel, i ).m_beta; 791 } 792 else 793 { 794 alphaLCU = m_encRCSeq->getPicPara( m_frameLevel ).m_alpha; 795 betaLCU = m_encRCSeq->getPicPara( m_frameLevel ).m_beta; 796 } 797 #else 798 Double alphaLCU = m_encRCSeq->getLCUPara( m_frameLevel, i ).m_alpha; 799 Double betaLCU = m_encRCSeq->getLCUPara( m_frameLevel, i ).m_beta; 800 #endif 801 802 m_LCUs[i].m_bitWeight = m_LCUs[i].m_numberOfPixel * pow( estLambda/alphaLCU, 1.0/betaLCU ); 803 804 if ( m_LCUs[i].m_bitWeight < 0.01 ) 805 { 806 m_LCUs[i].m_bitWeight = 0.01; 807 } 808 totalWeight += m_LCUs[i].m_bitWeight; 809 } 810 for ( Int i=0; i<m_numberOfLCU; i++ ) 811 { 812 Double BUTargetBits = m_targetBits * m_LCUs[i].m_bitWeight / totalWeight; 813 m_LCUs[i].m_bitWeight = BUTargetBits; 814 } 815 #endif 816 568 817 return estLambda; 569 818 } … … 607 856 } 608 857 858 #if RATE_CONTROL_INTRA 859 Double TEncRCPic::getLCUTargetBpp(SliceType eSliceType) 860 #else 609 861 Double TEncRCPic::getLCUTargetBpp() 862 #endif 610 863 { 611 864 Int LCUIdx = getLCUCoded(); 612 865 Double bpp = -1.0; 613 866 Int avgBits = 0; 867 #if !M0036_RC_IMPROVEMENT 614 868 Double totalMAD = -1.0; 615 869 Double MAD = -1.0; 616 870 #endif 871 872 #if RATE_CONTROL_INTRA 873 if (eSliceType == I_SLICE){ 874 Int noOfLCUsLeft = m_numberOfLCU - LCUIdx + 1; 875 Int bitrateWindow = min(4,noOfLCUsLeft); 876 Double MAD = getLCU(LCUIdx).m_costIntra; 877 878 if (m_remainingCostIntra > 0.1 ) 879 { 880 Double weightedBitsLeft = (m_bitsLeft*bitrateWindow+(m_bitsLeft-getLCU(LCUIdx).m_targetBitsLeft)*noOfLCUsLeft)/(Double)bitrateWindow; 881 avgBits = Int( MAD*weightedBitsLeft/m_remainingCostIntra ); 882 } 883 else 884 { 885 avgBits = Int( m_bitsLeft / m_LCULeft ); 886 } 887 m_remainingCostIntra -= MAD; 888 } 889 else 890 { 891 #endif 892 #if M0036_RC_IMPROVEMENT 893 Double totalWeight = 0; 894 for ( Int i=LCUIdx; i<m_numberOfLCU; i++ ) 895 { 896 totalWeight += m_LCUs[i].m_bitWeight; 897 } 898 Int realInfluenceLCU = min( g_RCLCUSmoothWindowSize, getLCULeft() ); 899 avgBits = (Int)( m_LCUs[LCUIdx].m_bitWeight - ( totalWeight - m_bitsLeft ) / realInfluenceLCU + 0.5 ); 900 #else 617 901 if ( m_lastPicture == NULL ) 618 902 { … … 637 921 } 638 922 } 639 640 #if L0033_RC_BUGFIX 923 #endif 924 #if RATE_CONTROL_INTRA 925 } 926 #endif 927 641 928 if ( avgBits < 1 ) 642 929 { 643 930 avgBits = 1; 644 931 } 645 #else646 if ( avgBits < 5 )647 {648 avgBits = 5;649 }650 #endif651 932 652 933 bpp = ( Double )avgBits/( Double )m_LCUs[ LCUIdx ].m_numberOfPixel; … … 716 997 //for Lambda clip, LCU level clip 717 998 Int clipNeighbourQP = g_RCInvalidQPValue; 718 #if L0033_RC_BUGFIX719 999 for ( int i=LCUIdx - 1; i>=0; i-- ) 720 #else721 for ( int i=LCUIdx; i>=0; i-- )722 #endif723 1000 { 724 1001 if ( (getLCU(i)).m_QP > g_RCInvalidQPValue ) … … 773 1050 beta *= ( 1.0 - m_encRCSeq->getBetaUpdate() / 2.0 ); 774 1051 1052 #if M0036_RC_IMPROVEMENT 1053 alpha = Clip3( g_RCAlphaMinValue, g_RCAlphaMaxValue, alpha ); 1054 beta = Clip3( g_RCBetaMinValue, g_RCBetaMaxValue, beta ); 1055 #else 775 1056 alpha = Clip3( 0.05, 20.0, alpha ); 776 1057 beta = Clip3( -3.0, -0.1, beta ); 1058 #endif 777 1059 778 1060 TRCParameter rcPara; … … 787 1069 alpha += m_encRCSeq->getAlphaUpdate() * ( log( inputLambda ) - log( calLambda ) ) * alpha; 788 1070 double lnbpp = log( bpp ); 1071 #if M0036_RC_IMPROVEMENT 1072 lnbpp = Clip3( -5.0, -0.1, lnbpp ); 1073 #else 789 1074 lnbpp = Clip3( -5.0, 1.0, lnbpp ); 1075 #endif 790 1076 beta += m_encRCSeq->getBetaUpdate() * ( log( inputLambda ) - log( calLambda ) ) * lnbpp; 791 1077 1078 #if M0036_RC_IMPROVEMENT 1079 alpha = Clip3( g_RCAlphaMinValue, g_RCAlphaMaxValue, alpha ); 1080 beta = Clip3( g_RCBetaMinValue, g_RCBetaMaxValue, beta ); 1081 #else 792 1082 alpha = Clip3( 0.05, 20.0, alpha ); 793 1083 beta = Clip3( -3.0, -0.1, beta ); 1084 #endif 794 1085 TRCParameter rcPara; 795 1086 rcPara.m_alpha = alpha; … … 799 1090 } 800 1091 1092 #if !M0036_RC_IMPROVEMENT 801 1093 Double TEncRCPic::getEffectivePercentage() 802 1094 { … … 816 1108 return effectivePixelPercentage; 817 1109 } 1110 #endif 818 1111 819 1112 Double TEncRCPic::calAverageQP() … … 871 1164 } 872 1165 1166 #if M0036_RC_IMPROVEMENT 1167 #if RATE_CONTROL_INTRA 1168 Void TEncRCPic::updateAfterPicture( Int actualHeaderBits, Int actualTotalBits, Double averageQP, Double averageLambda, SliceType eSliceType) 1169 #else 1170 Void TEncRCPic::updateAfterPicture( Int actualHeaderBits, Int actualTotalBits, Double averageQP, Double averageLambda ) 1171 #endif 1172 #else 873 1173 Void TEncRCPic::updateAfterPicture( Int actualHeaderBits, Int actualTotalBits, Double averageQP, Double averageLambda, Double effectivePercentage ) 1174 #endif 874 1175 { 875 1176 m_picActualHeaderBits = actualHeaderBits; … … 884 1185 } 885 1186 m_picLambda = averageLambda; 1187 #if !M0036_RC_IMPROVEMENT 886 1188 for ( Int i=0; i<m_numberOfLCU; i++ ) 887 1189 { 888 1190 m_totalMAD += m_LCUs[i].m_MAD; 889 1191 } 1192 #endif 890 1193 891 1194 Double alpha = m_encRCSeq->getPicPara( m_frameLevel ).m_alpha; 892 1195 Double beta = m_encRCSeq->getPicPara( m_frameLevel ).m_beta; 893 1196 #if RATE_CONTROL_INTRA 1197 if (eSliceType == I_SLICE) 1198 { 1199 updateAlphaBetaIntra(&alpha, &beta); 1200 } 1201 else 1202 { 1203 #endif 894 1204 // update parameters 895 1205 Double picActualBits = ( Double )m_picActualBits; … … 898 1208 Double inputLambda = m_picLambda; 899 1209 1210 #if M0036_RC_IMPROVEMENT 1211 if ( inputLambda < 0.01 || calLambda < 0.01 || picActualBpp < 0.0001 ) 1212 #else 900 1213 if ( inputLambda < 0.01 || calLambda < 0.01 || picActualBpp < 0.0001 || effectivePercentage < 0.05 ) 1214 #endif 901 1215 { 902 1216 alpha *= ( 1.0 - m_encRCSeq->getAlphaUpdate() / 2.0 ); 903 1217 beta *= ( 1.0 - m_encRCSeq->getBetaUpdate() / 2.0 ); 904 1218 1219 #if M0036_RC_IMPROVEMENT 1220 alpha = Clip3( g_RCAlphaMinValue, g_RCAlphaMaxValue, alpha ); 1221 beta = Clip3( g_RCBetaMinValue, g_RCBetaMaxValue, beta ); 1222 #else 905 1223 alpha = Clip3( 0.05, 20.0, alpha ); 906 1224 beta = Clip3( -3.0, -0.1, beta ); 1225 #endif 907 1226 TRCParameter rcPara; 908 1227 rcPara.m_alpha = alpha; … … 916 1235 alpha += m_encRCSeq->getAlphaUpdate() * ( log( inputLambda ) - log( calLambda ) ) * alpha; 917 1236 double lnbpp = log( picActualBpp ); 1237 #if M0036_RC_IMPROVEMENT 1238 lnbpp = Clip3( -5.0, -0.1, lnbpp ); 1239 #else 918 1240 lnbpp = Clip3( -5.0, 1.0, lnbpp ); 1241 #endif 919 1242 beta += m_encRCSeq->getBetaUpdate() * ( log( inputLambda ) - log( calLambda ) ) * lnbpp; 920 1243 1244 #if M0036_RC_IMPROVEMENT 1245 alpha = Clip3( g_RCAlphaMinValue, g_RCAlphaMaxValue, alpha ); 1246 beta = Clip3( g_RCBetaMinValue, g_RCBetaMaxValue, beta ); 1247 #else 921 1248 alpha = Clip3( 0.05, 20.0, alpha ); 922 1249 beta = Clip3( -3.0, -0.1, beta ); 1250 #endif 1251 #if RATE_CONTROL_INTRA 1252 } 1253 #endif 923 1254 924 1255 TRCParameter rcPara; … … 927 1258 928 1259 m_encRCSeq->setPicPara( m_frameLevel, rcPara ); 929 } 1260 1261 #if M0036_RC_IMPROVEMENT 1262 if ( m_frameLevel == 1 ) 1263 { 1264 Double currLambda = Clip3( 0.1, 10000.0, m_picLambda ); 1265 Double updateLastLambda = g_RCWeightHistoryLambda * m_encRCSeq->getLastLambda() + g_RCWeightCurrentLambda * currLambda; 1266 m_encRCSeq->setLastLambda( updateLastLambda ); 1267 } 1268 #endif 1269 } 1270 1271 #if RATE_CONTROL_INTRA 1272 Int TEncRCPic::getRefineBitsForIntra( Int orgBits ) 1273 { 1274 Double alpha=0.25, beta=0.5582; 1275 Int iIntraBits; 1276 1277 if (orgBits*40 < m_numberOfPixel) 1278 { 1279 alpha=0.25; 1280 } 1281 else 1282 { 1283 alpha=0.30; 1284 } 1285 1286 iIntraBits = (Int)(alpha* pow(m_totalCostIntra*4.0/(Double)orgBits, beta)*(Double)orgBits+0.5); 1287 1288 return iIntraBits; 1289 } 1290 1291 Double TEncRCPic::calculateLambdaIntra(double alpha, double beta, double MADPerPixel, double bitsPerPixel) 1292 { 1293 return ( (alpha/256.0) * pow( MADPerPixel/bitsPerPixel, beta ) ); 1294 } 1295 1296 Void TEncRCPic::updateAlphaBetaIntra(double *alpha, double *beta) 1297 { 1298 Double lnbpp = log(pow(m_totalCostIntra / (Double)m_numberOfPixel, BETA1)); 1299 Double diffLambda = (*beta)*(log((Double)m_picActualBits)-log((Double)m_targetBits)); 1300 1301 diffLambda = Clip3(-0.125, 0.125, 0.25*diffLambda); 1302 *alpha = (*alpha) * exp(diffLambda); 1303 *beta = (*beta) + diffLambda / lnbpp; 1304 } 1305 1306 1307 Void TEncRCPic::getLCUInitTargetBits() 1308 { 1309 Int iAvgBits = 0; 1310 1311 m_remainingCostIntra = m_totalCostIntra; 1312 for (Int i=m_numberOfLCU-1; i>=0; i--) 1313 { 1314 iAvgBits += Int(m_targetBits * getLCU(i).m_costIntra/m_totalCostIntra); 1315 getLCU(i).m_targetBitsLeft = iAvgBits; 1316 } 1317 } 1318 1319 1320 Double TEncRCPic::getLCUEstLambdaAndQP(Double bpp, Int clipPicQP, Int *estQP) 1321 { 1322 Int LCUIdx = getLCUCoded(); 1323 1324 Double alpha = m_encRCSeq->getPicPara( m_frameLevel ).m_alpha; 1325 Double beta = m_encRCSeq->getPicPara( m_frameLevel ).m_beta; 1326 1327 Double costPerPixel = getLCU(LCUIdx).m_costIntra/(Double)getLCU(LCUIdx).m_numberOfPixel; 1328 costPerPixel = pow(costPerPixel, BETA1); 1329 Double estLambda = calculateLambdaIntra(alpha, beta, costPerPixel, bpp); 1330 1331 Int clipNeighbourQP = g_RCInvalidQPValue; 1332 for (int i=LCUIdx-1; i>=0; i--) 1333 { 1334 if ((getLCU(i)).m_QP > g_RCInvalidQPValue) 1335 { 1336 clipNeighbourQP = getLCU(i).m_QP; 1337 break; 1338 } 1339 } 1340 1341 Int minQP = clipPicQP - 2; 1342 Int maxQP = clipPicQP + 2; 1343 1344 if ( clipNeighbourQP > g_RCInvalidQPValue ) 1345 { 1346 maxQP = min(clipNeighbourQP + 1, maxQP); 1347 minQP = max(clipNeighbourQP - 1, minQP); 1348 } 1349 1350 Double maxLambda=exp(((Double)(maxQP+0.49)-13.7122)/4.2005); 1351 Double minLambda=exp(((Double)(minQP-0.49)-13.7122)/4.2005); 1352 1353 estLambda = Clip3(minLambda, maxLambda, estLambda); 1354 1355 *estQP = Int( 4.2005 * log(estLambda) + 13.7122 + 0.5 ); 1356 *estQP = Clip3(minQP, maxQP, *estQP); 1357 1358 return estLambda; 1359 } 1360 #endif 930 1361 931 1362 TEncRateCtrl::TEncRateCtrl() … … 961 1392 } 962 1393 1394 #if M0036_RC_IMPROVEMENT 1395 Void TEncRateCtrl::init( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Int keepHierBits, Bool useLCUSeparateModel, GOPEntry GOPList[MAX_GOP] ) 1396 #else 963 1397 Void TEncRateCtrl::init( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Bool keepHierBits, Bool useLCUSeparateModel, GOPEntry GOPList[MAX_GOP] ) 1398 #endif 964 1399 { 965 1400 destroy(); … … 976 1411 977 1412 Int numberOfLevel = 1; 1413 #if M0036_RC_IMPROVEMENT 1414 Int adaptiveBit = 0; 1415 if ( keepHierBits > 0 ) 1416 #else 978 1417 if ( keepHierBits ) 1418 #endif 979 1419 { 980 1420 numberOfLevel = Int( log((Double)GOPSize)/log(2.0) + 0.5 ) + 1; … … 998 1438 } 999 1439 } 1440 1441 #if M0036_RC_IMPROVEMENT 1442 if ( keepHierBits > 0 ) 1443 #else 1000 1444 if ( keepHierBits ) 1445 #endif 1001 1446 { 1002 1447 Double bpp = (Double)( targetBitrate / (Double)( frameRate*picWidth*picHeight ) ); … … 1031 1476 bitsRatio[3] = 14; 1032 1477 } 1478 #if M0036_RC_IMPROVEMENT 1479 if ( keepHierBits == 2 ) 1480 { 1481 adaptiveBit = 1; 1482 } 1483 #endif 1033 1484 } 1034 1485 else if ( GOPSize == 8 && !isLowdelay ) … … 1078 1529 bitsRatio[7] = 1; 1079 1530 } 1531 #if M0036_RC_IMPROVEMENT 1532 if ( keepHierBits == 2 ) 1533 { 1534 adaptiveBit = 2; 1535 } 1536 #endif 1080 1537 } 1081 1538 else 1082 1539 { 1540 #if M0036_RC_IMPROVEMENT 1541 printf( "\n hierarchical bit allocation is not support for the specified coding structure currently.\n" ); 1542 #else 1083 1543 printf( "\n hierarchical bit allocation is not support for the specified coding structure currently." ); 1544 #endif 1084 1545 } 1085 1546 } … … 1094 1555 } 1095 1556 } 1557 #if M0036_RC_IMPROVEMENT 1558 if ( keepHierBits > 0 ) 1559 #else 1096 1560 if ( keepHierBits ) 1561 #endif 1097 1562 { 1098 1563 if ( GOPSize == 4 && isLowdelay ) … … 1129 1594 1130 1595 m_encRCSeq = new TEncRCSeq; 1596 #if M0036_RC_IMPROVEMENT 1597 m_encRCSeq->create( totalFrames, targetBitrate, frameRate, GOPSize, picWidth, picHeight, LCUWidth, LCUHeight, numberOfLevel, useLCUSeparateModel, adaptiveBit ); 1598 #else 1131 1599 m_encRCSeq->create( totalFrames, targetBitrate, frameRate, GOPSize, picWidth, picHeight, LCUWidth, LCUHeight, numberOfLevel, useLCUSeparateModel ); 1600 #endif 1132 1601 m_encRCSeq->initBitsRatio( bitsRatio ); 1133 1602 m_encRCSeq->initGOPID2Level( GOPID2Level ); -
branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncRateCtrl.h
r191 r302 65 65 const Double g_RCWeightPicTargetBitInGOP = 0.9; 66 66 const Double g_RCWeightPicRargetBitInBuffer = 1.0 - g_RCWeightPicTargetBitInGOP; 67 #if M0036_RC_IMPROVEMENT 68 const Int g_RCIterationNum = 20; 69 const Double g_RCWeightHistoryLambda = 0.5; 70 const Double g_RCWeightCurrentLambda = 1.0 - g_RCWeightHistoryLambda; 71 const Int g_RCLCUSmoothWindowSize = 4; 72 const Double g_RCAlphaMinValue = 0.05; 73 const Double g_RCAlphaMaxValue = 500.0; 74 const Double g_RCBetaMinValue = -3.0; 75 const Double g_RCBetaMaxValue = -0.1; 76 #endif 77 78 #if RATE_CONTROL_INTRA 79 #define ALPHA 6.7542; 80 #define BETA1 1.2517 81 #define BETA2 1.7860 82 #endif 67 83 68 84 struct TRCLCU … … 72 88 Int m_targetBits; 73 89 Double m_lambda; 90 #if M0036_RC_IMPROVEMENT 91 Double m_bitWeight; 92 #else 74 93 Double m_MAD; 94 #endif 75 95 Int m_numberOfPixel; 96 #if RATE_CONTROL_INTRA 97 Double m_costIntra; 98 Int m_targetBitsLeft; 99 #endif 76 100 }; 77 101 … … 89 113 90 114 public: 115 #if M0036_RC_IMPROVEMENT 116 Void create( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Int numberOfLevel, Bool useLCUSeparateModel, Int adaptiveBit ); 117 #else 91 118 Void create( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Int numberOfLevel, Bool useLCUSeparateModel ); 119 #endif 92 120 Void destroy(); 93 121 Void initBitsRatio( Int bitsRatio[] ); … … 96 124 Void initLCUPara( TRCParameter** LCUPara = NULL ); // NULL to initial with default value 97 125 Void updateAfterPic ( Int bits ); 126 #if !RATE_CONTROL_INTRA 98 127 Int getRefineBitsForIntra( Int orgBits ); 128 #endif 129 #if M0036_RC_IMPROVEMENT 130 Void setAllBitRatio( Double basicLambda, Double* equaCoeffA, Double* equaCoeffB ); 131 #endif 99 132 100 133 public: … … 134 167 Double getBetaUpdate() { return m_betaUpdate; } 135 168 169 #if M0036_RC_IMPROVEMENT 170 Int getAdaptiveBits() { return m_adaptiveBit; } 171 Double getLastLambda() { return m_lastLambda; } 172 Void setLastLambda( Double lamdba ) { m_lastLambda = lamdba; } 173 #endif 174 136 175 private: 137 176 Int m_totalFrames; … … 160 199 Double m_betaUpdate; 161 200 Bool m_useLCUSeparateModel; 201 202 #if M0036_RC_IMPROVEMENT 203 Int m_adaptiveBit; 204 Double m_lastLambda; 205 #endif 162 206 }; 163 207 … … 175 219 private: 176 220 Int xEstGOPTargetBits( TEncRCSeq* encRCSeq, Int GOPSize ); 221 #if M0036_RC_IMPROVEMENT 222 Void xCalEquaCoeff( TEncRCSeq* encRCSeq, Double* lambdaRatio, Double* equaCoeffA, Double* equaCoeffB, Int GOPSize ); 223 Double xSolveEqua( Double targetBpp, Double* equaCoeffA, Double* equaCoeffB, Int GOPSize ); 224 #endif 177 225 178 226 public: … … 203 251 Void destroy(); 204 252 253 #if !RATE_CONTROL_INTRA 205 254 Double estimatePicLambda( list<TEncRCPic*>& listPreviousPictures ); 255 #endif 206 256 Int estimatePicQP ( Double lambda, list<TEncRCPic*>& listPreviousPictures ); 257 #if RATE_CONTROL_INTRA 258 Int getRefineBitsForIntra(Int orgBits); 259 Double calculateLambdaIntra(double alpha, double beta, double MADPerPixel, double bitsPerPixel); 260 Double estimatePicLambda( list<TEncRCPic*>& listPreviousPictures, SliceType eSliceType); 261 262 Void updateAlphaBetaIntra(double *alpha, double *beta); 263 264 Double getLCUTargetBpp(SliceType eSliceType); 265 Double getLCUEstLambdaAndQP(Double bpp, Int clipPicQP, Int *estQP); 266 #else 207 267 Double getLCUTargetBpp(); 268 #endif 208 269 Double getLCUEstLambda( Double bpp ); 209 270 Int getLCUEstQP( Double lambda, Int clipPicQP ); 210 271 211 272 Void updateAfterLCU( Int LCUIdx, Int bits, Int QP, Double lambda, Bool updateLCUParameter = true ); 273 #if M0036_RC_IMPROVEMENT 274 #if RATE_CONTROL_INTRA 275 Void updateAfterPicture( Int actualHeaderBits, Int actualTotalBits, Double averageQP, Double averageLambda, SliceType eSliceType); 276 #else 277 Void updateAfterPicture( Int actualHeaderBits, Int actualTotalBits, Double averageQP, Double averageLambda ); 278 #endif 279 #else 212 280 Void updateAfterPicture( Int actualHeaderBits, Int actualTotalBits, Double averageQP, Double averageLambda, Double effectivePercentage ); 281 #endif 213 282 214 283 Void addToPictureLsit( list<TEncRCPic*>& listPreviousPictures ); 284 #if !M0036_RC_IMPROVEMENT 215 285 Double getEffectivePercentage(); 286 #endif 216 287 Double calAverageQP(); 217 288 Double calAverageLambda(); … … 229 300 Int getNumberOfLCU() { return m_numberOfLCU; } 230 301 Int getTargetBits() { return m_targetBits; } 302 #if !RATE_CONTROL_INTRA 231 303 Void setTargetBits( Int bits ) { m_targetBits = bits; } 304 #endif 232 305 Int getEstHeaderBits() { return m_estHeaderBits; } 233 306 Int getLCULeft() { return m_LCULeft; } … … 239 312 TRCLCU& getLCU( Int LCUIdx ) { return m_LCUs[LCUIdx]; } 240 313 Int getPicActualHeaderBits() { return m_picActualHeaderBits; } 314 #if !M0036_RC_IMPROVEMENT 241 315 Double getTotalMAD() { return m_totalMAD; } 242 316 Void setTotalMAD( Double MAD ) { m_totalMAD = MAD; } 317 #endif 318 #if RATE_CONTROL_INTRA 319 Void setTargetBits( Int bits ) { m_targetBits = bits; m_bitsLeft = bits;} 320 Void setTotalIntraCost(Double cost) { m_totalCostIntra = cost; } 321 Void getLCUInitTargetBits(); 322 #endif 323 243 324 Int getPicActualBits() { return m_picActualBits; } 244 325 Int getPicActualQP() { return m_picQP; } … … 267 348 TRCLCU* m_LCUs; 268 349 Int m_picActualHeaderBits; // only SH and potential APS 350 #if !M0036_RC_IMPROVEMENT 269 351 Double m_totalMAD; 352 #endif 353 #if RATE_CONTROL_INTRA 354 Double m_totalCostIntra; 355 Double m_remainingCostIntra; 356 #endif 270 357 Int m_picActualBits; // the whole picture, including header 271 358 Int m_picQP; // in integer form 272 359 Double m_picLambda; 360 #if !M0036_RC_IMPROVEMENT 273 361 TEncRCPic* m_lastPicture; 362 #endif 274 363 }; 275 364 … … 281 370 282 371 public: 372 #if M0036_RC_IMPROVEMENT 373 Void init( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Int keepHierBits, Bool useLCUSeparateModel, GOPEntry GOPList[MAX_GOP] ); 374 #else 283 375 Void init( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Bool keepHierBits, Bool useLCUSeparateModel, GOPEntry GOPList[MAX_GOP] ); 376 #endif 284 377 Void destroy(); 285 378 Void initRCPic( Int frameLevel ); -
branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp
r191 r302 299 299 m_iTypePartBest[iPartIdx] = -1; 300 300 if( m_bUseSBACRD ) 301 { 301 302 m_pcRDGoOnSbacCoder->store( m_pppcRDSbacCoder[pOnePart->PartLevel][CI_TEMP_BEST] ); 303 } 302 304 } 303 305 } -
branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncSearch.cpp
r282 r302 1410 1410 1411 1411 #if HHI_RQT_INTRA_SPEEDUP 1412 #if L0232_RD_PENALTY1413 1412 Int maxTuSize = pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize(); 1414 1413 Int isIntraSlice = (pcCU->getSlice()->getSliceType() == I_SLICE); … … 1427 1426 } 1428 1427 if( bCheckFirst && noSplitIntraMaxTuSize ) 1428 { 1429 bCheckSplit = false; 1430 } 1429 1431 #else 1430 if( bCheckFirst && bCheckFull )1431 #endif1432 {1433 bCheckSplit = false;1434 }1435 #else1436 #if L0232_RD_PENALTY1437 1432 Int maxTuSize = pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize(); 1438 1433 Int isIntraSlice = (pcCU->getSlice()->getSliceType() == I_SLICE); … … 1442 1437 bCheckFull = ( uiLog2TrSize <= min(maxTuSize,4)); 1443 1438 } 1444 #endif1445 1439 #endif 1446 1440 Double dSingleCost = MAX_DOUBLE; … … 1617 1611 //----- determine rate and r-d cost ----- 1618 1612 UInt uiSingleBits = xGetIntraBitsQT( pcCU, uiTrDepth, uiAbsPartIdx, true, !bLumaOnly, false ); 1619 #if L0232_RD_PENALTY1620 1613 if(m_pcEncCfg->getRDpenalty() && (uiLog2TrSize==5) && !isIntraSlice) 1621 1614 { 1622 1615 uiSingleBits=uiSingleBits*4; 1623 1616 } 1624 #endif1625 1617 dSingleCost = m_pcRdCost->calcRdCost( uiSingleBits, uiSingleDistY + uiSingleDistC ); 1626 1618 } … … 3096 3088 Int iHeight = 0; 3097 3089 3098 #if 0 //REF_IDX_FRAMEWORK // HM bug fix3099 for( UInt uiMergeCand = 0; uiMergeCand < pcCU->getSlice()->getMaxNumMergeCand(); ++uiMergeCand )3100 {3101 uhInterDirNeighbours[uiMergeCand] = 0;3102 cMvFieldNeighbours[0 + 2*uiMergeCand].setMvField(TComMv(), NOT_VALID);3103 cMvFieldNeighbours[1 + 2*uiMergeCand].setMvField(TComMv(), NOT_VALID);3104 }3105 #endif3106 3090 pcCU->getPartIndexAndSize( iPUIdx, uiAbsPartIdx, iWidth, iHeight ); 3107 3091 UInt uiDepth = pcCU->getDepth( uiAbsPartIdx ); … … 3280 3264 UInt uiBitsTempL0[MAX_NUM_REF]; 3281 3265 3282 #if L0034_COMBINED_LIST_CLEANUP3283 3266 TComMv mvValidList1; 3284 3267 Int refIdxValidList1 = 0; 3285 3268 UInt bitsValidList1 = MAX_UINT; 3286 3269 UInt costValidList1 = MAX_UINT; 3287 #endif3288 3270 3289 3271 xGetBlkBits( ePartSize, pcCU->getSlice()->isInterP(), iPartIdx, uiLastMode, uiMbBits); … … 3349 3331 uiBitsTemp += m_auiMVPIdxCost[aaiMvpIdx[iRefList][iRefIdxTemp]][AMVP_MAX_NUM_CANDS]; 3350 3332 #if ZERO_MVD_EST 3351 #if L0034_COMBINED_LIST_CLEANUP3352 3333 if ( iRefList == 0 || pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp ) < 0 ) 3353 #else3354 if ((iRefList != 1 || !pcCU->getSlice()->getNoBackPredFlag()) &&3355 (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) <= 0 || pcCU->getSlice()->getRefIdxOfLC(eRefPicList, iRefIdxTemp)>=0))3356 #endif3357 3334 { 3358 3335 uiZeroMvdBitsTemp = uiBitsTemp; … … 3374 3351 3375 3352 #if GPB_SIMPLE_UNI 3376 #if L0034_COMBINED_LIST_CLEANUP3377 3353 if ( iRefList == 1 ) // list 1 3378 3354 { … … 3399 3375 } 3400 3376 #else 3401 if ( pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0)3402 {3403 if ( iRefList && ( pcCU->getSlice()->getNoBackPredFlag() || (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && !pcCU->getSlice()->getNoBackPredFlag() && pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(iRefIdxTemp)>=0 ) ) )3404 {3405 if ( pcCU->getSlice()->getNoBackPredFlag() )3406 {3407 cMvTemp[1][iRefIdxTemp] = cMvTemp[0][iRefIdxTemp];3408 uiCostTemp = uiCostTempL0[iRefIdxTemp];3409 /*first subtract the bit-rate part of the cost of the other list*/3410 uiCostTemp -= m_pcRdCost->getCost( uiBitsTempL0[iRefIdxTemp] );3411 }3412 else3413 {3414 cMvTemp[1][iRefIdxTemp] = cMvTemp[0][pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(iRefIdxTemp)];3415 uiCostTemp = uiCostTempL0[pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(iRefIdxTemp)];3416 /*first subtract the bit-rate part of the cost of the other list*/3417 uiCostTemp -= m_pcRdCost->getCost( uiBitsTempL0[pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(iRefIdxTemp)] );3418 }3419 /*correct the bit-rate part of the current ref*/3420 m_pcRdCost->setPredictor ( cMvPred[iRefList][iRefIdxTemp] );3421 uiBitsTemp += m_pcRdCost->getBits( cMvTemp[1][iRefIdxTemp].getHor(), cMvTemp[1][iRefIdxTemp].getVer() );3422 /*calculate the correct cost*/3423 uiCostTemp += m_pcRdCost->getCost( uiBitsTemp );3424 }3425 else3426 {3427 xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp );3428 }3429 }3430 else3431 {3432 if (iRefList && pcCU->getSlice()->getNoBackPredFlag())3433 {3434 uiCostTemp = MAX_UINT;3435 cMvTemp[1][iRefIdxTemp] = cMvTemp[0][iRefIdxTemp];3436 }3437 else3438 {3439 xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp );3440 }3441 }3442 #endif3443 #else3444 3377 xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp ); 3445 3378 #endif … … 3447 3380 xCheckBestMVP(pcCU, eRefPicList, cMvTemp[iRefList][iRefIdxTemp], cMvPred[iRefList][iRefIdxTemp], aaiMvpIdx[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp); 3448 3381 3449 #if L0034_COMBINED_LIST_CLEANUP3450 3382 if ( iRefList == 0 ) 3451 3383 { … … 3472 3404 refIdxValidList1 = iRefIdxTemp; 3473 3405 } 3474 #else3475 if(pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && !pcCU->getSlice()->getNoBackPredFlag())3476 {3477 if(iRefList==REF_PIC_LIST_0)3478 {3479 uiCostTempL0[iRefIdxTemp] = uiCostTemp;3480 uiBitsTempL0[iRefIdxTemp] = uiBitsTemp;3481 if(pcCU->getSlice()->getRefIdxOfLC(REF_PIC_LIST_0, iRefIdxTemp)<0)3482 {3483 uiCostTemp = MAX_UINT;3484 }3485 }3486 else3487 {3488 if(pcCU->getSlice()->getRefIdxOfLC(REF_PIC_LIST_1, iRefIdxTemp)<0)3489 {3490 uiCostTemp = MAX_UINT;3491 }3492 }3493 }3494 3495 #if ENCODER_BUGFIX3496 if ( ( iRefList == 0 && uiCostTemp < uiCost[iRefList] ) ||3497 ( iRefList == 1 && pcCU->getSlice()->getNoBackPredFlag() && iRefIdxTemp == iRefIdx[0] ) ||3498 ( iRefList == 1 && !pcCU->getSlice()->getNoBackPredFlag() && uiCostTemp < uiCost[iRefList] ) )3499 #else3500 if ( ( iRefList == 0 && uiCostTemp < uiCost[iRefList] ) ||3501 ( iRefList == 1 && pcCU->getSlice()->getNoBackPredFlag() && iRefIdxTemp == iRefIdx[0] ) ||3502 ( iRefList == 1 && (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0) && (iRefIdxTemp==0 || iRefIdxTemp == iRefIdx[0]) && !pcCU->getSlice()->getNoBackPredFlag() && (iRefIdxTemp == pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(iRefIdxTemp)) ) ||3503 ( iRefList == 1 && !pcCU->getSlice()->getNoBackPredFlag() && uiCostTemp < uiCost[iRefList] ) )3504 #endif3505 {3506 uiCost[iRefList] = uiCostTemp;3507 uiBits[iRefList] = uiBitsTemp; // storing for bi-prediction3508 3509 // set motion3510 cMv[iRefList] = cMvTemp[iRefList][iRefIdxTemp];3511 iRefIdx[iRefList] = iRefIdxTemp;3512 pcCU->getCUMvField(eRefPicList)->setAllMv( cMv[iRefList], ePartSize, uiPartAddr, 0, iPartIdx );3513 pcCU->getCUMvField(eRefPicList)->setAllRefIdx( iRefIdx[iRefList], ePartSize, uiPartAddr, 0, iPartIdx );3514 3515 if(!pcCU->getSlice()->getMvdL1ZeroFlag())3516 {3517 // storing list 1 prediction signal for iterative bi-directional prediction3518 if ( eRefPicList == REF_PIC_LIST_1 )3519 {3520 TComYuv* pcYuvPred = &m_acYuvPred[iRefList];3521 motionCompensation ( pcCU, pcYuvPred, eRefPicList, iPartIdx );3522 }3523 if ( (pcCU->getSlice()->getNoBackPredFlag() || (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(0)==0 )) && eRefPicList == REF_PIC_LIST_0 )3524 {3525 TComYuv* pcYuvPred = &m_acYuvPred[iRefList];3526 motionCompensation ( pcCU, pcYuvPred, eRefPicList, iPartIdx );3527 }3528 }3529 }3530 #endif3531 3406 } 3532 3407 } … … 3596 3471 3597 3472 Int iRefList = iIter % 2; 3598 #if L0034_COMBINED_LIST_CLEANUP3599 3473 if ( m_pcEncCfg->getUseFastEnc() ) 3600 3474 { … … 3619 3493 motionCompensation ( pcCU, pcYuvPred, RefPicList(1-iRefList), iPartIdx ); 3620 3494 } 3621 #else3622 if ( m_pcEncCfg->getUseFastEnc() && (pcCU->getSlice()->getNoBackPredFlag() || (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(0)==0 )) )3623 {3624 iRefList = 1;3625 }3626 #endif3627 3495 RefPicList eRefPicList = ( iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0 ); 3628 3496 … … 3785 3653 UInt uiMEBits = 0; 3786 3654 // Set Motion Field_ 3787 #if L0034_COMBINED_LIST_CLEANUP3788 3655 cMv[1] = mvValidList1; 3789 3656 iRefIdx[1] = refIdxValidList1; 3790 3657 uiBits[1] = bitsValidList1; 3791 3658 uiCost[1] = costValidList1; 3792 #else3793 if ( pcCU->getSlice()->getNoBackPredFlag() || (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(0)==0 ) )3794 {3795 uiCost[1] = MAX_UINT;3796 }3797 #endif3798 3659 #if AMP_MRG 3799 3660 if (bTestNormalMC) -
branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncSlice.cpp
r296 r302 425 425 rpcSlice->setNumRefIdx(REF_PIC_LIST_1,m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive); 426 426 427 #if L0386_DB_METRIC428 427 if ( m_pcCfg->getDeblockingFilterMetric() ) 429 428 { … … 433 432 rpcSlice->setDeblockingFilterTcOffsetDiv2( 0 ); 434 433 } else 435 #endif436 434 if (rpcSlice->getPPS()->getDeblockingFilterControlPresentFlag()) 437 435 { … … 519 517 // store lambda 520 518 slice->setSliceQp( sliceQP ); 521 #if L0033_RC_BUGFIX522 519 slice->setSliceQpBase ( sliceQP ); 523 #endif524 520 m_pcRdCost ->setLambda( lambda ); 525 521 #if WEIGHTED_CHROMA_DISTORTION … … 828 824 /** \param rpcPic picture class 829 825 */ 826 #if RATE_CONTROL_INTRA 827 Void TEncSlice::calCostSliceI(TComPic*& rpcPic) 828 { 829 UInt uiCUAddr; 830 UInt uiStartCUAddr; 831 UInt uiBoundingCUAddr; 832 Int iSumHad, shift = g_bitDepthY-8, offset = (shift>0)?(1<<(shift-1)):0;; 833 Double iSumHadSlice = 0; 834 835 rpcPic->getSlice(getSliceIdx())->setSliceSegmentBits(0); 836 TComSlice* pcSlice = rpcPic->getSlice(getSliceIdx()); 837 xDetermineStartAndBoundingCUAddr ( uiStartCUAddr, uiBoundingCUAddr, rpcPic, false ); 838 839 UInt uiEncCUOrder; 840 uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU()); 841 for( uiEncCUOrder = uiStartCUAddr/rpcPic->getNumPartInCU(); 842 uiEncCUOrder < (uiBoundingCUAddr+(rpcPic->getNumPartInCU()-1))/rpcPic->getNumPartInCU(); 843 uiCUAddr = rpcPic->getPicSym()->getCUOrderMap(++uiEncCUOrder) ) 844 { 845 // initialize CU encoder 846 TComDataCU*& pcCU = rpcPic->getCU( uiCUAddr ); 847 pcCU->initCU( rpcPic, uiCUAddr ); 848 849 Int height = min( pcSlice->getSPS()->getMaxCUHeight(),pcSlice->getSPS()->getPicHeightInLumaSamples() - uiCUAddr / rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUHeight() ); 850 Int width = min( pcSlice->getSPS()->getMaxCUWidth(),pcSlice->getSPS()->getPicWidthInLumaSamples() - uiCUAddr % rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUWidth() ); 851 852 iSumHad = m_pcCuEncoder->updateLCUDataISlice(pcCU, uiCUAddr, width, height); 853 854 (m_pcRateCtrl->getRCPic()->getLCU(uiCUAddr)).m_costIntra=(iSumHad+offset)>>shift; 855 iSumHadSlice += (m_pcRateCtrl->getRCPic()->getLCU(uiCUAddr)).m_costIntra; 856 857 } 858 m_pcRateCtrl->getRCPic()->setTotalIntraCost(iSumHadSlice); 859 } 860 #endif 861 830 862 Void TEncSlice::compressSlice( TComPic*& rpcPic ) 831 863 { … … 1091 1123 Double bpp = -1.0; 1092 1124 1125 #if M0036_RC_IMPROVEMENT 1126 if ( ( rpcPic->getSlice( 0 )->getSliceType() == I_SLICE && m_pcCfg->getForceIntraQP() ) || !m_pcCfg->getLCULevelRC() ) 1127 #else 1093 1128 if ( rpcPic->getSlice( 0 )->getSliceType() == I_SLICE || !m_pcCfg->getLCULevelRC() ) 1129 #endif 1094 1130 { 1095 1131 estQP = pcSlice->getSliceQp(); … … 1097 1133 else 1098 1134 { 1135 #if RATE_CONTROL_INTRA 1136 bpp = m_pcRateCtrl->getRCPic()->getLCUTargetBpp(pcSlice->getSliceType()); 1137 if ( rpcPic->getSlice( 0 )->getSliceType() == I_SLICE) 1138 { 1139 estLambda = m_pcRateCtrl->getRCPic()->getLCUEstLambdaAndQP(bpp, pcSlice->getSliceQp(), &estQP); 1140 } 1141 else 1142 { 1143 estLambda = m_pcRateCtrl->getRCPic()->getLCUEstLambda( bpp ); 1144 estQP = m_pcRateCtrl->getRCPic()->getLCUEstQP ( estLambda, pcSlice->getSliceQp() ); 1145 } 1146 #else 1099 1147 bpp = m_pcRateCtrl->getRCPic()->getLCUTargetBpp(); 1100 1148 estLambda = m_pcRateCtrl->getRCPic()->getLCUEstLambda( bpp ); 1101 1149 estQP = m_pcRateCtrl->getRCPic()->getLCUEstQP ( estLambda, pcSlice->getSliceQp() ); 1150 #endif 1151 1102 1152 estQP = Clip3( -pcSlice->getSPS()->getQpBDOffsetY(), MAX_QP, estQP ); 1103 1153 1104 1154 m_pcRdCost->setLambda(estLambda); 1155 #if M0036_RC_IMPROVEMENT 1156 #if RDOQ_CHROMA_LAMBDA 1157 // set lambda for RDOQ 1158 Double weight=m_pcRdCost->getChromaWeight(); 1159 m_pcTrQuant->setLambda( estLambda, estLambda / weight ); 1160 #else 1161 m_pcTrQuant->setLambda( estLambda ); 1162 #endif 1163 #endif 1105 1164 } 1106 1165 1107 1166 m_pcRateCtrl->setRCQP( estQP ); 1108 #if L0033_RC_BUGFIX1109 1167 pcCU->getSlice()->setSliceQpBase( estQP ); 1110 #endif1111 1168 } 1112 1169 #endif … … 1115 1172 m_pcCuEncoder->compressCU( pcCU ); 1116 1173 1174 #if !TICKET_1090_FIX 1117 1175 #if RATE_CONTROL_LAMBDA_DOMAIN 1118 1176 if ( m_pcCfg->getUseRateCtrl() ) 1119 1177 { 1178 #if !M0036_RC_IMPROVEMENT 1120 1179 UInt SAD = m_pcCuEncoder->getLCUPredictionSAD(); 1121 1180 Int height = min( pcSlice->getSPS()->getMaxCUHeight(),pcSlice->getSPS()->getPicHeightInLumaSamples() - uiCUAddr / rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUHeight() ); … … 1124 1183 MAD = MAD * MAD; 1125 1184 ( m_pcRateCtrl->getRCPic()->getLCU(uiCUAddr) ).m_MAD = MAD; 1185 #endif 1126 1186 1127 1187 Int actualQP = g_RCInvalidQPValue; … … 1147 1207 } 1148 1208 m_pcRdCost->setLambda(oldLambda); 1149 1209 #if RATE_CONTROL_INTRA 1210 m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda, 1211 pcCU->getSlice()->getSliceType() == I_SLICE ? 0 : m_pcCfg->getLCULevelRC() ); 1212 #else 1150 1213 m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda, m_pcCfg->getLCULevelRC() ); 1151 } 1214 #endif 1215 } 1216 #endif 1152 1217 #endif 1153 1218 … … 1183 1248 } 1184 1249 } 1250 1251 #if TICKET_1090_FIX 1252 #if RATE_CONTROL_LAMBDA_DOMAIN 1253 if ( m_pcCfg->getUseRateCtrl() ) 1254 { 1255 #if !M0036_RC_IMPROVEMENT 1256 UInt SAD = m_pcCuEncoder->getLCUPredictionSAD(); 1257 Int height = min( pcSlice->getSPS()->getMaxCUHeight(),pcSlice->getSPS()->getPicHeightInLumaSamples() - uiCUAddr / rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUHeight() ); 1258 Int width = min( pcSlice->getSPS()->getMaxCUWidth(),pcSlice->getSPS()->getPicWidthInLumaSamples() - uiCUAddr % rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUWidth() ); 1259 Double MAD = (Double)SAD / (Double)(height * width); 1260 MAD = MAD * MAD; 1261 ( m_pcRateCtrl->getRCPic()->getLCU(uiCUAddr) ).m_MAD = MAD; 1262 #endif 1263 1264 Int actualQP = g_RCInvalidQPValue; 1265 Double actualLambda = m_pcRdCost->getLambda(); 1266 Int actualBits = pcCU->getTotalBits(); 1267 Int numberOfEffectivePixels = 0; 1268 for ( Int idx = 0; idx < rpcPic->getNumPartInCU(); idx++ ) 1269 { 1270 if ( pcCU->getPredictionMode( idx ) != MODE_NONE && ( !pcCU->isSkipped( idx ) ) ) 1271 { 1272 numberOfEffectivePixels = numberOfEffectivePixels + 16; 1273 break; 1274 } 1275 } 1276 1277 if ( numberOfEffectivePixels == 0 ) 1278 { 1279 actualQP = g_RCInvalidQPValue; 1280 } 1281 else 1282 { 1283 actualQP = pcCU->getQP( 0 ); 1284 } 1285 m_pcRdCost->setLambda(oldLambda); 1286 1287 #if RATE_CONTROL_INTRA 1288 m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda, 1289 pcCU->getSlice()->getSliceType() == I_SLICE ? 0 : m_pcCfg->getLCULevelRC() ); 1290 #else 1291 m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda, m_pcCfg->getLCULevelRC() ); 1292 #endif 1293 } 1294 #endif 1295 #endif 1185 1296 } 1186 1297 // other case: encodeCU is not called -
branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncSlice.h
r191 r302 132 132 Void precompressSlice ( TComPic*& rpcPic ); ///< precompress slice for multi-loop opt. 133 133 Void compressSlice ( TComPic*& rpcPic ); ///< analysis stage of slice 134 #if RATE_CONTROL_INTRA 135 Void calCostSliceI ( TComPic*& rpcPic ); 136 #endif 134 137 Void encodeSlice ( TComPic*& rpcPic, TComOutputBitstream* pcSubstreams ); 135 138 -
branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncTop.cpp
r291 r302 313 313 /* set the VPS profile information */ 314 314 *m_cVPS.getPTL() = *m_cSPS.getPTL(); 315 #if L0043_TIMING_INFO316 315 m_cVPS.getTimingInfo()->setTimingInfoPresentFlag ( false ); 317 #endif318 316 // initialize PPS 319 317 m_cPPS.setSPS(&m_cSPS); … … 615 613 profileTierLevel.setProfileIdc(m_profile); 616 614 profileTierLevel.setProfileCompatibilityFlag(m_profile, 1); 617 #if L0046_CONSTRAINT_FLAGS618 615 profileTierLevel.setProgressiveSourceFlag(m_progressiveSourceFlag); 619 616 profileTierLevel.setInterlacedSourceFlag(m_interlacedSourceFlag); 620 617 profileTierLevel.setNonPackedConstraintFlag(m_nonPackedConstraintFlag); 621 618 profileTierLevel.setFrameOnlyConstraintFlag(m_frameOnlyConstraintFlag); 622 #endif623 619 624 620 if (m_profile == Profile::MAIN10 && g_bitDepthY == 8 && g_bitDepthC == 8) … … 670 666 671 667 m_cSPS.setMaxTrSize ( 1 << m_uiQuadtreeTULog2MaxSize ); 672 #if !L0034_COMBINED_LIST_CLEANUP673 m_cSPS.setUseLComb ( m_bUseLComb );674 #endif675 668 676 669 Int i; … … 737 730 pcVUI->setFieldSeqFlag(false); 738 731 pcVUI->setHrdParametersPresentFlag(false); 739 #if L0043_TIMING_INFO740 732 pcVUI->getTimingInfo()->setPocProportionalToTimingFlag(getPocProportionalToTimingFlag()); 741 733 pcVUI->getTimingInfo()->setNumTicksPocDiffOneMinus1 (getNumTicksPocDiffOneMinus1() ); 742 #else743 pcVUI->setPocProportionalToTimingFlag(getPocProportionalToTimingFlag());744 pcVUI->setNumTicksPocDiffOneMinus1 (getNumTicksPocDiffOneMinus1() );745 #endif746 734 pcVUI->setBitstreamRestrictionFlag(getBitstreamRestrictionFlag()); 747 735 pcVUI->setTilesFixedStructureFlag(getTilesFixedStructureFlag()); … … 816 804 m_cPPS.setOutputFlagPresentFlag( false ); 817 805 m_cPPS.setSignHideFlag(getSignHideFlag()); 818 #if L0386_DB_METRIC819 806 if ( getDeblockingFilterMetric() ) 820 807 { … … 829 816 m_cPPS.setDeblockingFilterControlPresentFlag (m_DeblockingFilterControlPresent ); 830 817 } 831 #else832 m_cPPS.setDeblockingFilterControlPresentFlag (m_DeblockingFilterControlPresent );833 #endif834 818 m_cPPS.setLog2ParallelMergeLevelMinus2 (m_log2ParallelMergeLevelMinus2 ); 835 819 m_cPPS.setCabacInitPresentFlag(CABAC_INIT_PRESENT_FLAG); … … 855 839 } 856 840 } 857 #if L0323_LIMIT_DEFAULT_LIST_SIZE858 841 assert(bestPos <= 15); 859 #endif860 842 m_cPPS.setNumRefIdxL0DefaultActive(bestPos); 861 843 m_cPPS.setNumRefIdxL1DefaultActive(bestPos); … … 1104 1086 } 1105 1087 1106 #if L0208_SOP_DESCRIPTION_SEI1107 1088 Int TEncTop::getReferencePictureSetIdxForSOP(TComSlice* slice, Int POCCurr, Int GOPid ) 1108 1089 { … … 1134 1115 return rpsIdx; 1135 1116 } 1136 #endif1137 1117 1138 1118 Void TEncTop::xInitPPSforTiles() -
branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncTop.h
r297 r302 199 199 TComPPS* getPPS () { return &m_cPPS; } 200 200 Void selectReferencePictureSet(TComSlice* slice, Int POCCurr, Int GOPid ); 201 #if L0208_SOP_DESCRIPTION_SEI202 201 Int getReferencePictureSetIdxForSOP(TComSlice* slice, Int POCCurr, Int GOPid ); 203 #endif204 202 TComScalingList* getScalingList () { return &m_scalingList; } 205 203 #if SVC_EXTENSION
Note: See TracChangeset for help on using the changeset viewer.