Changeset 189 in SHVCSoftware for trunk/source
- Timestamp:
- 13 May 2013, 16:58:44 (12 years ago)
- Location:
- trunk/source
- Files:
-
- 57 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source
- Property svn:mergeinfo changed
/branches/SHM-2.0-dev/source (added) merged: 133-167,169-182,184-188
- Property svn:mergeinfo changed
-
trunk/source/App/TAppDecoder/TAppDecCfg.h
r125 r189 60 60 #if SVC_EXTENSION 61 61 Char* m_pchReconFile [MAX_LAYERS]; ///< output reconstruction file name 62 #if AVC_BASE63 Char* m_pchBLReconFile; ///< input BL reconstruction file name64 Int m_iBLSourceWidth;65 Int m_iBLSourceHeight;66 #if AVC_SYNTAX67 Char* m_pchBLSyntaxFile; ///< input BL syntax file name68 #endif69 #endif70 62 #else 71 63 Char* m_pchReconFile; ///< output reconstruction file name 72 #endif73 #if SYNTAX_OUTPUT74 Char* m_pchBLSyntaxFile; ///< input BL syntax file name75 Int m_iBLSourceWidth;76 Int m_iBLSourceHeight;77 Int m_iBLFrames;78 64 #endif 79 65 Int m_iSkipFrame; ///< counter for frames prior to the random access point to skip … … 86 72 #if SVC_EXTENSION 87 73 Int m_tgtLayerId; ///< target layer ID 74 #if AVC_BASE 75 Char* m_pchBLReconFile; ///< input BL reconstruction file name 76 Int m_iBLSourceWidth; 77 Int m_iBLSourceHeight; 78 #if AVC_SYNTAX 79 Char* m_pchBLSyntaxFile; ///< input BL syntax file name 88 80 #endif 81 #endif 82 #endif 83 84 #if SYNTAX_OUTPUT 85 Char* m_pchBLSyntaxFile; ///< input BL syntax file name 86 Int m_iBLSourceWidth; 87 Int m_iBLSourceHeight; 88 Int m_iBLFrames; 89 #endif 90 89 91 std::vector<Int> m_targetDecLayerIdSet; ///< set of LayerIds to be included in the sub-bitstream extraction process. 90 92 Int m_respectDefDispWindow; ///< Only output content inside the default display window … … 103 105 #if SVC_EXTENSION 104 106 , m_tgtLayerId(0) 105 #endif106 , m_respectDefDispWindow(0)107 107 #if AVC_BASE 108 108 , m_iBLSourceWidth(0) … … 114 114 , m_iBLFrames(0) 115 115 #endif 116 #endif 117 , m_respectDefDispWindow(0) 116 118 {} 117 119 virtual ~TAppDecCfg() {} -
trunk/source/App/TAppDecoder/TAppDecTop.cpp
r125 r189 157 157 #if AVC_BASE 158 158 TComPic pcBLPic; 159 if( !m_pchBLReconFile ) 160 { 161 printf( "Wrong base layer YUV input file\n" ); 162 exit(EXIT_FAILURE); 163 } 164 fstream streamYUV( m_pchBLReconFile, fstream::in | fstream::binary ); 165 if( !streamYUV.good() ) 166 { 167 printf( "Base layer YUV input reading error\n" ); 168 exit(EXIT_FAILURE); 159 fstream streamYUV; 160 if( m_pchBLReconFile ) 161 { 162 streamYUV.open( m_pchBLReconFile, fstream::in | fstream::binary ); 169 163 } 170 164 TComList<TComPic*> *cListPic = m_acTDecTop[0].getListPic(); … … 174 168 cListPic->pushBack( &pcBLPic ); 175 169 #if AVC_SYNTAX 176 if( !m_pchBLSyntaxFile ) 177 { 178 printf( "Wrong base layer syntax file\n" ); 179 exit(EXIT_FAILURE); 180 } 181 fstream streamSyntaxFile( m_pchBLSyntaxFile, fstream::in | fstream::binary ); 182 if( !streamSyntaxFile.good() ) 183 { 184 printf( "Base layer syntax input reading error\n" ); 185 exit(EXIT_FAILURE); 170 fstream streamSyntaxFile; 171 if( m_pchBLSyntaxFile ) 172 { 173 streamSyntaxFile.open( m_pchBLSyntaxFile, fstream::in | fstream::binary ); 186 174 } 187 175 m_acTDecTop[0].setBLSyntaxFile( &streamSyntaxFile ); … … 254 242 } 255 243 if ( bNewPicture && bNewPOC && 256 ( nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR 244 ( nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL 257 245 || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP 258 246 || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_N_LP 259 || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA NT260 || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA ) )247 || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_RADL 248 || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_LP ) ) 261 249 { 262 250 xFlushOutput( pcListPic, curLayerId ); … … 414 402 } 415 403 if ( bNewPicture && 416 ( nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR 404 ( nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL 417 405 || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP 418 406 || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_N_LP 419 || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA NT420 || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA ) )407 || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_RADL 408 || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_LP ) ) 421 409 { 422 410 xFlushOutput( pcListPic ); … … 572 560 if ( m_pchReconFile ) 573 561 { 562 #if SYNTAX_OUTPUT && ILP_DECODED_PICTURE 563 m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec() ); 564 #else 574 565 const Window &conf = pcPic->getConformanceWindow(); 575 566 const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window(); … … 579 570 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 580 571 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() ); 572 #endif 581 573 } 582 574 -
trunk/source/App/TAppEncoder/TAppEncCfg.cpp
r125 r189 66 66 TAppEncCfg::TAppEncCfg() 67 67 : m_pBitstreamFile() 68 #if AVC_BASE 69 , m_avcBaseLayerFlag(0) 70 #endif 68 71 , m_pColumnWidth() 69 72 , m_pRowHeight() … … 89 92 { 90 93 m_aidQP = NULL; 94 #if J0149_TONE_MAPPING_SEI 95 m_startOfCodedInterval = NULL; 96 m_codedPivotValue = NULL; 97 m_targetPivotValue = NULL; 98 #endif 91 99 } 92 100 #endif … … 102 110 delete[] m_aidQP; 103 111 } 112 #if J0149_TONE_MAPPING_SEI 113 if ( m_startOfCodedInterval ) 114 { 115 delete[] m_startOfCodedInterval; 116 m_startOfCodedInterval = NULL; 117 } 118 if ( m_codedPivotValue ) 119 { 120 delete[] m_codedPivotValue; 121 m_codedPivotValue = NULL; 122 } 123 if ( m_targetPivotValue ) 124 { 125 delete[] m_targetPivotValue; 126 m_targetPivotValue = NULL; 127 } 128 #endif 104 129 free(m_pchInputFile); 105 130 #endif … … 119 144 Void TAppEncCfg::destroy() 120 145 { 146 #if VPS_EXTN_DIRECT_REF_LAYERS 147 for(Int layer = 0; layer < MAX_LAYERS; layer++) 148 { 149 if( m_acLayerCfg[layer].m_numDirectRefLayers > 0 ) 150 { 151 delete [] m_acLayerCfg[layer].m_refLayerIds; 152 } 153 } 154 #endif 121 155 } 122 156 … … 297 331 string* cfg_refLayerIdsPtr [MAX_LAYERS]; 298 332 #endif 333 #if SCALED_REF_LAYER_OFFSETS 334 Int* cfg_scaledRefLayerLeftOffset [MAX_LAYERS]; 335 Int* cfg_scaledRefLayerTopOffset [MAX_LAYERS]; 336 Int* cfg_scaledRefLayerRightOffset [MAX_LAYERS]; 337 Int* cfg_scaledRefLayerBottomOffset [MAX_LAYERS]; 338 #endif 299 339 for(UInt layer = 0; layer < MAX_LAYERS; layer++) 300 340 { … … 311 351 cfg_refLayerIdsPtr [layer] = &cfg_refLayerIds[layer]; 312 352 #endif 313 } 353 #if SCALED_REF_LAYER_OFFSETS 354 cfg_scaledRefLayerLeftOffset [layer] = &m_acLayerCfg[layer].m_scaledRefLayerLeftOffset; 355 cfg_scaledRefLayerTopOffset [layer] = &m_acLayerCfg[layer].m_scaledRefLayerTopOffset; 356 cfg_scaledRefLayerRightOffset [layer] = &m_acLayerCfg[layer].m_scaledRefLayerRightOffset; 357 cfg_scaledRefLayerBottomOffset[layer] = &m_acLayerCfg[layer].m_scaledRefLayerBottomOffset; 358 #endif 359 } 360 #if AVC_BASE 361 string cfg_BLInputFile; 362 #endif 314 363 #if AVC_SYNTAX 315 364 string cfg_BLSyntaxFile; … … 324 373 string cfg_RowHeight; 325 374 string cfg_ScalingListFile; 375 #if J0149_TONE_MAPPING_SEI 376 string cfg_startOfCodedInterval; 377 string cfg_codedPivotValue; 378 string cfg_targetPivotValue; 379 #endif 326 380 #if SIGNAL_BITRATE_PICRATE_IN_VPS 327 381 string cfg_bitRateInfoPresentFlag; … … 361 415 ("OutputBitDepthC", m_outputBitDepthC, 0, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)") 362 416 ("InternalBitDepthC", m_internalBitDepthC, 0, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth)") 363 417 #if SCALED_REF_LAYER_OFFSETS 418 ("ScaledRefLayerLeftOffset%d", cfg_scaledRefLayerLeftOffset, 0, MAX_LAYERS, "Horizontal offset of top-left luma sample of scaled base layer picture with respect to" 419 " top-left luma sample of the EL picture, in units of two luma samples") 420 ("ScaledRefLayerTopOffset%d", cfg_scaledRefLayerTopOffset, 0, MAX_LAYERS, "Vertical offset of top-left luma sample of scaled base layer picture with respect to" 421 " top-left luma sample of the EL picture, in units of two luma samples") 422 ("ScaledRefLayerRightOffset%d", cfg_scaledRefLayerRightOffset, 0, MAX_LAYERS, "Horizontal offset of bottom-right luma sample of scaled base layer picture with respect to" 423 " bottom-right luma sample of the EL picture, in units of two luma samples") 424 ("ScaledRefLayerBottomOffset%d", cfg_scaledRefLayerBottomOffset,0, MAX_LAYERS, "Vertical offset of bottom-right luma sample of scaled base layer picture with respect to" 425 " bottom-right luma sample of the EL picture, in units of two luma samples") 426 #endif 364 427 #if AVC_BASE 365 ("InputBLFile,-ibl", *cfg_InputFile[0], string(""), "Base layer rec YUV input file name") 428 ("AvcBase,-avc", m_avcBaseLayerFlag, 0, "avc_base_layer_flag") 429 ("InputBLFile,-ibl", cfg_BLInputFile, string(""), "Base layer rec YUV input file name") 366 430 #if AVC_SYNTAX 367 431 ("InputBLSyntaxFile,-ibs", cfg_BLSyntaxFile, string(""), "Base layer syntax input file name") … … 369 433 #endif 370 434 #if REF_IDX_FRAMEWORK 371 ("EnableElRapB,-use-rap-b", m_elRapSliceBEnabled, 0, "Set ILP over base-layer I picture to B picture (default is P picture _")435 ("EnableElRapB,-use-rap-b", m_elRapSliceBEnabled, 0, "Set ILP over base-layer I picture to B picture (default is P picture)") 372 436 #endif 373 437 #else … … 430 494 ("DecodingRefreshType,-dr", m_iDecodingRefreshType, 0, "Intra refresh type (0:none 1:CRA 2:IDR)") 431 495 ("GOPSize,g", m_iGOPSize, 1, "GOP size of temporal structure") 496 #if !L0034_COMBINED_LIST_CLEANUP 432 497 ("ListCombination,-lc", m_bUseLComb, true, "Combined reference list for uni-prediction estimation in B-slices") 498 #endif 433 499 // motion options 434 500 ("FastSearch", m_iFastSearch, 1, "0:Full search 1:Diamond 2:PMVFAST") … … 488 554 ("LoopFilterTcOffset_div2", m_loopFilterTcOffsetDiv2, 0 ) 489 555 ("DeblockingFilterControlPresent", m_DeblockingFilterControlPresent, false ) 556 #if L0386_DB_METRIC 557 ("DeblockingFilterMetric", m_DeblockingFilterMetric, false ) 558 #endif 490 559 491 560 // Coding tools … … 602 671 ("SEIBufferingPeriod", m_bufferingPeriodSEIEnabled, 0, "Control generation of buffering period SEI messages") 603 672 ("SEIPictureTiming", m_pictureTimingSEIEnabled, 0, "Control generation of picture timing SEI messages") 673 #if J0149_TONE_MAPPING_SEI 674 ("SEIToneMappingInfo", m_toneMappingInfoSEIEnabled, false, "Control generation of Tone Mapping SEI messages") 675 ("SEIToneMapId", m_toneMapId, 0, "Specifies Id of Tone Mapping SEI message for a given session") 676 ("SEIToneMapCancelFlag", m_toneMapCancelFlag, false, "Indicates that Tone Mapping SEI message cancels the persistance or follows") 677 ("SEIToneMapPersistenceFlag", m_toneMapPersistenceFlag, true, "Specifies the persistence of the Tone Mapping SEI message") 678 ("SEIToneMapCodedDataBitDepth", m_toneMapCodedDataBitDepth, 8, "Specifies Coded Data BitDepth of Tone Mapping SEI messages") 679 ("SEIToneMapTargetBitDepth", m_toneMapTargetBitDepth, 8, "Specifies Output BitDepth of Tome mapping function") 680 ("SEIToneMapModelId", m_toneMapModelId, 0, "Specifies Model utilized for mapping coded data into target_bit_depth range\n" 681 "\t0: linear mapping with clipping\n" 682 "\t1: sigmoidal mapping\n" 683 "\t2: user-defined table mapping\n" 684 "\t3: piece-wise linear mapping\n" 685 "\t4: luminance dynamic range information ") 686 ("SEIToneMapMinValue", m_toneMapMinValue, 0, "Specifies the minimum value in mode 0") 687 ("SEIToneMapMaxValue", m_toneMapMaxValue, 1023, "Specifies the maxmum value in mode 0") 688 ("SEIToneMapSigmoidMidpoint", m_sigmoidMidpoint, 512, "Specifies the centre point in mode 1") 689 ("SEIToneMapSigmoidWidth", m_sigmoidWidth, 960, "Specifies the distance between 5% and 95% values of the target_bit_depth in mode 1") 690 ("SEIToneMapStartOfCodedInterval", cfg_startOfCodedInterval, string(""), "Array of user-defined mapping table") 691 ("SEIToneMapNumPivots", m_numPivots, 0, "Specifies the number of pivot points in mode 3") 692 ("SEIToneMapCodedPivotValue", cfg_codedPivotValue, string(""), "Array of pivot point") 693 ("SEIToneMapTargetPivotValue", cfg_targetPivotValue, string(""), "Array of pivot point") 694 ("SEIToneMapCameraIsoSpeedIdc", m_cameraIsoSpeedIdc, 0, "Indicates the camera ISO speed for daylight illumination") 695 ("SEIToneMapCameraIsoSpeedValue", m_cameraIsoSpeedValue, 400, "Specifies the camera ISO speed for daylight illumination of Extended_ISO") 696 ("SEIToneMapExposureCompensationValueSignFlag", m_exposureCompensationValueSignFlag, 0, "Specifies the sign of ExposureCompensationValue") 697 ("SEIToneMapExposureCompensationValueNumerator", m_exposureCompensationValueNumerator, 0, "Specifies the numerator of ExposureCompensationValue") 698 ("SEIToneMapExposureCompensationValueDenomIdc", m_exposureCompensationValueDenomIdc, 2, "Specifies the denominator of ExposureCompensationValue") 699 ("SEIToneMapRefScreenLuminanceWhite", m_refScreenLuminanceWhite, 350, "Specifies reference screen brightness setting in units of candela per square metre") 700 ("SEIToneMapExtendedRangeWhiteLevel", m_extendedRangeWhiteLevel, 800, "Indicates the luminance dynamic range") 701 ("SEIToneMapNominalBlackLevelLumaCodeValue", m_nominalBlackLevelLumaCodeValue, 16, "Specifies luma sample value of the nominal black level assigned decoded pictures") 702 ("SEIToneMapNominalWhiteLevelLumaCodeValue", m_nominalWhiteLevelLumaCodeValue, 235, "Specifies luma sample value of the nominal white level assigned decoded pictures") 703 ("SEIToneMapExtendedWhiteLevelLumaCodeValue", m_extendedWhiteLevelLumaCodeValue, 300, "Specifies luma sample value of the extended dynamic range assigned decoded pictures") 704 #endif 604 705 ("SEIFramePacking", m_framePackingSEIEnabled, 0, "Control generation of frame packing SEI messages") 605 706 ("SEIFramePackingType", m_framePackingSEIType, 0, "Define frame packing arrangement\n" … … 622 723 ("SEIGradualDecodingRefreshInfo", m_gradualDecodingRefreshInfoEnabled, 0, "Control generation of gradual decoding refresh information SEI message") 623 724 ("SEIDecodingUnitInfo", m_decodingUnitInfoSEIEnabled, 0, "Control generation of decoding unit information SEI message.") 725 #if L0208_SOP_DESCRIPTION_SEI 726 ("SEISOPDescription", m_SOPDescriptionSEIEnabled, 0, "Control generation of SOP description SEI messages") 727 #endif 728 #if K0180_SCALABLE_NESTING_SEI 729 ("SEIScalableNesting", m_scalableNestingSEIEnabled, 0, "Control generation of scalable nesting SEI messages") 730 #endif 624 731 #if SIGNAL_BITRATE_PICRATE_IN_VPS 625 732 ("BitRatePicRateMaxTLayers", m_bitRatePicRateMaxTLayers, 0, "Maximum number of sub-layers signalled; can be inferred otherwise; here for easy parsing of config. file") … … 662 769 /* convert std::string to c string for compatability */ 663 770 #if SVC_EXTENSION 771 #if AVC_BASE 772 if( m_avcBaseLayerFlag ) 773 { 774 *cfg_InputFile[0] = cfg_BLInputFile; 775 } 776 #endif 664 777 m_pBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str()); 665 778 #if AVC_SYNTAX … … 878 991 } 879 992 m_iWaveFrontSubstreams = m_iWaveFrontSynchro ? (m_iSourceHeight + m_uiMaxCUHeight - 1) / m_uiMaxCUHeight : 1; 993 #endif 994 #if J0149_TONE_MAPPING_SEI 995 if( m_toneMappingInfoSEIEnabled && !m_toneMapCancelFlag ) 996 { 997 Char* pcStartOfCodedInterval = cfg_startOfCodedInterval.empty() ? NULL: strdup(cfg_startOfCodedInterval.c_str()); 998 Char* pcCodedPivotValue = cfg_codedPivotValue.empty() ? NULL: strdup(cfg_codedPivotValue.c_str()); 999 Char* pcTargetPivotValue = cfg_targetPivotValue.empty() ? NULL: strdup(cfg_targetPivotValue.c_str()); 1000 if( m_toneMapModelId == 2 && pcStartOfCodedInterval ) 1001 { 1002 char *startOfCodedInterval; 1003 UInt num = 1u<< m_toneMapTargetBitDepth; 1004 m_startOfCodedInterval = new Int[num]; 1005 ::memset( m_startOfCodedInterval, 0, sizeof(Int)*num ); 1006 startOfCodedInterval = strtok(pcStartOfCodedInterval, " ."); 1007 int i = 0; 1008 while( startOfCodedInterval && ( i < num ) ) 1009 { 1010 m_startOfCodedInterval[i] = atoi( startOfCodedInterval ); 1011 startOfCodedInterval = strtok(NULL, " ."); 1012 i++; 1013 } 1014 } 1015 else 1016 { 1017 m_startOfCodedInterval = NULL; 1018 } 1019 if( ( m_toneMapModelId == 3 ) && ( m_numPivots > 0 ) ) 1020 { 1021 if( pcCodedPivotValue && pcTargetPivotValue ) 1022 { 1023 char *codedPivotValue; 1024 char *targetPivotValue; 1025 m_codedPivotValue = new Int[m_numPivots]; 1026 m_targetPivotValue = new Int[m_numPivots]; 1027 ::memset( m_codedPivotValue, 0, sizeof(Int)*( m_numPivots ) ); 1028 ::memset( m_targetPivotValue, 0, sizeof(Int)*( m_numPivots ) ); 1029 codedPivotValue = strtok(pcCodedPivotValue, " ."); 1030 int i=0; 1031 while(codedPivotValue&&i<m_numPivots) 1032 { 1033 m_codedPivotValue[i] = atoi( codedPivotValue ); 1034 codedPivotValue = strtok(NULL, " ."); 1035 i++; 1036 } 1037 i=0; 1038 targetPivotValue = strtok(pcTargetPivotValue, " ."); 1039 while(targetPivotValue&&i<m_numPivots) 1040 { 1041 m_targetPivotValue[i]= atoi( targetPivotValue ); 1042 targetPivotValue = strtok(NULL, " ."); 1043 i++; 1044 } 1045 } 1046 } 1047 else 1048 { 1049 m_codedPivotValue = NULL; 1050 m_targetPivotValue = NULL; 1051 } 1052 } 880 1053 #endif 881 1054 // check validity of input parameters … … 1139 1312 1140 1313 #if SVC_EXTENSION 1314 xConfirmPara( m_numLayers > MAX_LAYERS , "Number of layers in config file is greater than MAX_LAYERS" ); 1315 m_numLayers = m_numLayers > MAX_LAYERS ? MAX_LAYERS : m_numLayers; 1316 1141 1317 // verify layer configuration parameters 1142 1318 for(UInt layer=0; layer<m_numLayers; layer++) … … 1375 1551 { 1376 1552 m_numReorderPics[i] = 0; 1553 #if L0323_DPB 1554 m_maxDecPicBuffering[i] = 1; 1555 #else 1377 1556 m_maxDecPicBuffering[i] = 0; 1557 #endif 1378 1558 } 1379 1559 for(Int i=0; i<m_iGOPSize; i++) 1380 1560 { 1561 #if L0323_DPB 1562 if(m_GOPList[i].m_numRefPics+1 > m_maxDecPicBuffering[m_GOPList[i].m_temporalId]) 1563 #else 1381 1564 if(m_GOPList[i].m_numRefPics > m_maxDecPicBuffering[m_GOPList[i].m_temporalId]) 1382 { 1565 #endif 1566 { 1567 #if L0323_DPB 1568 m_maxDecPicBuffering[m_GOPList[i].m_temporalId] = m_GOPList[i].m_numRefPics + 1; 1569 #else 1383 1570 m_maxDecPicBuffering[m_GOPList[i].m_temporalId] = m_GOPList[i].m_numRefPics; 1571 #endif 1384 1572 } 1385 1573 Int highestDecodingNumberWithLowerPOC = 0; … … 1412 1600 m_numReorderPics[i+1] = m_numReorderPics[i]; 1413 1601 } 1602 #if L0323_DPB 1603 // the value of num_reorder_pics[ i ] shall be in the range of 0 to max_dec_pic_buffering[ i ] - 1, inclusive 1604 if(m_numReorderPics[i] > m_maxDecPicBuffering[i] - 1) 1605 { 1606 m_maxDecPicBuffering[i] = m_numReorderPics[i] + 1; 1607 } 1608 #else 1414 1609 // the value of num_reorder_pics[ i ] shall be in the range of 0 to max_dec_pic_buffering[ i ], inclusive 1415 1610 if(m_numReorderPics[i] > m_maxDecPicBuffering[i]) … … 1417 1612 m_maxDecPicBuffering[i] = m_numReorderPics[i]; 1418 1613 } 1614 #endif 1419 1615 // a lower layer can not have higher value of m_uiMaxDecPicBuffering than a higher layer 1420 1616 if(m_maxDecPicBuffering[i+1] < m_maxDecPicBuffering[i]) … … 1423 1619 } 1424 1620 } 1621 1622 1623 #if L0323_DPB 1624 // the value of num_reorder_pics[ i ] shall be in the range of 0 to max_dec_pic_buffering[ i ] - 1, inclusive 1625 if(m_numReorderPics[MAX_TLAYER-1] > m_maxDecPicBuffering[MAX_TLAYER-1] - 1) 1626 { 1627 m_maxDecPicBuffering[MAX_TLAYER-1] = m_numReorderPics[MAX_TLAYER-1] + 1; 1628 } 1629 #else 1425 1630 // the value of num_reorder_pics[ i ] shall be in the range of 0 to max_dec_pic_buffering[ i ], inclusive 1426 1631 if(m_numReorderPics[MAX_TLAYER-1] > m_maxDecPicBuffering[MAX_TLAYER-1]) … … 1428 1633 m_maxDecPicBuffering[MAX_TLAYER-1] = m_numReorderPics[MAX_TLAYER-1]; 1429 1634 } 1635 #endif 1430 1636 1431 1637 #if SVC_EXTENSION // ToDo: it should be checked for the case when parameters are different for the layers … … 1511 1717 } 1512 1718 #endif 1513 1719 #if !L0034_COMBINED_LIST_CLEANUP 1514 1720 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. 1721 #endif 1515 1722 xConfirmPara( m_iWaveFrontSynchro < 0, "WaveFrontSynchro cannot be negative" ); 1516 1723 #if !SVC_EXTENSION … … 1520 1727 1521 1728 xConfirmPara( m_decodedPictureHashSEIEnabled<0 || m_decodedPictureHashSEIEnabled>3, "this hash type is not correct!\n"); 1729 1730 #if J0149_TONE_MAPPING_SEI 1731 if (m_toneMappingInfoSEIEnabled) 1732 { 1733 xConfirmPara( m_toneMapCodedDataBitDepth < 8 || m_toneMapCodedDataBitDepth > 14 , "SEIToneMapCodedDataBitDepth must be in rage 8 to 14"); 1734 xConfirmPara( m_toneMapTargetBitDepth < 1 || (m_toneMapTargetBitDepth > 16 && m_toneMapTargetBitDepth < 255) , "SEIToneMapTargetBitDepth must be in rage 1 to 16 or equal to 255"); 1735 xConfirmPara( m_toneMapModelId < 0 || m_toneMapModelId > 4 , "SEIToneMapModelId must be in rage 0 to 4"); 1736 xConfirmPara( m_cameraIsoSpeedValue == 0, "SEIToneMapCameraIsoSpeedValue shall not be equal to 0"); 1737 xConfirmPara( m_extendedRangeWhiteLevel < 100, "SEIToneMapExtendedRangeWhiteLevel should be greater than or equal to 100"); 1738 xConfirmPara( m_nominalBlackLevelLumaCodeValue >= m_nominalWhiteLevelLumaCodeValue, "SEIToneMapNominalWhiteLevelLumaCodeValue shall be greater than SEIToneMapNominalBlackLevelLumaCodeValue"); 1739 xConfirmPara( m_extendedWhiteLevelLumaCodeValue < m_nominalWhiteLevelLumaCodeValue, "SEIToneMapExtendedWhiteLevelLumaCodeValue shall be greater than or equal to SEIToneMapNominalWhiteLevelLumaCodeValue"); 1740 } 1741 #endif 1522 1742 1523 1743 #if RATE_CONTROL_LAMBDA_DOMAIN … … 1609 1829 { 1610 1830 printf("=== Layer %d settings === \n", layer); 1831 #if AVC_SYNTAX 1832 m_acLayerCfg[layer].xPrintParameter( layer ); 1833 #else 1611 1834 m_acLayerCfg[layer].xPrintParameter(); 1835 #endif 1612 1836 printf("\n"); 1613 1837 } … … 1677 1901 printf("SQP:%d ", m_uiDeltaQpRD ); 1678 1902 printf("ASR:%d ", m_bUseASR ); 1903 #if !L0034_COMBINED_LIST_CLEANUP 1679 1904 printf("LComb:%d ", m_bUseLComb ); 1905 #endif 1680 1906 printf("FEN:%d ", m_bUseFastEnc ); 1681 1907 printf("ECU:%d ", m_bUseEarlyCU ); … … 1718 1944 #if SVC_EXTENSION 1719 1945 printf("RecalQP:%d ", m_recalculateQPAccordingToLambda ? 1 : 0 ); 1720 printf("AVC_BASE:%d ", AVC_BASE); 1946 #if AVC_BASE 1947 printf("AvcBase:%d ", m_avcBaseLayerFlag ? 1 : 0); 1948 #else 1949 printf("AvcBase:%d ", 0); 1950 #endif 1721 1951 #if REF_IDX_FRAMEWORK 1722 1952 printf("REF_IDX_FRAMEWORK:%d ", REF_IDX_FRAMEWORK); 1723 1953 printf("EL_RAP_SliceType: %d ", m_elRapSliceBEnabled); 1724 printf("REF_IDX_ME_ZEROMV: %d", REF_IDX_ME_ZEROMV); 1954 printf("REF_IDX_ME_ZEROMV: %d ", REF_IDX_ME_ZEROMV); 1955 printf("ENCODER_FAST_MODE: %d ", ENCODER_FAST_MODE); 1956 printf("REF_IDX_MFM: %d ", REF_IDX_MFM); 1725 1957 #elif INTRA_BL 1726 1958 printf("INTRA_BL:%d ", INTRA_BL); -
trunk/source/App/TAppEncoder/TAppEncCfg.h
r125 r189 67 67 UInt m_FrameSkip; ///< number of skipped frames from the beginning 68 68 Int m_framesToBeEncoded; ///< number of encoded frames 69 #if AVC_BASE 70 Int m_avcBaseLayerFlag; ///< AVC_BASElayer_flag 71 #endif 69 72 #if AVC_SYNTAX 70 char* m_BLSyntaxFile; ///< input syntax file73 Char* m_BLSyntaxFile; ///< input syntax file 71 74 #endif 72 75 #else … … 109 112 GOPEntry m_GOPList[MAX_GOP]; ///< the coding structure entries from the config file 110 113 Int m_numReorderPics[MAX_TLAYER]; ///< total number of reorder pictures 114 #if L0323_DPB 115 Int m_maxDecPicBuffering[MAX_TLAYER]; ///< total number of pictures in the decoded picture buffer 116 #else 111 117 Int m_maxDecPicBuffering[MAX_TLAYER]; ///< total number of reference pictures needed for decoding 118 #endif 119 #if !L0034_COMBINED_LIST_CLEANUP 112 120 Bool m_bUseLComb; ///< flag for using combined reference list for uni-prediction in B-slices (JCTVC-D421) 121 #endif 113 122 Bool m_useTransformSkip; ///< flag for enabling intra transform skipping 114 123 Bool m_useTransformSkipFast; ///< flag for enabling fast intra transform skipping … … 172 181 Int m_loopFilterTcOffsetDiv2; ///< tc offset for deblocking filter 173 182 Bool m_DeblockingFilterControlPresent; ///< deblocking filter control present flag in PPS 183 #if L0386_DB_METRIC 184 Bool m_DeblockingFilterMetric; ///< blockiness metric in encoder 185 #endif 174 186 175 187 // coding tools (PCM) … … 223 235 Int m_bufferingPeriodSEIEnabled; 224 236 Int m_pictureTimingSEIEnabled; 237 #if J0149_TONE_MAPPING_SEI 238 Bool m_toneMappingInfoSEIEnabled; 239 Int m_toneMapId; 240 Bool m_toneMapCancelFlag; 241 Bool m_toneMapPersistenceFlag; 242 Int m_toneMapCodedDataBitDepth; 243 Int m_toneMapTargetBitDepth; 244 Int m_toneMapModelId; 245 Int m_toneMapMinValue; 246 Int m_toneMapMaxValue; 247 Int m_sigmoidMidpoint; 248 Int m_sigmoidWidth; 249 Int m_numPivots; 250 Int m_cameraIsoSpeedIdc; 251 Int m_cameraIsoSpeedValue; 252 Int m_exposureCompensationValueSignFlag; 253 Int m_exposureCompensationValueNumerator; 254 Int m_exposureCompensationValueDenomIdc; 255 Int m_refScreenLuminanceWhite; 256 Int m_extendedRangeWhiteLevel; 257 Int m_nominalBlackLevelLumaCodeValue; 258 Int m_nominalWhiteLevelLumaCodeValue; 259 Int m_extendedWhiteLevelLumaCodeValue; 260 Int* m_startOfCodedInterval; 261 Int* m_codedPivotValue; 262 Int* m_targetPivotValue; 263 #endif 225 264 Int m_framePackingSEIEnabled; 226 265 Int m_framePackingSEIType; … … 232 271 Int m_gradualDecodingRefreshInfoEnabled; 233 272 Int m_decodingUnitInfoSEIEnabled; 273 #if L0208_SOP_DESCRIPTION_SEI 274 Int m_SOPDescriptionSEIEnabled; 275 #endif 276 #if K0180_SCALABLE_NESTING_SEI 277 Int m_scalableNestingSEIEnabled; 278 #endif 234 279 // weighted prediction 235 280 Bool m_useWeightedPred; ///< Use of weighted prediction in P slices … … 316 361 Int* m_constantPicRateIdc; ///< Indicates constant picture rate idc for various sub-layers 317 362 #endif 318 #319 363 public: 320 364 TAppEncCfg(); -
trunk/source/App/TAppEncoder/TAppEncLayerCfg.cpp
r125 r189 116 116 } 117 117 118 #if AVC_SYNTAX 119 Void TAppEncLayerCfg::xPrintParameter( UInt layerId ) 120 #else 118 121 Void TAppEncLayerCfg::xPrintParameter() 122 #endif 119 123 { 120 124 printf("Input File : %s\n", m_cInputFile.c_str() ); 121 125 printf("Reconstruction File : %s\n", m_cReconFile.c_str() ); 122 126 #if AVC_SYNTAX 123 printf("Base layer input file : %s\n", m_cAppEncCfg->getBLSyntaxFile() ); 127 if( layerId == 0 ) 128 { 129 printf("Base layer syntax file : %s\n", m_cAppEncCfg->getBLSyntaxFile() ); 130 } 124 131 #endif 125 132 printf("Real Format : %dx%d %dHz\n", m_iSourceWidth - m_confLeft - m_confRight, m_iSourceHeight - m_confTop - m_confBottom, m_iFrameRate ); -
trunk/source/App/TAppEncoder/TAppEncLayerCfg.h
r125 r189 54 54 Int* m_aidQP; ///< array of slice QP values 55 55 TAppEncCfg* m_cAppEncCfg; ///< pointer to app encoder config 56 #if SCALED_REF_LAYER_OFFSETS 57 Int m_scaledRefLayerLeftOffset; 58 Int m_scaledRefLayerTopOffset; 59 Int m_scaledRefLayerRightOffset; 60 Int m_scaledRefLayerBottomOffset; 61 #endif 56 62 public: 57 63 TAppEncLayerCfg(); … … 63 69 bool parseCfg ( const string& cfgFileName ); ///< parse layer configuration file to fill member variables 64 70 71 #if AVC_SYNTAX 72 Void xPrintParameter( UInt layerId ); 73 #else 65 74 Void xPrintParameter(); 75 #endif 66 76 Bool xCheckParameter(); 67 77 -
trunk/source/App/TAppEncoder/TAppEncTop.cpp
r125 r189 1 1 /* The copyright in this software is being made available under the BSD 2 * License, included below. This software may be subject to other third party3 * and contributor rights, including patent rights, and no such rights are4 * granted under this license.5 *6 * Copyright (c) 2010-2013, ITU/ISO/IEC7 * All rights reserved.8 *9 * Redistribution and use in source and binary forms, with or without10 * modification, are permitted provided that the following conditions are met:11 *12 * * Redistributions of source code must retain the above copyright notice,13 * this list of conditions and the following disclaimer.14 * * Redistributions in binary form must reproduce the above copyright notice,15 * this list of conditions and the following disclaimer in the documentation16 * and/or other materials provided with the distribution.17 * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may18 * be used to endorse or promote products derived from this software without19 * specific prior written permission.20 *21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF31 * THE POSSIBILITY OF SUCH DAMAGE.32 */2 * License, included below. This software may be subject to other third party 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 5 * 6 * Copyright (c) 2010-2013, ITU/ISO/IEC 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions are met: 11 * 12 * * Redistributions of source code must retain the above copyright notice, 13 * this list of conditions and the following disclaimer. 14 * * Redistributions in binary form must reproduce the above copyright notice, 15 * this list of conditions and the following disclaimer in the documentation 16 * and/or other materials provided with the distribution. 17 * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 * be used to endorse or promote products derived from this software without 19 * specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 * THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 33 34 34 /** \file TAppEncTop.cpp 35 \brief Encoder application class35 \brief Encoder application class 36 36 */ 37 37 … … 112 112 113 113 #if REF_IDX_MFM 114 #if AVC_BASE 115 m_acTEncTop[layer].setMFMEnabledFlag(layer == 0 ? false : ( m_avcBaseLayerFlag ? AVC_SYNTAX : true )); 116 #else 114 117 m_acTEncTop[layer].setMFMEnabledFlag(layer == 0 ? false : true); 118 #endif 115 119 #endif 116 120 // set layer ID … … 167 171 m_acTEncTop[layer].setLoopFilterTcOffset ( m_loopFilterTcOffsetDiv2 ); 168 172 m_acTEncTop[layer].setDeblockingFilterControlPresent( m_DeblockingFilterControlPresent); 173 #if L0386_DB_METRIC 174 m_acTEncTop[layer].setDeblockingFilterMetric ( m_DeblockingFilterMetric ); 175 #endif 169 176 170 177 //====== Motion search ======== … … 200 207 m_acTEncTop[layer].setUseHADME ( m_bUseHADME ); 201 208 m_acTEncTop[layer].setUseLossless ( m_useLossless ); 202 m_acTEncTop[layer].setUseLComb ( m_bUseLComb ); 209 #if !L0034_COMBINED_LIST_CLEANUP 210 m_cTEncTop.setUseLComb ( m_bUseLComb ); 211 #endif 203 212 m_acTEncTop[layer].setdQPs ( m_acLayerCfg[layer].getdQPs() ); 204 213 m_acTEncTop[layer].setUseRDOQ ( m_useRDOQ ); … … 270 279 m_acTEncTop[layer].setBufferingPeriodSEIEnabled( m_bufferingPeriodSEIEnabled ); 271 280 m_acTEncTop[layer].setPictureTimingSEIEnabled( m_pictureTimingSEIEnabled ); 281 #if J0149_TONE_MAPPING_SEI 282 m_acTEncTop[layer].setToneMappingInfoSEIEnabled ( m_toneMappingInfoSEIEnabled ); 283 m_acTEncTop[layer].setTMISEIToneMapId ( m_toneMapId ); 284 m_acTEncTop[layer].setTMISEIToneMapCancelFlag ( m_toneMapCancelFlag ); 285 m_acTEncTop[layer].setTMISEIToneMapPersistenceFlag ( m_toneMapPersistenceFlag ); 286 m_acTEncTop[layer].setTMISEICodedDataBitDepth ( m_toneMapCodedDataBitDepth ); 287 m_acTEncTop[layer].setTMISEITargetBitDepth ( m_toneMapTargetBitDepth ); 288 m_acTEncTop[layer].setTMISEIModelID ( m_toneMapModelId ); 289 m_acTEncTop[layer].setTMISEIMinValue ( m_toneMapMinValue ); 290 m_acTEncTop[layer].setTMISEIMaxValue ( m_toneMapMaxValue ); 291 m_acTEncTop[layer].setTMISEISigmoidMidpoint ( m_sigmoidMidpoint ); 292 m_acTEncTop[layer].setTMISEISigmoidWidth ( m_sigmoidWidth ); 293 m_acTEncTop[layer].setTMISEIStartOfCodedInterva ( m_startOfCodedInterval ); 294 m_acTEncTop[layer].setTMISEINumPivots ( m_numPivots ); 295 m_acTEncTop[layer].setTMISEICodedPivotValue ( m_codedPivotValue ); 296 m_acTEncTop[layer].setTMISEITargetPivotValue ( m_targetPivotValue ); 297 m_acTEncTop[layer].setTMISEICameraIsoSpeedIdc ( m_cameraIsoSpeedIdc ); 298 m_acTEncTop[layer].setTMISEICameraIsoSpeedValue ( m_cameraIsoSpeedValue ); 299 m_acTEncTop[layer].setTMISEIExposureCompensationValueSignFlag ( m_exposureCompensationValueSignFlag ); 300 m_acTEncTop[layer].setTMISEIExposureCompensationValueNumerator ( m_exposureCompensationValueNumerator ); 301 m_acTEncTop[layer].setTMISEIExposureCompensationValueDenomIdc ( m_exposureCompensationValueDenomIdc ); 302 m_acTEncTop[layer].setTMISEIRefScreenLuminanceWhite ( m_refScreenLuminanceWhite ); 303 m_acTEncTop[layer].setTMISEIExtendedRangeWhiteLevel ( m_extendedRangeWhiteLevel ); 304 m_acTEncTop[layer].setTMISEINominalBlackLevelLumaCodeValue ( m_nominalBlackLevelLumaCodeValue ); 305 m_acTEncTop[layer].setTMISEINominalWhiteLevelLumaCodeValue ( m_nominalWhiteLevelLumaCodeValue ); 306 m_acTEncTop[layer].setTMISEIExtendedWhiteLevelLumaCodeValue ( m_extendedWhiteLevelLumaCodeValue ); 307 #endif 272 308 m_acTEncTop[layer].setFramePackingArrangementSEIEnabled( m_framePackingSEIEnabled ); 273 309 m_acTEncTop[layer].setFramePackingArrangementSEIType( m_framePackingSEIType ); … … 279 315 m_acTEncTop[layer].setGradualDecodingRefreshInfoEnabled( m_gradualDecodingRefreshInfoEnabled ); 280 316 m_acTEncTop[layer].setDecodingUnitInfoSEIEnabled( m_decodingUnitInfoSEIEnabled ); 317 #if L0208_SOP_DESCRIPTION_SEI 318 m_acTEncTop[layer].setSOPDescriptionSEIEnabled( m_SOPDescriptionSEIEnabled ); 319 #endif 320 #if K0180_SCALABLE_NESTING_SEI 321 m_acTEncTop[layer].setScalableNestingSEIEnabled( m_scalableNestingSEIEnabled ); 322 #endif 281 323 m_acTEncTop[layer].setUniformSpacingIdr ( m_iUniformSpacingIdr ); 282 324 m_acTEncTop[layer].setNumColumnsMinus1 ( m_iNumColumnsMinus1 ); … … 376 418 m_acTEncTop[layer].setElRapSliceTypeB(layer == 0? 0 : m_elRapSliceBEnabled); 377 419 #endif 420 #if SCALED_REF_LAYER_OFFSETS 421 if( layer > 0 ) 422 { 423 m_acTEncTop[layer].getScaledRefLayerWindow().setWindow( 2*m_acLayerCfg[layer].m_scaledRefLayerLeftOffset, 2*m_acLayerCfg[layer].m_scaledRefLayerRightOffset, 424 2*m_acLayerCfg[layer].m_scaledRefLayerTopOffset, 2*m_acLayerCfg[layer].m_scaledRefLayerBottomOffset); 425 } 426 #endif 378 427 } 379 428 } … … 442 491 m_cTEncTop.setLoopFilterTcOffset ( m_loopFilterTcOffsetDiv2 ); 443 492 m_cTEncTop.setDeblockingFilterControlPresent( m_DeblockingFilterControlPresent); 493 #if L0386_DB_METRIC 494 m_cTEncTop.setDeblockingFilterMetric ( m_DeblockingFilterMetric ); 495 #endif 444 496 445 497 //====== Motion search ======== … … 475 527 m_cTEncTop.setUseHADME ( m_bUseHADME ); 476 528 m_cTEncTop.setUseLossless ( m_useLossless ); 529 #if !L0034_COMBINED_LIST_CLEANUP 477 530 m_cTEncTop.setUseLComb ( m_bUseLComb ); 531 #endif 478 532 m_cTEncTop.setdQPs ( m_aidQP ); 479 533 m_cTEncTop.setUseRDOQ ( m_useRDOQ ); … … 545 599 m_cTEncTop.setBufferingPeriodSEIEnabled( m_bufferingPeriodSEIEnabled ); 546 600 m_cTEncTop.setPictureTimingSEIEnabled( m_pictureTimingSEIEnabled ); 601 #if J0149_TONE_MAPPING_SEI 602 m_cTEncTop.setToneMappingInfoSEIEnabled ( m_toneMappingInfoSEIEnabled ); 603 m_cTEncTop.setTMISEIToneMapId ( m_toneMapId ); 604 m_cTEncTop.setTMISEIToneMapCancelFlag ( m_toneMapCancelFlag ); 605 m_cTEncTop.setTMISEIToneMapPersistenceFlag ( m_toneMapPersistenceFlag ); 606 m_cTEncTop.setTMISEICodedDataBitDepth ( m_toneMapCodedDataBitDepth ); 607 m_cTEncTop.setTMISEITargetBitDepth ( m_toneMapTargetBitDepth ); 608 m_cTEncTop.setTMISEIModelID ( m_toneMapModelId ); 609 m_cTEncTop.setTMISEIMinValue ( m_toneMapMinValue ); 610 m_cTEncTop.setTMISEIMaxValue ( m_toneMapMaxValue ); 611 m_cTEncTop.setTMISEISigmoidMidpoint ( m_sigmoidMidpoint ); 612 m_cTEncTop.setTMISEISigmoidWidth ( m_sigmoidWidth ); 613 m_cTEncTop.setTMISEIStartOfCodedInterva ( m_startOfCodedInterval ); 614 m_cTEncTop.setTMISEINumPivots ( m_numPivots ); 615 m_cTEncTop.setTMISEICodedPivotValue ( m_codedPivotValue ); 616 m_cTEncTop.setTMISEITargetPivotValue ( m_targetPivotValue ); 617 m_cTEncTop.setTMISEICameraIsoSpeedIdc ( m_cameraIsoSpeedIdc ); 618 m_cTEncTop.setTMISEICameraIsoSpeedValue ( m_cameraIsoSpeedValue ); 619 m_cTEncTop.setTMISEIExposureCompensationValueSignFlag ( m_exposureCompensationValueSignFlag ); 620 m_cTEncTop.setTMISEIExposureCompensationValueNumerator ( m_exposureCompensationValueNumerator ); 621 m_cTEncTop.setTMISEIExposureCompensationValueDenomIdc ( m_exposureCompensationValueDenomIdc ); 622 m_cTEncTop.setTMISEIRefScreenLuminanceWhite ( m_refScreenLuminanceWhite ); 623 m_cTEncTop.setTMISEIExtendedRangeWhiteLevel ( m_extendedRangeWhiteLevel ); 624 m_cTEncTop.setTMISEINominalBlackLevelLumaCodeValue ( m_nominalBlackLevelLumaCodeValue ); 625 m_cTEncTop.setTMISEINominalWhiteLevelLumaCodeValue ( m_nominalWhiteLevelLumaCodeValue ); 626 m_cTEncTop.setTMISEIExtendedWhiteLevelLumaCodeValue ( m_extendedWhiteLevelLumaCodeValue ); 627 #endif 547 628 m_cTEncTop.setFramePackingArrangementSEIEnabled( m_framePackingSEIEnabled ); 548 629 m_cTEncTop.setFramePackingArrangementSEIType( m_framePackingSEIType ); … … 554 635 m_cTEncTop.setGradualDecodingRefreshInfoEnabled( m_gradualDecodingRefreshInfoEnabled ); 555 636 m_cTEncTop.setDecodingUnitInfoSEIEnabled( m_decodingUnitInfoSEIEnabled ); 637 #if L0208_SOP_DESCRIPTION_SEI 638 m_cTEncTop.setSOPDescriptionSEIEnabled( m_SOPDescriptionSEIEnabled ); 639 #endif 640 #if K0180_SCALABLE_NESTING_SEI 641 m_cTEncTop.setScalableNestingSEIEnabled( m_scalableNestingSEIEnabled ); 642 #endif 556 643 m_cTEncTop.setUniformSpacingIdr ( m_iUniformSpacingIdr ); 557 644 m_cTEncTop.setNumColumnsMinus1 ( m_iNumColumnsMinus1 ); … … 729 816 #if VPS_EXTN_MASK_AND_DIM_INFO 730 817 UInt i = 0, dimIdLen = 0; 818 #if AVC_BASE 819 vps->setAvcBaseLayerFlag(m_avcBaseLayerFlag); 820 #else 731 821 vps->setAvcBaseLayerFlag(false); 822 #endif 732 823 vps->setSplittingFlag(false); 733 824 for(i = 0; i < MAX_VPS_NUM_SCALABILITY_TYPES; i++) … … 769 860 #endif 770 861 // Target output layer 862 #if VPS_PROFILE_OUTPUT_LAYERS 863 vps->setNumOutputLayerSets(2); // 2 including the default base-layer set. 864 vps->setNumProfileTierLevel(2); // 1 for the enhancement layer 865 vps->setProfileLevelTierIdx(1, 1); 866 vps->setDefaultOneTargetOutputLayerFlag(true); 867 Int lsIdx = 1; 868 vps->setOutputLayerSetIdx(1, lsIdx); // Because only one layer set 869 #else 771 870 vps->setNumOutputLayerSets(1); 772 871 Int lsIdx = 1; 773 872 vps->setOutputLayerSetIdx(0, lsIdx); // Because only one layer set 873 #endif 774 874 // Include the highest layer as output layer 775 875 for(UInt layer=0; layer <= vps->getMaxLayerId() ; layer++) … … 802 902 } 803 903 #endif 904 #if JCTVC_M0458_INTERLAYER_RPS_SIG 905 vps->setMaxOneActiveRefLayerFlag(true); 906 #endif 804 907 #else 805 908 m_cTEncTop.init(); … … 812 915 813 916 /** 814 - create internal class815 - initialize internal variable816 - until the end of input YUV file, call encoding function in TEncTop class817 - delete allocated buffers818 - destroy internal class819 .820 */917 - create internal class 918 - initialize internal variable 919 - until the end of input YUV file, call encoding function in TEncTop class 920 - delete allocated buffers 921 - destroy internal class 922 . 923 */ 821 924 #if SVC_EXTENSION 822 925 Void TAppEncTop::encode() … … 855 958 856 959 #if AVC_SYNTAX 857 if( !m_BLSyntaxFile ) 858 { 859 printf( "Wrong base layer syntax input file\n" ); 860 exit(EXIT_FAILURE); 861 } 862 fstream streamSyntaxFile( m_BLSyntaxFile, fstream::in | fstream::binary ); 863 if( !streamSyntaxFile.good() ) 864 { 865 printf( "Base layer syntax input reading error\n" ); 866 exit(EXIT_FAILURE); 867 } 868 m_acTEncTop[0].setBLSyntaxFile( &streamSyntaxFile ); 960 fstream streamSyntaxFile; 961 if( m_acTEncTop[0].getVPS()->getAvcBaseLayerFlag() ) 962 { 963 if( !m_BLSyntaxFile ) 964 { 965 printf( "Wrong base layer syntax input file\n" ); 966 exit(EXIT_FAILURE); 967 } 968 streamSyntaxFile.open( m_BLSyntaxFile, fstream::in | fstream::binary ); 969 if( !streamSyntaxFile.good() ) 970 { 971 printf( "Base layer syntax input reading error\n" ); 972 exit(EXIT_FAILURE); 973 } 974 m_acTEncTop[0].setBLSyntaxFile( &streamSyntaxFile ); 975 } 869 976 #endif 870 977 … … 1102 1209 1103 1210 /** 1104 - application has picture buffer list with size of GOP1105 - picture buffer list acts as ring buffer1106 - end of the list has the latest picture1107 .1108 */1211 - application has picture buffer list with size of GOP 1212 - picture buffer list acts as ring buffer 1213 - end of the list has the latest picture 1214 . 1215 */ 1109 1216 #if SVC_EXTENSION 1110 1217 Void TAppEncTop::xGetBuffer( TComPicYuv*& rpcPicYuvRec, UInt layer) … … 1222 1329 1223 1330 /** \param iNumEncoded number of encoded frames 1224 */1331 */ 1225 1332 Void TAppEncTop::xWriteOutput(std::ostream& bitstreamFile, Int iNumEncoded, const std::list<AccessUnit>& accessUnits) 1226 1333 { … … 1240 1347 if (m_pchReconFile) 1241 1348 { 1349 #if SYNTAX_OUTPUT && ILP_DECODED_PICTURE 1350 m_cTVideoIOYuvReconFile.write( pcPicYuvRec ); 1351 #else 1242 1352 m_cTVideoIOYuvReconFile.write( pcPicYuvRec, m_confLeft, m_confRight, m_confTop, m_confBottom ); 1353 #endif 1243 1354 } 1244 1355 … … 1251 1362 1252 1363 /** 1253 *1254 */1364 * 1365 */ 1255 1366 void TAppEncTop::rateStatsAccum(const AccessUnit& au, const std::vector<UInt>& annexBsizes) 1256 1367 { … … 1264 1375 case NAL_UNIT_CODED_SLICE_TRAIL_R: 1265 1376 case NAL_UNIT_CODED_SLICE_TRAIL_N: 1266 case NAL_UNIT_CODED_SLICE_TLA :1377 case NAL_UNIT_CODED_SLICE_TLA_R: 1267 1378 case NAL_UNIT_CODED_SLICE_TSA_N: 1268 1379 case NAL_UNIT_CODED_SLICE_STSA_R: 1269 1380 case NAL_UNIT_CODED_SLICE_STSA_N: 1270 case NAL_UNIT_CODED_SLICE_BLA :1271 case NAL_UNIT_CODED_SLICE_BLA NT:1381 case NAL_UNIT_CODED_SLICE_BLA_W_LP: 1382 case NAL_UNIT_CODED_SLICE_BLA_W_RADL: 1272 1383 case NAL_UNIT_CODED_SLICE_BLA_N_LP: 1273 case NAL_UNIT_CODED_SLICE_IDR :1384 case NAL_UNIT_CODED_SLICE_IDR_W_RADL: 1274 1385 case NAL_UNIT_CODED_SLICE_IDR_N_LP: 1275 1386 case NAL_UNIT_CODED_SLICE_CRA: 1276 1387 case NAL_UNIT_CODED_SLICE_RADL_N: 1277 case NAL_UNIT_CODED_SLICE_ DLP:1388 case NAL_UNIT_CODED_SLICE_RADL_R: 1278 1389 case NAL_UNIT_CODED_SLICE_RASL_N: 1279 case NAL_UNIT_CODED_SLICE_ TFD:1390 case NAL_UNIT_CODED_SLICE_RASL_R: 1280 1391 case NAL_UNIT_VPS: 1281 1392 case NAL_UNIT_SPS: -
trunk/source/Lib/TLibCommon/CommonDef.h
r125 r189 56 56 // ==================================================================================================================== 57 57 58 #define NV_VERSION " 1.2" ///< Current software version58 #define NV_VERSION "2.0rc1" ///< Current software version 59 59 60 60 // ==================================================================================================================== … … 110 110 #define MAX_NUM_REF_PICS 16 ///< max. number of pictures used for reference 111 111 #define MAX_NUM_REF 16 ///< max. number of entries in picture reference list 112 #if !L0034_COMBINED_LIST_CLEANUP 112 113 #define MAX_NUM_REF_LC MAX_NUM_REF_PICS // TODO: remove this macro definition (leftover from combined list concept) 114 #endif 113 115 114 116 #define MAX_UINT 0xFFFFFFFFU ///< max. value of unsigned 32-bit integer … … 197 199 198 200 NAL_UNIT_CODED_SLICE_TSA_N, // 2 199 NAL_UNIT_CODED_SLICE_TLA , // 3 // Current name in the spec: TSA_R201 NAL_UNIT_CODED_SLICE_TLA_R, // 3 200 202 201 203 NAL_UNIT_CODED_SLICE_STSA_N, // 4 … … 203 205 204 206 NAL_UNIT_CODED_SLICE_RADL_N, // 6 205 NAL_UNIT_CODED_SLICE_ DLP, // 7 // Current name in the spec: RADL_R207 NAL_UNIT_CODED_SLICE_RADL_R, // 7 206 208 207 209 NAL_UNIT_CODED_SLICE_RASL_N, // 8 208 NAL_UNIT_CODED_SLICE_ TFD, // 9 // Current name in the spec: RASL_R209 210 NAL_UNIT_RESERVED_ 10,211 NAL_UNIT_RESERVED_ 11,212 NAL_UNIT_RESERVED_ 12,213 NAL_UNIT_RESERVED_ 13,214 NAL_UNIT_RESERVED_ 14,215 NAL_UNIT_RESERVED_ 15,216 217 NAL_UNIT_CODED_SLICE_BLA , // 16 // Current name in the spec: BLA_W_LP218 NAL_UNIT_CODED_SLICE_BLA NT, // 17 // Current name in the spec: BLA_W_DLP210 NAL_UNIT_CODED_SLICE_RASL_R, // 9 211 212 NAL_UNIT_RESERVED_VCL_N10, 213 NAL_UNIT_RESERVED_VCL_R11, 214 NAL_UNIT_RESERVED_VCL_N12, 215 NAL_UNIT_RESERVED_VCL_R13, 216 NAL_UNIT_RESERVED_VCL_N14, 217 NAL_UNIT_RESERVED_VCL_R15, 218 219 NAL_UNIT_CODED_SLICE_BLA_W_LP, // 16 220 NAL_UNIT_CODED_SLICE_BLA_W_RADL, // 17 219 221 NAL_UNIT_CODED_SLICE_BLA_N_LP, // 18 220 NAL_UNIT_CODED_SLICE_IDR , // 19 // Current name in the spec: IDR_W_DLP222 NAL_UNIT_CODED_SLICE_IDR_W_RADL, // 19 221 223 NAL_UNIT_CODED_SLICE_IDR_N_LP, // 20 222 224 NAL_UNIT_CODED_SLICE_CRA, // 21 223 NAL_UNIT_RESERVED_ 22,224 NAL_UNIT_RESERVED_ 23,225 226 NAL_UNIT_RESERVED_ 24,227 NAL_UNIT_RESERVED_ 25,228 NAL_UNIT_RESERVED_ 26,229 NAL_UNIT_RESERVED_ 27,230 NAL_UNIT_RESERVED_ 28,231 NAL_UNIT_RESERVED_ 29,232 NAL_UNIT_RESERVED_ 30,233 NAL_UNIT_RESERVED_ 31,225 NAL_UNIT_RESERVED_IRAP_VCL22, 226 NAL_UNIT_RESERVED_IRAP_VCL23, 227 228 NAL_UNIT_RESERVED_VCL24, 229 NAL_UNIT_RESERVED_VCL25, 230 NAL_UNIT_RESERVED_VCL26, 231 NAL_UNIT_RESERVED_VCL27, 232 NAL_UNIT_RESERVED_VCL28, 233 NAL_UNIT_RESERVED_VCL29, 234 NAL_UNIT_RESERVED_VCL30, 235 NAL_UNIT_RESERVED_VCL31, 234 236 235 237 NAL_UNIT_VPS, // 32 … … 240 242 NAL_UNIT_EOB, // 37 241 243 NAL_UNIT_FILLER_DATA, // 38 242 NAL_UNIT_ SEI, // 39 Prefix SEI243 NAL_UNIT_S EI_SUFFIX, // 40 Suffix SEI244 NAL_UNIT_RESERVED_ 41,245 NAL_UNIT_RESERVED_ 42,246 NAL_UNIT_RESERVED_ 43,247 NAL_UNIT_RESERVED_ 44,248 NAL_UNIT_RESERVED_ 45,249 NAL_UNIT_RESERVED_ 46,250 NAL_UNIT_RESERVED_ 47,244 NAL_UNIT_PREFIX_SEI, // 39 245 NAL_UNIT_SUFFIX_SEI, // 40 246 NAL_UNIT_RESERVED_NVCL41, 247 NAL_UNIT_RESERVED_NVCL42, 248 NAL_UNIT_RESERVED_NVCL43, 249 NAL_UNIT_RESERVED_NVCL44, 250 NAL_UNIT_RESERVED_NVCL45, 251 NAL_UNIT_RESERVED_NVCL46, 252 NAL_UNIT_RESERVED_NVCL47, 251 253 NAL_UNIT_UNSPECIFIED_48, 252 254 NAL_UNIT_UNSPECIFIED_49, -
trunk/source/Lib/TLibCommon/NAL.h
r125 r189 76 76 return m_nalUnitType == NAL_UNIT_CODED_SLICE_TRAIL_R 77 77 || m_nalUnitType == NAL_UNIT_CODED_SLICE_TRAIL_N 78 || m_nalUnitType == NAL_UNIT_CODED_SLICE_TLA 78 || m_nalUnitType == NAL_UNIT_CODED_SLICE_TLA_R 79 79 || m_nalUnitType == NAL_UNIT_CODED_SLICE_TSA_N 80 80 || m_nalUnitType == NAL_UNIT_CODED_SLICE_STSA_R 81 81 || m_nalUnitType == NAL_UNIT_CODED_SLICE_STSA_N 82 || m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA 83 || m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA NT82 || m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_LP 83 || m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_RADL 84 84 || m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_N_LP 85 || m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR 85 || m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL 86 86 || m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP 87 87 || m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA 88 88 || m_nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N 89 || m_nalUnitType == NAL_UNIT_CODED_SLICE_ DLP89 || m_nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R 90 90 || m_nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N 91 || m_nalUnitType == NAL_UNIT_CODED_SLICE_ TFD;91 || m_nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R; 92 92 } 93 93 #if L0045_NON_NESTED_SEI_RESTRICTIONS 94 94 Bool isSei() 95 95 { 96 return m_nalUnitType == NAL_UNIT_ SEI97 || m_nalUnitType == NAL_UNIT_S EI_SUFFIX;96 return m_nalUnitType == NAL_UNIT_PREFIX_SEI 97 || m_nalUnitType == NAL_UNIT_SUFFIX_SEI; 98 98 } 99 99 -
trunk/source/Lib/TLibCommon/SEI.cpp
r127 r189 38 38 #include "CommonDef.h" 39 39 #include "SEI.h" 40 41 #if J0149_TONE_MAPPING_SEI 42 //Table D-7 Meaning of camera iso sensitivity indicator and exposure index rating indicator 43 Int Table_exp_indicator[32] = {0, 10, 12, 16, 20, 25, 32, 40, 50, 64, 80, 100, 125, 160, 200, 250, 320, 400, 500, 640, 800, 1000, 1250, 1600, 2000, 2500, 3200, 4000, 5000, 6400, 8000, -1}; 44 #endif 40 45 41 46 SEIMessages getSeisByType(SEIMessages &seiList, SEI::PayloadType seiType) -
trunk/source/Lib/TLibCommon/SEI.h
r125 r189 355 355 }; 356 356 357 #if L0208_SOP_DESCRIPTION_SEI 358 class SEISOPDescription : public SEI 359 { 360 public: 361 PayloadType payloadType() const { return SOP_DESCRIPTION; } 362 363 SEISOPDescription() {} 364 virtual ~SEISOPDescription() {} 365 366 UInt m_sopSeqParameterSetId; 367 UInt m_numPicsInSopMinus1; 368 369 UInt m_sopDescVclNaluType[MAX_NUM_PICS_IN_SOP]; 370 UInt m_sopDescTemporalId[MAX_NUM_PICS_IN_SOP]; 371 UInt m_sopDescStRpsIdx[MAX_NUM_PICS_IN_SOP]; 372 Int m_sopDescPocDelta[MAX_NUM_PICS_IN_SOP]; 373 }; 374 #endif 375 376 #if J0149_TONE_MAPPING_SEI 377 class SEIToneMappingInfo : public SEI 378 { 379 public: 380 PayloadType payloadType() const { return TONE_MAPPING_INFO; } 381 SEIToneMappingInfo() {} 382 virtual ~SEIToneMappingInfo() {} 383 384 Int m_toneMapId; 385 Bool m_toneMapCancelFlag; 386 Bool m_toneMapPersistenceFlag; 387 Int m_codedDataBitDepth; 388 Int m_targetBitDepth; 389 Int m_modelId; 390 Int m_minValue; 391 Int m_maxValue; 392 Int m_sigmoidMidpoint; 393 Int m_sigmoidWidth; 394 std::vector<Int> m_startOfCodedInterval; 395 Int m_numPivots; 396 std::vector<Int> m_codedPivotValue; 397 std::vector<Int> m_targetPivotValue; 398 Int m_cameraIsoSpeedIdc; 399 Int m_cameraIsoSpeedValue; 400 Int m_exposureCompensationValueSignFlag; 401 Int m_exposureCompensationValueNumerator; 402 Int m_exposureCompensationValueDenomIdc; 403 Int m_refScreenLuminanceWhite; 404 Int m_extendedRangeWhiteLevel; 405 Int m_nominalBlackLevelLumaCodeValue; 406 Int m_nominalWhiteLevelLumaCodeValue; 407 Int m_extendedWhiteLevelLumaCodeValue; 408 }; 409 #endif 410 357 411 typedef std::list<SEI*> SEIMessages; 358 412 … … 366 420 Void deleteSEIs (SEIMessages &seiList); 367 421 422 #if K0180_SCALABLE_NESTING_SEI 423 class SEIScalableNesting : public SEI 424 { 425 public: 426 PayloadType payloadType() const { return SCALABLE_NESTING; } 427 428 SEIScalableNesting() {} 429 virtual ~SEIScalableNesting() 430 { 431 if (!m_callerOwnsSEIs) 432 { 433 deleteSEIs(m_nestedSEIs); 434 } 435 } 436 437 Bool m_bitStreamSubsetFlag; 438 Bool m_nestingOpFlag; 439 Bool m_defaultOpFlag; //value valid if m_nestingOpFlag != 0 440 UInt m_nestingNumOpsMinus1; // -"- 441 UInt m_nestingMaxTemporalIdPlus1[MAX_TLAYER]; // -"- 442 UInt m_nestingOpIdx[MAX_NESTING_NUM_OPS]; // -"- 443 444 Bool m_allLayersFlag; //value valid if m_nestingOpFlag == 0 445 UInt m_nestingNoOpMaxTemporalIdPlus1; //value valid if m_nestingOpFlag == 0 and m_allLayersFlag == 0 446 UInt m_nestingNumLayersMinus1; //value valid if m_nestingOpFlag == 0 and m_allLayersFlag == 0 447 UChar m_nestingLayerId[MAX_NESTING_NUM_LAYER]; //value valid if m_nestingOpFlag == 0 and m_allLayersFlag == 0. This can e.g. be a static array of 64 unsigned char values 448 449 Bool m_callerOwnsSEIs; 450 SEIMessages m_nestedSEIs; 451 }; 452 #endif 453 368 454 //! \} -
trunk/source/Lib/TLibCommon/TComBitStream.cpp
r125 r189 177 177 } 178 178 } 179 179 180 Void TComOutputBitstream::writeByteAlignment() 180 181 { … … 182 183 writeAlignZero(); 183 184 } 185 186 Int TComOutputBitstream::countStartCodeEmulations() 187 { 188 UInt cnt = 0; 189 vector<uint8_t>& rbsp = getFIFO(); 190 for (vector<uint8_t>::iterator it = rbsp.begin(); it != rbsp.end();) 191 { 192 vector<uint8_t>::iterator found = it; 193 do 194 { 195 // find the next emulated 00 00 {00,01,02,03} 196 // NB, end()-1, prevents finding a trailing two byte sequence 197 found = search_n(found, rbsp.end()-1, 2, 0); 198 found++; 199 // if not found, found == end, otherwise found = second zero byte 200 if (found == rbsp.end()) 201 { 202 break; 203 } 204 if (*(++found) <= 3) 205 { 206 break; 207 } 208 } while (true); 209 it = found; 210 if (found != rbsp.end()) 211 { 212 cnt++; 213 } 214 } 215 return cnt; 216 } 217 184 218 /** 185 219 * read #uiNumberOfBits# from bitstream without updating the bitstream -
trunk/source/Lib/TLibCommon/TComBitStream.h
r125 r189 154 154 Void addSubstream ( TComOutputBitstream* pcSubstream ); 155 155 Void writeByteAlignment(); 156 157 //! returns the number of start code emulations contained in the current buffer 158 Int countStartCodeEmulations(); 156 159 }; 157 160 … … 163 166 { 164 167 std::vector<uint8_t> *m_fifo; /// FIFO for storage of complete bytes 168 std::vector<UInt> m_emulationPreventionByteLocation; 165 169 166 170 protected: … … 206 210 UInt getNumBitsRead() { return m_numBitsRead; } 207 211 Void readByteAlignment(); 212 213 Void pushEmulationPreventionByteLocation ( UInt pos ) { m_emulationPreventionByteLocation.push_back( pos ); } 214 UInt numEmulationPreventionBytesRead () { return (UInt) m_emulationPreventionByteLocation.size(); } 215 std::vector<UInt> getEmulationPreventionByteLocation () { return m_emulationPreventionByteLocation; } 216 UInt getEmulationPreventionByteLocation ( UInt idx ) { return m_emulationPreventionByteLocation[ idx ]; } 217 Void clearEmulationPreventionByteLocation() { m_emulationPreventionByteLocation.clear(); } 218 Void setEmulationPreventionByteLocation ( std::vector<UInt> vec ) { m_emulationPreventionByteLocation = vec; } 208 219 }; 209 220 -
trunk/source/Lib/TLibCommon/TComDataCU.cpp
r125 r189 1802 1802 UInt TComDataCU::getCtxIntraBLFlag( UInt uiAbsPartIdx ) 1803 1803 { 1804 #if INTRA_BL_CTX_CHANGE 1805 Int cuDepth = getDepth(uiAbsPartIdx); 1806 Int maxCuDepth = g_uiMaxCUDepth - g_uiAddCUDepth; 1807 UInt uiCtx = (maxCuDepth==3 && cuDepth > 0) ? (cuDepth - 1) : cuDepth; 1808 return uiCtx; 1809 #else 1804 1810 TComDataCU* pcTempCU; 1805 1811 UInt uiTempPartIdx; … … 1824 1830 1825 1831 return uiCtx; 1832 #endif 1826 1833 } 1827 1834 #endif … … 1835 1842 { 1836 1843 Int refIdxL0 = cMvFieldL0.getRefIdx(); 1837 if(getSlice()->getRefPic(REF_PIC_LIST_0, refIdxL0)->isILR( ))1844 if(getSlice()->getRefPic(REF_PIC_LIST_0, refIdxL0)->isILR(m_layerId)) 1838 1845 { 1839 1846 checkZeroMVILR &= (cMvFieldL0.getHor() == 0 && cMvFieldL0.getVer() == 0); … … 1843 1850 { 1844 1851 Int refIdxL1 = cMvFieldL1.getRefIdx(); 1845 if(getSlice()->getRefPic(REF_PIC_LIST_1, refIdxL1)->isILR( ))1852 if(getSlice()->getRefPic(REF_PIC_LIST_1, refIdxL1)->isILR(m_layerId)) 1846 1853 { 1847 1854 checkZeroMVILR &= (cMvFieldL1.getHor() == 0 && cMvFieldL1.getVer() == 0); … … 1859 1866 Bool checkZeroMVILR = true; 1860 1867 1861 if(getSlice()->getRefPic(eRefPicList, iRefIdx)->isILR( ))1868 if(getSlice()->getRefPic(eRefPicList, iRefIdx)->isILR(m_layerId)) 1862 1869 { 1863 1870 AMVPInfo* pcAMVPInfo = getCUMvField(eRefPicList)->getAMVPInfo(); … … 2530 2537 if(m_layerId) 2531 2538 { 2532 #if MV_SCALING_POS_FIX2533 2539 pcColCU = getBaseColCU( xP + nPSW/2, yP + nPSH/2, uiCUAddrBase, uiAbsPartAddrBase ); 2534 #else2535 UInt uiPartIdxCenter;2536 xDeriveCenterIdx( cCurPS, uiPUIdx, uiPartIdxCenter );2537 uiPartIdxCenter -= m_uiAbsIdxInLCU;2538 pcColCU = getBaseColCU( uiPartIdxCenter, uiCUAddrBase, uiAbsPartAddrBase );2539 #endif2540 2540 2541 2541 #if INTRA_BL … … 2671 2671 #endif 2672 2672 Bool isAvailableB0 = pcCUAboveRight && 2673 #if SVC_MVP 2673 #if SVC_MVP && !IL_MRG_SIMPLIFIED_PRUNING 2674 2674 ( !pcColCU || pcColCU->isIntra( uiAbsPartAddrBase ) || !pcCUAboveRight->hasEqualMotion( uiAboveRightPartIdx, puhInterDirNeighbours[0], &pcMvFieldNeighbours[0] )) && 2675 2675 #endif … … 2715 2715 Bool isAvailableA0 = pcCULeftBottom && 2716 2716 pcCULeftBottom->isDiffMER(xP-1, yP+nPSH, xP, yP) && 2717 #if SVC_MVP 2717 #if SVC_MVP && !IL_MRG_SIMPLIFIED_PRUNING 2718 2718 ( !pcColCU || pcColCU->isIntra( uiAbsPartAddrBase ) || !pcCULeftBottom->hasEqualMotion( uiLeftBottomPartIdx, puhInterDirNeighbours[0], &pcMvFieldNeighbours[0])) && 2719 2719 #endif … … 2759 2759 Bool isAvailableB2 = pcCUAboveLeft && 2760 2760 pcCUAboveLeft->isDiffMER(xP-1, yP-1, xP, yP) && 2761 #if SVC_MVP 2761 #if SVC_MVP && !IL_MRG_SIMPLIFIED_PRUNING 2762 2762 ( !pcColCU || pcColCU->isIntra( uiAbsPartAddrBase ) || !pcCUAboveLeft->hasEqualMotion( uiAboveLeftPartIdx, puhInterDirNeighbours[0], &pcMvFieldNeighbours[0] )) && 2763 2763 #endif … … 4175 4175 TComPic* cBaseColPic = m_pcSlice->getBaseColPic(); 4176 4176 4177 #if SVC_UPSAMPLING 4177 #if !SIMPLIFIED_MV_POS_SCALING 4178 #if SVC_UPSAMPLING && !ILP_DECODED_PICTURE 4178 4179 const Window &confBL = cBaseColPic->getPicYuvRec()->getConformanceWindow(); 4179 4180 const Window &confEL = m_pcPic->getPicYuvRec()->getConformanceWindow(); … … 4191 4192 Int heightEL = m_pcPic->getPicYuvRec()->getHeight(); 4192 4193 #endif 4194 #endif 4193 4195 4194 4196 uiPelX = (UInt)Clip3<UInt>(0, m_pcPic->getPicYuvRec()->getWidth() - 1, uiPelX); … … 4197 4199 UInt uiMinUnitSize = m_pcPic->getMinCUWidth(); 4198 4200 4201 #if SIMPLIFIED_MV_POS_SCALING 4202 #if SCALED_REF_LAYER_OFFSETS 4203 Int leftStartL = this->getSlice()->getSPS()->getScaledRefLayerWindow().getWindowLeftOffset(); 4204 Int topStartL = this->getSlice()->getSPS()->getScaledRefLayerWindow().getWindowTopOffset(); 4205 Int iBX = ((uiPelX - leftStartL)*g_posScalingFactor[m_layerId][0] + (1<<15)) >> 16; 4206 Int iBY = ((uiPelY - topStartL )*g_posScalingFactor[m_layerId][1] + (1<<15)) >> 16; 4207 #else 4208 Int iBX = (uiPelX*g_posScalingFactor[m_layerId][0] + (1<<15)) >> 16; 4209 Int iBY = (uiPelY*g_posScalingFactor[m_layerId][1] + (1<<15)) >> 16; 4210 #endif 4211 #else 4199 4212 Int iBX = (uiPelX*widthBL + widthEL/2)/widthEL; 4200 4213 Int iBY = (uiPelY*heightBL+ heightEL/2)/heightEL; 4201 4214 #endif 4215 4216 #if SCALED_REF_LAYER_OFFSETS 4217 if ( iBX >= cBaseColPic->getPicYuvRec()->getWidth() || iBY >= cBaseColPic->getPicYuvRec()->getHeight() || 4218 iBX < 0 || iBY < 0 ) 4219 #else 4202 4220 if ( iBX >= cBaseColPic->getPicYuvRec()->getWidth() || iBY >= cBaseColPic->getPicYuvRec()->getHeight()) 4221 #endif 4203 4222 { 4204 4223 return NULL; 4205 4224 } 4206 4225 4207 #if AVC_SYNTAX 4226 #if AVC_SYNTAX && !ILP_DECODED_PICTURE 4227 #if !ILP_DECODED_PICTURE 4228 const Window &confBL = cBaseColPic->getPicYuvRec()->getConformanceWindow(); 4229 const Window &confEL = m_pcPic->getPicYuvRec()->getConformanceWindow(); 4230 4231 Int widthBL = m_pcSlice->getBaseColPic()->getPicYuvRec()->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset(); 4232 Int heightBL = m_pcSlice->getBaseColPic()->getPicYuvRec()->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset(); 4233 #endif 4208 4234 if( iBX >= widthBL || iBY >= heightBL ) //outside of the reference layer cropped picture 4209 4235 { … … 4228 4254 TComMvField cMvFieldBase; 4229 4255 TComMv cMv; 4230 4231 #if MV_SCALING_FIX 4256 #if SIMPLIFIED_MV_POS_SCALING 4257 cMv = rcMvFieldBase.getMv().scaleMv( g_mvScalingFactor[m_layerId][0], g_mvScalingFactor[m_layerId][1] ); 4258 #else 4232 4259 const Window &confBL = m_pcSlice->getBaseColPic()->getPicYuvRec()->getConformanceWindow(); 4233 4260 const Window &confEL = m_pcPic->getPicYuvRec()->getConformanceWindow(); … … 4238 4265 Int widthEL = m_pcPic->getPicYuvRec()->getWidth() - confEL.getWindowLeftOffset() - confEL.getWindowRightOffset(); 4239 4266 Int heightEL = m_pcPic->getPicYuvRec()->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset(); 4240 #else4241 Int widthBL = m_pcSlice->getBaseColPic()->getPicYuvRec()->getWidth();4242 Int heightBL = m_pcSlice->getBaseColPic()->getPicYuvRec()->getHeight();4243 4244 Int widthEL = m_pcPic->getPicYuvRec()->getWidth();4245 Int heightEL = m_pcPic->getPicYuvRec()->getHeight();4246 #endif4247 4267 4248 4268 Int iMvX = (rcMvFieldBase.getHor()*widthEL + (widthBL/2 -1) * (rcMvFieldBase.getHor() > 0 ? 1: -1) )/widthBL; … … 4250 4270 4251 4271 cMv.set(iMvX, iMvY); 4272 #endif 4252 4273 4253 4274 rcMvFieldEnhance.setMvField( cMv, rcMvFieldBase.getRefIdx() ); -
trunk/source/Lib/TLibCommon/TComLoopFilter.cpp
r125 r189 57 57 // ==================================================================================================================== 58 58 59 const UChar tctable_8x8[54] =59 const UChar TComLoopFilter::sm_tcTable[54] = 60 60 { 61 61 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,5,5,6,6,7,8,9,10,11,13,14,16,18,20,22,24 62 62 }; 63 63 64 const UChar betatable_8x8[52] =64 const UChar TComLoopFilter::sm_betaTable[52] = 65 65 { 66 66 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,8,9,10,11,12,13,14,15,16,17,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64 … … 585 585 Int iIndexB = Clip3(0, MAX_QP, iQP + (betaOffsetDiv2 << 1)); 586 586 587 Int iTc = tctable_8x8[iIndexTC]*iBitdepthScale;588 Int iBeta = betatable_8x8[iIndexB]*iBitdepthScale;587 Int iTc = sm_tcTable[iIndexTC]*iBitdepthScale; 588 Int iBeta = sm_betaTable[iIndexB]*iBitdepthScale; 589 589 Int iSideThreshold = (iBeta+(iBeta>>1))>>3; 590 590 Int iThrCut = iTc*10; … … 735 735 736 736 Int iIndexTC = Clip3(0, MAX_QP+DEFAULT_INTRA_TC_OFFSET, iQP + DEFAULT_INTRA_TC_OFFSET*(ucBs - 1) + (tcOffsetDiv2 << 1)); 737 Int iTc = tctable_8x8[iIndexTC]*iBitdepthScale;737 Int iTc = sm_tcTable[iIndexTC]*iBitdepthScale; 738 738 739 739 for ( UInt uiStep = 0; uiStep < uiPelsInPartChroma; uiStep++ ) -
trunk/source/Lib/TLibCommon/TComLoopFilter.h
r125 r189 99 99 __inline Int xCalcDQ( Pel* piSrc, Int iOffset); 100 100 101 static const UChar sm_tcTable[54]; 102 static const UChar sm_betaTable[52]; 103 101 104 public: 102 105 TComLoopFilter(); … … 111 114 /// picture-level deblocking filter 112 115 Void loopFilterPic( TComPic* pcPic ); 116 117 static Int getBeta( Int qp ) 118 { 119 Int indexB = Clip3( 0, MAX_QP, qp ); 120 return sm_betaTable[ indexB ]; 121 } 113 122 }; 114 123 -
trunk/source/Lib/TLibCommon/TComMv.h
r125 r189 149 149 return TComMv( mvx, mvy ); 150 150 } 151 #if SIMPLIFIED_MV_POS_SCALING 152 const TComMv scaleMv( Int iScaleX, Int iScaleY ) const 153 { 154 Int mvx = Clip3( -32768, 32767, (iScaleX * getHor() + 127 + (iScaleX * getHor() < 0)) >> 8 ); 155 Int mvy = Clip3( -32768, 32767, (iScaleY * getVer() + 127 + (iScaleY * getVer() < 0)) >> 8 ); 156 return TComMv( mvx, mvy ); 157 } 158 #endif 151 159 };// END CLASS DEFINITION TComMV 152 160 -
trunk/source/Lib/TLibCommon/TComPic.cpp
r125 r189 116 116 return; 117 117 } 118 #if REF_IDX_FRAMEWORK119 Void TComPic::createWithOutYuv( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, TComSPS* pcSps, Bool bIsVirtual)120 {121 m_apcPicSym = new TComPicSym; m_apcPicSym ->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth );122 if (!bIsVirtual)123 {124 m_apcPicYuv[0] = new TComPicYuv; m_apcPicYuv[0]->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth, pcSps );125 }126 m_apcPicYuv[1] = NULL;127 128 #if SVC_UPSAMPLING129 if (m_bSpatialEnhLayer)130 {131 m_pcFullPelBaseRec = new TComPicYuv; m_pcFullPelBaseRec->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth, pcSps );132 }133 #endif134 135 /* there are no SEI messages associated with this picture initially */136 m_SEIs.clear();137 m_bUsedByCurr = false;138 return;139 }140 #endif141 118 #else 142 119 Void TComPic::create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, Window &conformanceWindow, Window &defaultDisplayWindow, … … 559 536 } 560 537 561 Void TComPic:: 538 Void TComPic::copyUpsampledPictureYuv(TComPicYuv* pcPicYuvIn, TComPicYuv* pcPicYuvOut) 562 539 { 563 540 Int upsampledRowWidthLuma = pcPicYuvOut->getStride(); // 2 * pcPicYuvOut->getLumaMargin() + pcPicYuvOut->getWidth(); … … 585 562 586 563 #if REF_IDX_MFM 587 #if !REUSE_BLKMAPPING588 Void TComPic::deriveUnitIdxBase( UInt upsamplePelX, UInt upsamplePelY, UInt ratio, UInt& baseCUAddr, UInt& baseAbsPartIdx )589 {590 //pixel in the base layer591 592 UInt pelX = (upsamplePelX<<1)/ratio;593 UInt pelY = (upsamplePelY<<1)/ratio;594 UInt baseWidth = getPicYuvRec()->getWidth();595 UInt baseHeight = getPicYuvRec()->getHeight();596 597 UInt widthInCU = ( baseWidth % g_uiMaxCUWidth ) ? baseWidth /g_uiMaxCUWidth + 1 : baseWidth /g_uiMaxCUWidth;598 599 #if MFM_CLIPPING_FIX600 pelX = (UInt)Clip3<UInt>(0, getPicYuvRec()->getWidth() - 1, pelX);601 pelY = (UInt)Clip3<UInt>(0, getPicYuvRec()->getHeight() - 1, pelY);602 #else603 UInt heightInCU = ( baseHeight% g_uiMaxCUHeight ) ? baseHeight/ g_uiMaxCUHeight + 1 : baseHeight/ g_uiMaxCUHeight;604 605 pelX = (UInt)Clip3<UInt>(0, widthInCU * g_uiMaxCUWidth - 1, pelX);606 pelY = (UInt)Clip3<UInt>(0, heightInCU * g_uiMaxCUHeight - 1, pelY);607 #endif608 609 baseCUAddr = pelY / g_uiMaxCUHeight * widthInCU + pelX / g_uiMaxCUWidth;610 611 UInt widthMinPU = g_uiMaxCUWidth / (1<<g_uiMaxCUDepth);612 UInt heightMinPU = g_uiMaxCUHeight/(1<<g_uiMaxCUDepth);613 614 UInt absPelX = pelX - (pelX / g_uiMaxCUWidth) * g_uiMaxCUWidth;615 UInt absPelY = pelY - (pelY / g_uiMaxCUHeight) * g_uiMaxCUHeight;616 617 UInt rasterIdx = absPelY / heightMinPU * (g_uiMaxCUWidth/widthMinPU) + absPelX / widthMinPU;618 baseAbsPartIdx = g_auiRasterToZscan[rasterIdx];619 620 return;621 }622 #endif623 624 564 Void TComPic::copyUpsampledMvField(TComPic* pcPicBase) 625 565 { 626 #if !REUSE_MVSCALE || !REUSE_BLKMAPPING || AVC_SYNTAX566 #if AVC_SYNTAX && !ILP_DECODED_PICTURE 627 567 const Window &confBL = pcPicBase->getConformanceWindow(); 628 568 const Window &confEL = getPicYuvRec()->getConformanceWindow(); … … 633 573 Int widthEL = getPicYuvRec()->getWidth() - confEL.getWindowLeftOffset() - confEL.getWindowRightOffset(); 634 574 Int heightEL = getPicYuvRec()->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset(); 635 #endif636 637 #if !REUSE_MVSCALE || !REUSE_BLKMAPPING638 UInt upSampleRatio = 0;639 if(widthEL == widthBL && heightEL == heightBL)640 {641 upSampleRatio = 2;642 }643 else if(2*widthEL == 3*widthBL && 2*heightEL == 3*heightBL)644 {645 upSampleRatio = 3;646 }647 else if(widthEL == 2*widthBL && heightEL == 2*heightBL)648 {649 upSampleRatio = 4;650 }651 else652 {653 assert(0);654 }655 575 #endif 656 576 … … 671 591 UInt baseCUAddr, baseAbsPartIdx; 672 592 673 #if REUSE_BLKMAPPING674 593 TComDataCU *pcColCU = 0; 675 594 pcColCU = pcCUDes->getBaseColCU(pelX + 8, pelY + 8, baseCUAddr, baseAbsPartIdx); 676 #else 677 pcPicBase->deriveUnitIdxBase(pelX + 8, pelY + 8, upSampleRatio, baseCUAddr, baseAbsPartIdx); 678 #endif 679 680 #if AVC_SYNTAX 595 596 #if AVC_SYNTAX && !ILP_DECODED_PICTURE 681 597 Int xBL = ( (pelX + 8) * widthBL + widthEL/2 ) / widthEL; 682 598 Int yBL = ( (pelY + 8) * heightBL+ heightEL/2 ) / heightEL; 683 599 684 #if REUSE_BLKMAPPING685 600 if( ( xBL < widthBL && yBL < heightBL ) && pcColCU && (pcColCU->getPredictionMode(baseAbsPartIdx) != MODE_NONE) && (pcColCU->getPredictionMode(baseAbsPartIdx) != MODE_INTRA) ) //base layer unit not skip and invalid mode 686 601 #else 687 if( ( xBL < widthBL && yBL < heightBL ) && (pcPicBase->getCU(baseCUAddr)->getPredictionMode(baseAbsPartIdx) != MODE_NONE) && (pcPicBase->getCU(baseCUAddr)->getPredictionMode(baseAbsPartIdx) != MODE_INTRA) ) //base layer unit not skip and invalid mode688 #endif689 #else690 #if REUSE_BLKMAPPING691 602 if( pcColCU && (pcColCU->getPredictionMode(baseAbsPartIdx) != MODE_NONE) && (pcColCU->getPredictionMode(baseAbsPartIdx) != MODE_INTRA) ) //base layer unit not skip and invalid mode 692 #else693 if( (pcPicBase->getCU(baseCUAddr)->getPredictionMode(baseAbsPartIdx) != MODE_NONE) && (pcPicBase->getCU(baseCUAddr)->getPredictionMode(baseAbsPartIdx) != MODE_INTRA) ) //base layer unit not skip and invalid mode694 #endif695 603 #endif 696 604 { 697 605 for(UInt refPicList = 0; refPicList < 2; refPicList++) //for each reference list 698 606 { 699 #if REUSE_MVSCALE700 607 TComMvField sMvFieldBase, sMvField; 701 #if REUSE_BLKMAPPING702 608 pcColCU->getMvField( pcColCU, baseAbsPartIdx, (RefPicList)refPicList, sMvFieldBase); 703 #else704 pcPicBase->getCU(baseCUAddr)->getMvField( pcPicBase->getCU(baseCUAddr), baseAbsPartIdx, (RefPicList)refPicList, sMvFieldBase);705 #endif706 609 pcCUDes->scaleBaseMV( sMvField, sMvFieldBase ); 707 #else708 TComMv cMv = pcPicBase->getCU(baseCUAddr)->getCUMvField((RefPicList)refPicList)->getMv(baseAbsPartIdx);709 Int refIdx = pcPicBase->getCU(baseCUAddr)->getCUMvField((RefPicList)refPicList)->getRefIdx(baseAbsPartIdx);710 711 Int hor = ((Int)upSampleRatio * cMv.getHor())/2 ;712 Int ver = ((Int)upSampleRatio * cMv.getVer())/2 ;713 714 TComMv cScaledMv(hor, ver);715 TComMvField sMvField;716 sMvField.setMvField(cScaledMv, refIdx);717 #endif718 610 719 611 pcCUDes->getCUMvField((RefPicList)refPicList)->setMvField(sMvField, absPartIdx); … … 739 631 } 740 632 } 741 #endif 742 743 #if RAP_MFM_INIT 633 744 634 Void TComPic::initUpsampledMvField() 745 635 { … … 774 664 } 775 665 666 #if ILP_DECODED_PICTURE 667 UInt width = this->getPicYuvRec()->getWidth(); 668 UInt height = this->getPicYuvRec()->getHeight(); 669 #else 776 670 const Window &conf = this->getPicYuvRec()->getConformanceWindow(); 777 671 UInt width = this->getPicYuvRec()->getWidth() - conf.getWindowLeftOffset() - conf.getWindowRightOffset(); 778 672 UInt height = this->getPicYuvRec()->getHeight() - conf.getWindowTopOffset() - conf.getWindowBottomOffset(); 673 #endif 779 674 UInt64 poc = (UInt64)this->getPOC(); 780 675 UInt partWidth = width / 4; … … 853 748 } 854 749 750 #if ILP_DECODED_PICTURE 751 UInt width = this->getPicYuvRec()->getWidth(); 752 UInt height = this->getPicYuvRec()->getHeight(); 753 #else 855 754 const Window &conf = this->getConformanceWindow(); 856 755 UInt width = this->getPicYuvRec()->getWidth() - conf.getWindowLeftOffset() - conf.getWindowRightOffset(); 857 756 UInt height = this->getPicYuvRec()->getHeight() - conf.getWindowTopOffset() - conf.getWindowBottomOffset(); 757 #endif 858 758 859 759 UInt64 poc = (UInt64)this->getPOC(); -
trunk/source/Lib/TLibCommon/TComPic.h
r125 r189 103 103 Void create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, Window &conformanceWindow, Window &defaultDisplayWindow, 104 104 Int *numReorderPics, TComSPS* pcSps = NULL, Bool bIsVirtual = false ); 105 #if REF_IDX_FRAMEWORK106 Void createWithOutYuv( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, TComSPS* pcSps = NULL, Bool bIsVirtual = false );107 Void setPicYuvRec(TComPicYuv *pPicYuv) { m_apcPicYuv[1]=pPicYuv; }108 #endif109 105 #else 110 106 Void create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, Window &conformanceWindow, Window &defaultDisplayWindow, … … 124 120 #endif 125 121 #if REF_IDX_ME_ZEROMV || ENCODER_FAST_MODE || REF_IDX_MFM 126 Bool isILR( UInt refLayer = 0 ) {return (getIsLongTerm() && m_layerId == refLayer);}122 Bool isILR( UInt currLayerId ) { return ( getIsLongTerm() && m_layerId < currLayerId ); } 127 123 #endif 128 124 129 125 #if REF_IDX_MFM 130 126 Void copyUpsampledMvField ( TComPic* pcPicBase ); 131 #if !REUSE_BLKMAPPING132 Void deriveUnitIdxBase ( UInt upsamplePelX, UInt upsamplePelY, UInt ratio, UInt& baseCUAddr, UInt& baseAbsPartIdx );133 #endif134 #if RAP_MFM_INIT135 127 Void initUpsampledMvField (); 136 #endif137 128 #endif 138 129 -
trunk/source/Lib/TLibCommon/TComPicYuv.cpp
r125 r189 60 60 m_piPicOrgU = NULL; 61 61 m_piPicOrgV = NULL; 62 62 63 m_bIsBorderExtended = false; 63 64 } -
trunk/source/Lib/TLibCommon/TComPrediction.cpp
r125 r189 83 83 if( m_piYuvExt == NULL ) 84 84 { 85 Int extWidth = g_uiMaxCUWidth+ 16;86 Int extHeight = g_uiMaxCUHeight+ 1;85 Int extWidth = MAX_CU_SIZE + 16; 86 Int extHeight = MAX_CU_SIZE + 1; 87 87 Int i, j; 88 88 for (i = 0; i < 4; i++) … … 94 94 } 95 95 } 96 m_iYuvExtHeight = (( g_uiMaxCUHeight+ 2) << 4);97 m_iYuvExtStride = (( g_uiMaxCUWidth+ 8) << 4);96 m_iYuvExtHeight = ((MAX_CU_SIZE + 2) << 4); 97 m_iYuvExtStride = ((MAX_CU_SIZE + 8) << 4); 98 98 m_piYuvExt = new Int[ m_iYuvExtStride * m_iYuvExtHeight ]; 99 99 100 100 // new structure 101 m_acYuvPred[0] .create( g_uiMaxCUWidth, g_uiMaxCUHeight);102 m_acYuvPred[1] .create( g_uiMaxCUWidth, g_uiMaxCUHeight);103 104 m_cYuvPredTemp.create( g_uiMaxCUWidth, g_uiMaxCUHeight);105 } 106 107 if (m_iLumaRecStride != ( g_uiMaxCUWidth>>1) + 1)108 { 109 m_iLumaRecStride = ( g_uiMaxCUWidth>>1) + 1;101 m_acYuvPred[0] .create( MAX_CU_SIZE, MAX_CU_SIZE ); 102 m_acYuvPred[1] .create( MAX_CU_SIZE, MAX_CU_SIZE ); 103 104 m_cYuvPredTemp.create( MAX_CU_SIZE, MAX_CU_SIZE ); 105 } 106 107 if (m_iLumaRecStride != (MAX_CU_SIZE>>1) + 1) 108 { 109 m_iLumaRecStride = (MAX_CU_SIZE>>1) + 1; 110 110 if (!m_pLumaRecBuffer) 111 111 { … … 495 495 496 496 #if REF_IDX_ME_ZEROMV 497 assert( ( pcCU->getSlice()->getRefPic(eRefPicList, iRefIdx)->isILR( ) && cMv.getHor() == 0 && cMv.getVer() == 0 ) || pcCU->getSlice()->getRefPic(eRefPicList, iRefIdx)->isILR() == false );497 assert( ( pcCU->getSlice()->getRefPic(eRefPicList, iRefIdx)->isILR(pcCU->getLayerId()) && cMv.getHor() == 0 && cMv.getVer() == 0 ) || pcCU->getSlice()->getRefPic(eRefPicList, iRefIdx)->isILR(pcCU->getLayerId()) == false ); 498 498 #endif 499 499 … … 773 773 774 774 #if SVC_UPSAMPLING 775 #if SCALED_REF_LAYER_OFFSETS 776 Void TComPrediction::upsampleBasePic( TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window) 777 { 778 m_cUsf.upsampleBasePic( pcUsPic, pcBasePic, pcTempPic, window); 779 } 780 #else 775 781 Void TComPrediction::upsampleBasePic( TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic) 776 782 { 777 783 m_cUsf.upsampleBasePic( pcUsPic, pcBasePic, pcTempPic); 778 784 } 785 #endif 779 786 #endif 780 787 //! \} -
trunk/source/Lib/TLibCommon/TComPrediction.h
r125 r189 122 122 123 123 #if SVC_UPSAMPLING 124 #if SCALED_REF_LAYER_OFFSETS 125 Void upsampleBasePic( TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window ); 126 #else 124 127 Void upsampleBasePic( TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic ); 128 #endif 125 129 #endif 126 130 }; -
trunk/source/Lib/TLibCommon/TComRom.cpp
r125 r189 62 62 g_aucConvertToBit[ i ] = c; 63 63 64 // g_auiFrameScanXY[ g_aucConvertToBit[ transformSize ] ]: zigzag scan array for transformSize65 64 c=2; 66 65 for ( i=0; i<MAX_CU_DEPTH; i++ ) … … 77 76 Void destroyROM() 78 77 { 79 Int i; 80 81 for ( i=0; i<MAX_CU_DEPTH; i++ ) 78 for (Int i=0; i<MAX_CU_DEPTH; i++ ) 82 79 { 83 80 delete[] g_auiSigLastScan[0][i]; … … 521 518 Int g_eTTable[4] = {0,3,1,2}; 522 519 520 #if SIMPLIFIED_MV_POS_SCALING 521 Int g_mvScalingFactor [MAX_LAYERS][2] = {{0,0}, {0,0}}; 522 Int g_posScalingFactor [MAX_LAYERS][2] = {{0,0}, {0,0}}; 523 #endif 524 523 525 //! \} -
trunk/source/Lib/TLibCommon/TComRom.h
r125 r189 273 273 extern UInt g_scalingListNum [SCALING_LIST_SIZE_NUM]; 274 274 extern Int g_eTTable[4]; 275 276 #if SIMPLIFIED_MV_POS_SCALING 277 extern Int g_mvScalingFactor [MAX_LAYERS][2]; 278 extern Int g_posScalingFactor [MAX_LAYERS][2]; 279 #endif 280 275 281 //! \} 276 282 -
trunk/source/Lib/TLibCommon/TComSlice.cpp
r125 r189 54 54 , m_iPOC ( 0 ) 55 55 , m_iLastIDR ( 0 ) 56 , m_eNalUnitType ( NAL_UNIT_CODED_SLICE_IDR )56 , m_eNalUnitType ( NAL_UNIT_CODED_SLICE_IDR_W_RADL ) 57 57 , m_eSliceType ( I_SLICE ) 58 58 , m_iSliceQp ( 0 ) … … 65 65 , m_deblockingFilterBetaOffsetDiv2 ( 0 ) 66 66 , m_deblockingFilterTcOffsetDiv2 ( 0 ) 67 #if !L0034_COMBINED_LIST_CLEANUP 67 68 , m_bRefPicListModificationFlagLC ( false ) 68 69 , m_bRefPicListCombinationFlag ( false ) 70 #endif 69 71 , m_bCheckLDC ( false ) 70 72 , m_iSliceQpDelta ( 0 ) … … 84 86 , m_dLambda ( 0.0 ) 85 87 #endif 86 , m_bNoBackPredFlag ( false ) 88 #if !L0034_COMBINED_LIST_CLEANUP 89 , m_bNoBackPredFlag ( false ) 90 #endif 87 91 , m_uiTLayer ( 0 ) 88 92 #if SVC_EXTENSION … … 113 117 , m_enableTMVPFlag ( true ) 114 118 { 119 #if L0034_COMBINED_LIST_CLEANUP 120 m_aiNumRefIdx[0] = m_aiNumRefIdx[1] = 0; 121 #else 115 122 m_aiNumRefIdx[0] = m_aiNumRefIdx[1] = m_aiNumRefIdx[2] = 0; 123 #endif 116 124 117 #if REF_LIST_BUGFIX 118 m_aiNumILRRefIdx = 0; 119 #endif 125 #if REF_IDX_FRAMEWORK 126 #if JCTVC_M0458_INTERLAYER_RPS_SIG 127 m_activeNumILRRefIdx = 0; 128 m_interLayerPredEnabledFlag = 0; 129 ::memset( m_interLayerPredLayerIdc, 0, sizeof(m_interLayerPredLayerIdc) ); 130 #else 131 m_numILRRefIdx = 0; 132 #endif 133 #endif 134 120 135 initEqualRef(); 121 136 137 #if L0034_COMBINED_LIST_CLEANUP 138 for ( Int idx = 0; idx < MAX_NUM_REF; idx++ ) 139 { 140 m_list1IdxToList0Idx[idx] = -1; 141 } 142 #else 122 143 for(Int iNumCount = 0; iNumCount < MAX_NUM_REF_LC; iNumCount++) 123 144 { … … 129 150 m_iRefIdxOfL1FromRefIdxOfL0[iNumCount] = -1; 130 151 } 152 #endif 131 153 for(Int iNumCount = 0; iNumCount < MAX_NUM_REF; iNumCount++) 132 154 { … … 136 158 m_aiRefPOCList [1][iNumCount] = 0; 137 159 } 138 resetWpScaling( m_weightPredTable);160 resetWpScaling(); 139 161 initWpAcDcParam(); 140 162 m_saoEnabledFlag = false; … … 159 181 m_aiNumRefIdx[0] = 0; 160 182 m_aiNumRefIdx[1] = 0; 161 #if REF_LIST_BUGFIX 162 if(layerId) 163 { 164 m_aiNumILRRefIdx = 1; // to be set to NumDirectRefLayers[LayerIdInVps[nuh_layer_id]] 165 } 166 else 167 { 168 m_aiNumILRRefIdx = 0; 169 } 183 #if REF_IDX_FRAMEWORK 184 #if JCTVC_M0458_INTERLAYER_RPS_SIG 185 m_activeNumILRRefIdx = 0; 186 m_interLayerPredEnabledFlag = 0; 187 #else 188 m_numILRRefIdx = 0; 189 #endif 190 170 191 #endif 171 192 m_colFromL0Flag = 1; … … 173 194 m_colRefIdx = 0; 174 195 initEqualRef(); 196 #if !L0034_COMBINED_LIST_CLEANUP 175 197 m_bNoBackPredFlag = false; 176 198 m_bRefPicListCombinationFlag = false; 177 199 m_bRefPicListModificationFlagLC = false; 200 #endif 178 201 m_bCheckLDC = false; 179 202 m_iSliceQpDeltaCb = 0; 180 203 m_iSliceQpDeltaCr = 0; 181 204 205 #if !L0034_COMBINED_LIST_CLEANUP 182 206 m_aiNumRefIdx[REF_PIC_LIST_C] = 0; 207 #endif 183 208 184 209 m_maxNumMergeCand = MRG_MAX_NUM_CANDS; … … 194 219 Bool TComSlice::getRapPicFlag() 195 220 { 196 return getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR 221 return getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL 197 222 || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP 198 223 || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP 199 || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA NT200 || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA 224 || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL 225 || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 201 226 || getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA; 202 227 } … … 213 238 } 214 239 215 Void TComSlice::sortPicList 240 Void TComSlice::sortPicList(TComList<TComPic*>& rcListPic) 216 241 { 217 242 TComPic* pcPicExtract; … … 268 293 269 294 270 TComPic* TComSlice::xGetLongTermRefPic (TComList<TComPic*>& rcListPic, 271 Int poc) 295 TComPic* TComSlice::xGetLongTermRefPic(TComList<TComPic*>& rcListPic, Int poc, Bool pocHasMsb) 272 296 { 273 297 TComList<TComPic*>::iterator iterPic = rcListPic.begin(); 274 298 TComPic* pcPic = *(iterPic); 275 299 TComPic* pcStPic = pcPic; 300 301 Int pocCycle = 1 << getSPS()->getBitsForPOC(); 302 if (!pocHasMsb) 303 { 304 poc = poc % pocCycle; 305 } 306 276 307 while ( iterPic != rcListPic.end() ) 277 308 { 278 309 pcPic = *(iterPic); 279 if(pcPic && (pcPic->getPOC()%(1<<getSPS()->getBitsForPOC())) == (poc%(1<<getSPS()->getBitsForPOC()))) 280 { 281 if(pcPic->getIsLongTerm()) 310 if (pcPic && pcPic->getPOC()!=this->getPOC() && pcPic->getSlice( 0 )->isReferenced()) 311 { 312 Int picPoc = pcPic->getPOC(); 313 if (!pocHasMsb) 314 { 315 picPoc = picPoc % pocCycle; 316 } 317 318 if (poc == picPoc) 319 { 320 if (pcPic->getIsLongTerm()) 282 321 { 283 322 return pcPic; … … 289 328 break; 290 329 } 330 } 291 331 292 332 iterPic++; 293 333 } 334 294 335 return pcStPic; 295 336 } 296 337 297 Void TComSlice::setRefPOCList 338 Void TComSlice::setRefPOCList() 298 339 { 299 340 for (Int iDir = 0; iDir < 2; iDir++) … … 307 348 } 308 349 350 #if L0034_COMBINED_LIST_CLEANUP 351 Void TComSlice::setList1IdxToList0Idx() 352 { 353 Int idxL0, idxL1; 354 for ( idxL1 = 0; idxL1 < getNumRefIdx( REF_PIC_LIST_1 ); idxL1++ ) 355 { 356 m_list1IdxToList0Idx[idxL1] = -1; 357 for ( idxL0 = 0; idxL0 < getNumRefIdx( REF_PIC_LIST_0 ); idxL0++ ) 358 { 359 if ( m_apcRefPicList[REF_PIC_LIST_0][idxL0]->getPOC() == m_apcRefPicList[REF_PIC_LIST_1][idxL1]->getPOC() ) 360 { 361 m_list1IdxToList0Idx[idxL1] = idxL0; 362 break; 363 } 364 } 365 } 366 } 367 #else 309 368 Void TComSlice::generateCombinedList() 310 369 { … … 369 428 } 370 429 } 371 372 Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic) 373 { 374 #if REF_IDX_FRAMEWORK 375 if( m_eSliceType == I_SLICE || ( getSPS()->getLayerId() && 376 (getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA) && 377 (getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA) ) ) 378 #else 379 if (m_eSliceType == I_SLICE) 380 #endif 381 { 382 ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList)); 383 ::memset( m_aiNumRefIdx, 0, sizeof ( m_aiNumRefIdx )); 384 385 return; 386 } 430 #endif 431 432 #if FIX1071 433 Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic, Bool checkNumPocTotalCurr, TComPic** ilpPic) 434 #else 435 Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic ) 436 #endif 437 { 438 #if FIX1071 439 if (!checkNumPocTotalCurr) 440 #endif 441 { 442 if( m_eSliceType == I_SLICE ) 443 { 444 ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList)); 445 ::memset( m_aiNumRefIdx, 0, sizeof ( m_aiNumRefIdx )); 446 return; 447 } 387 448 388 m_aiNumRefIdx[0] = getNumRefIdx(REF_PIC_LIST_0); 389 m_aiNumRefIdx[1] = getNumRefIdx(REF_PIC_LIST_1); 449 m_aiNumRefIdx[0] = getNumRefIdx(REF_PIC_LIST_0); 450 m_aiNumRefIdx[1] = getNumRefIdx(REF_PIC_LIST_1); 451 } 390 452 391 453 TComPic* pcRefPic= NULL; … … 398 460 Int i; 399 461 462 #if REF_IDX_FRAMEWORK 463 #if ZERO_NUM_DIRECT_LAYERS 464 if( m_layerId == 0 || ( m_layerId > 0 && ( m_activeNumILRRefIdx == 0 || !((getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP) && (getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA)) ) ) ) 465 #else 466 if ((getLayerId() == 0) || 467 ((getSPS()->getLayerId()) && !((getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP) && 468 (getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA)) ) 469 ) 470 #endif 471 { 472 #endif 400 473 for(i=0; i < m_pcRPS->getNumberOfNegativePictures(); i++) 401 474 { … … 410 483 } 411 484 } 485 412 486 for(; i < m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures(); i++) 413 487 { … … 422 496 } 423 497 } 498 424 499 for(i = m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures()+m_pcRPS->getNumberOfLongtermPictures()-1; i > m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures()-1 ; i--) 425 500 { 426 501 if(m_pcRPS->getUsed(i)) 427 502 { 428 pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i) );503 pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i), m_pcRPS->getCheckLTMSBPresent(i)); 429 504 pcRefPic->setIsLongTerm(1); 430 505 pcRefPic->getPicYuvRec()->extendPicBorder(); … … 434 509 if(pcRefPic==NULL) 435 510 { 436 pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i) );511 pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i), m_pcRPS->getCheckLTMSBPresent(i)); 437 512 } 438 513 pcRefPic->setCheckLTMSBPresent(m_pcRPS->getCheckLTMSBPresent(i)); 439 514 } 440 515 #if REF_IDX_FRAMEWORK 516 } 517 #endif 518 519 #if REF_IDX_FRAMEWORK 520 //inter-layer reference picture 521 #if REF_IDX_MFM 522 #if ZERO_NUM_DIRECT_LAYERS 523 if( m_layerId > 0 && m_activeNumILRRefIdx > 0 ) 524 #else 525 if (getLayerId()) 526 #endif 527 { 528 if(!(getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA) && getSPS()->getMFMEnabledFlag()) 529 { 530 ilpPic[0]->copyUpsampledMvField(getBaseColPic()); 531 } 532 else 533 { 534 ilpPic[0]->initUpsampledMvField(); 535 } 536 #endif 537 ilpPic[0]->setIsLongTerm(1); 538 } 539 #endif 441 540 // ref_pic_list_init 442 541 TComPic* rpsCurrList0[MAX_NUM_REF+1]; 443 542 TComPic* rpsCurrList1[MAX_NUM_REF+1]; 543 #if REF_IDX_FRAMEWORK 544 #if JCTVC_M0458_INTERLAYER_RPS_SIG 545 Int numPocTotalCurr = NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr + m_activeNumILRRefIdx; 546 #else 547 Int numPocTotalCurr = NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr + m_numILRRefIdx; 548 #endif 549 #else 444 550 Int numPocTotalCurr = NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr; 445 446 { 551 #endif 552 #if FIX1071 553 if (checkNumPocTotalCurr) 554 { 555 // The variable NumPocTotalCurr is derived as specified in subclause 7.4.7.2. It is a requirement of bitstream conformance that the following applies to the value of NumPocTotalCurr: 556 // – If the current picture is a BLA or CRA picture, the value of NumPocTotalCurr shall be equal to 0. 557 // – Otherwise, when the current picture contains a P or B slice, the value of NumPocTotalCurr shall not be equal to 0. 558 if (getRapPicFlag()) 559 { 560 assert(numPocTotalCurr == 0); 561 } 562 563 if (m_eSliceType == I_SLICE) 564 { 565 ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList)); 566 ::memset( m_aiNumRefIdx, 0, sizeof ( m_aiNumRefIdx )); 567 568 return; 569 } 570 571 assert(numPocTotalCurr != 0); 572 573 m_aiNumRefIdx[0] = getNumRefIdx(REF_PIC_LIST_0); 574 m_aiNumRefIdx[1] = getNumRefIdx(REF_PIC_LIST_1); 575 } 576 #endif 577 447 578 Int cIdx = 0; 448 579 for ( i=0; i<NumPocStCurr0; i++, cIdx++) … … 458 589 rpsCurrList0[cIdx] = RefPicSetLtCurr[i]; 459 590 } 460 } 461 591 #if REF_IDX_FRAMEWORK 592 if(getLayerId()) 593 { 594 #if JCTVC_M0458_INTERLAYER_RPS_SIG 595 for( i = 0; i < m_activeNumILRRefIdx && cIdx < numPocTotalCurr; cIdx ++, i ++) 596 #else 597 for( i = 0; i < m_numILRRefIdx && cIdx < numPocTotalCurr; cIdx ++, i ++) 598 #endif 599 { 600 rpsCurrList0[cIdx] = ilpPic[i]; 601 } 602 } 603 #endif 462 604 if (m_eSliceType==B_SLICE) 463 605 { 464 IntcIdx = 0;606 cIdx = 0; 465 607 for ( i=0; i<NumPocStCurr1; i++, cIdx++) 466 608 { … … 475 617 rpsCurrList1[cIdx] = RefPicSetLtCurr[i]; 476 618 } 619 #if REF_IDX_FRAMEWORK 620 if(getLayerId()) 621 { 622 #if JCTVC_M0458_INTERLAYER_RPS_SIG 623 for( i = 0; i < m_activeNumILRRefIdx && cIdx < numPocTotalCurr; cIdx ++, i ++) 624 #else 625 for( i = 0; i < m_numILRRefIdx && cIdx < numPocTotalCurr; cIdx ++, i ++) 626 #endif 627 { 628 rpsCurrList1[cIdx] = ilpPic[i]; 629 } 630 } 631 #endif 477 632 } 478 633 … … 501 656 } 502 657 503 #if REF_ LIST_BUGFIX658 #if REF_IDX_FRAMEWORK 504 659 Void TComSlice::setRefPicListModificationSvc() 505 660 { … … 509 664 } 510 665 511 if(this->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA && this->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA) 666 if(this->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && this->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA) 667 { 512 668 return; 669 } 513 670 514 671 TComRefPicListModification* refPicListModification = this->getRefPicListModification(); … … 537 694 else 538 695 { 539 for(Int i = m_aiNumILRRefIdx; i > 0; i-- ) 696 #if JCTVC_M0458_INTERLAYER_RPS_SIG 697 for(Int i = m_activeNumILRRefIdx; i > 0; i-- ) 698 #else 699 for(Int i = m_numILRRefIdx; i > 0; i-- ) 700 #endif 540 701 { 541 702 refPicListModification->setRefPicSetIdxL0(m_aiNumRefIdx[REF_PIC_LIST_0] - i, numberOfRpsCurrTempList - i); … … 563 724 else 564 725 { 565 for(Int i = m_aiNumILRRefIdx; i > 0; i-- ) 726 #if JCTVC_M0458_INTERLAYER_RPS_SIG 727 for(Int i = m_activeNumILRRefIdx; i > 0; i-- ) 728 #else 729 for(Int i = m_numILRRefIdx; i > 0; i-- ) 730 #endif 566 731 { 567 732 refPicListModification->setRefPicSetIdxL1(m_aiNumRefIdx[REF_PIC_LIST_1] - i, numberOfRpsCurrTempList - i); … … 569 734 } 570 735 } 571 return;572 }573 574 Void TComSlice::setRefPicListSvc( TComList<TComPic*>& rcListPic, TComPic** ilpPic )575 {576 assert(getLayerId() > 0);577 578 m_aiNumRefIdx[0] = getNumRefIdx(REF_PIC_LIST_0);579 m_aiNumRefIdx[1] = getNumRefIdx(REF_PIC_LIST_1);580 581 TComPic* pcRefPic= NULL;582 TComPic* RefPicSetStCurr0[16];583 TComPic* RefPicSetStCurr1[16];584 TComPic* RefPicSetLtCurr[16];585 UInt NumPocStCurr0 = 0;586 UInt NumPocStCurr1 = 0;587 UInt NumPocLtCurr = 0;588 Int i;589 590 //temporal reference pictures591 if( !(getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA && getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA) )592 {593 for(i=0; i < m_pcRPS->getNumberOfNegativePictures(); i++)594 {595 if(m_pcRPS->getUsed(i))596 {597 pcRefPic = xGetRefPic(rcListPic, getPOC()+m_pcRPS->getDeltaPOC(i));598 pcRefPic->setIsLongTerm(0);599 pcRefPic->getPicYuvRec()->extendPicBorder();600 RefPicSetStCurr0[NumPocStCurr0] = pcRefPic;601 NumPocStCurr0++;602 pcRefPic->setCheckLTMSBPresent(false);603 }604 }605 for(; i < m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures(); i++)606 {607 if(m_pcRPS->getUsed(i))608 {609 pcRefPic = xGetRefPic(rcListPic, getPOC()+m_pcRPS->getDeltaPOC(i));610 pcRefPic->setIsLongTerm(0);611 pcRefPic->getPicYuvRec()->extendPicBorder();612 RefPicSetStCurr1[NumPocStCurr1] = pcRefPic;613 NumPocStCurr1++;614 pcRefPic->setCheckLTMSBPresent(false);615 }616 }617 for(i = m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures()+m_pcRPS->getNumberOfLongtermPictures()-1; i > m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures()-1 ; i--)618 {619 if(m_pcRPS->getUsed(i))620 {621 pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i));622 pcRefPic->setIsLongTerm(1);623 pcRefPic->getPicYuvRec()->extendPicBorder();624 RefPicSetLtCurr[NumPocLtCurr] = pcRefPic;625 NumPocLtCurr++;626 }627 if(pcRefPic==NULL)628 {629 pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i));630 }631 pcRefPic->setCheckLTMSBPresent(m_pcRPS->getCheckLTMSBPresent(i));632 }633 }634 635 //inter-layer reference picture636 #if REF_IDX_MFM637 assert(m_aiNumILRRefIdx == 1);638 if(!(getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA && getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA) && getSPS()->getMFMEnabledFlag())639 {640 ilpPic[0]->copyUpsampledMvField(getBaseColPic());641 }642 else643 {644 ilpPic[0]->initUpsampledMvField();645 }646 #endif647 ilpPic[0]->setIsLongTerm(1);648 649 // ref_pic_list_init650 UInt cIdx = 0;651 UInt num_ref_idx_l0_active_minus1 = m_aiNumRefIdx[0] - 1;652 UInt num_ref_idx_l1_active_minus1 = m_aiNumRefIdx[1] - 1;653 TComPic* refPicListTemp0[MAX_NUM_REF+1];654 TComPic* refPicListTemp1[MAX_NUM_REF+1];655 Int numRpsCurrTempList0, numRpsCurrTempList1;656 657 numRpsCurrTempList0 = numRpsCurrTempList1 = NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr + m_aiNumILRRefIdx;658 if (numRpsCurrTempList0 <= num_ref_idx_l0_active_minus1)659 {660 numRpsCurrTempList0 = num_ref_idx_l0_active_minus1 + 1;661 }662 if (numRpsCurrTempList1 <= num_ref_idx_l1_active_minus1)663 {664 numRpsCurrTempList1 = num_ref_idx_l1_active_minus1 + 1;665 }666 667 assert(numRpsCurrTempList0 <= MAX_NUM_REF);668 assert(numRpsCurrTempList1 <= MAX_NUM_REF);669 670 cIdx = 0;671 while (cIdx < numRpsCurrTempList0)672 {673 for ( i=0; i<NumPocStCurr0 && cIdx<numRpsCurrTempList0; cIdx++,i++)674 refPicListTemp0[cIdx] = RefPicSetStCurr0[ i ];675 for ( i=0; i<NumPocStCurr1 && cIdx<numRpsCurrTempList0; cIdx++,i++)676 refPicListTemp0[cIdx] = RefPicSetStCurr1[ i ];677 for ( i=0; i<NumPocLtCurr && cIdx<numRpsCurrTempList0; cIdx++,i++)678 refPicListTemp0[cIdx] = RefPicSetLtCurr[ i ];679 for ( i=0; i<m_aiNumILRRefIdx && cIdx<numRpsCurrTempList0; cIdx++,i++)680 refPicListTemp0[cIdx] = ilpPic[ i ];681 }682 cIdx = 0;683 while (cIdx<numRpsCurrTempList1 && m_eSliceType==B_SLICE)684 {685 for ( i=0; i<NumPocStCurr1 && cIdx<numRpsCurrTempList1; cIdx++,i++)686 refPicListTemp1[cIdx] = RefPicSetStCurr1[ i ];687 for ( i=0; i<NumPocStCurr0 && cIdx<numRpsCurrTempList1; cIdx++,i++)688 refPicListTemp1[cIdx] = RefPicSetStCurr0[ i ];689 for ( i=0; i<NumPocLtCurr && cIdx<numRpsCurrTempList1; cIdx++,i++)690 refPicListTemp1[cIdx] = RefPicSetLtCurr[ i ];691 for ( i=0; i<m_aiNumILRRefIdx && cIdx<numRpsCurrTempList1; cIdx++,i++)692 refPicListTemp1[cIdx] = ilpPic[ i ];693 }694 ::memset(m_bIsUsedAsLongTerm, 0, sizeof(m_bIsUsedAsLongTerm));695 for (Int rIdx = 0; rIdx <= (m_aiNumRefIdx[0]-1); rIdx ++)696 {697 m_apcRefPicList[0][rIdx] = m_RefPicListModification.getRefPicListModificationFlagL0() ? refPicListTemp0[ m_RefPicListModification.getRefPicSetIdxL0(rIdx) ] : refPicListTemp0[rIdx % numRpsCurrTempList0];698 m_bIsUsedAsLongTerm[0][rIdx] = m_RefPicListModification.getRefPicListModificationFlagL0() ? (m_RefPicListModification.getRefPicSetIdxL0(rIdx) >= (NumPocStCurr0 + NumPocStCurr1))699 : ((rIdx % numRpsCurrTempList0) >= (NumPocStCurr0 + NumPocStCurr1));700 }701 if ( m_eSliceType == P_SLICE )702 {703 m_aiNumRefIdx[1] = 0;704 ::memset( m_apcRefPicList[1], 0, sizeof(m_apcRefPicList[1]));705 }706 else707 {708 for (Int rIdx = 0; rIdx <= (m_aiNumRefIdx[1]-1); rIdx ++)709 {710 m_apcRefPicList[1][rIdx] = m_RefPicListModification.getRefPicListModificationFlagL1() ? refPicListTemp1[ m_RefPicListModification.getRefPicSetIdxL1(rIdx) ] : refPicListTemp1[rIdx % numRpsCurrTempList1];711 m_bIsUsedAsLongTerm[1][rIdx] = m_RefPicListModification.getRefPicListModificationFlagL1() ?712 (m_RefPicListModification.getRefPicSetIdxL1(rIdx) >= (NumPocStCurr0 + NumPocStCurr1)): ((rIdx % numRpsCurrTempList1) >= (NumPocStCurr0 + NumPocStCurr1));713 }714 }715 716 736 return; 717 737 } … … 724 744 #if REF_IDX_FRAMEWORK 725 745 if( m_eSliceType == I_SLICE || ( getSPS()->getLayerId() && 726 (getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA ) &&746 (getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP) && 727 747 (getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA) ) ) 728 748 #else … … 730 750 #endif 731 751 { 732 #if REF_LIST_BUGFIX 733 return m_aiNumILRRefIdx; 752 #if REF_IDX_FRAMEWORK 753 #if JCTVC_M0458_INTERLAYER_RPS_SIG 754 return m_activeNumILRRefIdx; 755 #else 756 return getNumILRRefIdx(); 757 #endif 734 758 #else 735 759 return 0; … … 743 767 } 744 768 } 745 #if REF_ LIST_BUGFIX769 #if REF_IDX_FRAMEWORK 746 770 if(getLayerId()) 747 771 { 772 #if JCTVC_M0458_INTERLAYER_RPS_SIG 773 numRpsCurrTempList += m_activeNumILRRefIdx; 774 #else 748 775 numRpsCurrTempList += getNumILRRefIdx(); 776 #endif 749 777 } 750 778 #endif … … 793 821 } 794 822 795 Void TComSlice::checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, Bool& prevRAPisBLA )823 Void TComSlice::checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, Bool& prevRAPisBLA, TComList<TComPic *>& rcListPic) 796 824 { 797 825 for(Int i = 0; i < pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures(); i++) … … 806 834 if(pocCRA < MAX_UINT && getPOC() > pocCRA) 807 835 { 836 if (!pReferencePictureSet->getCheckLTMSBPresent(i)) 837 { 838 assert(xGetLongTermRefPic(rcListPic, pReferencePictureSet->getPOC(i), false)->getPOC() >= pocCRA); 839 } 840 else 841 { 808 842 assert(pReferencePictureSet->getPOC(i) >= pocCRA); 809 843 } 810 844 } 811 if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP ) // IDR picture found 845 } 846 if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP ) // IDR picture found 812 847 { 813 848 pocCRA = getPOC(); … … 819 854 prevRAPisBLA = false; 820 855 } 821 else if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA 822 || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA NT856 else if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 857 || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL 823 858 || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) // BLA picture found 824 859 { … … 851 886 Int pocCurr = getPOC(); 852 887 853 if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA 854 || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA NT888 if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 889 || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL 855 890 || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP 856 || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR 891 || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL 857 892 || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP ) // IDR or BLA picture 858 893 { … … 866 901 iterPic++; 867 902 } 868 if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA 869 || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA NT903 if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 904 || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL 870 905 || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) 871 906 { … … 881 916 { 882 917 rpcPic = *(iterPic); 883 if (rpcPic->getPOC() != pocCurr && rpcPic->getPOC() != pocCRA) rpcPic->getSlice(0)->setReferenced(false); 918 if (rpcPic->getPOC() != pocCurr && rpcPic->getPOC() != pocCRA) 919 { 920 rpcPic->getSlice(0)->setReferenced(false); 921 } 884 922 iterPic++; 885 923 } … … 912 950 m_deblockingFilterTcOffsetDiv2 = pSrc->m_deblockingFilterTcOffsetDiv2; 913 951 952 #if L0034_COMBINED_LIST_CLEANUP 953 for (i = 0; i < 2; i++) 954 #else 914 955 for (i = 0; i < 3; i++) 956 #endif 915 957 { 916 958 m_aiNumRefIdx[i] = pSrc->m_aiNumRefIdx[i]; 917 959 } 918 960 961 #if L0034_COMBINED_LIST_CLEANUP 962 for (i = 0; i < MAX_NUM_REF; i++) 963 { 964 m_list1IdxToList0Idx[i] = pSrc->m_list1IdxToList0Idx[i]; 965 } 966 #else 919 967 for (i = 0; i < 2; i++) 920 968 { … … 933 981 m_bRefPicListModificationFlagLC = pSrc->m_bRefPicListModificationFlagLC; 934 982 m_bRefPicListCombinationFlag = pSrc->m_bRefPicListCombinationFlag; 983 #endif 935 984 m_bCheckLDC = pSrc->m_bCheckLDC; 936 985 m_iSliceQpDelta = pSrc->m_iSliceQpDelta; … … 958 1007 959 1008 // access channel 1009 #if SVC_EXTENSION 1010 m_pcVPS = pSrc->m_pcVPS; 1011 #if JCTVC_M0458_INTERLAYER_RPS_SIG 1012 m_activeNumILRRefIdx = pSrc->m_activeNumILRRefIdx; 1013 m_interLayerPredEnabledFlag = pSrc->m_interLayerPredEnabledFlag; 1014 m_numInterLayerRefPics = pSrc->m_numInterLayerRefPics; 1015 memcpy( m_interLayerPredLayerIdc, pSrc->m_interLayerPredLayerIdc, sizeof( m_interLayerPredLayerIdc ) ); 1016 #elif REF_IDX_FRAMEWORK 1017 m_numILRRefIdx = pSrc->m_numILRRefIdx; 1018 #endif 1019 #endif 960 1020 m_pcSPS = pSrc->m_pcSPS; 961 1021 m_pcPPS = pSrc->m_pcPPS; … … 984 1044 } 985 1045 1046 #if !L0034_COMBINED_LIST_CLEANUP 986 1047 m_bNoBackPredFlag = pSrc->m_bNoBackPredFlag; 1048 #endif 987 1049 m_uiTLayer = pSrc->m_uiTLayer; 988 1050 m_bTLayerSwitchingFlag = pSrc->m_bTLayerSwitchingFlag; … … 1018 1080 1019 1081 Int TComSlice::m_prevPOC = 0; 1082 1020 1083 /** Function for setting the slice's temporal layer ID and corresponding temporal_layer_switching_point_flag. 1021 1084 * \param uiTLayer Temporal layer ID of the current slice … … 1078 1141 Int i, isReference; 1079 1142 1080 Int j = 0;1081 1143 // loop through all pictures in the reference picture buffer 1082 1144 TComList<TComPic*>::iterator iterPic = rcListPic.begin(); 1083 1145 while ( iterPic != rcListPic.end()) 1084 1146 { 1085 j++;1086 1147 rpcPic = *(iterPic++); 1148 1149 if(!rpcPic->getSlice( 0 )->isReferenced()) 1150 { 1151 continue; 1152 } 1087 1153 1088 1154 isReference = 0; … … 1123 1189 { 1124 1190 rpcPic->getSlice( 0 )->setReferenced( false ); 1191 rpcPic->setUsedByCurr(0); 1125 1192 rpcPic->setIsLongTerm(0); 1126 1193 } … … 1128 1195 assert(rpcPic->getSlice( 0 )->isReferenced()==0||rpcPic->getUsedByCurr()==0||rpcPic->getTLayer()<=this->getTLayer()); 1129 1196 //check that pictures of higher or equal temporal layer are not in the RPS if the current picture is a TSA picture 1130 if(this->getNalUnitType() == NAL_UNIT_CODED_SLICE_TLA || this->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N)1197 if(this->getNalUnitType() == NAL_UNIT_CODED_SLICE_TLA_R || this->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N) 1131 1198 { 1132 1199 assert(rpcPic->getSlice( 0 )->isReferenced()==0||rpcPic->getTLayer()<this->getTLayer()); … … 1145 1212 { 1146 1213 TComPic* rpcPic; 1147 Int i, isAvailable , j;1214 Int i, isAvailable; 1148 1215 Int atLeastOneLost = 0; 1149 1216 Int atLeastOneRemoved = 0; … … 1154 1221 for(i=pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures();i<pReferencePictureSet->getNumberOfPictures();i++) 1155 1222 { 1156 j = 0;1157 1223 isAvailable = 0; 1158 1224 // loop through all pictures in the reference picture buffer … … 1160 1226 while ( iterPic != rcListPic.end()) 1161 1227 { 1162 j++;1163 1228 rpcPic = *(iterPic++); 1164 1229 if(pReferencePictureSet->getCheckLTMSBPresent(i)==true) … … 1183 1248 while ( iterPic != rcListPic.end()) 1184 1249 { 1185 j++;1186 1250 rpcPic = *(iterPic++); 1187 1251 1188 if((rpcPic->getPicSym()->getSlice(0)->getPOC()%(1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC())) == (this->getPOC() + pReferencePictureSet->getDeltaPOC(i))%(1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC()) && rpcPic->getSlice(0)->isReferenced()) 1252 Int pocCycle = 1 << rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC(); 1253 Int curPoc = rpcPic->getPicSym()->getSlice(0)->getPOC(); 1254 Int refPoc = pReferencePictureSet->getPOC(i); 1255 if (!pReferencePictureSet->getCheckLTMSBPresent(i)) 1256 { 1257 curPoc = curPoc % pocCycle; 1258 refPoc = refPoc % pocCycle; 1259 } 1260 1261 if (rpcPic->getSlice(0)->isReferenced() && curPoc == refPoc) 1189 1262 { 1190 1263 isAvailable = 1; … … 1224 1297 for(i=0;i<pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures();i++) 1225 1298 { 1226 j = 0;1227 1299 isAvailable = 0; 1228 1300 // loop through all pictures in the reference picture buffer … … 1230 1302 while ( iterPic != rcListPic.end()) 1231 1303 { 1232 j++;1233 1304 rpcPic = *(iterPic++); 1234 1305 … … 1247 1318 { 1248 1319 if(printErrors) 1320 { 1249 1321 printf("\nShort-term reference picture with POC = %3d seems to have been removed or not correctly decoded.", this->getPOC() + pReferencePictureSet->getDeltaPOC(i)); 1322 } 1250 1323 atLeastOneRemoved = 1; 1251 1324 } … … 1253 1326 { 1254 1327 if(printErrors) 1328 { 1255 1329 printf("\nShort-term reference picture with POC = %3d is lost or not correctly decoded!", this->getPOC() + pReferencePictureSet->getDeltaPOC(i)); 1330 } 1256 1331 atLeastOneLost = 1; 1257 1332 iPocLost=this->getPOC() + pReferencePictureSet->getDeltaPOC(i); … … 1399 1474 * \returns Void 1400 1475 */ 1401 Void TComSlice::resetWpScaling( wpScalingParam wp[2][MAX_NUM_REF][3])1476 Void TComSlice::resetWpScaling() 1402 1477 { 1403 1478 for ( Int e=0 ; e<2 ; e++ ) … … 1407 1482 for ( Int yuv=0 ; yuv<3 ; yuv++ ) 1408 1483 { 1409 wpScalingParam *pwp = &( wp[e][i][yuv]);1484 wpScalingParam *pwp = &(m_weightPredTable[e][i][yuv]); 1410 1485 pwp->bPresentFlag = false; 1411 1486 pwp->uiLog2WeightDenom = 0; … … 1423 1498 Void TComSlice::initWpScaling() 1424 1499 { 1425 initWpScaling(m_weightPredTable);1426 }1427 1428 /** set WP tables1429 * \param wpScalingParam1430 * \returns Void1431 */1432 Void TComSlice::initWpScaling(wpScalingParam wp[2][MAX_NUM_REF][3])1433 {1434 1500 for ( Int e=0 ; e<2 ; e++ ) 1435 1501 { … … 1438 1504 for ( Int yuv=0 ; yuv<3 ; yuv++ ) 1439 1505 { 1440 wpScalingParam *pwp = &(wp[e][i][yuv]); 1441 if ( !pwp->bPresentFlag ) { 1506 wpScalingParam *pwp = &(m_weightPredTable[e][i][yuv]); 1507 if ( !pwp->bPresentFlag ) 1508 { 1442 1509 // Inferring values not present : 1443 1510 pwp->iWeight = (1 << pwp->uiLog2WeightDenom); … … 1477 1544 , m_numOutputLayerSets (0) 1478 1545 #endif 1479 { 1480 1546 #if VPS_PROFILE_OUTPUT_LAYERS 1547 , m_numProfileTierLevel (0) 1548 , m_moreOutputLayerSetsThanDefaultFlag (false) 1549 , m_numAddOutputLayerSets (0) 1550 , m_defaultOneTargetOutputLayerFlag (false) 1551 #endif 1552 { 1481 1553 for( Int i = 0; i < MAX_TLAYER; i++) 1482 1554 { 1483 1555 m_numReorderPics[i] = 0; 1556 #if L0323_DPB 1557 m_uiMaxDecPicBuffering[i] = 1; 1558 #else 1484 1559 m_uiMaxDecPicBuffering[i] = 0; 1560 #endif 1485 1561 m_uiMaxLatencyIncrease[i] = 0; 1486 1562 } … … 1512 1588 ::memset(m_refLayerId, 0, sizeof(m_refLayerId )); 1513 1589 #endif 1590 #if DERIVE_LAYER_ID_LIST_VARIABLES 1591 ::memset(m_layerSetLayerIdList, 0, sizeof(m_layerSetLayerIdList)); 1592 ::memset(m_numLayerInIdList, 0, sizeof(m_numLayerInIdList )); 1593 #endif 1594 #if VPS_PROFILE_OUTPUT_LAYERS 1595 ::memset(m_profileLevelTierIdx, 0, sizeof(m_profileLevelTierIdx)); 1596 #endif 1597 #if JCTVC_M0458_INTERLAYER_RPS_SIG 1598 m_maxOneActiveRefLayerFlag = true; 1599 #endif 1514 1600 } 1515 1601 1516 1602 TComVPS::~TComVPS() 1517 1603 { 1518 if( m_hrdParameters != NULL ) delete m_hrdParameters; 1519 if( m_hrdOpSetIdx != NULL ) delete m_hrdOpSetIdx; 1520 if( m_cprmsPresentFlag != NULL ) delete m_cprmsPresentFlag; 1521 } 1522 1604 if( m_hrdParameters != NULL ) delete[] m_hrdParameters; 1605 if( m_hrdOpSetIdx != NULL ) delete[] m_hrdOpSetIdx; 1606 if( m_cprmsPresentFlag != NULL ) delete[] m_cprmsPresentFlag; 1607 } 1608 #if DERIVE_LAYER_ID_LIST_VARIABLES 1609 Void TComVPS::deriveLayerIdListVariables() 1610 { 1611 // For layer 0 1612 setNumLayersInIdList(0, 1); 1613 setLayerSetLayerIdList(0, 0, 0); 1614 1615 // For other layers 1616 Int i, m, n; 1617 for( i = 1; i <= getNumLayerSets() - 1; i++ ) 1618 { 1619 n = 0; 1620 for( m = 0; m <= this->getMaxLayerId(); m++) 1621 { 1622 if(this->getLayerIdIncludedFlag(i, m)) 1623 { 1624 setLayerSetLayerIdList(i, n, m); 1625 n++; 1626 } 1627 } 1628 setNumLayersInIdList(i, n); 1629 } 1630 } 1631 #endif 1523 1632 // ------------------------------------------------------------------------------------------------ 1524 1633 // Sequence parameter set (SPS) … … 1533 1642 , m_picWidthInLumaSamples (352) 1534 1643 , m_picHeightInLumaSamples (288) 1644 , m_log2MinCodingBlockSize ( 0) 1645 , m_log2DiffMaxMinCodingBlockSize (0) 1535 1646 , m_uiMaxCUWidth ( 32) 1536 1647 , m_uiMaxCUHeight ( 32) 1537 1648 , m_uiMaxCUDepth ( 3) 1538 , m_uiMinTrDepth ( 0)1539 , m_uiMaxTrDepth ( 1)1540 1649 , m_bLongTermRefsPresent (false) 1541 1650 , m_uiQuadtreeTULog2MaxSize ( 0) … … 1547 1656 , m_pcmLog2MaxSize ( 5) 1548 1657 , m_uiPCMLog2MinSize ( 7) 1658 #if !L0034_COMBINED_LIST_CLEANUP 1549 1659 , m_bUseLComb (false) 1660 #endif 1550 1661 , m_bitDepthY ( 8) 1551 1662 , m_bitDepthC ( 8) … … 1572 1683 { 1573 1684 m_uiMaxLatencyIncrease[i] = 0; 1685 #if L0323_DPB 1686 m_uiMaxDecPicBuffering[i] = 1; 1687 #else 1574 1688 m_uiMaxDecPicBuffering[i] = 0; 1689 #endif 1575 1690 m_numReorderPics[i] = 0; 1576 1691 } … … 1591 1706 m_RPSList.create(numRPS); 1592 1707 } 1708 1593 1709 Void TComSPS::setHrdParameters( UInt frameRate, UInt numDU, UInt bitRate, Bool randomAccess ) 1594 1710 { … … 1835 1951 return m_POC[bufferNum]; 1836 1952 } 1953 1837 1954 Void TComReferencePictureSet::setPOC(Int bufferNum, Int POC) 1838 1955 { 1839 1956 m_POC[bufferNum] = POC; 1840 1957 } 1958 1841 1959 Bool TComReferencePictureSet::getCheckLTMSBPresent(Int bufferNum) 1842 1960 { 1843 1961 return m_bCheckLTMSB[bufferNum]; 1844 1962 } 1963 1845 1964 Void TComReferencePictureSet::setCheckLTMSBPresent(Int bufferNum, Bool b) 1846 1965 { … … 2022 2141 return (defaultCounter == (SCALING_LIST_NUM * SCALING_LIST_SIZE_NUM - 4)) ? false : true; // -4 for 32x32 2023 2142 } 2143 2024 2144 /** get scaling matrix from RefMatrixID 2025 2145 * \param sizeId size index … … 2031 2151 ::memcpy(getScalingListAddress(sizeId, listId),((listId == refListId)? getScalingListDefaultAddress(sizeId, refListId): getScalingListAddress(sizeId, refListId)),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])); 2032 2152 } 2153 2033 2154 /** parse syntax infomation 2034 2155 * \param pchFile syntax infomation … … 2123 2244 m_scalingListCoef[SCALING_LIST_32x32][3] = m_scalingListCoef[SCALING_LIST_32x32][1]; // copy address for 32x32 2124 2245 } 2246 2125 2247 /** destroy quantization matrix array 2126 2248 */ … … 2135 2257 } 2136 2258 } 2259 2137 2260 /** get default address of quantization matrix 2138 2261 * \param sizeId size index … … 2164 2287 return src; 2165 2288 } 2289 2166 2290 /** process of default matrix 2167 2291 * \param sizeId size index … … 2173 2297 setScalingListDC(sizeId,listId,SCALING_LIST_DC); 2174 2298 } 2299 2175 2300 /** check DC value of matrix for default matrix signaling 2176 2301 */ … … 2240 2365 //! activate a PPS and depending on isIDR parameter also SPS and VPS 2241 2366 //! \returns true, if activation is successful 2242 Bool ParameterSetManager::activatePPS(Int ppsId, Bool isI DR)2367 Bool ParameterSetManager::activatePPS(Int ppsId, Bool isIRAP) 2243 2368 { 2244 2369 TComPPS *pps = m_ppsMap.getPS(ppsId); … … 2246 2371 { 2247 2372 Int spsId = pps->getSPSId(); 2248 if (!isI DR&& (spsId != m_activeSPSId))2249 { 2250 printf("Warning: tried to activate PPS referring to a inactive SPS at non-I DR.");2373 if (!isIRAP && (spsId != m_activeSPSId)) 2374 { 2375 printf("Warning: tried to activate PPS referring to a inactive SPS at non-IRAP."); 2251 2376 return false; 2252 2377 } … … 2255 2380 { 2256 2381 Int vpsId = sps->getVPSId(); 2257 if (!isI DR&& (vpsId != m_activeVPSId))2258 { 2259 printf("Warning: tried to activate PPS referring to a inactive VPS at non-I DR.");2382 if (!isIRAP && (vpsId != m_activeVPSId)) 2383 { 2384 printf("Warning: tried to activate PPS referring to a inactive VPS at non-IRAP."); 2260 2385 return false; 2261 2386 } … … 2345 2470 // Assumed that RPL of the base layer is same to the EL, otherwise this information should be also dumped and read from the metadata file 2346 2471 setPOC( pcSlice->getPOC() ); 2347 if( pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA && pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA )2472 if( pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA ) 2348 2473 { 2349 2474 setSliceType( I_SLICE ); … … 2395 2520 #endif 2396 2521 2397 #if REF_IDX_FRAMEWORK2398 Void TComSlice::addRefPicList( TComPic **pIlpPicList, Int iRefPicNum, Int iInsertOffset )2399 {2400 if(getSPS()->getLayerId() && m_eSliceType != I_SLICE)2401 {2402 #if REF_IDX_MFM2403 assert(iRefPicNum == 1);2404 #if RAP_MFM_INIT2405 if(!(getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA && getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA) && getSPS()->getMFMEnabledFlag())2406 #else2407 if( getPOC() != 0 )2408 #endif2409 {2410 pIlpPicList[0]->copyUpsampledMvField(getBaseColPic());2411 }2412 #if RAP_MFM_INIT2413 else2414 {2415 pIlpPicList[0]->initUpsampledMvField();2416 }2417 #endif2418 #endif2419 //add to list 0;2420 Int iOffset;2421 m_aiNumRefIdx[REF_PIC_LIST_0] += iInsertOffset;2422 iOffset = m_aiNumRefIdx[REF_PIC_LIST_0];2423 for (Int i=0; i<iRefPicNum; i++)2424 {2425 pIlpPicList[i]->setIsLongTerm(1); //mark ilp as long-term reference2426 m_bIsUsedAsLongTerm[REF_PIC_LIST_0][iOffset + i] = 1; //mark ilp as long-term reference2427 m_apcRefPicList[REF_PIC_LIST_0][iOffset + i] = pIlpPicList[i];2428 m_aiNumRefIdx[REF_PIC_LIST_0]++;2429 //m_aiNumRefIdx[REF_PIC_LIST_C]++;2430 }2431 if(m_eSliceType == B_SLICE)2432 {2433 m_aiNumRefIdx[REF_PIC_LIST_1] += iInsertOffset;2434 iOffset = m_aiNumRefIdx[REF_PIC_LIST_1];2435 for (Int i=0; i<iRefPicNum; i++)2436 {2437 pIlpPicList[i]->setIsLongTerm(1); //mark ilp as long-term reference2438 m_bIsUsedAsLongTerm[REF_PIC_LIST_1][iOffset + i] = 1; //mark ilp as long-term reference2439 m_apcRefPicList[REF_PIC_LIST_1][iOffset + i] = pIlpPicList[i];2440 m_aiNumRefIdx[REF_PIC_LIST_1]++;2441 //m_aiNumRefIdx[REF_PIC_LIST_C]++;2442 }2443 }2444 }2445 }2446 2447 2522 #if REF_IDX_MFM 2448 2523 Void TComSlice::setRefPOCListILP( TComPic** ilpPic, TComPic *pcRefPicBL ) … … 2453 2528 assert(thePoc == pcRefPicBL->getPOC()); 2454 2529 2455 #if REUSE_MVSCALE || REUSE_BLKMAPPING2456 2530 ilpPic[0]->getSlice(0)->setBaseColPic( pcRefPicBL ); 2457 #endif2458 2531 2459 2532 //copy reference pictures marking from the reference layer … … 2486 2559 #endif 2487 2560 2488 2489 #endif2490 2561 //! \} -
trunk/source/Lib/TLibCommon/TComSlice.h
r125 r189 504 504 Bool m_layerIdIncludedFlag[MAX_VPS_OP_SETS_PLUS1][MAX_VPS_NUH_RESERVED_ZERO_LAYER_ID_PLUS1]; 505 505 #endif 506 506 #if DERIVE_LAYER_ID_LIST_VARIABLES 507 Int m_layerSetLayerIdList[MAX_VPS_LAYER_SETS_PLUS1][MAX_VPS_LAYER_ID_PLUS1]; 508 Int m_numLayerInIdList[MAX_VPS_LAYER_SETS_PLUS1]; 509 #endif 507 510 TComPTL m_pcPTL; 508 511 #if SIGNAL_BITRATE_PICRATE_IN_VPS … … 547 550 UInt m_refLayerId[MAX_VPS_LAYER_ID_PLUS1][MAX_VPS_LAYER_ID_PLUS1]; 548 551 #endif 549 552 #if VPS_PROFILE_OUTPUT_LAYERS 553 UInt m_numProfileTierLevel; 554 Bool m_moreOutputLayerSetsThanDefaultFlag; 555 Int m_numAddOutputLayerSets; 556 Bool m_defaultOneTargetOutputLayerFlag; 557 Int m_profileLevelTierIdx[64]; 558 #endif 559 #if JCTVC_M0458_INTERLAYER_RPS_SIG 560 Bool m_maxOneActiveRefLayerFlag; 561 #endif 550 562 public: 551 563 TComVPS(); … … 604 616 Bool getLayerIdIncludedFlag(UInt opsIdx, UInt id) { return m_layerIdIncludedFlag[opsIdx][id]; } 605 617 Void setLayerIdIncludedFlag(Bool v, UInt opsIdx, UInt id) { m_layerIdIncludedFlag[opsIdx][id] = v; } 606 618 #if DERIVE_LAYER_ID_LIST_VARIABLES 619 Int getLayerSetLayerIdList(Int set, Int layerId) { return m_layerSetLayerIdList[set][layerId]; } 620 Void setLayerSetLayerIdList(Int set, Int layerId, Int x) { m_layerSetLayerIdList[set][layerId] = x ; } 621 622 Int getNumLayersInIdList(Int set) { return m_numLayerInIdList[set]; } 623 Void setNumLayersInIdList(Int set, Int x) { m_numLayerInIdList[set] = x ; } 624 625 Void deriveLayerIdListVariables(); 626 #endif 607 627 TComPTL* getPTL() { return &m_pcPTL; } 608 628 #if SIGNAL_BITRATE_PICRATE_IN_VPS … … 663 683 #if VPS_EXTN_DIRECT_REF_LAYERS 664 684 // Direct dependency of layers 665 Bool getDirectDependencyFlag(Int i, Int j) { return m_directDependencyFlag[i][j]; } 666 Void setDirectDependencyFlag(Int i, Int j, Bool x) { m_directDependencyFlag[i][j] = x; } 667 668 UInt getNumDirectRefLayers(Int i) { return m_numDirectRefLayers[i]; } 669 Void setNumDirectRefLayers(Int i, UInt x) { m_numDirectRefLayers[i] = x; } 670 671 UInt getRefLayerId(Int i, Int j) { return m_refLayerId[i][j]; } 672 Void setRefLayerId(Int i, Int j, UInt x) { m_refLayerId[i][j] = x; } 673 #endif 685 Bool getDirectDependencyFlag(Int currLayerId, Int refLayerId) { return m_directDependencyFlag[currLayerId][refLayerId]; } 686 Void setDirectDependencyFlag(Int currLayerId, Int refLayerId, Bool x) { m_directDependencyFlag[currLayerId][refLayerId] = x; } 687 688 UInt getNumDirectRefLayers(Int layerId) { return m_numDirectRefLayers[layerId]; } 689 Void setNumDirectRefLayers(Int layerId, UInt refLayerNum) { m_numDirectRefLayers[layerId] = refLayerNum; } 690 691 UInt getRefLayerId(Int layerId, Int refLayerIdx) { return m_refLayerId[layerId][refLayerIdx]; } 692 Void setRefLayerId(Int layerId, Int refLayerIdx, UInt refLayerId) { m_refLayerId[layerId][refLayerIdx] = refLayerId; } 693 #endif 694 #if VPS_PROFILE_OUTPUT_LAYERS 695 UInt getNumProfileTierLevel() { return m_numProfileTierLevel; } 696 Void setNumProfileTierLevel(Int x) { m_numProfileTierLevel = x; } 697 698 Bool getMoreOutputLayerSetsThanDefaultFlag() { return m_moreOutputLayerSetsThanDefaultFlag;} 699 Void setMoreOutputLayerSetsThanDefaultFlag(Bool x) { m_moreOutputLayerSetsThanDefaultFlag = x ;} 700 701 Int getNumAddOutputLayerSets() { return m_numAddOutputLayerSets; } 702 Void setNumAddOutputLayerSets(Int x) { m_numAddOutputLayerSets = x ; } 703 704 Bool getDefaultOneTargetOutputLayerFlag() { return m_defaultOneTargetOutputLayerFlag;} 705 Void setDefaultOneTargetOutputLayerFlag(Bool x) { m_defaultOneTargetOutputLayerFlag= x ;} 706 707 Int getProfileLevelTierIdx(Int i) { return m_profileLevelTierIdx[i]; } 708 Void setProfileLevelTierIdx(Int i, Int x) { m_profileLevelTierIdx[i] = x ; } 709 #endif 710 #if JCTVC_M0458_INTERLAYER_RPS_SIG 711 Bool getMaxOneActiveRefLayerFlag() { return m_maxOneActiveRefLayerFlag; } 712 Void setMaxOneActiveRefLayerFlag(Bool x) { m_maxOneActiveRefLayerFlag = x; } 713 #endif 674 714 }; 675 715 … … 908 948 UInt m_picHeightInLumaSamples; 909 949 910 Window m_conformanceWindow;911 950 Int m_log2MinCodingBlockSize; 951 Int m_log2DiffMaxMinCodingBlockSize; 912 952 UInt m_uiMaxCUWidth; 913 953 UInt m_uiMaxCUHeight; 914 954 UInt m_uiMaxCUDepth; 915 UInt m_uiMinTrDepth; 916 UInt m_uiMaxTrDepth; 955 956 Window m_conformanceWindow; 957 917 958 TComRPSList m_RPSList; 918 959 Bool m_bLongTermRefsPresent; … … 930 971 Bool m_useAMP; 931 972 973 #if !L0034_COMBINED_LIST_CLEANUP 932 974 Bool m_bUseLComb; 975 #endif 933 976 934 977 // Parameter … … 978 1021 Bool m_bMFMEnabledFlag; 979 1022 #endif 1023 #if SCALED_REF_LAYER_OFFSETS 1024 Window m_scaledRefLayerWindow; 1025 #endif 980 1026 public: 981 1027 TComSPS(); … … 1009 1055 Bool getUsedByCurrPicLtSPSFlag(Int i) {return m_usedByCurrPicLtSPSFlag[i];} 1010 1056 Void setUsedByCurrPicLtSPSFlag(Int i, Bool x) { m_usedByCurrPicLtSPSFlag[i] = x;} 1057 1058 Int getLog2MinCodingBlockSize() const { return m_log2MinCodingBlockSize; } 1059 Void setLog2MinCodingBlockSize(Int val) { m_log2MinCodingBlockSize = val; } 1060 Int getLog2DiffMaxMinCodingBlockSize() const { return m_log2DiffMaxMinCodingBlockSize; } 1061 Void setLog2DiffMaxMinCodingBlockSize(Int val) { m_log2DiffMaxMinCodingBlockSize = val; } 1062 1011 1063 Void setMaxCUWidth ( UInt u ) { m_uiMaxCUWidth = u; } 1012 1064 UInt getMaxCUWidth () { return m_uiMaxCUWidth; } … … 1025 1077 Bool getUseAMP() { return m_useAMP; } 1026 1078 Void setUseAMP( Bool b ) { m_useAMP = b; } 1027 Void setMinTrDepth ( UInt u ) { m_uiMinTrDepth = u; }1028 UInt getMinTrDepth () { return m_uiMinTrDepth; }1029 Void setMaxTrDepth ( UInt u ) { m_uiMaxTrDepth = u; }1030 UInt getMaxTrDepth () { return m_uiMaxTrDepth; }1031 1079 Void setQuadtreeTULog2MaxSize( UInt u ) { m_uiQuadtreeTULog2MaxSize = u; } 1032 1080 UInt getQuadtreeTULog2MaxSize() { return m_uiQuadtreeTULog2MaxSize; } … … 1050 1098 1051 1099 // Tool list 1100 #if !L0034_COMBINED_LIST_CLEANUP 1052 1101 Void setUseLComb (Bool b) { m_bUseLComb = b; } 1053 1102 Bool getUseLComb () { return m_bUseLComb; } 1103 #endif 1054 1104 1055 1105 Bool getUseLossless () { return m_useLossless; } … … 1112 1162 Void setMFMEnabledFlag(Bool flag) {m_bMFMEnabledFlag = flag;} 1113 1163 Bool getMFMEnabledFlag() {return m_bMFMEnabledFlag;} 1164 #endif 1165 #if SCALED_REF_LAYER_OFFSETS 1166 Window& getScaledRefLayerWindow( ) { return m_scaledRefLayerWindow; } 1114 1167 #endif 1115 1168 }; … … 1370 1423 Int m_deblockingFilterBetaOffsetDiv2; //< beta offset for deblocking filter 1371 1424 Int m_deblockingFilterTcOffsetDiv2; //< tc offset for deblocking filter 1372 1425 #if JCTVC_M0458_INTERLAYER_RPS_SIG 1426 Int m_activeNumILRRefIdx; //< Active inter-layer reference pictures 1427 Int m_interLayerPredLayerIdc [MAX_VPS_LAYER_ID_PLUS1]; 1428 #else 1429 #if REF_IDX_FRAMEWORK 1430 Int m_numILRRefIdx; //< for inter-layer reference picture ser 1431 #endif 1432 #endif 1433 #if L0034_COMBINED_LIST_CLEANUP 1434 Int m_list1IdxToList0Idx[MAX_NUM_REF]; 1435 Int m_aiNumRefIdx [2]; // for multiple reference of current slice 1436 #else 1373 1437 Int m_aiNumRefIdx [3]; // for multiple reference of current slice 1374 1375 #if REF_LIST_BUGFIX1376 Int m_aiNumILRRefIdx; //< for inter-layer reference picture ser1377 #endif1378 1379 1438 Int m_iRefIdxOfLC[2][MAX_NUM_REF_LC]; 1380 1439 Int m_eListIdFromIdxOfLC[MAX_NUM_REF_LC]; … … 1384 1443 Bool m_bRefPicListModificationFlagLC; 1385 1444 Bool m_bRefPicListCombinationFlag; 1445 #endif 1386 1446 1387 1447 Bool m_bCheckLDC; … … 1421 1481 1422 1482 Bool m_abEqualRef [2][MAX_NUM_REF][MAX_NUM_REF]; 1423 1483 #if !L0034_COMBINED_LIST_CLEANUP 1424 1484 Bool m_bNoBackPredFlag; 1485 #endif 1425 1486 UInt m_uiTLayer; 1426 1487 #if SVC_EXTENSION … … 1462 1523 1463 1524 Bool m_enableTMVPFlag; 1525 #if JCTVC_M0458_INTERLAYER_RPS_SIG 1526 Bool m_interLayerPredEnabledFlag; 1527 Int m_numInterLayerRefPics; 1528 #endif 1464 1529 public: 1465 1530 TComSlice(); … … 1517 1582 Int getDeblockingFilterBetaOffsetDiv2() { return m_deblockingFilterBetaOffsetDiv2; } 1518 1583 Int getDeblockingFilterTcOffsetDiv2() { return m_deblockingFilterTcOffsetDiv2; } 1519 #if REF_LIST_BUGFIX 1520 Int getNumILRRefIdx ( ) { return m_aiNumILRRefIdx; } 1521 Void setNumILRRefIdx ( Int i ) { m_aiNumILRRefIdx = i; } 1522 #endif 1584 1523 1585 Int getNumRefIdx ( RefPicList e ) { return m_aiNumRefIdx[e]; } 1524 1586 TComPic* getPic () { return m_pcPic; } … … 1533 1595 Bool getMvdL1ZeroFlag () { return m_bLMvdL1Zero; } 1534 1596 Int getNumRpsCurrTempList(); 1597 #if L0034_COMBINED_LIST_CLEANUP 1598 Int getList1IdxToList0Idx ( Int list1Idx ) { return m_list1IdxToList0Idx[list1Idx]; } 1599 #else 1535 1600 Int getRefIdxOfLC (RefPicList e, Int iRefIdx) { return m_iRefIdxOfLC[e][iRefIdx]; } 1536 1601 Int getListIdFromIdxOfLC(Int iRefIdx) { return m_eListIdFromIdxOfLC[iRefIdx]; } … … 1542 1607 Bool getRefPicListCombinationFlag() {return m_bRefPicListCombinationFlag;} 1543 1608 Void setRefPicListCombinationFlag(Bool bflag) {m_bRefPicListCombinationFlag=bflag;} 1609 #endif 1544 1610 Void setReferenced(Bool b) { m_bRefenced = b; } 1545 1611 Bool isReferenced() { return m_bRefenced; } 1546 1612 Void setPOC ( Int i ) { m_iPOC = i; if(getTLayer()==0) m_prevPOC=i; } 1547 1613 Void setNalUnitType ( NalUnitType e ) { m_eNalUnitType = e; } 1548 NalUnitType getNalUnitType () 1614 NalUnitType getNalUnitType () const { return m_eNalUnitType; } 1549 1615 Bool getRapPicFlag (); 1550 Bool getIdrPicFlag () { return getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP; } 1551 Void checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, Bool& prevRAPisBLA); 1616 Bool getIdrPicFlag () { return getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP; } 1617 Bool isIRAP () const { return (getNalUnitType() >= 16) && (getNalUnitType() <= 23); } 1618 Void checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, Bool& prevRAPisBLA, TComList<TComPic *>& rcListPic); 1552 1619 Void decodingRefreshMarking(Int& pocCRA, Bool& bRefreshPending, TComList<TComPic*>& rcListPic); 1553 1620 Void setSliceType ( SliceType e ) { m_eSliceType = e; } … … 1569 1636 Void setPic ( TComPic* p ) { m_pcPic = p; } 1570 1637 Void setDepth ( Int iDepth ) { m_iDepth = iDepth; } 1571 1572 #if SVC_EXTENSION 1573 Void setBaseColPic ( TComPic* p) { m_pcBaseColPic = p; } 1574 Void setBaseColPic ( TComList<TComPic*>& rcListPic , UInt layerID ); 1575 TComPic* getBaseColPic () { return m_pcBaseColPic; } 1576 1577 Void setLayerId (UInt layerId) { m_layerId = layerId; } 1578 UInt getLayerId () { return m_layerId; } 1579 1580 Void setFullPelBaseRec ( TComPicYuv* p) { m_pcFullPelBaseRec = p; } 1581 TComPicYuv* getFullPelBaseRec () { return m_pcFullPelBaseRec; } 1582 1583 #if AVC_SYNTAX 1584 Void initBaseLayerRPL( TComSlice *pcSlice ); 1585 #endif 1586 #endif 1587 1588 #if REF_IDX_MFM 1589 Void setRefPOCListILP(TComPic** ilpPic, TComPic *pcRefPicBL); 1590 #endif 1591 1638 1639 #if FIX1071 1640 Void setRefPicList ( TComList<TComPic*>& rcListPic, Bool checkNumPocTotalCurr = false, TComPic** ilpPic = NULL ); 1641 #else 1592 1642 Void setRefPicList ( TComList<TComPic*>& rcListPic ); 1643 #endif 1593 1644 Void setRefPOCList (); 1594 1645 Void setColFromL0Flag ( UInt colFromL0 ) { m_colFromL0Flag = colFromL0; } … … 1596 1647 Void setCheckLDC ( Bool b ) { m_bCheckLDC = b; } 1597 1648 Void setMvdL1ZeroFlag ( Bool b) { m_bLMvdL1Zero = b; } 1598 1599 #if REF_LIST_BUGFIX1600 Void setRefPicListModificationSvc();1601 Void setRefPicListSvc ( TComList<TComPic*>& rcListPic, TComPic** ilpPic );1602 #endif1603 1649 1604 1650 Bool isIntra () { return m_eSliceType == I_SLICE; } … … 1628 1674 1629 1675 static Void sortPicList ( TComList<TComPic*>& rcListPic ); 1630 1676 #if L0034_COMBINED_LIST_CLEANUP 1677 Void setList1IdxToList0Idx(); 1678 #else 1631 1679 Bool getNoBackPredFlag() { return m_bNoBackPredFlag; } 1632 1680 Void setNoBackPredFlag( Bool b ) { m_bNoBackPredFlag = b; } 1633 1681 Void generateCombinedList (); 1682 #endif 1634 1683 1635 1684 UInt getTLayer () { return m_uiTLayer; } … … 1679 1728 Void getWpScaling ( RefPicList e, Int iRefIdx, wpScalingParam *&wp); 1680 1729 1681 Void resetWpScaling (wpScalingParam wp[2][MAX_NUM_REF][3]); 1682 Void initWpScaling (wpScalingParam wp[2][MAX_NUM_REF][3]); 1730 Void resetWpScaling (); 1683 1731 Void initWpScaling (); 1684 1732 inline Bool applyWP () { return( (m_eSliceType==P_SLICE && m_pcPPS->getUseWP()) || (m_eSliceType==B_SLICE && m_pcPPS->getWPBiPred()) ); } … … 1714 1762 Void setEnableTMVPFlag ( Bool b ) { m_enableTMVPFlag = b; } 1715 1763 Bool getEnableTMVPFlag () { return m_enableTMVPFlag;} 1764 1765 #if SVC_EXTENSION 1766 Void setBaseColPic ( TComList<TComPic*>& rcListPic , UInt layerID ); 1767 Void setBaseColPic ( TComPic* p) { m_pcBaseColPic = p; } 1768 TComPic* getBaseColPic () { return m_pcBaseColPic; } 1769 1770 Void setLayerId (UInt layerId) { m_layerId = layerId; } 1771 UInt getLayerId () { return m_layerId; } 1772 1773 Void setFullPelBaseRec ( TComPicYuv* p) { m_pcFullPelBaseRec = p; } 1774 TComPicYuv* getFullPelBaseRec () { return m_pcFullPelBaseRec; } 1775 1776 #if AVC_SYNTAX 1777 Void initBaseLayerRPL( TComSlice *pcSlice ); 1778 #endif 1779 1716 1780 #if REF_IDX_FRAMEWORK 1717 Void addRefPicList( TComPic **pIlpPicList, Int iRefPicNum, Int iInsertOffset=0 ); 1718 #endif 1781 Void setRefPicListModificationSvc(); 1782 Int getNumILRRefIdx ( ) { return m_pcVPS->getNumDirectRefLayers( m_layerId ); } 1783 1784 #if REF_IDX_MFM 1785 Void setRefPOCListILP(TComPic** ilpPic, TComPic *pcRefPicBL); 1786 #endif 1787 1788 #if JCTVC_M0458_INTERLAYER_RPS_SIG 1789 Int getActiveNumILRRefIdx ( ) { return m_activeNumILRRefIdx; } 1790 Void setActiveNumILRRefIdx ( Int i ) { m_activeNumILRRefIdx = i; } 1791 1792 Int getInterLayerPredLayerIdc (UInt Idx ) { return m_interLayerPredLayerIdc[Idx];} 1793 Void setInterLayerPredLayerIdc (UInt val, UInt Idx) { m_interLayerPredLayerIdc[Idx] = val; } 1794 1795 Void setInterLayerPredEnabledFlag ( Bool val ) { m_interLayerPredEnabledFlag = val; } 1796 Bool getInterLayerPredEnabledFlag () { return m_interLayerPredEnabledFlag;} 1797 1798 Void setNumInterLayerRefPics ( UInt val ) { m_numInterLayerRefPics = val; } 1799 UInt getNumInterLayerRefPics () { return m_numInterLayerRefPics;} 1800 #else 1801 Void setNumILRRefIdx ( Int i ) { m_numILRRefIdx = i; } 1802 #endif 1803 #endif 1804 1805 #endif //SVC_EXTENSION 1806 1719 1807 protected: 1720 1808 TComPic* xGetRefPic (TComList<TComPic*>& rcListPic, 1721 1809 Int poc); 1722 TComPic* xGetLongTermRefPic (TComList<TComPic*>& rcListPic, 1723 Int poc); 1810 TComPic* xGetLongTermRefPic(TComList<TComPic*>& rcListPic, Int poc, Bool pocHasMsb); 1724 1811 };// END CLASS DEFINITION TComSlice 1725 1812 … … 1805 1892 //! activate a PPS and depending on isIDR parameter also SPS and VPS 1806 1893 //! \returns true, if activation is successful 1807 Bool activatePPS(Int ppsId, Bool isI DR);1894 Bool activatePPS(Int ppsId, Bool isIRAP); 1808 1895 1809 1896 TComVPS* getActiveVPS(){ return m_vpsMap.getPS(m_activeVPSId); }; -
trunk/source/Lib/TLibCommon/TComTrQuant.cpp
r125 r189 2007 2007 } 2008 2008 2009 if(pi QCoef[minPos] == 32767 || piQCoef[minPos] == -32768)2009 if(piDstCoeff[minPos] == 32767 || piDstCoeff[minPos] == -32768) 2010 2010 { 2011 2011 finalChange = -1; -
trunk/source/Lib/TLibCommon/TComUpsampleFilter.cpp
r125 r189 128 128 } 129 129 130 #if SCALED_REF_LAYER_OFFSETS 131 Void TComUpsampleFilter::upsampleBasePic( TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window ) 132 #else 130 133 Void TComUpsampleFilter::upsampleBasePic( TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic ) 134 #endif 131 135 { 132 136 assert ( NTAPS_US_LUMA == 8 ); … … 136 140 137 141 //========== Y component upsampling =========== 142 #if SCALED_REF_LAYER_OFFSETS 143 const Window &scalEL = window; 144 145 Int widthBL = pcBasePic->getWidth (); 146 Int heightBL = pcBasePic->getHeight(); 147 Int strideBL = pcBasePic->getStride(); 148 149 Int widthEL = pcUsPic->getWidth () - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset(); 150 Int heightEL = pcUsPic->getHeight() - scalEL.getWindowTopOffset() - scalEL.getWindowBottomOffset(); 151 Int strideEL = pcUsPic->getStride(); 152 #else 138 153 const Window &confBL = pcBasePic->getConformanceWindow(); 139 154 const Window &confEL = pcUsPic->getConformanceWindow(); … … 146 161 Int heightEL = pcUsPic->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset(); 147 162 Int strideEL = pcUsPic->getStride(); 148 163 #endif 149 164 Pel* piTempBufY = pcTempPic->getLumaAddr(); 150 165 Pel* piSrcBufY = pcBasePic->getLumaAddr(); … … 329 344 const Double sFactor12 = sFactor * 12; 330 345 #endif 346 #if ILP_DECODED_PICTURE 347 widthBL = pcBasePic->getWidth (); 348 heightBL = pcBasePic->getHeight(); 349 350 widthEL = pcUsPic->getWidth (); 351 heightEL = pcUsPic->getHeight(); 352 #endif 353 #if SCALED_REF_LAYER_OFFSETS 354 Int leftStartL = scalEL.getWindowLeftOffset(); 355 Int rightEndL = pcUsPic->getWidth() - scalEL.getWindowRightOffset(); 356 Int topStartL = scalEL.getWindowTopOffset(); 357 Int bottomEndL = pcUsPic->getHeight() - scalEL.getWindowBottomOffset(); 358 #endif 331 359 332 360 //========== horizontal upsampling =========== 333 361 for( i = 0; i < widthEL; i++ ) 334 362 { 363 #if SCALED_REF_LAYER_OFFSETS 364 Int x = Clip3( leftStartL, rightEndL - 1, i ); 365 #endif 335 366 #if PHASE_DERIVATION_IN_INTEGER 367 #if SCALED_REF_LAYER_OFFSETS 368 refPos16 = (((x - leftStartL)*scaleX + addX) >> shiftXM4) - deltaX; 369 #else 336 370 refPos16 = ((i*scaleX + addX) >> shiftXM4) - deltaX; 371 #endif 337 372 phase = refPos16 & 15; 338 373 refPos = refPos16 >> 4; … … 366 401 Int iOffset = 1 << (nShift - 1); 367 402 403 #if SCALED_REF_LAYER_OFFSETS 404 for( j = 0; j < pcTempPic->getHeight(); j++ ) 405 #else 368 406 for( j = 0; j < heightEL; j++ ) 369 { 407 #endif 408 { 409 #if SCALED_REF_LAYER_OFFSETS 410 Int y = Clip3(topStartL, bottomEndL - 1, j); 411 #endif 370 412 #if PHASE_DERIVATION_IN_INTEGER 413 #if SCALED_REF_LAYER_OFFSETS 414 refPos16 = ((( y - topStartL )*scaleY + addY) >> shiftYM4) - deltaY; 415 #else 371 416 refPos16 = ((j*scaleY + addY) >> shiftYM4) - deltaY; 417 #endif 372 418 phase = refPos16 & 15; 373 419 refPos = refPos16 >> 4; … … 382 428 piSrcY = piTempBufY + (refPos -((NTAPS_US_LUMA>>1) - 1))*strideEL; 383 429 piDstY = piDstBufY + j * strideEL; 384 430 #if SCALED_REF_LAYER_OFFSETS 431 for( i = 0; i < pcTempPic->getWidth(); i++ ) 432 #else 385 433 for( i = 0; i < widthEL; i++ ) 434 #endif 386 435 { 387 436 *piDstY = ClipY( (sumLumaVer(piSrcY, coeff, strideEL) + iOffset) >> (nShift)); 437 #if SCALED_REF_LAYER_OFFSETS 438 // Only increase the x position of reference upsample picture when within the window 439 // "-2" to ensure that pointer doesn't go beyond the boundary rightEndL-1 440 if( (i >= leftStartL) && (i <= rightEndL-2) ) 441 { 442 piSrcY++; 443 } 444 #else 388 445 piSrcY++; 446 #endif 389 447 piDstY++; 390 448 } 391 449 } 450 451 #if ILP_DECODED_PICTURE 452 #if SCALED_REF_LAYER_OFFSETS 453 widthBL = pcBasePic->getWidth (); 454 heightBL = pcBasePic->getHeight(); 455 456 widthEL = pcUsPic->getWidth () - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset(); 457 heightEL = pcUsPic->getHeight() - scalEL.getWindowTopOffset() - scalEL.getWindowBottomOffset(); 458 #else 459 widthBL = pcBasePic->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset(); 460 heightBL = pcBasePic->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset(); 461 462 widthEL = pcUsPic->getWidth () - confEL.getWindowLeftOffset() - confEL.getWindowRightOffset(); 463 heightEL = pcUsPic->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset(); 464 #endif 465 #endif 392 466 393 467 //========== UV component upsampling =========== … … 401 475 strideBL = pcBasePic->getCStride(); 402 476 strideEL = pcUsPic->getCStride(); 477 #if SCALED_REF_LAYER_OFFSETS 478 Int leftStartC = scalEL.getWindowLeftOffset() >> 1; 479 Int rightEndC = (pcUsPic->getWidth() >> 1) - (scalEL.getWindowRightOffset() >> 1); 480 Int topStartC = scalEL.getWindowTopOffset() >> 1; 481 Int bottomEndC = (pcUsPic->getHeight() >> 1) - (scalEL.getWindowBottomOffset() >> 1); 482 #endif 403 483 404 484 #if PHASE_DERIVATION_IN_INTEGER … … 422 502 #endif 423 503 504 #if ILP_DECODED_PICTURE 505 widthBL = pcBasePic->getWidth () >> 1; 506 heightBL = pcBasePic->getHeight() >> 1; 507 508 widthEL = pcUsPic->getWidth () >> 1; 509 heightEL = pcUsPic->getHeight() >> 1; 510 #endif 511 424 512 //========== horizontal upsampling =========== 425 513 for( i = 0; i < widthEL; i++ ) 426 514 { 515 #if SCALED_REF_LAYER_OFFSETS 516 Int x = Clip3(leftStartC, rightEndC - 1, i); 517 #endif 427 518 #if PHASE_DERIVATION_IN_INTEGER 519 #if SCALED_REF_LAYER_OFFSETS 520 refPos16 = (((x - leftStartC)*scaleX + addX) >> shiftXM4) - deltaX; 521 #else 428 522 refPos16 = ((i*scaleX + addX) >> shiftXM4) - deltaX; 523 #endif 429 524 phase = refPos16 & 15; 430 525 refPos = refPos16 >> 4; … … 460 555 pcTempPic->setHeight(heightEL << 1); 461 556 462 for( j = 0; j < heightEL; j++ ) 463 { 557 #if SCALED_REF_LAYER_OFFSETS 558 for( j = 0; j < pcTempPic->getHeight() >> 1; j++ ) 559 #else 560 for( j = 0; j < heightEL; j++ ) 561 #endif 562 { 563 #if SCALED_REF_LAYER_OFFSETS 564 Int y = Clip3(topStartC, bottomEndC - 1, j); 565 #endif 464 566 #if PHASE_DERIVATION_IN_INTEGER 567 #if SCALED_REF_LAYER_OFFSETS 568 refPos16 = (((y - topStartC)*scaleY + addY) >> shiftYM4) - deltaY; 569 #else 465 570 refPos16 = ((j*scaleY + addY) >> shiftYM4) - deltaY; 571 #endif 466 572 phase = refPos16 & 15; 467 573 refPos = refPos16 >> 4; … … 488 594 piDstV = piDstBufV + j*strideEL; 489 595 596 #if SCALED_REF_LAYER_OFFSETS 597 for( i = 0; i < pcTempPic->getWidth() >> 1; i++ ) 598 #else 490 599 for( i = 0; i < widthEL; i++ ) 600 #endif 491 601 { 492 602 *piDstU = ClipC( (sumChromaVer(piSrcU, coeff, strideEL) + iOffset) >> (nShift)); 493 603 *piDstV = ClipC( (sumChromaVer(piSrcV, coeff, strideEL) + iOffset) >> (nShift)); 494 604 605 #if SCALED_REF_LAYER_OFFSETS 606 // Only increase the x position of reference upsample picture when within the window 607 // "-2" to ensure that pointer doesn't go beyond the boundary rightEndC-1 608 if( (i >= leftStartC) && (i <= rightEndC-2) ) 609 { 610 piSrcU++; 611 piSrcV++; 612 } 613 #else 495 614 piSrcU++; 496 615 piSrcV++; 616 #endif 497 617 piDstU++; 498 618 piDstV++; -
trunk/source/Lib/TLibCommon/TComUpsampleFilter.h
r2 r189 52 52 ~TComUpsampleFilter(void); 53 53 54 #if SCALED_REF_LAYER_OFFSETS 55 Void upsampleBasePic( TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window ); 56 #else 54 57 Void upsampleBasePic( TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic ); 58 #endif 55 59 }; 56 60 -
trunk/source/Lib/TLibCommon/TypeDef.h
r125 r189 44 44 45 45 #if SVC_EXTENSION 46 #define SCALED_REF_LAYER_OFFSETS 1 ///< M0309: Signal scaled reference layer offsets in SPS 47 #define MAX_LAYERS 2 ///< max number of layers the codec is supposed to handle 48 46 49 #define VPS_RENAME 1 ///< Rename variables max_layer_id and num_layer_sets_minus1 in VPS 47 50 #define VPS_EXTNS 1 ///< Include function structure for VPS extensions … … 51 54 #define VPS_EXTN_PROFILE_INFO 1 ///< Include profile information for layer sets in VPS extension 52 55 #define VPS_EXTN_DIRECT_REF_LAYERS 1 ///< Include indication of direct dependency of layers in VPS extension 53 #endif 54 #define MAX_LAYERS 2 ///< max number of layers the codec is supposed to handle 56 #define VPS_EXTN_DIRECT_REF_LAYERS_CONTINUE 1 57 #define VPS_OUTPUT_LAYER_SET_IDX 1 ///< M0268: Signal output_layer_set_idx[i] as output_layer_set_idx_minus1[i] 58 #define VPS_MOVE_DIR_DEPENDENCY_FLAG 1 ///< M0268: Move the syntax element direct_dependency_flag to follow the syntax element dimension_id 59 #define VPS_PROFILE_OUTPUT_LAYERS 1 ///< M0268: Signal profile information and output layer information as in Sec. 3 of M0268v2 60 #endif 61 62 #define DERIVE_LAYER_ID_LIST_VARIABLES 1 ///< Derived variables based on the variables in VPS - for use in syntax table parsing 55 63 56 64 #define SVC_COL_BLK 1 ///< get co-located block … … 60 68 #define CHROMA_UPSAMPLING 1 ///< L0335: Chroma upsampling with 5 bits coefficients 61 69 62 #define MV_SCALING_FIX 1 ///< fixing the base layer MV scaling 63 #define MV_SCALING_POS_FIX 1 ///< use center pixels to get co-located base layer block 64 #define MFM_CLIPPING_FIX 1 ///< set the right picture size for the clipping 65 66 #define AVC_BASE 0 ///< YUV BL reading for AVC base SVC 67 #define REF_IDX_FRAMEWORK 0 ///< inter-layer reference framework 68 69 #if SVC_UPSAMPLING 70 #define SIMPLIFIED_MV_POS_SCALING 1 ///< M0133/M0449: inter-layer MV scaling and pixel mapping position calculation 71 #define ILP_DECODED_PICTURE 1 ///< M0274: use decoded picture for inter-layer prediction 72 #define JCTVC_M0259_LAMBDAREFINEMENT 1 ///< JCTVC-M0259: lambda refinement (encoder only optimization) 73 74 #define REF_IDX_FRAMEWORK 1 ///< inter-layer reference framework 75 76 #if SVC_UPSAMPLING && !ILP_DECODED_PICTURE 70 77 #define JCTVC_L0178 1 ///< implementation of JCTVC-L0178 (code only supports right and bottom croppping offsets) 71 78 #endif … … 73 80 #define IDR_ALIGNMENT 1 ///< align IDR picures across layers 74 81 82 #define AVC_BASE 1 ///< YUV BL reading for AVC base SVC 75 83 #if AVC_BASE 76 #define AVC_SYNTAX 1///< Syntax reading for AVC base84 #define AVC_SYNTAX 0 ///< Syntax reading for AVC base 77 85 #endif 78 86 … … 80 88 #define REF_IDX_ME_ZEROMV 1 ///< L0051: use zero motion for inter-layer reference picture (without fractional ME) 81 89 #define ENCODER_FAST_MODE 1 ///< L0174: enable encoder fast mode. TestMethod 1 is enabled by setting to 1 and TestMethod 2 is enable by setting to 2. By default it is set to 1. 82 #if !AVC_BASE || AVC_SYNTAX83 90 #define REF_IDX_MFM 1 ///< L0336: motion vector mapping of inter-layer reference picture 84 #endif 85 86 #if REF_IDX_MFM 87 #define REUSE_MVSCALE 1 ///< using the base layer MV scaling function 88 #define REUSE_BLKMAPPING 1 ///< using the base layer get co-located block function 89 #define RAP_MFM_INIT 1 ///< initilizing MFM when base layer is RAP picture 90 #define REF_LIST_BUGFIX 1 91 #endif 92 91 #define JCTVC_M0458_INTERLAYER_RPS_SIG 1 ///< implementation of JCTVC-L0178 (currently only one reference layer is supported ) 92 #if JCTVC_M0458_INTERLAYER_RPS_SIG 93 #define ZERO_NUM_DIRECT_LAYERS 1 ///< support of zero direct reference layers 94 #endif 93 95 #else 94 96 #define INTRA_BL 1 ///< inter-layer texture prediction … … 97 99 #define INTRA_BL_DST4x4 1 ///< L0067/L0204: DST4x4 for Intra BL 98 100 #define NO_RESIDUAL_FLAG_FOR_BLPRED 1 ///< L0437: Root cbf for Intra_BL 101 #define IL_MRG_SIMPLIFIED_PRUNING 1 ///< M0124: simplified pruning, Only the left and above candidates are checked with BL-C candidate for redundancy removal 102 #define INTRA_BL_CTX_CHANGE 1 ///< M0075: spatial dependency removal for IntraBL flag context derivation 99 103 100 104 // Hooks … … 109 113 #endif 110 114 #else 115 #define ILP_DECODED_PICTURE 0 111 116 #define SYNTAX_OUTPUT 0 112 117 #endif … … 114 119 //! \ingroup TLibCommon 115 120 //! \{ 121 122 #define FIX1071 1 ///< Temporary fix for issue #1071 123 124 #define L0208_SOP_DESCRIPTION_SEI 1 ///< L0208: add SOP descrioption SEI 125 #define MAX_NUM_PICS_IN_SOP 1024 126 127 #define K0180_SCALABLE_NESTING_SEI 1 ///JCTVC-K0180 scalable nesting sei message 128 #define MAX_NESTING_NUM_OPS 1024 129 #define MAX_NESTING_NUM_LAYER 64 130 131 #define J0149_TONE_MAPPING_SEI 1 ///< J0149: Tone mapping information SEI 116 132 #define L0363_DU_BIT_RATE 1 ///< L0363: add bit_rate_du_value_minus1 to HRD parameters 117 133 #define L0328_SPLICING 1 ///< L0328: splicing support in HRD … … 138 154 #define SIGNAL_BITRATE_PICRATE_IN_VPS 0 ///< K0125: Signal bit_rate and pic_rate in VPS 139 155 #define L0232_RD_PENALTY 1 ///< L0232: RD-penalty for 32x32 TU for intra in non-intra slices 156 #define L0386_DB_METRIC 1 ///< L0386: non-normative blockiness metric (automatically configures deblocking parameters in bitstream) 157 #define L0323_DPB 1 ///< L0323: Specification of active reference indices and decoded picture buffer 158 159 #define L0034_COMBINED_LIST_CLEANUP 1 140 160 141 161 #if VPS_EXTN_MASK_AND_DIM_INFO … … 144 164 #if VPS_RENAME 145 165 #define MAX_VPS_LAYER_SETS_PLUS1 1024 146 #define MAX_VPS_LAYER_ID_PLUS1 2166 #define MAX_VPS_LAYER_ID_PLUS1 MAX_LAYERS 147 167 #else 148 168 #define MAX_VPS_NUM_HRD_PARAMETERS 1 … … 477 497 REF_PIC_LIST_0 = 0, ///< reference list 0 478 498 REF_PIC_LIST_1 = 1, ///< reference list 1 499 #if !L0034_COMBINED_LIST_CLEANUP 479 500 REF_PIC_LIST_C = 2, ///< combined reference list for uni-prediction in B-Slices 501 #endif 480 502 REF_PIC_LIST_X = 100 ///< special mark 481 503 }; -
trunk/source/Lib/TLibDecoder/NALread.cpp
r125 r189 50 50 //! \ingroup TLibDecoder 51 51 //! \{ 52 static void convertPayloadToRBSP(vector<uint8_t>& nalUnitBuf, Bool isVclNalUnit)52 static void convertPayloadToRBSP(vector<uint8_t>& nalUnitBuf, TComInputBitstream *bitstream, Bool isVclNalUnit) 53 53 { 54 54 UInt zeroCount = 0; 55 55 vector<uint8_t>::iterator it_read, it_write; 56 56 57 for (it_read = it_write = nalUnitBuf.begin(); it_read != nalUnitBuf.end(); it_read++, it_write++) 57 UInt pos = 0; 58 bitstream->clearEmulationPreventionByteLocation(); 59 for (it_read = it_write = nalUnitBuf.begin(); it_read != nalUnitBuf.end(); it_read++, it_write++, pos++) 58 60 { 59 61 assert(zeroCount < 2 || *it_read >= 0x03); 60 62 if (zeroCount == 2 && *it_read == 0x03) 61 63 { 64 bitstream->pushEmulationPreventionByteLocation( pos ); 65 pos++; 62 66 it_read++; 63 67 zeroCount = 0; … … 109 113 if ( nalu.m_temporalId ) 110 114 { 111 assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA 112 && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA NT115 assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA_W_LP 116 && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA_W_RADL 113 117 && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA_N_LP 114 && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_IDR 118 && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_IDR_W_RADL 115 119 && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_IDR_N_LP 116 120 && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_CRA … … 122 126 else 123 127 { 124 assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_TLA 128 assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_TLA_R 125 129 && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_TSA_N 126 130 && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_STSA_R … … 136 140 /* perform anti-emulation prevention */ 137 141 TComInputBitstream *pcBitstream = new TComInputBitstream(NULL); 138 convertPayloadToRBSP(nalUnitBuf, (nalUnitBuf[0] & 64) == 0);142 convertPayloadToRBSP(nalUnitBuf, pcBitstream, (nalUnitBuf[0] & 64) == 0); 139 143 140 144 nalu.m_Bitstream = new TComInputBitstream(&nalUnitBuf); 145 nalu.m_Bitstream->setEmulationPreventionByteLocation(pcBitstream->getEmulationPreventionByteLocation()); 141 146 delete pcBitstream; 142 147 readNalUnitHeader(nalu); -
trunk/source/Lib/TLibDecoder/SEIread.cpp
r125 r189 90 90 fprintf( g_hTrace, "=========== Decoding Unit Information SEI message ===========\n"); 91 91 break; 92 #if J0149_TONE_MAPPING_SEI 93 case SEI::TONE_MAPPING_INFO: 94 fprintf( g_hTrace, "===========Tone Mapping Info SEI message ===========\n"); 95 break; 96 #endif 97 #if L0208_SOP_DESCRIPTION_SEI 98 case SEI::SOP_DESCRIPTION: 99 fprintf( g_hTrace, "=========== SOP Description SEI message ===========\n"); 100 break; 101 #endif 102 #if K0180_SCALABLE_NESTING_SEI 103 case SEI::SCALABLE_NESTING: 104 fprintf( g_hTrace, "=========== Scalable Nesting SEI message ===========\n"); 105 break; 106 #endif 92 107 default: 93 108 fprintf( g_hTrace, "=========== Unknown SEI message ===========\n"); … … 154 169 SEI *sei = NULL; 155 170 156 if(nalUnitType == NAL_UNIT_ SEI)171 if(nalUnitType == NAL_UNIT_PREFIX_SEI) 157 172 { 158 173 switch (payloadType) … … 219 234 xParseSEIGradualDecodingRefreshInfo((SEIGradualDecodingRefreshInfo&) *sei, payloadSize); 220 235 break; 236 #if J0149_TONE_MAPPING_SEI 237 case SEI::TONE_MAPPING_INFO: 238 sei = new SEIToneMappingInfo; 239 xParseSEIToneMappingInfo((SEIToneMappingInfo&) *sei, payloadSize); 240 break; 241 #endif 242 #if L0208_SOP_DESCRIPTION_SEI 243 case SEI::SOP_DESCRIPTION: 244 sei = new SEISOPDescription; 245 xParseSEISOPDescription((SEISOPDescription&) *sei, payloadSize); 246 break; 247 #endif 248 #if K0180_SCALABLE_NESTING_SEI 249 case SEI::SCALABLE_NESTING: 250 sei = new SEIScalableNesting; 251 xParseSEIScalableNesting((SEIScalableNesting&) *sei, nalUnitType, payloadSize, sps); 252 break; 253 #endif 221 254 default: 222 255 for (UInt i = 0; i < payloadSize; i++) … … 284 317 { 285 318 UInt reservedPayloadExtensionData; 286 READ_ CODE (1,reservedPayloadExtensionData, "reserved_payload_extension_data");319 READ_FLAG (reservedPayloadExtensionData, "reserved_payload_extension_data"); 287 320 } 288 321 289 322 UInt dummy; 290 READ_CODE (1, dummy, "payload_bit_equal_to_one"); 291 READ_CODE (payloadBitsRemaining-1, dummy, "payload_bit_equal_to_zero"); 323 READ_FLAG (dummy, "payload_bit_equal_to_one"); payloadBitsRemaining--; 324 while (payloadBitsRemaining) 325 { 326 READ_FLAG (dummy, "payload_bit_equal_to_zero"); payloadBitsRemaining--; 327 } 292 328 } 293 329 … … 632 668 } 633 669 670 #if J0149_TONE_MAPPING_SEI 671 Void SEIReader::xParseSEIToneMappingInfo(SEIToneMappingInfo& sei, UInt /*payloadSize*/) 672 { 673 Int i; 674 UInt val; 675 READ_UVLC( val, "tone_map_id" ); sei.m_toneMapId = val; 676 READ_FLAG( val, "tone_map_cancel_flag" ); sei.m_toneMapCancelFlag = val; 677 678 if ( !sei.m_toneMapCancelFlag ) 679 { 680 READ_FLAG( val, "tone_map_persistence_flag" ); sei.m_toneMapPersistenceFlag = val; 681 READ_CODE( 8, val, "coded_data_bit_depth" ); sei.m_codedDataBitDepth = val; 682 READ_CODE( 8, val, "target_bit_depth" ); sei.m_targetBitDepth = val; 683 READ_UVLC( val, "model_id" ); sei.m_modelId = val; 684 switch(sei.m_modelId) 685 { 686 case 0: 687 { 688 READ_CODE( 32, val, "min_value" ); sei.m_minValue = val; 689 READ_CODE( 32, val, "max_value" ); sei.m_maxValue = val; 690 break; 691 } 692 case 1: 693 { 694 READ_CODE( 32, val, "sigmoid_midpoint" ); sei.m_sigmoidMidpoint = val; 695 READ_CODE( 32, val, "sigmoid_width" ); sei.m_sigmoidWidth = val; 696 break; 697 } 698 case 2: 699 { 700 UInt num = 1u << sei.m_targetBitDepth; 701 sei.m_startOfCodedInterval.resize(num+1); 702 for(i = 0; i < num; i++) 703 { 704 READ_CODE( ((( sei.m_codedDataBitDepth + 7 ) >> 3 ) << 3), val, "start_of_coded_interval" ); 705 sei.m_startOfCodedInterval[i] = val; 706 } 707 sei.m_startOfCodedInterval[num] = 1u << sei.m_codedDataBitDepth; 708 break; 709 } 710 case 3: 711 { 712 READ_CODE( 16, val, "num_pivots" ); sei.m_numPivots = val; 713 sei.m_codedPivotValue.resize(sei.m_numPivots); 714 sei.m_targetPivotValue.resize(sei.m_numPivots); 715 for(i = 0; i < sei.m_numPivots; i++ ) 716 { 717 READ_CODE( ((( sei.m_codedDataBitDepth + 7 ) >> 3 ) << 3), val, "coded_pivot_value" ); 718 sei.m_codedPivotValue[i] = val; 719 READ_CODE( ((( sei.m_targetBitDepth + 7 ) >> 3 ) << 3), val, "target_pivot_value" ); 720 sei.m_targetPivotValue[i] = val; 721 } 722 break; 723 } 724 case 4: 725 { 726 READ_CODE( 8, val, "camera_iso_speed_idc" ); sei.m_cameraIsoSpeedValue = val; 727 if( sei.m_cameraIsoSpeedValue == 255) //Extended_ISO 728 { 729 READ_CODE( 32, val, "camera_iso_speed_value" ); sei.m_cameraIsoSpeedValue = val; 730 } 731 READ_FLAG( val, "exposure_compensation_value_sign_flag" ); sei.m_exposureCompensationValueSignFlag = val; 732 READ_CODE( 16, val, "exposure_compensation_value_numerator" ); sei.m_exposureCompensationValueNumerator = val; 733 READ_CODE( 16, val, "exposure_compensation_value_denom_idc" ); sei.m_exposureCompensationValueDenomIdc = val; 734 READ_CODE( 32, val, "ref_screen_luminance_white" ); sei.m_refScreenLuminanceWhite = val; 735 READ_CODE( 32, val, "extended_range_white_level" ); sei.m_extendedRangeWhiteLevel = val; 736 READ_CODE( 16, val, "nominal_black_level_luma_code_value" ); sei.m_nominalBlackLevelLumaCodeValue = val; 737 READ_CODE( 16, val, "nominal_white_level_luma_code_value" ); sei.m_nominalWhiteLevelLumaCodeValue= val; 738 READ_CODE( 16, val, "extended_white_level_luma_code_value" ); sei.m_extendedWhiteLevelLumaCodeValue = val; 739 break; 740 } 741 default: 742 { 743 assert(!"Undefined SEIToneMapModelId"); 744 break; 745 } 746 }//switch model id 747 }// if(!sei.m_toneMapCancelFlag) 748 749 xParseByteAlign(); 750 } 751 #endif 752 753 #if L0208_SOP_DESCRIPTION_SEI 754 Void SEIReader::xParseSEISOPDescription(SEISOPDescription &sei, UInt payloadSize) 755 { 756 Int iCode; 757 UInt uiCode; 758 759 READ_UVLC( uiCode, "sop_seq_parameter_set_id" ); sei.m_sopSeqParameterSetId = uiCode; 760 READ_UVLC( uiCode, "num_pics_in_sop_minus1" ); sei.m_numPicsInSopMinus1 = uiCode; 761 for (UInt i = 0; i <= sei.m_numPicsInSopMinus1; i++) 762 { 763 READ_CODE( 6, uiCode, "sop_desc_vcl_nalu_type" ); sei.m_sopDescVclNaluType[i] = uiCode; 764 READ_CODE( 3, sei.m_sopDescTemporalId[i], "sop_desc_temporal_id" ); sei.m_sopDescTemporalId[i] = uiCode; 765 if (sei.m_sopDescVclNaluType[i] != NAL_UNIT_CODED_SLICE_IDR_W_RADL && sei.m_sopDescVclNaluType[i] != NAL_UNIT_CODED_SLICE_IDR_N_LP) 766 { 767 READ_UVLC( sei.m_sopDescStRpsIdx[i], "sop_desc_st_rps_idx" ); sei.m_sopDescStRpsIdx[i] = uiCode; 768 } 769 if (i > 0) 770 { 771 READ_SVLC( iCode, "sop_desc_poc_delta" ); sei.m_sopDescPocDelta[i] = iCode; 772 } 773 } 774 775 xParseByteAlign(); 776 } 777 #endif 778 779 #if K0180_SCALABLE_NESTING_SEI 780 Void SEIReader::xParseSEIScalableNesting(SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, TComSPS *sps) 781 { 782 UInt uiCode; 783 SEIMessages seis; 784 785 READ_FLAG( uiCode, "bitstream_subset_flag" ); sei.m_bitStreamSubsetFlag = uiCode; 786 READ_FLAG( uiCode, "nesting_op_flag" ); sei.m_nestingOpFlag = uiCode; 787 if (sei.m_nestingOpFlag) 788 { 789 READ_FLAG( uiCode, "default_op_flag" ); sei.m_defaultOpFlag = uiCode; 790 READ_UVLC( uiCode, "nesting_num_ops_minus1" ); sei.m_nestingNumOpsMinus1 = uiCode; 791 for (UInt i = sei.m_defaultOpFlag; i <= sei.m_nestingNumOpsMinus1; i++) 792 { 793 READ_CODE( 3, uiCode, "nesting_max_temporal_id_plus1" ); sei.m_nestingMaxTemporalIdPlus1[i] = uiCode; 794 READ_UVLC( uiCode, "nesting_op_idx" ); sei.m_nestingOpIdx[i] = uiCode; 795 } 796 } 797 else 798 { 799 READ_FLAG( uiCode, "all_layers_flag" ); sei.m_allLayersFlag = uiCode; 800 if (!sei.m_allLayersFlag) 801 { 802 READ_CODE( 3, uiCode, "nesting_no_op_max_temporal_id_plus1" ); sei.m_nestingNoOpMaxTemporalIdPlus1 = uiCode; 803 READ_UVLC( uiCode, "nesting_num_layers_minus1" ); sei.m_nestingNumLayersMinus1 = uiCode; 804 for (UInt i = 0; i <= sei.m_nestingNumLayersMinus1; i++) 805 { 806 READ_CODE( 6, uiCode, "nesting_layer_id" ); sei.m_nestingLayerId[i] = uiCode; 807 } 808 } 809 } 810 811 // byte alignment 812 while ( m_pcBitstream->getNumBitsRead() % 8 != 0 ) 813 { 814 UInt code; 815 READ_FLAG( code, "nesting_zero_bit" ); 816 } 817 818 sei.m_callerOwnsSEIs = false; 819 820 // read nested SEI messages 821 do { 822 xReadSEImessage(sei.m_nestedSEIs, nalUnitType, sps); 823 } while (m_pcBitstream->getNumBitsLeft() > 8); 824 825 } 826 #endif 827 634 828 Void SEIReader::xParseByteAlign() 635 829 { -
trunk/source/Lib/TLibDecoder/SEIread.h
r125 r189 70 70 Void xParseSEITemporalLevel0Index (SEITemporalLevel0Index &sei, UInt payloadSize); 71 71 Void xParseSEIGradualDecodingRefreshInfo (SEIGradualDecodingRefreshInfo &sei, UInt payloadSize); 72 #if J0149_TONE_MAPPING_SEI 73 Void xParseSEIToneMappingInfo (SEIToneMappingInfo& sei, UInt payloadSize); 74 #endif 75 #if L0208_SOP_DESCRIPTION_SEI 76 Void xParseSEISOPDescription (SEISOPDescription &sei, UInt payloadSize); 77 #endif 78 #if K0180_SCALABLE_NESTING_SEI 79 Void xParseSEIScalableNesting (SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, TComSPS *sps); 80 #endif 72 81 Void xParseByteAlign(); 73 82 }; -
trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp
r125 r189 593 593 594 594 READ_UVLC( uiCode, "bit_depth_luma_minus8" ); 595 g_bitDepthY = 8 + uiCode; 596 pcSPS->setBitDepthY(g_bitDepthY); 595 pcSPS->setBitDepthY( uiCode + 8 ); 597 596 pcSPS->setQpBDOffsetY( (Int) (6*uiCode) ); 598 597 599 598 READ_UVLC( uiCode, "bit_depth_chroma_minus8" ); 600 g_bitDepthC = 8 + uiCode; 601 pcSPS->setBitDepthC(g_bitDepthC); 599 pcSPS->setBitDepthC( uiCode + 8 ); 602 600 pcSPS->setQpBDOffsetC( (Int) (6*uiCode) ); 603 601 … … 608 606 for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++) 609 607 { 608 #if L0323_DPB 609 READ_UVLC ( uiCode, "sps_max_dec_pic_buffering_minus1"); 610 pcSPS->setMaxDecPicBuffering( uiCode + 1, i); 611 #else 610 612 READ_UVLC ( uiCode, "sps_max_dec_pic_buffering"); 611 613 pcSPS->setMaxDecPicBuffering( uiCode, i); 614 #endif 612 615 READ_UVLC ( uiCode, "sps_num_reorder_pics" ); 613 616 pcSPS->setNumReorderPics(uiCode, i); … … 628 631 629 632 READ_UVLC( uiCode, "log2_min_coding_block_size_minus3" ); 630 UInt log2MinCUSize = uiCode + 3; 633 Int log2MinCUSize = uiCode + 3; 634 pcSPS->setLog2MinCodingBlockSize(log2MinCUSize); 631 635 READ_UVLC( uiCode, "log2_diff_max_min_coding_block_size" ); 632 UInt uiMaxCUDepthCorrect = uiCode; 633 pcSPS->setMaxCUWidth ( 1<<(log2MinCUSize + uiMaxCUDepthCorrect) ); g_uiMaxCUWidth = 1<<(log2MinCUSize + uiMaxCUDepthCorrect); 634 pcSPS->setMaxCUHeight ( 1<<(log2MinCUSize + uiMaxCUDepthCorrect) ); g_uiMaxCUHeight = 1<<(log2MinCUSize + uiMaxCUDepthCorrect); 636 pcSPS->setLog2DiffMaxMinCodingBlockSize(uiCode); 637 Int maxCUDepthDelta = uiCode; 638 pcSPS->setMaxCUWidth ( 1<<(log2MinCUSize + maxCUDepthDelta) ); 639 pcSPS->setMaxCUHeight ( 1<<(log2MinCUSize + maxCUDepthDelta) ); 635 640 READ_UVLC( uiCode, "log2_min_transform_block_size_minus2" ); pcSPS->setQuadtreeTULog2MinSize( uiCode + 2 ); 636 641 … … 640 645 READ_UVLC( uiCode, "max_transform_hierarchy_depth_inter" ); pcSPS->setQuadtreeTUMaxDepthInter( uiCode+1 ); 641 646 READ_UVLC( uiCode, "max_transform_hierarchy_depth_intra" ); pcSPS->setQuadtreeTUMaxDepthIntra( uiCode+1 ); 642 g_uiAddCUDepth = 0; 643 while( ( pcSPS->getMaxCUWidth() >> uiMaxCUDepthCorrect ) > ( 1 << ( pcSPS->getQuadtreeTULog2MinSize() + g_uiAddCUDepth ) ) ) 644 { 645 g_uiAddCUDepth++; 646 } 647 pcSPS->setMaxCUDepth( uiMaxCUDepthCorrect+g_uiAddCUDepth ); 648 g_uiMaxCUDepth = uiMaxCUDepthCorrect+g_uiAddCUDepth; 649 // BB: these parameters may be removed completly and replaced by the fixed values 650 pcSPS->setMinTrDepth( 0 ); 651 pcSPS->setMaxTrDepth( 1 ); 647 648 Int addCuDepth = max (0, log2MinCUSize - (Int)pcSPS->getQuadtreeTULog2MinSize() ); 649 pcSPS->setMaxCUDepth( maxCUDepthDelta + addCuDepth ); 650 652 651 READ_FLAG( uiCode, "scaling_list_enabled_flag" ); pcSPS->setScalingListFlag ( uiCode ); 653 652 if(pcSPS->getScalingListFlag()) … … 712 711 parseVUI(pcSPS->getVuiParameters(), pcSPS); 713 712 } 713 714 #if SCALED_REF_LAYER_OFFSETS 715 if( pcSPS->getLayerId() > 0 ) 716 { 717 Int iCode; 718 Window& scaledWindow = pcSPS->getScaledRefLayerWindow(); 719 READ_SVLC( iCode, "scaled_ref_layer_left_offset" ); scaledWindow.setWindowLeftOffset (iCode << 1); 720 READ_SVLC( iCode, "scaled_ref_layer_top_offset" ); scaledWindow.setWindowTopOffset (iCode << 1); 721 READ_SVLC( iCode, "scaled_ref_layer_right_offset" ); scaledWindow.setWindowRightOffset (iCode << 1); 722 READ_SVLC( iCode, "scaled_ref_layer_bottom_offset" ); scaledWindow.setWindowBottomOffset(iCode << 1); 723 } 724 #endif 714 725 715 726 READ_FLAG( uiCode, "sps_extension_flag"); … … 746 757 for(UInt i = 0; i <= pcVPS->getMaxTLayers()-1; i++) 747 758 { 759 #if L0323_DPB 760 READ_UVLC( uiCode, "vps_max_dec_pic_buffering_minus1[i]" ); pcVPS->setMaxDecPicBuffering( uiCode + 1, i ); 761 #else 748 762 READ_UVLC( uiCode, "vps_max_dec_pic_buffering[i]" ); pcVPS->setMaxDecPicBuffering( uiCode, i ); 763 #endif 749 764 READ_UVLC( uiCode, "vps_num_reorder_pics[i]" ); pcVPS->setNumReorderPics( uiCode, i ); 750 765 READ_UVLC( uiCode, "vps_max_latency_increase[i]" ); pcVPS->setMaxLatencyIncrease( uiCode, i ); … … 785 800 } 786 801 } 802 #if DERIVE_LAYER_ID_LIST_VARIABLES 803 pcVPS->deriveLayerIdListVariables(); 804 #endif 787 805 #if L0043_TIMING_INFO 788 806 TimingInfo *timingInfo = pcVPS->getTimingInfo(); … … 900 918 } 901 919 #endif 920 #if VPS_MOVE_DIR_DEPENDENCY_FLAG 921 #if VPS_EXTN_DIRECT_REF_LAYERS 922 // For layer 0 923 vps->setNumDirectRefLayers(0, 0); 924 // For other layers 925 for( Int layerCtr = 1; layerCtr <= vps->getMaxLayers() - 1; layerCtr++) 926 { 927 UInt numDirectRefLayers = 0; 928 for( Int refLayerCtr = 0; refLayerCtr < layerCtr; refLayerCtr++) 929 { 930 READ_FLAG(uiCode, "direct_dependency_flag[i][j]" ); vps->setDirectDependencyFlag(layerCtr, refLayerCtr, uiCode? true : false); 931 if(uiCode) 932 { 933 vps->setRefLayerId(layerCtr, numDirectRefLayers, refLayerCtr); 934 numDirectRefLayers++; 935 } 936 } 937 vps->setNumDirectRefLayers(layerCtr, numDirectRefLayers); 938 } 939 #endif 940 #endif 902 941 903 942 #if VPS_EXTN_PROFILE_INFO 904 943 // Profile-tier-level signalling 944 #if VPS_PROFILE_OUTPUT_LAYERS 945 READ_CODE( 10, uiCode, "vps_number_layer_sets_minus1" ); assert( uiCode == (vps->getNumLayerSets() - 1) ); 946 READ_CODE( 6, uiCode, "vps_num_profile_tier_level_minus1"); vps->setNumProfileTierLevel( uiCode + 1 ); 947 vps->getPTLForExtnPtr()->resize(vps->getNumProfileTierLevel()); 948 for(Int idx = 1; idx <= vps->getNumProfileTierLevel() - 1; idx++) 949 #else 905 950 vps->getPTLForExtnPtr()->resize(vps->getNumLayerSets()); 906 951 for(Int idx = 1; idx <= vps->getNumLayerSets() - 1; idx++) 952 #endif 907 953 { 908 954 READ_FLAG( uiCode, "vps_profile_present_flag[i]" ); vps->setProfilePresentFlag(idx, uiCode ? true : false); 909 955 if( !vps->getProfilePresentFlag(idx) ) 910 956 { 957 #if VPS_PROFILE_OUTPUT_LAYERS 958 READ_CODE( 6, uiCode, "profile_ref_minus1[i]" ); vps->setProfileLayerSetRef(idx, uiCode + 1); 959 #else 911 960 READ_UVLC( uiCode, "vps_profile_layer_set_ref_minus1[i]" ); vps->setProfileLayerSetRef(idx, uiCode + 1); 961 #endif 912 962 assert( vps->getProfileLayerSetRef(idx) < idx ); 913 963 // Copy profile information as indicated … … 918 968 #endif 919 969 970 #if VPS_PROFILE_OUTPUT_LAYERS 971 READ_FLAG( uiCode, "more_output_layer_sets_than_default_flag" ); vps->setMoreOutputLayerSetsThanDefaultFlag( uiCode ? true : false ); 972 Int numOutputLayerSets = 0; 973 if(! vps->getMoreOutputLayerSetsThanDefaultFlag() ) 974 { 975 numOutputLayerSets = vps->getNumLayerSets(); 976 } 977 else 978 { 979 READ_CODE( 10, uiCode, "num_add_output_layer_sets" ); vps->setNumAddOutputLayerSets( uiCode ); 980 numOutputLayerSets = vps->getNumLayerSets() + vps->getNumAddOutputLayerSets(); 981 } 982 if( numOutputLayerSets > 1 ) 983 { 984 READ_FLAG( uiCode, "default_one_target_output_layer_flag" ); vps->setDefaultOneTargetOutputLayerFlag( uiCode ? true : false ); 985 } 986 vps->setNumOutputLayerSets( numOutputLayerSets ); 987 988 for(i = 1; i < numOutputLayerSets; i++) 989 { 990 if( i > (vps->getNumLayerSets() - 1) ) 991 { 992 Int numBits = 1; 993 while ((1 << numBits) < (vps->getNumLayerSets() - 1)) 994 { 995 numBits++; 996 } 997 READ_CODE( numBits, uiCode, "output_layer_set_idx_minus1"); vps->setOutputLayerSetIdx( i, uiCode + 1); 998 Int lsIdx = vps->getOutputLayerSetIdx(i); 999 for(j = 0; j < vps->getNumLayersInIdList(lsIdx) - 1; j++) 1000 { 1001 READ_FLAG( uiCode, "output_layer_flag[i][j]"); vps->setOutputLayerFlag(i, j, uiCode); 1002 } 1003 } 1004 else 1005 { 1006 // i <= (vps->getNumLayerSets() - 1) 1007 // Assign OutputLayerFlag depending on default_one_target_output_layer_flag 1008 Int lsIdx = i; 1009 if( vps->getDefaultOneTargetOutputLayerFlag() ) 1010 { 1011 for(j = 0; j < vps->getNumLayersInIdList(lsIdx); j++) 1012 { 1013 vps->setOutputLayerFlag(i, j, (j == (vps->getNumLayersInIdList(lsIdx)-1))); 1014 } 1015 } 1016 else 1017 { 1018 for(j = 0; j < vps->getNumLayersInIdList(lsIdx); j++) 1019 { 1020 vps->setOutputLayerFlag(i, j, 1); 1021 } 1022 } 1023 } 1024 Int numBits = 1; 1025 while ((1 << numBits) < (vps->getNumProfileTierLevel())) 1026 { 1027 numBits++; 1028 } 1029 READ_CODE( numBits, uiCode, "profile_level_tier_idx[i]" ); vps->setProfileLevelTierIdx(i, uiCode); 1030 } 1031 #else 920 1032 #if VPS_EXTN_OP_LAYER_SETS 921 1033 // Target output layer signalling … … 923 1035 for(i = 0; i < vps->getNumOutputLayerSets(); i++) 924 1036 { 1037 #if VPS_OUTPUT_LAYER_SET_IDX 1038 READ_UVLC( uiCode, "vps_output_layer_set_idx_minus1[i]"); vps->setOutputLayerSetIdx(i, uiCode + 1); 1039 #else 925 1040 READ_UVLC( uiCode, "vps_output_layer_set_idx[i]"); vps->setOutputLayerSetIdx(i, uiCode); 1041 #endif 926 1042 Int lsIdx = vps->getOutputLayerSetIdx(i); 927 1043 for(j = 0; j <= vps->getMaxLayerId(); j++) … … 932 1048 } 933 1049 } 934 } 935 #endif 1050 } 1051 #endif 1052 #endif 1053 #if JCTVC_M0458_INTERLAYER_RPS_SIG 1054 READ_FLAG(uiCode, "max_one_active_ref_layer_flag" ); 1055 vps->setMaxOneActiveRefLayerFlag(uiCode); 1056 #endif 1057 1058 #if !VPS_MOVE_DIR_DEPENDENCY_FLAG 936 1059 #if VPS_EXTN_DIRECT_REF_LAYERS 937 1060 // For layer 0 … … 952 1075 vps->setNumDirectRefLayers(layerCtr, numDirectRefLayers); 953 1076 } 1077 #endif 954 1078 #endif 955 1079 } … … 1074 1198 iPOCmsb = iPrevPOCmsb; 1075 1199 } 1076 if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA 1077 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA NT1200 if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 1201 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL 1078 1202 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) 1079 1203 { … … 1084 1208 1085 1209 TComReferencePictureSet* rps; 1210 rps = rpcSlice->getLocalRPS(); 1211 rpcSlice->setRPS(rps); 1086 1212 READ_FLAG( uiCode, "short_term_ref_pic_set_sps_flag" ); 1087 1213 if(uiCode == 0) // use short-term reference picture set explicitly signalled in slice header 1088 1214 { 1089 rps = rpcSlice->getLocalRPS();1090 1215 parseShortTermRefPicSet(sps,rps, sps->getRPSList()->getNumberOfReferencePictureSets()); 1091 rpcSlice->setRPS(rps);1092 1216 } 1093 1217 else // use reference to short-term reference picture set in PPS … … 1106 1230 uiCode = 0; 1107 1231 } 1108 rpcSlice->setRPS(sps->getRPSList()->getReferencePictureSet(uiCode)); 1109 1110 rps = rpcSlice->getRPS(); 1232 memcpy(rps,sps->getRPSList()->getReferencePictureSet(uiCode),sizeof(TComReferencePictureSet)); 1111 1233 } 1112 1234 if(sps->getLongTermRefsPresent()) … … 1131 1253 rps->setNumberOfLongtermPictures(numOfLtrp); 1132 1254 Int maxPicOrderCntLSB = 1 << rpcSlice->getSPS()->getBitsForPOC(); 1133 Int prev LSB = 0, prevDeltaMSB = 0, deltaPocMSBCycleLT = 0;;1255 Int prevDeltaMSB = 0, deltaPocMSBCycleLT = 0;; 1134 1256 for(Int j=offset+rps->getNumberOfLongtermPictures()-1, k = 0; k < numOfLtrp; j--, k++) 1135 1257 { … … 1158 1280 READ_UVLC( uiCode, "delta_poc_msb_cycle_lt[i]" ); 1159 1281 Bool deltaFlag = false; 1160 // First LTRP || First LTRP from SH || curr LSB != prev LSB1161 if( (j == offset+rps->getNumberOfLongtermPictures()-1) || (j == offset+(numOfLtrp-numLtrpInSPS)-1) || (pocLsbLt != prevLSB))1282 // First LTRP || First LTRP from SH 1283 if( (j == offset+rps->getNumberOfLongtermPictures()-1) || (j == offset+(numOfLtrp-numLtrpInSPS)-1) ) 1162 1284 { 1163 1285 deltaFlag = true; … … 1184 1306 rps->setCheckLTMSBPresent(j,false); 1185 1307 } 1186 prevLSB = pocLsbLt;1187 1308 prevDeltaMSB = deltaPocMSBCycleLT; 1188 1309 } … … 1190 1311 rps->setNumberOfPictures(offset); 1191 1312 } 1192 if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA 1193 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA NT1313 if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 1314 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL 1194 1315 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) 1195 1316 { … … 1202 1323 rpcSlice->setRPS(rps); 1203 1324 } 1325 1326 1204 1327 if (rpcSlice->getSPS()->getTMVPFlagsPresent()) 1205 1328 { … … 1212 1335 } 1213 1336 } 1337 1338 #if REF_IDX_FRAMEWORK 1339 #if JCTVC_M0458_INTERLAYER_RPS_SIG 1340 rpcSlice->setActiveNumILRRefIdx(0); 1341 if((sps->getLayerId() > 0) && (rpcSlice->getNumILRRefIdx() > 0) ) 1342 { 1343 READ_FLAG(uiCode,"inter_layer_pred_enabled_flag"); 1344 rpcSlice->setInterLayerPredEnabledFlag(uiCode); 1345 if( rpcSlice->getInterLayerPredEnabledFlag()) 1346 { 1347 if(rpcSlice->getNumILRRefIdx() > 1) 1348 { 1349 Int numBits = 1; 1350 while ((1 << numBits) < rpcSlice->getNumILRRefIdx()) 1351 { 1352 numBits++; 1353 } 1354 if( !rpcSlice->getVPS()->getMaxOneActiveRefLayerFlag()) 1355 { 1356 READ_CODE( numBits, uiCode,"num_inter_layer_ref_pics_minus1" ); 1357 rpcSlice->setActiveNumILRRefIdx(uiCode + 1); 1358 } 1359 else 1360 { 1361 rpcSlice->setActiveNumILRRefIdx(1); 1362 } 1363 for(Int i = 0; i < rpcSlice->getActiveNumILRRefIdx(); i++ ) 1364 { 1365 READ_CODE( numBits,uiCode,"inter_layer_pred_layer_idc[i]" ); 1366 rpcSlice->setInterLayerPredLayerIdc(uiCode,i); 1367 } 1368 } 1369 else 1370 { 1371 rpcSlice->setActiveNumILRRefIdx(1); 1372 rpcSlice->setInterLayerPredLayerIdc(0,0); 1373 } 1374 } 1375 } 1376 #else 1377 if( rpcSlice->getLayerId() > 0 ) 1378 { 1379 rpcSlice->setNumILRRefIdx( rpcSlice->getVPS()->getNumDirectRefLayers( rpcSlice->getLayerId() ) ); 1380 } 1381 #endif 1382 #endif 1383 1214 1384 if(sps->getUseSAO()) 1215 1385 { … … 1423 1593 if(!rpcSlice->getDeblockingFilterDisable()) 1424 1594 { 1425 READ_SVLC( iCode, "beta_offset_div2" ); rpcSlice->setDeblockingFilterBetaOffsetDiv2(iCode); 1426 READ_SVLC( iCode, "tc_offset_div2" ); rpcSlice->setDeblockingFilterTcOffsetDiv2(iCode); 1595 READ_SVLC( iCode, "slice_beta_offset_div2" ); rpcSlice->setDeblockingFilterBetaOffsetDiv2(iCode); 1596 assert(rpcSlice->getDeblockingFilterBetaOffsetDiv2() >= -6 && 1597 rpcSlice->getDeblockingFilterBetaOffsetDiv2() <= 6); 1598 READ_SVLC( iCode, "slice_tc_offset_div2" ); rpcSlice->setDeblockingFilterTcOffsetDiv2(iCode); 1599 assert(rpcSlice->getDeblockingFilterTcOffsetDiv2() >= -6 && 1600 rpcSlice->getDeblockingFilterTcOffsetDiv2() <= 6); 1427 1601 } 1428 1602 } … … 1456 1630 } 1457 1631 1458 if( pps->getTilesEnabledFlag() || pps->getEntropyCodingSyncEnabledFlag() )1459 {1460 1632 UInt *entryPointOffset = NULL; 1461 1633 UInt numEntryPointOffsets, offsetLenMinus1; 1462 1634 if( pps->getTilesEnabledFlag() || pps->getEntropyCodingSyncEnabledFlag() ) 1635 { 1463 1636 READ_UVLC(numEntryPointOffsets, "num_entry_point_offsets"); rpcSlice->setNumEntryPointOffsets ( numEntryPointOffsets ); 1464 1637 if (numEntryPointOffsets>0) … … 1477 1650 #endif 1478 1651 } 1652 } 1653 else 1654 { 1655 rpcSlice->setNumEntryPointOffsets ( 0 ); 1656 } 1657 1658 if(pps->getSliceHeaderExtensionPresentFlag()) 1659 { 1660 READ_UVLC(uiCode,"slice_header_extension_length"); 1661 for(Int i=0; i<uiCode; i++) 1662 { 1663 UInt ignore; 1664 READ_CODE(8,ignore,"slice_header_extension_data_byte"); 1665 } 1666 } 1667 m_pcBitstream->readByteAlignment(); 1668 1669 if( pps->getTilesEnabledFlag() || pps->getEntropyCodingSyncEnabledFlag() ) 1670 { 1671 Int endOfSliceHeaderLocation = m_pcBitstream->getByteLocation(); 1672 Int curEntryPointOffset = 0; 1673 Int prevEntryPointOffset = 0; 1674 for (UInt idx=0; idx<numEntryPointOffsets; idx++) 1675 { 1676 curEntryPointOffset += entryPointOffset[ idx ]; 1677 1678 Int emulationPreventionByteCount = 0; 1679 for ( UInt curByteIdx = 0; curByteIdx<m_pcBitstream->numEmulationPreventionBytesRead(); curByteIdx++ ) 1680 { 1681 if ( m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) >= ( prevEntryPointOffset + endOfSliceHeaderLocation ) && 1682 m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) < ( curEntryPointOffset + endOfSliceHeaderLocation ) ) 1683 { 1684 emulationPreventionByteCount++; 1685 } 1686 } 1687 1688 entryPointOffset[ idx ] -= emulationPreventionByteCount; 1689 prevEntryPointOffset = curEntryPointOffset; 1690 } 1479 1691 1480 1692 if ( pps->getTilesEnabledFlag() ) … … 1512 1724 } 1513 1725 } 1514 else 1515 { 1516 rpcSlice->setNumEntryPointOffsets ( 0 ); 1517 } 1518 1519 if(pps->getSliceHeaderExtensionPresentFlag()) 1520 { 1521 READ_UVLC(uiCode,"slice_header_extension_length"); 1522 for(Int i=0; i<uiCode; i++) 1523 { 1524 UInt ignore; 1525 READ_CODE(8,ignore,"slice_header_extension_data_byte"); 1526 } 1527 } 1528 m_pcBitstream->readByteAlignment(); 1726 1529 1727 return; 1530 1728 } … … 1771 1969 // ==================================================================================================================== 1772 1970 1773 1774 /** Parse PCM alignment zero bits.1775 * \returns Void1776 */1777 Void TDecCavlc::xReadPCMAlignZero( )1778 {1779 UInt uiNumberOfBits = m_pcBitstream->getNumBitsUntilByteAligned();1780 1781 if(uiNumberOfBits)1782 {1783 UInt uiBits;1784 UInt uiSymbol;1785 1786 for(uiBits = 0; uiBits < uiNumberOfBits; uiBits++)1787 {1788 xReadFlag( uiSymbol );1789 assert( uiSymbol == 0 );1790 }1791 }1792 }1793 1794 Void TDecCavlc::xReadUnaryMaxSymbol( UInt& ruiSymbol, UInt uiMaxSymbol )1795 {1796 if (uiMaxSymbol == 0)1797 {1798 ruiSymbol = 0;1799 return;1800 }1801 1802 xReadFlag( ruiSymbol );1803 1804 if (ruiSymbol == 0 || uiMaxSymbol == 1)1805 {1806 return;1807 }1808 1809 UInt uiSymbol = 0;1810 UInt uiCont;1811 1812 do1813 {1814 xReadFlag( uiCont );1815 uiSymbol++;1816 }1817 while( uiCont && (uiSymbol < uiMaxSymbol-1) );1818 1819 if( uiCont && (uiSymbol == uiMaxSymbol-1) )1820 {1821 uiSymbol++;1822 }1823 1824 ruiSymbol = uiSymbol;1825 }1826 1827 Void TDecCavlc::xReadExGolombLevel( UInt& ruiSymbol )1828 {1829 UInt uiSymbol ;1830 UInt uiCount = 0;1831 do1832 {1833 xReadFlag( uiSymbol );1834 uiCount++;1835 }1836 while( uiSymbol && (uiCount != 13));1837 1838 ruiSymbol = uiCount-1;1839 1840 if( uiSymbol )1841 {1842 xReadEpExGolomb( uiSymbol, 0 );1843 ruiSymbol += uiSymbol+1;1844 }1845 1846 return;1847 }1848 1849 Void TDecCavlc::xReadEpExGolomb( UInt& ruiSymbol, UInt uiCount )1850 {1851 UInt uiSymbol = 0;1852 UInt uiBit = 1;1853 1854 1855 while( uiBit )1856 {1857 xReadFlag( uiBit );1858 uiSymbol += uiBit << uiCount++;1859 }1860 1861 uiCount--;1862 while( uiCount-- )1863 {1864 xReadFlag( uiBit );1865 uiSymbol += uiBit << uiCount;1866 }1867 1868 ruiSymbol = uiSymbol;1869 1870 return;1871 }1872 1873 UInt TDecCavlc::xGetBit()1874 {1875 UInt ruiCode;1876 m_pcBitstream->read( 1, ruiCode );1877 return ruiCode;1878 }1879 1880 1881 1971 /** parse explicit wp tables 1882 1972 * \param TComSlice* pcSlice … … 1895 1985 // decode delta_luma_log2_weight_denom : 1896 1986 READ_UVLC( uiLog2WeightDenomLuma, "luma_log2_weight_denom" ); // ue(v): luma_log2_weight_denom 1987 assert( uiLog2WeightDenomLuma <= 7 ); 1897 1988 if( bChroma ) 1898 1989 { 1899 1990 READ_SVLC( iDeltaDenom, "delta_chroma_log2_weight_denom" ); // se(v): delta_chroma_log2_weight_denom 1900 1991 assert((iDeltaDenom + (Int)uiLog2WeightDenomLuma)>=0); 1992 assert((iDeltaDenom + (Int)uiLog2WeightDenomLuma)<=7); 1901 1993 uiLog2WeightDenomChroma = (UInt)(iDeltaDenom + uiLog2WeightDenomLuma); 1902 1994 } … … 1937 2029 Int iDeltaWeight; 1938 2030 READ_SVLC( iDeltaWeight, "delta_luma_weight_lX" ); // se(v): delta_luma_weight_l0[i] 2031 assert( iDeltaWeight >= -128 ); 2032 assert( iDeltaWeight <= 127 ); 1939 2033 wp[0].iWeight = (iDeltaWeight + (1<<wp[0].uiLog2WeightDenom)); 1940 2034 READ_SVLC( wp[0].iOffset, "luma_offset_lX" ); // se(v): luma_offset_l0[i] 2035 assert( wp[0].iOffset >= -128 ); 2036 assert( wp[0].iOffset <= 127 ); 1941 2037 } 1942 2038 else … … 1953 2049 Int iDeltaWeight; 1954 2050 READ_SVLC( iDeltaWeight, "delta_chroma_weight_lX" ); // se(v): chroma_weight_l0[i][j] 2051 assert( iDeltaWeight >= -128 ); 2052 assert( iDeltaWeight <= 127 ); 1955 2053 wp[j].iWeight = (iDeltaWeight + (1<<wp[1].uiLog2WeightDenom)); 1956 2054 1957 2055 Int iDeltaChroma; 1958 2056 READ_SVLC( iDeltaChroma, "delta_chroma_offset_lX" ); // se(v): delta_chroma_offset_l0[i][j] 2057 assert( iDeltaChroma >= -512 ); 2058 assert( iDeltaChroma <= 511 ); 1959 2059 Int pred = ( 128 - ( ( 128*wp[j].iWeight)>>(wp[j].uiLog2WeightDenom) ) ); 1960 2060 wp[j].iOffset = Clip3(-128, 127, (iDeltaChroma + pred) ); -
trunk/source/Lib/TLibDecoder/TDecCAVLC.h
r125 r189 61 61 62 62 protected: 63 Void xReadEpExGolomb ( UInt& ruiSymbol, UInt uiCount );64 Void xReadExGolombLevel ( UInt& ruiSymbol );65 Void xReadUnaryMaxSymbol ( UInt& ruiSymbol, UInt uiMaxSymbol );66 67 Void xReadPCMAlignZero ();68 69 UInt xGetBit ();70 71 63 void parseShortTermRefPicSet (TComSPS* pcSPS, TComReferencePictureSet* pcRPS, Int idx); 72 private:73 64 74 65 public: -
trunk/source/Lib/TLibDecoder/TDecCu.cpp
r125 r189 370 370 m_pcEntropyDecoder->decodePredInfo( pcCU, uiAbsPartIdx, uiDepth, m_ppcCU[uiDepth]); 371 371 #endif 372 372 373 373 // Coefficient decoding 374 374 Bool bCodeDQP = getdQPFlag(); -
trunk/source/Lib/TLibDecoder/TDecGop.cpp
r125 r189 247 247 for (Int iRefIndex = 0; iRefIndex < pcSlice->getNumRefIdx(RefPicList(iRefList)); iRefIndex++) 248 248 { 249 #if REF_IDX_FRAMEWORK && VPS_EXTN_DIRECT_REF_LAYERS_CONTINUE 250 if( pcSlice->getRefPic(RefPicList(iRefList), iRefIndex)->isILR( m_layerId ) ) 251 { 252 printf( "%d(%d) ", pcSlice->getRefPOC(RefPicList(iRefList), iRefIndex), pcSlice->getRefPic(RefPicList(iRefList), iRefIndex)->getLayerId() ); 253 } 254 else 255 #endif 249 256 printf ("%d ", pcSlice->getRefPOC(RefPicList(iRefList), iRefIndex)); 250 257 } -
trunk/source/Lib/TLibDecoder/TDecSlice.h
r125 r189 91 91 Void initCtxMem( UInt i ); 92 92 Void setCtxMem( TDecSbac* sb, Int b ) { CTXMem[b] = sb; } 93 Int getCtxMemSize( ) { return (Int)CTXMem.size(); } 93 94 #if SVC_EXTENSION 94 95 TDecTop* getLayerDec ( UInt LayerId ) { return m_ppcTDecTop[LayerId]; } -
trunk/source/Lib/TLibDecoder/TDecTop.cpp
r125 r189 113 113 if(m_cIlpPic[i]) 114 114 { 115 //m_cIlpPic[i]->setPicYuvRec(NULL);116 115 m_cIlpPic[i]->destroy(); 117 116 delete m_cIlpPic[i]; … … 143 142 if(m_layerId>0) 144 143 { 144 g_bitDepthY = pcSPS->getBitDepthY(); 145 g_bitDepthC = pcSPS->getBitDepthC(); 146 g_uiMaxCUWidth = pcSPS->getMaxCUWidth(); 147 g_uiMaxCUHeight = pcSPS->getMaxCUHeight(); 148 g_uiMaxCUDepth = pcSPS->getMaxCUDepth(); 149 g_uiAddCUDepth = max (0, pcSPS->getLog2MinCodingBlockSize() - (Int)pcSPS->getQuadtreeTULog2MinSize() ); 150 145 151 Int numReorderPics[MAX_TLAYER]; 146 152 Window &conformanceWindow = pcSPS->getConformanceWindow(); … … 154 160 if (m_cIlpPic[0] == NULL) 155 161 { 156 for (Int j=0; j<1/*MAX_NUM_REF*/; j++) 157 { 162 for (Int j=0; j< 1/*MAX_NUM_REF*/; j++) // to be set to NumDirectRefLayers[LayerIdInVps[nuh_layer_id]] 163 { 164 158 165 m_cIlpPic[j] = new TComPic; 159 //m_cIlpPic[j]->createWithOutYuv(m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, &m_cSPS, true);160 166 #if SVC_UPSAMPLING 161 167 m_cIlpPic[j]->create(pcSPS->getPicWidthInLumaSamples(), pcSPS->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, pcSPS, true); … … 176 182 if(m_cIlpPic[0]) 177 183 { 178 //m_cIlpPic[0]->setPicYuvRec(pcPic->getFullPelBaseRec());179 184 m_cIlpPic[0]->copyUpsampledPictureYuv(pcPic->getFullPelBaseRec(), m_cIlpPic[0]->getPicYuvRec()); 180 185 m_cIlpPic[0]->getSlice(0)->setPOC(pcPic->getPOC()); 181 m_cIlpPic[0]->setLayerId( 0); //set reference layerId186 m_cIlpPic[0]->setLayerId(pcPic->getSlice(0)->getBaseColPic()->getLayerId()); //set reference layerId 182 187 m_cIlpPic[0]->getPicYuvRec()->setBorderExtension(false); 183 188 m_cIlpPic[0]->getPicYuvRec()->extendPicBorder(); … … 231 236 } 232 237 238 #if L0323_DPB 239 m_iMaxRefPicNum = pcSlice->getSPS()->getMaxDecPicBuffering(pcSlice->getTLayer())+pcSlice->getSPS()->getNumReorderPics(pcSlice->getTLayer()); // m_uiMaxDecPicBuffering has the space for the picture currently being decoded 240 #else 233 241 m_iMaxRefPicNum = pcSlice->getSPS()->getMaxDecPicBuffering(pcSlice->getTLayer())+pcSlice->getSPS()->getNumReorderPics(pcSlice->getTLayer()) + 1; // +1 to have space for the picture currently being decoded 242 #endif 234 243 if (m_cListPic.size() < (UInt)m_iMaxRefPicNum) 235 244 { … … 239 248 if(m_layerId > 0) 240 249 { 250 #if VPS_EXTN_DIRECT_REF_LAYERS_CONTINUE 251 TDecTop *pcTDecTopBase = (TDecTop *)getRefLayerDec( m_layerId ); 252 #else 241 253 TDecTop *pcTDecTopBase = (TDecTop *)getLayerDec( m_layerId-1 ); 254 #endif 242 255 //TComPic* pcPic = *(pcTDecTopBase->getListPic()->begin()); 243 256 TComPicYuv* pcPicYuvRecBase = (*(pcTDecTopBase->getListPic()->begin()))->getPicYuvRec(); … … 339 352 cFillSlice.setSPS( m_parameterSetManagerDecoder[m_layerId].getFirstSPS() ); 340 353 cFillSlice.setPPS( m_parameterSetManagerDecoder[m_layerId].getFirstPPS() ); 354 cFillSlice.setVPS( m_parameterSetManagerDecoder[m_layerId].getFirstVPS() ); 341 355 cFillSlice.initSlice( m_layerId ); 342 356 #else … … 350 364 cFillPic->getSlice(0)->setSPS( m_parameterSetManagerDecoder[m_layerId].getFirstSPS() ); 351 365 cFillPic->getSlice(0)->setPPS( m_parameterSetManagerDecoder[m_layerId].getFirstPPS() ); 366 cFillPic->getSlice(0)->setVPS( m_parameterSetManagerDecoder[m_layerId].getFirstVPS() ); 352 367 cFillPic->getSlice(0)->initSlice( m_layerId ); 353 368 #else … … 405 420 assert (sps != 0); 406 421 407 if( false == m_parameterSetManagerDecoder[m_layerId].activatePPS(m_apcSlicePilot->getPPSId(), m_apcSlicePilot-> getIdrPicFlag()) )422 if( false == m_parameterSetManagerDecoder[m_layerId].activatePPS(m_apcSlicePilot->getPPSId(), m_apcSlicePilot->isIRAP()) ) 408 423 #else 409 424 m_parameterSetManagerDecoder.applyPrefetchedPS(); … … 415 430 assert (sps != 0); 416 431 417 if (false == m_parameterSetManagerDecoder.activatePPS(m_apcSlicePilot->getPPSId(),m_apcSlicePilot-> getIdrPicFlag()))432 if (false == m_parameterSetManagerDecoder.activatePPS(m_apcSlicePilot->getPPSId(),m_apcSlicePilot->isIRAP())) 418 433 #endif 419 434 { … … 422 437 } 423 438 439 if( pps->getDependentSliceSegmentsEnabledFlag() ) 440 { 441 Int NumCtx = pps->getEntropyCodingSyncEnabledFlag()?2:1; 442 443 if (m_cSliceDecoder.getCtxMemSize() != NumCtx) 444 { 445 m_cSliceDecoder.initCtxMem(NumCtx); 446 for ( UInt st = 0; st < NumCtx; st++ ) 447 { 448 TDecSbac* ctx = NULL; 449 ctx = new TDecSbac; 450 ctx->init( &m_cBinCABAC ); 451 m_cSliceDecoder.setCtxMem( ctx, st ); 452 } 453 } 454 } 455 424 456 m_apcSlicePilot->setPPS(pps); 425 457 m_apcSlicePilot->setSPS(sps); 458 426 459 pps->setSPS(sps); 427 460 pps->setNumSubstreams(pps->getEntropyCodingSyncEnabledFlag() ? ((sps->getPicHeightInLumaSamples() + sps->getMaxCUHeight() - 1) / sps->getMaxCUHeight()) * (pps->getNumColumnsMinus1() + 1) : 1); 428 461 pps->setMinCuDQPSize( sps->getMaxCUWidth() >> ( pps->getMaxCuDQPDepth()) ); 429 462 430 for (Int i = 0; i < sps->getMaxCUDepth() - g_uiAddCUDepth; i++) 463 g_bitDepthY = sps->getBitDepthY(); 464 g_bitDepthC = sps->getBitDepthC(); 465 g_uiMaxCUWidth = sps->getMaxCUWidth(); 466 g_uiMaxCUHeight = sps->getMaxCUHeight(); 467 g_uiMaxCUDepth = sps->getMaxCUDepth(); 468 g_uiAddCUDepth = max (0, sps->getLog2MinCodingBlockSize() - (Int)sps->getQuadtreeTULog2MinSize() ); 469 470 for (Int i = 0; i < sps->getLog2DiffMaxMinCodingBlockSize(); i++) 431 471 { 432 472 sps->setAMPAcc( i, sps->getUseAMP() ); 433 473 } 434 474 435 for (Int i = sps->get MaxCUDepth() - g_uiAddCUDepth; i < sps->getMaxCUDepth(); i++)475 for (Int i = sps->getLog2DiffMaxMinCodingBlockSize(); i < sps->getMaxCUDepth(); i++) 436 476 { 437 477 sps->setAMPAcc( i, 0 ); … … 439 479 440 480 m_cSAO.destroy(); 441 m_cSAO.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight);442 m_cLoopFilter. create( g_uiMaxCUDepth);481 m_cSAO.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), sps->getMaxCUWidth(), sps->getMaxCUHeight() ); 482 m_cLoopFilter.create( sps->getMaxCUDepth() ); 443 483 } 444 484 … … 451 491 TComPic*& pcPic = m_pcPic; 452 492 #if SVC_EXTENSION 493 m_apcSlicePilot->setVPS( m_parameterSetManagerDecoder[m_layerId].getPrefetchedVPS(0) ); 453 494 m_apcSlicePilot->initSlice( nalu.m_layerId ); 454 495 #else … … 467 508 468 509 m_apcSlicePilot->setNalUnitType(nalu.m_nalUnitType); 469 if((m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TRAIL_N) || 470 (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N) || 471 (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_N)) 472 { 473 m_apcSlicePilot->setTemporalLayerNonReferenceFlag(true); 474 } 510 Bool nonReferenceFlag = (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TRAIL_N || 511 m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N || 512 m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_N || 513 m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_N || 514 m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N); 515 m_apcSlicePilot->setTemporalLayerNonReferenceFlag(nonReferenceFlag); 516 475 517 m_apcSlicePilot->setReferenced(true); // Putting this as true ensures that picture is referenced the first time it is in an RPS 476 518 m_apcSlicePilot->setTLayerInfo(nalu.m_temporalId); … … 481 523 m_cEntropyDecoder.decodeSliceHeader (m_apcSlicePilot, &m_parameterSetManagerDecoder); 482 524 #endif 483 if (m_apcSlicePilot->isNextSlice()) 484 { 485 // Skip pictures due to random access 486 if (isRandomAccessSkipPicture(iSkipFrame, iPOCLastDisplay)) 487 { 488 return false; 489 } 490 // Skip TFD pictures associated with BLA/BLANT pictures 491 if (isSkipPictureForBLA(iPOCLastDisplay)) 492 { 493 return false; 494 } 495 } 525 526 // Skip pictures due to random access 527 if (isRandomAccessSkipPicture(iSkipFrame, iPOCLastDisplay)) 528 { 529 return false; 530 } 531 // Skip TFD pictures associated with BLA/BLANT pictures 532 if (isSkipPictureForBLA(iPOCLastDisplay)) 533 { 534 return false; 535 } 496 536 497 537 // exit when a new picture is found … … 506 546 } 507 547 #else 508 if (m_apcSlicePilot->isNextSlice() && m_apcSlicePilot->getPOC()!=m_prevPOC && !m_bFirstSliceInSequence) 548 //we should only get a different poc for a new picture (with CTU address==0) 549 if (m_apcSlicePilot->isNextSlice() && m_apcSlicePilot->getPOC()!=m_prevPOC && !m_bFirstSliceInSequence && (!m_apcSlicePilot->getSliceCurStartCUAddr()==0)) 550 { 551 printf ("Warning, the first slice of a picture might have been lost!\n"); 552 } 553 // exit when a new picture is found 554 if (m_apcSlicePilot->isNextSlice() && (m_apcSlicePilot->getSliceCurStartCUAddr() == 0 && !m_bFirstSliceInPicture) && !m_bFirstSliceInSequence ) 509 555 { 510 556 if (m_prevPOC >= m_pocRandomAccess) … … 537 583 { 538 584 #if AVC_BASE 539 if( m_layerId == 1 ) 540 { 541 TComPic* pBLPic = (*m_ppcTDecTop[0]->getListPic()->begin()); 542 fstream* pFile = m_ppcTDecTop[0]->getBLReconFile(); 543 const Window &conf = pBLPic->getConformanceWindow(); 544 UInt uiWidth = pBLPic->getPicYuvRec()->getWidth() - conf.getWindowLeftOffset() - conf.getWindowRightOffset(); 545 UInt uiHeight = pBLPic->getPicYuvRec()->getHeight() - conf.getWindowTopOffset() - conf.getWindowBottomOffset(); 546 547 if( pFile->good() ) 548 { 549 UInt64 uiPos = (UInt64) m_apcSlicePilot->getPOC() * uiWidth * uiHeight * 3 / 2; 550 551 pFile->seekg((UInt)uiPos, ios::beg ); 552 553 Pel* pPel = pBLPic->getPicYuvRec()->getLumaAddr(); 554 UInt uiStride = pBLPic->getPicYuvRec()->getStride(); 555 for( Int i = 0; i < uiHeight; i++ ) 556 { 557 for( Int j = 0; j < uiWidth; j++ ) 585 if( m_layerId == 1 && m_parameterSetManagerDecoder[0].getPrefetchedVPS(0)->getAvcBaseLayerFlag() ) 586 { 587 TComPic* pBLPic = (*m_ppcTDecTop[0]->getListPic()->begin()); 588 fstream* pFile = m_ppcTDecTop[0]->getBLReconFile(); 589 #if ILP_DECODED_PICTURE 590 UInt uiWidth = pBLPic->getPicYuvRec()->getWidth(); 591 UInt uiHeight = pBLPic->getPicYuvRec()->getHeight(); 592 #else 593 const Window &conf = pBLPic->getConformanceWindow(); 594 UInt uiWidth = pBLPic->getPicYuvRec()->getWidth() - conf.getWindowLeftOffset() - conf.getWindowRightOffset(); 595 UInt uiHeight = pBLPic->getPicYuvRec()->getHeight() - conf.getWindowTopOffset() - conf.getWindowBottomOffset(); 596 #endif 597 598 if( pFile->good() ) 599 { 600 UInt64 uiPos = (UInt64) m_apcSlicePilot->getPOC() * uiWidth * uiHeight * 3 / 2; 601 602 pFile->seekg((UInt)uiPos, ios::beg ); 603 604 Pel* pPel = pBLPic->getPicYuvRec()->getLumaAddr(); 605 UInt uiStride = pBLPic->getPicYuvRec()->getStride(); 606 for( Int i = 0; i < uiHeight; i++ ) 558 607 { 559 pPel[j] = pFile->get(); 608 for( Int j = 0; j < uiWidth; j++ ) 609 { 610 pPel[j] = pFile->get(); 611 } 612 pPel += uiStride; 560 613 } 561 pPel += uiStride; 562 } 563 564 pPel = pBLPic->getPicYuvRec()->getCbAddr(); 565 uiStride = pBLPic->getPicYuvRec()->getCStride(); 566 for( Int i = 0; i < uiHeight/2; i++ ) 567 { 568 for( Int j = 0; j < uiWidth/2; j++ ) 614 615 pPel = pBLPic->getPicYuvRec()->getCbAddr(); 616 uiStride = pBLPic->getPicYuvRec()->getCStride(); 617 for( Int i = 0; i < uiHeight/2; i++ ) 569 618 { 570 pPel[j] = pFile->get(); 619 for( Int j = 0; j < uiWidth/2; j++ ) 620 { 621 pPel[j] = pFile->get(); 622 } 623 pPel += uiStride; 571 624 } 572 pPel += uiStride; 573 } 574 575 pPel = pBLPic->getPicYuvRec()->getCrAddr(); 576 uiStride = pBLPic->getPicYuvRec()->getCStride(); 577 for( Int i = 0; i < uiHeight/2; i++ ) 578 { 579 for( Int j = 0; j < uiWidth/2; j++ ) 625 626 pPel = pBLPic->getPicYuvRec()->getCrAddr(); 627 uiStride = pBLPic->getPicYuvRec()->getCStride(); 628 for( Int i = 0; i < uiHeight/2; i++ ) 580 629 { 581 pPel[j] = pFile->get(); 630 for( Int j = 0; j < uiWidth/2; j++ ) 631 { 632 pPel[j] = pFile->get(); 633 } 634 pPel += uiStride; 582 635 } 583 pPel += uiStride; 584 } 585 } 586 } 636 } 637 } 587 638 #endif 588 639 … … 732 783 if (bNextSlice) 733 784 { 734 pcSlice->checkCRA(pcSlice->getRPS(), m_pocCRA, m_prevRAPisBLA );785 pcSlice->checkCRA(pcSlice->getRPS(), m_pocCRA, m_prevRAPisBLA, m_cListPic ); 735 786 // Set reference list 736 #if REF_ LIST_BUGFIX787 #if REF_IDX_FRAMEWORK 737 788 if (m_layerId == 0) 738 { 739 pcSlice->setRefPicList( m_cListPic ); 740 }789 #endif 790 #if FIX1071 791 pcSlice->setRefPicList( m_cListPic, true ); 741 792 #else 742 793 pcSlice->setRefPicList( m_cListPic ); … … 747 798 { 748 799 #if AVC_BASE 749 pcSlice->setBaseColPic ( *m_ppcTDecTop[0]->getListPic()->begin() ); 800 if( m_parameterSetManagerDecoder[0].getActiveVPS()->getAvcBaseLayerFlag() ) 801 { 802 pcSlice->setBaseColPic ( *m_ppcTDecTop[0]->getListPic()->begin() ); 750 803 #if AVC_SYNTAX 751 TComPic* pBLPic = pcSlice->getBaseColPic(); 752 if( pcSlice->getPOC() == 0 ) 753 { 754 // initialize partition order. 755 UInt* piTmp = &g_auiZscanToRaster[0]; 756 initZscanToRaster( pBLPic->getPicSym()->getMaxDepth() + 1, 1, 0, piTmp ); 757 initRasterToZscan( pBLPic->getPicSym()->getMaxCUWidth(), pBLPic->getPicSym()->getMaxCUHeight(), pBLPic->getPicSym()->getMaxDepth() + 1 ); 758 } 759 pBLPic->getSlice( 0 )->initBaseLayerRPL( pcSlice ); 760 pBLPic->readBLSyntax( m_ppcTDecTop[0]->getBLSyntaxFile(), SYNTAX_BYTES ); 761 #endif 762 804 TComPic* pBLPic = pcSlice->getBaseColPic(); 805 if( pcSlice->getPOC() == 0 ) 806 { 807 // initialize partition order. 808 UInt* piTmp = &g_auiZscanToRaster[0]; 809 initZscanToRaster( pBLPic->getPicSym()->getMaxDepth() + 1, 1, 0, piTmp ); 810 initRasterToZscan( pBLPic->getPicSym()->getMaxCUWidth(), pBLPic->getPicSym()->getMaxCUHeight(), pBLPic->getPicSym()->getMaxDepth() + 1 ); 811 } 812 pBLPic->getSlice( 0 )->initBaseLayerRPL( pcSlice ); 813 pBLPic->readBLSyntax( m_ppcTDecTop[0]->getBLSyntaxFile(), SYNTAX_BYTES ); 814 #endif 815 } 816 else 817 { 818 #if VPS_EXTN_DIRECT_REF_LAYERS_CONTINUE 819 TDecTop *pcTDecTop = (TDecTop *)getRefLayerDec( m_layerId ); 820 #else 821 TDecTop *pcTDecTop = (TDecTop *)getLayerDec( m_layerId-1 ); 822 #endif 823 TComList<TComPic*> *cListPic = pcTDecTop->getListPic(); 824 pcSlice->setBaseColPic ( *cListPic, m_layerId ); 825 } 826 #else 827 #if VPS_EXTN_DIRECT_REF_LAYERS_CONTINUE 828 TDecTop *pcTDecTop = (TDecTop *)getRefLayerDec( m_layerId ); 763 829 #else 764 830 TDecTop *pcTDecTop = (TDecTop *)getLayerDec( m_layerId-1 ); 831 #endif 765 832 TComList<TComPic*> *cListPic = pcTDecTop->getListPic(); 766 833 pcSlice->setBaseColPic ( *cListPic, m_layerId ); … … 769 836 if ( pcPic->isSpatialEnhLayer()) 770 837 { 838 #if SCALED_REF_LAYER_OFFSETS 839 m_cPrediction.upsampleBasePic( pcPic->getFullPelBaseRec(), pcSlice->getBaseColPic()->getPicYuvRec(), pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow() ); 840 #else 771 841 m_cPrediction.upsampleBasePic( pcPic->getFullPelBaseRec(), pcSlice->getBaseColPic()->getPicYuvRec(), pcPic->getPicYuvRec() ); 842 #endif 772 843 } 773 844 else … … 778 849 #endif 779 850 } 780 #endif781 851 782 852 #if REF_IDX_FRAMEWORK … … 785 855 setILRPic(pcPic); 786 856 #if REF_IDX_MFM 787 pcSlice->setRefPOCListILP(m_ppcTDecTop[m_layerId]->m_cIlpPic, pcSlice->getBaseColPic()); 788 #endif 789 #if REF_LIST_BUGFIX 790 pcSlice->setRefPicListSvc( m_cListPic, m_cIlpPic); 791 #else 792 pcSlice->addRefPicList ( m_cIlpPic, 793 1, 794 ((pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA) && 795 (pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA)) ? 0: -1); 796 #endif 797 } 798 #endif 857 if( pcSlice->getSPS()->getMFMEnabledFlag() ) 858 { 859 pcSlice->setRefPOCListILP(m_ppcTDecTop[m_layerId]->m_cIlpPic, pcSlice->getBaseColPic()); 860 } 861 #endif 862 pcSlice->setRefPicList( m_cListPic, false, m_cIlpPic); 863 } 864 #endif 865 866 #endif //SVC_EXTENSION 799 867 800 868 // For generalized B … … 839 907 //--------------- 840 908 pcSlice->setRefPOCList(); 909 #if !L0034_COMBINED_LIST_CLEANUP 841 910 pcSlice->setNoBackPredFlag( false ); 842 911 if ( pcSlice->getSliceType() == B_SLICE ) … … 855 924 } 856 925 } 926 #endif 857 927 } 858 928 … … 878 948 m_cTrQuant.setUseScalingList(false); 879 949 } 950 951 #if SIMPLIFIED_MV_POS_SCALING 952 if (m_layerId > 0) 953 { 954 #if SCALED_REF_LAYER_OFFSETS 955 const Window &scalEL = pcSlice->getSPS()->getScaledRefLayerWindow(); 956 957 Int widthBL = pcSlice->getBaseColPic()->getPicYuvRec()->getWidth(); 958 Int heightBL = pcSlice->getBaseColPic()->getPicYuvRec()->getHeight(); 959 960 Int widthEL = pcPic->getPicYuvRec()->getWidth() - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset(); 961 Int heightEL = pcPic->getPicYuvRec()->getHeight() - scalEL.getWindowTopOffset() - scalEL.getWindowBottomOffset(); 962 #else 963 const Window &confBL = pcSlice->getBaseColPic()->getPicYuvRec()->getConformanceWindow(); 964 const Window &confEL = pcPic->getPicYuvRec()->getConformanceWindow(); 965 966 Int widthBL = pcSlice->getBaseColPic()->getPicYuvRec()->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset(); 967 Int heightBL = pcSlice->getBaseColPic()->getPicYuvRec()->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset(); 968 969 Int widthEL = pcPic->getPicYuvRec()->getWidth() - confEL.getWindowLeftOffset() - confEL.getWindowRightOffset(); 970 Int heightEL = pcPic->getPicYuvRec()->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset(); 971 #endif 972 g_mvScalingFactor[m_layerId][0] = Clip3(-4096, 4095, ((widthEL << 8) + (widthBL >> 1)) / widthBL); 973 g_mvScalingFactor[m_layerId][1] = Clip3(-4096, 4095, ((heightEL << 8) + (heightBL >> 1)) / heightBL); 974 975 g_posScalingFactor[m_layerId][0] = ((widthBL << 16) + (widthEL >> 1)) / widthEL; 976 g_posScalingFactor[m_layerId][1] = ((heightBL << 16) + (heightEL >> 1)) / heightEL; 977 } 978 #endif 880 979 881 980 // Decode a picture … … 947 1046 { 948 1047 #if SVC_EXTENSION 949 if(nalUnitType == NAL_UNIT_S EI_SUFFIX)1048 if(nalUnitType == NAL_UNIT_SUFFIX_SEI) 950 1049 { 951 1050 m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder[m_layerId].getActiveSPS() ); … … 967 1066 } 968 1067 #else 969 if(nalUnitType == NAL_UNIT_S EI_SUFFIX)1068 if(nalUnitType == NAL_UNIT_SUFFIX_SEI) 970 1069 { 971 1070 m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveSPS() ); … … 1003 1102 case NAL_UNIT_VPS: 1004 1103 xDecodeVPS(); 1104 #if AVC_BASE 1105 if( m_parameterSetManagerDecoder[0].getPrefetchedVPS(0)->getAvcBaseLayerFlag() ) 1106 { 1107 if( !m_ppcTDecTop[0]->getBLReconFile()->good() ) 1108 { 1109 printf( "Base layer YUV input reading error\n" ); 1110 exit(EXIT_FAILURE); 1111 } 1112 #if AVC_SYNTAX 1113 if( !m_ppcTDecTop[0]->getBLSyntaxFile()->good() ) 1114 { 1115 printf( "Base layer syntax input reading error\n" ); 1116 exit(EXIT_FAILURE); 1117 } 1118 #endif 1119 } 1120 else 1121 { 1122 TComList<TComPic*> *cListPic = m_ppcTDecTop[0]->getListPic(); 1123 cListPic->clear(); 1124 } 1125 #endif 1005 1126 return false; 1006 1127 … … 1008 1129 xDecodeSPS(); 1009 1130 #if AVC_BASE 1131 if( m_parameterSetManagerDecoder[0].getPrefetchedVPS(0)->getAvcBaseLayerFlag() ) 1010 1132 { 1011 1133 TComPic* pBLPic = (*m_ppcTDecTop[0]->getListPic()->begin()); … … 1019 1141 #if AVC_SYNTAX 1020 1142 1021 pBLPic->create( m_ppcTDecTop[0]->getBLWidth(), m_ppcTDecTop[0]->getBLHeight(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, sps, true);1022 #else 1023 pBLPic->create( m_ppcTDecTop[0]->getBLWidth(), m_ppcTDecTop[0]->getBLHeight(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, NULL, true);1024 #endif 1025 #else 1026 pBLPic->create( m_ppcTDecTop[0]->getBLWidth(), m_ppcTDecTop[0]->getBLHeight(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, onformanceWindow, defaultDisplayWindow, numReorderPics, true);1143 pBLPic->create( m_ppcTDecTop[0]->getBLWidth(), m_ppcTDecTop[0]->getBLHeight(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCUDepth(), conformanceWindow, defaultDisplayWindow, numReorderPics, sps, true); 1144 #else 1145 pBLPic->create( m_ppcTDecTop[0]->getBLWidth(), m_ppcTDecTop[0]->getBLHeight(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCUDepth(), conformanceWindow, defaultDisplayWindow, numReorderPics, NULL, true); 1146 #endif 1147 #else 1148 pBLPic->create( m_ppcTDecTop[0]->getBLWidth(), m_ppcTDecTop[0]->getBLHeight(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCUDepth(), onformanceWindow, defaultDisplayWindow, numReorderPics, true); 1027 1149 #endif 1028 1150 } … … 1035 1157 return false; 1036 1158 1037 case NAL_UNIT_ SEI:1038 case NAL_UNIT_S EI_SUFFIX:1159 case NAL_UNIT_PREFIX_SEI: 1160 case NAL_UNIT_SUFFIX_SEI: 1039 1161 xDecodeSEI( nalu.m_Bitstream, nalu.m_nalUnitType ); 1040 1162 return false; … … 1042 1164 case NAL_UNIT_CODED_SLICE_TRAIL_R: 1043 1165 case NAL_UNIT_CODED_SLICE_TRAIL_N: 1044 case NAL_UNIT_CODED_SLICE_TLA :1166 case NAL_UNIT_CODED_SLICE_TLA_R: 1045 1167 case NAL_UNIT_CODED_SLICE_TSA_N: 1046 1168 case NAL_UNIT_CODED_SLICE_STSA_R: 1047 1169 case NAL_UNIT_CODED_SLICE_STSA_N: 1048 case NAL_UNIT_CODED_SLICE_BLA :1049 case NAL_UNIT_CODED_SLICE_BLA NT:1170 case NAL_UNIT_CODED_SLICE_BLA_W_LP: 1171 case NAL_UNIT_CODED_SLICE_BLA_W_RADL: 1050 1172 case NAL_UNIT_CODED_SLICE_BLA_N_LP: 1051 case NAL_UNIT_CODED_SLICE_IDR :1173 case NAL_UNIT_CODED_SLICE_IDR_W_RADL: 1052 1174 case NAL_UNIT_CODED_SLICE_IDR_N_LP: 1053 1175 case NAL_UNIT_CODED_SLICE_CRA: 1054 1176 case NAL_UNIT_CODED_SLICE_RADL_N: 1055 case NAL_UNIT_CODED_SLICE_ DLP:1177 case NAL_UNIT_CODED_SLICE_RADL_R: 1056 1178 case NAL_UNIT_CODED_SLICE_RASL_N: 1057 case NAL_UNIT_CODED_SLICE_ TFD:1179 case NAL_UNIT_CODED_SLICE_RASL_R: 1058 1180 #if SVC_EXTENSION 1059 1181 return xDecodeSlice(nalu, iSkipFrame, iPOCLastDisplay, curLayerId, bNewPOC); … … 1077 1199 Bool TDecTop::isSkipPictureForBLA(Int& iPOCLastDisplay) 1078 1200 { 1079 if (m_prevRAPisBLA && m_apcSlicePilot->getPOC() < m_pocCRA && (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_ TFD|| m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N))1201 if (m_prevRAPisBLA && m_apcSlicePilot->getPOC() < m_pocCRA && (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_R || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N)) 1080 1202 { 1081 1203 iPOCLastDisplay++; … … 1108 1230 { 1109 1231 if ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA 1110 || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA 1232 || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 1111 1233 || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP 1112 || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA NT)1234 || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL ) 1113 1235 { 1114 1236 // set the POC random access since we need to skip the reordered pictures in the case of CRA/CRANT/BLA/BLANT. 1115 1237 m_pocRandomAccess = m_apcSlicePilot->getPOC(); 1116 1238 } 1117 else if ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP )1239 else if ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP ) 1118 1240 { 1119 1241 m_pocRandomAccess = -MAX_INT; // no need to skip the reordered pictures in IDR, they are decodable. … … 1131 1253 } 1132 1254 // skip the reordered pictures, if necessary 1133 else if (m_apcSlicePilot->getPOC() < m_pocRandomAccess && (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_ TFD|| m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N))1255 else if (m_apcSlicePilot->getPOC() < m_pocRandomAccess && (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_R || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N)) 1134 1256 { 1135 1257 iPOCLastDisplay++; … … 1140 1262 } 1141 1263 1264 #if VPS_EXTN_DIRECT_REF_LAYERS_CONTINUE 1265 TDecTop* TDecTop::getRefLayerDec( UInt layerId ) 1266 { 1267 TComVPS* vps = m_parameterSetManagerDecoder[0].getActiveVPS(); 1268 if( vps->getNumDirectRefLayers( m_layerId ) <= 0 ) 1269 { 1270 #if ZERO_NUM_DIRECT_LAYERS 1271 return (TDecTop *)getLayerDec( 0 ); 1272 #else 1273 return NULL; 1274 #endif 1275 } 1276 1277 // currently only one reference layer is supported 1278 assert( vps->getNumDirectRefLayers( m_layerId ) == 1 ); 1279 #if JCTVC_M0458_INTERLAYER_RPS_SIG 1280 assert( vps->getMaxOneActiveRefLayerFlag() == 1 ); 1281 #endif 1282 1283 return (TDecTop *)getLayerDec( vps->getRefLayerId( m_layerId, 0 ) ); 1284 } 1285 #endif 1286 1142 1287 //! \} -
trunk/source/Lib/TLibDecoder/TDecTop.h
r125 r189 154 154 Void setNumLayer (UInt uiNum) { m_numLayer = uiNum; } 155 155 TComList<TComPic*>* getListPic() { return &m_cListPic; } 156 Void setLayerDec(TDecTop **p) { m_ppcTDecTop = p; } 157 TDecTop* getLayerDec(UInt layer) { return m_ppcTDecTop[layer]; } 156 Void setLayerDec(TDecTop **p) { m_ppcTDecTop = p; } 157 TDecTop* getLayerDec(UInt layer) { return m_ppcTDecTop[layer]; } 158 #if VPS_EXTN_DIRECT_REF_LAYERS_CONTINUE 159 TDecTop* getRefLayerDec(UInt layerId); 160 #endif 158 161 #if AVC_BASE 159 162 Void setBLReconFile( fstream* pFile ) { m_pBLReconFile = pFile; } -
trunk/source/Lib/TLibEncoder/SEIwrite.cpp
r125 r189 84 84 fprintf( g_hTrace, "=========== Decoding Unit Information SEI message ===========\n"); 85 85 break; 86 #if J0149_TONE_MAPPING_SEI 87 case SEI::TONE_MAPPING_INFO: 88 fprintf( g_hTrace, "=========== Tone Mapping Info SEI message ===========\n"); 89 break; 90 #endif 91 #if L0208_SOP_DESCRIPTION_SEI 92 case SEI::SOP_DESCRIPTION: 93 fprintf( g_hTrace, "=========== SOP Description SEI message ===========\n"); 94 break; 95 #endif 96 #if K0180_SCALABLE_NESTING_SEI 97 case SEI::SCALABLE_NESTING: 98 fprintf( g_hTrace, "=========== Scalable Nesting SEI message ===========\n"); 99 break; 100 #endif 86 101 default: 87 102 fprintf( g_hTrace, "=========== Unknown SEI message ===========\n"); … … 91 106 #endif 92 107 108 #if K0180_SCALABLE_NESTING_SEI 109 void SEIWriter::xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComSPS *sps) 110 #else 93 111 void SEIWriter::xWriteSEIpayloadData(const SEI& sei, TComSPS *sps) 112 #endif 94 113 { 95 114 switch (sei.payloadType()) … … 128 147 xWriteSEIGradualDecodingRefreshInfo(*static_cast<const SEIGradualDecodingRefreshInfo*>(&sei)); 129 148 break; 149 #if J0149_TONE_MAPPING_SEI 150 case SEI::TONE_MAPPING_INFO: 151 xWriteSEIToneMappingInfo(*static_cast<const SEIToneMappingInfo*>(&sei)); 152 break; 153 #endif 154 #if L0208_SOP_DESCRIPTION_SEI 155 case SEI::SOP_DESCRIPTION: 156 xWriteSEISOPDescription(*static_cast<const SEISOPDescription*>(&sei)); 157 break; 158 #endif 159 #if K0180_SCALABLE_NESTING_SEI 160 case SEI::SCALABLE_NESTING: 161 xWriteSEIScalableNesting(bs, *static_cast<const SEIScalableNesting*>(&sei), sps); 162 break; 163 #endif 130 164 default: 131 165 assert(!"Unhandled SEI message"); … … 145 179 setBitstream(&bs_count); 146 180 181 182 #if K0180_SCALABLE_NESTING_SEI 183 184 #if ENC_DEC_TRACE 185 Bool traceEnable = g_HLSTraceEnable; 186 g_HLSTraceEnable = false; 187 #endif 188 xWriteSEIpayloadData(bs_count, sei, sps); 189 #if ENC_DEC_TRACE 190 g_HLSTraceEnable = traceEnable; 191 #endif 192 193 #else 194 147 195 #if ENC_DEC_TRACE 148 196 g_HLSTraceEnable = false; … … 152 200 g_HLSTraceEnable = true; 153 201 #endif 202 203 #endif 204 154 205 UInt payload_data_num_bits = bs_count.getNumberOfWrittenBits(); 155 206 assert(0 == payload_data_num_bits % 8); … … 158 209 159 210 #if ENC_DEC_TRACE 211 #if K0180_SCALABLE_NESTING_SEI 212 if (g_HLSTraceEnable) 213 #endif 160 214 xTraceSEIHeader(); 161 215 #endif … … 177 231 /* payloadData */ 178 232 #if ENC_DEC_TRACE 233 #if K0180_SCALABLE_NESTING_SEI 234 if (g_HLSTraceEnable) 235 #endif 179 236 xTraceSEIMessageType(sei.payloadType()); 180 237 #endif 181 238 239 #if K0180_SCALABLE_NESTING_SEI 240 xWriteSEIpayloadData(bs, sei, sps); 241 #else 182 242 xWriteSEIpayloadData(sei, sps); 243 #endif 183 244 } 184 245 … … 421 482 xWriteByteAlign(); 422 483 } 484 485 #if J0149_TONE_MAPPING_SEI 486 Void SEIWriter::xWriteSEIToneMappingInfo(const SEIToneMappingInfo& sei) 487 { 488 Int i; 489 WRITE_UVLC( sei.m_toneMapId, "tone_map_id" ); 490 WRITE_FLAG( sei.m_toneMapCancelFlag, "tone_map_cancel_flag" ); 491 if( !sei.m_toneMapCancelFlag ) 492 { 493 WRITE_FLAG( sei.m_toneMapPersistenceFlag, "tone_map_persistence_flag" ); 494 WRITE_CODE( sei.m_codedDataBitDepth, 8, "coded_data_bit_depth" ); 495 WRITE_CODE( sei.m_targetBitDepth, 8, "target_bit_depth" ); 496 WRITE_UVLC( sei.m_modelId, "model_id" ); 497 switch(sei.m_modelId) 498 { 499 case 0: 500 { 501 WRITE_CODE( sei.m_minValue, 32, "min_value" ); 502 WRITE_CODE( sei.m_maxValue, 32, "max_value" ); 503 break; 504 } 505 case 1: 506 { 507 WRITE_CODE( sei.m_sigmoidMidpoint, 32, "sigmoid_midpoint" ); 508 WRITE_CODE( sei.m_sigmoidWidth, 32, "sigmoid_width" ); 509 break; 510 } 511 case 2: 512 { 513 UInt num = 1u << sei.m_targetBitDepth; 514 for(i = 0; i < num; i++) 515 { 516 WRITE_CODE( sei.m_startOfCodedInterval[i], (( sei.m_codedDataBitDepth + 7 ) >> 3 ) << 3, "start_of_coded_interval" ); 517 } 518 break; 519 } 520 case 3: 521 { 522 WRITE_CODE( sei.m_numPivots, 16, "num_pivots" ); 523 for(i = 0; i < sei.m_numPivots; i++ ) 524 { 525 WRITE_CODE( sei.m_codedPivotValue[i], (( sei.m_codedDataBitDepth + 7 ) >> 3 ) << 3, "coded_pivot_value" ); 526 WRITE_CODE( sei.m_targetPivotValue[i], (( sei.m_targetBitDepth + 7 ) >> 3 ) << 3, "target_pivot_value"); 527 } 528 break; 529 } 530 case 4: 531 { 532 WRITE_CODE( sei.m_cameraIsoSpeedIdc, 8, "camera_iso_speed_idc" ); 533 if( sei.m_cameraIsoSpeedIdc == 255) //Extended_ISO 534 { 535 WRITE_CODE( sei.m_cameraIsoSpeedValue, 32, "camera_iso_speed_value" ); 536 } 537 WRITE_FLAG( sei.m_exposureCompensationValueSignFlag, "exposure_compensation_value_sign_flag" ); 538 WRITE_CODE( sei.m_exposureCompensationValueNumerator, 16, "exposure_compensation_value_numerator" ); 539 WRITE_CODE( sei.m_exposureCompensationValueDenomIdc, 16, "exposure_compensation_value_denom_idc" ); 540 WRITE_CODE( sei.m_refScreenLuminanceWhite, 32, "ref_screen_luminance_white" ); 541 WRITE_CODE( sei.m_extendedRangeWhiteLevel, 32, "extended_range_white_level" ); 542 WRITE_CODE( sei.m_nominalBlackLevelLumaCodeValue, 16, "nominal_black_level_luma_code_value" ); 543 WRITE_CODE( sei.m_nominalWhiteLevelLumaCodeValue, 16, "nominal_white_level_luma_code_value" ); 544 WRITE_CODE( sei.m_extendedWhiteLevelLumaCodeValue, 16, "extended_white_level_luma_code_value" ); 545 break; 546 } 547 default: 548 { 549 assert(!"Undefined SEIToneMapModelId"); 550 break; 551 } 552 }//switch m_modelId 553 }//if(!sei.m_toneMapCancelFlag) 554 555 xWriteByteAlign(); 556 } 557 #endif 558 423 559 Void SEIWriter::xWriteSEIDisplayOrientation(const SEIDisplayOrientation &sei) 424 560 { … … 455 591 } 456 592 593 #if L0208_SOP_DESCRIPTION_SEI 594 Void SEIWriter::xWriteSEISOPDescription(const SEISOPDescription& sei) 595 { 596 WRITE_UVLC( sei.m_sopSeqParameterSetId, "sop_seq_parameter_set_id" ); 597 WRITE_UVLC( sei.m_numPicsInSopMinus1, "num_pics_in_sop_minus1" ); 598 for (UInt i = 0; i <= sei.m_numPicsInSopMinus1; i++) 599 { 600 WRITE_CODE( sei.m_sopDescVclNaluType[i], 6, "sop_desc_vcl_nalu_type" ); 601 WRITE_CODE( sei.m_sopDescTemporalId[i], 3, "sop_desc_temporal_id" ); 602 if (sei.m_sopDescVclNaluType[i] != NAL_UNIT_CODED_SLICE_IDR_W_RADL && sei.m_sopDescVclNaluType[i] != NAL_UNIT_CODED_SLICE_IDR_N_LP) 603 { 604 WRITE_UVLC( sei.m_sopDescStRpsIdx[i], "sop_desc_st_rps_idx" ); 605 } 606 if (i > 0) 607 { 608 WRITE_SVLC( sei.m_sopDescPocDelta[i], "sop_desc_poc_delta" ); 609 } 610 } 611 612 xWriteByteAlign(); 613 } 614 #endif 615 616 #if K0180_SCALABLE_NESTING_SEI 617 Void SEIWriter::xWriteSEIScalableNesting(TComBitIf& bs, const SEIScalableNesting& sei, TComSPS *sps) 618 { 619 WRITE_FLAG( sei.m_bitStreamSubsetFlag, "bitstream_subset_flag" ); 620 WRITE_FLAG( sei.m_nestingOpFlag, "nesting_op_flag " ); 621 if (sei.m_nestingOpFlag) 622 { 623 WRITE_FLAG( sei.m_defaultOpFlag, "default_op_flag" ); 624 WRITE_UVLC( sei.m_nestingNumOpsMinus1, "nesting_num_ops" ); 625 for (UInt i = (sei.m_defaultOpFlag ? 1 : 0); i <= sei.m_nestingNumOpsMinus1; i++) 626 { 627 WRITE_CODE( sei.m_nestingNoOpMaxTemporalIdPlus1, 3, "nesting_no_op_max_temporal_id" ); 628 WRITE_CODE( sei.m_nestingMaxTemporalIdPlus1[i], 3, "nesting_max_temporal_id" ); 629 WRITE_UVLC( sei.m_nestingOpIdx[i], "nesting_op_idx" ); 630 } 631 } 632 else 633 { 634 WRITE_FLAG( sei.m_allLayersFlag, "all_layers_flag" ); 635 if (!sei.m_allLayersFlag) 636 { 637 WRITE_CODE( sei.m_nestingNoOpMaxTemporalIdPlus1, 3, "nesting_no_op_max_temporal_id" ); 638 WRITE_UVLC( sei.m_nestingNumLayersMinus1, "nesting_num_layers" ); 639 for (UInt i = 0; i <= sei.m_nestingNumLayersMinus1; i++) 640 { 641 WRITE_CODE( sei.m_nestingLayerId[i], 6, "nesting_layer_id" ); 642 } 643 } 644 } 645 646 // byte alignment 647 while ( m_pcBitIf->getNumberOfWrittenBits() % 8 != 0 ) 648 { 649 WRITE_FLAG( 0, "nesting_zero_bit" ); 650 } 651 652 // write nested SEI messages 653 for (SEIMessages::const_iterator it = sei.m_nestedSEIs.begin(); it != sei.m_nestedSEIs.end(); it++) 654 { 655 writeSEImessage(bs, *(*it), sps); 656 } 657 } 658 #endif 659 457 660 Void SEIWriter::xWriteByteAlign() 458 661 { -
trunk/source/Lib/TLibEncoder/SEIwrite.h
r125 r189 50 50 51 51 protected: 52 #if K0180_SCALABLE_NESTING_SEI 53 Void xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComSPS *sps); 54 #else 52 55 Void xWriteSEIpayloadData(const SEI& sei, TComSPS *sps); 56 #endif 53 57 Void xWriteSEIuserDataUnregistered(const SEIuserDataUnregistered &sei); 54 58 Void xWriteSEIActiveParameterSets(const SEIActiveParameterSets& sei); … … 63 67 Void xWriteSEITemporalLevel0Index(const SEITemporalLevel0Index &sei); 64 68 Void xWriteSEIGradualDecodingRefreshInfo(const SEIGradualDecodingRefreshInfo &sei); 69 #if J0149_TONE_MAPPING_SEI 70 Void xWriteSEIToneMappingInfo(const SEIToneMappingInfo& sei); 71 #endif 72 #if L0208_SOP_DESCRIPTION_SEI 73 Void xWriteSEISOPDescription(const SEISOPDescription& sei); 74 #endif 75 #if K0180_SCALABLE_NESTING_SEI 76 Void xWriteSEIScalableNesting(TComBitIf& bs, const SEIScalableNesting& sei, TComSPS *sps); 77 #endif 65 78 Void xWriteByteAlign(); 66 79 }; -
trunk/source/Lib/TLibEncoder/TEncCavlc.cpp
r125 r189 39 39 #include "TEncCavlc.h" 40 40 #include "SEIwrite.h" 41 41 #include <iostream> 42 42 //! \ingroup TLibEncoder 43 43 //! \{ … … 285 285 WRITE_FLAG(pcVUI->getNeutralChromaIndicationFlag(), "neutral_chroma_indication_flag"); 286 286 WRITE_FLAG(pcVUI->getFieldSeqFlag(), "field_seq_flag"); 287 assert(pcVUI->getFieldSeqFlag() == 0); // not currently supported288 287 WRITE_FLAG(pcVUI->getFrameFieldInfoPresentFlag(), "frame_field_info_present_flag"); 289 288 … … 474 473 for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++) 475 474 { 475 #if L0323_DPB 476 WRITE_UVLC( pcSPS->getMaxDecPicBuffering(i) - 1, "sps_max_dec_pic_buffering_minus1[i]" ); 477 #else 476 478 WRITE_UVLC( pcSPS->getMaxDecPicBuffering(i), "sps_max_dec_pic_buffering[i]" ); 479 #endif 477 480 WRITE_UVLC( pcSPS->getNumReorderPics(i), "sps_num_reorder_pics[i]" ); 478 481 WRITE_UVLC( pcSPS->getMaxLatencyIncrease(i), "sps_max_latency_increase[i]" ); … … 484 487 assert( pcSPS->getMaxCUWidth() == pcSPS->getMaxCUHeight() ); 485 488 486 UInt MinCUSize = pcSPS->getMaxCUWidth() >> ( pcSPS->getMaxCUDepth()-g_uiAddCUDepth ); 487 UInt log2MinCUSize = 0; 488 while(MinCUSize > 1) 489 { 490 MinCUSize >>= 1; 491 log2MinCUSize++; 492 } 493 494 WRITE_UVLC( log2MinCUSize - 3, "log2_min_coding_block_size_minus3" ); 495 WRITE_UVLC( pcSPS->getMaxCUDepth()-g_uiAddCUDepth, "log2_diff_max_min_coding_block_size" ); 489 WRITE_UVLC( pcSPS->getLog2MinCodingBlockSize() - 3, "log2_min_coding_block_size_minus3" ); 490 WRITE_UVLC( pcSPS->getLog2DiffMaxMinCodingBlockSize(), "log2_diff_max_min_coding_block_size" ); 496 491 WRITE_UVLC( pcSPS->getQuadtreeTULog2MinSize() - 2, "log2_min_transform_block_size_minus2" ); 497 492 WRITE_UVLC( pcSPS->getQuadtreeTULog2MaxSize() - pcSPS->getQuadtreeTULog2MinSize(), "log2_diff_max_min_transform_block_size" ); … … 558 553 codeVUI(pcSPS->getVuiParameters(), pcSPS); 559 554 } 555 #if SCALED_REF_LAYER_OFFSETS 556 if( pcSPS->getLayerId() > 0 ) 557 { 558 Window scaledWindow = pcSPS->getScaledRefLayerWindow(); 559 WRITE_SVLC( scaledWindow.getWindowLeftOffset() >> 1, "scaled_ref_layer_left_offset" ); 560 WRITE_SVLC( scaledWindow.getWindowTopOffset() >> 1, "scaled_ref_layer_top_offset" ); 561 WRITE_SVLC( scaledWindow.getWindowRightOffset() >> 1, "scaled_ref_layer_right_offset" ); 562 WRITE_SVLC( scaledWindow.getWindowBottomOffset() >> 1, "scaled_ref_layer_bottom_offset" ); 563 } 564 #endif 560 565 561 566 WRITE_FLAG( 0, "sps_extension_flag" ); … … 583 588 for(UInt i=0; i <= pcVPS->getMaxTLayers()-1; i++) 584 589 { 590 #if L0323_DPB 591 WRITE_UVLC( pcVPS->getMaxDecPicBuffering(i) - 1, "vps_max_dec_pic_buffering_minus1[i]" ); 592 #else 585 593 WRITE_UVLC( pcVPS->getMaxDecPicBuffering(i), "vps_max_dec_pic_buffering[i]" ); 594 #endif 586 595 WRITE_UVLC( pcVPS->getNumReorderPics(i), "vps_num_reorder_pics[i]" ); 587 596 WRITE_UVLC( pcVPS->getMaxLatencyIncrease(i), "vps_max_latency_increase[i]" ); … … 623 632 } 624 633 } 634 #if DERIVE_LAYER_ID_LIST_VARIABLES 635 pcVPS->deriveLayerIdListVariables(); 636 #endif 625 637 #if L0043_TIMING_INFO 626 638 TimingInfo *timingInfo = pcVPS->getTimingInfo(); … … 703 715 } 704 716 #endif 717 #if VPS_MOVE_DIR_DEPENDENCY_FLAG 718 #if VPS_EXTN_DIRECT_REF_LAYERS 719 for( Int layerCtr = 1; layerCtr <= vps->getMaxLayers() - 1; layerCtr++) 720 { 721 for( Int refLayerCtr = 0; refLayerCtr < layerCtr; refLayerCtr++) 722 { 723 WRITE_FLAG(vps->getDirectDependencyFlag(layerCtr, refLayerCtr), "direct_dependency_flag[i][j]" ); 724 } 725 } 726 #endif 727 #endif 705 728 #if VPS_EXTN_PROFILE_INFO 706 729 // Profile-tier-level signalling 730 #if VPS_PROFILE_OUTPUT_LAYERS 731 WRITE_CODE( vps->getNumLayerSets() - 1 , 10, "vps_number_layer_sets_minus1" ); 732 WRITE_CODE( vps->getNumProfileTierLevel() - 1, 6, "vps_num_profile_tier_level_minus1"); 733 for(Int idx = 1; idx <= vps->getNumProfileTierLevel() - 1; idx++) 734 #else 707 735 for(Int idx = 1; idx <= vps->getNumLayerSets() - 1; idx++) 736 #endif 708 737 { 709 738 WRITE_FLAG( vps->getProfilePresentFlag(idx), "vps_profile_present_flag[i]" ); 710 739 if( !vps->getProfilePresentFlag(idx) ) 711 740 { 741 #if VPS_PROFILE_OUTPUT_LAYERS 742 WRITE_CODE( vps->getProfileLayerSetRef(idx) - 1, 6, "profile_ref_minus1[i]" ); 743 #else 712 744 WRITE_UVLC( vps->getProfileLayerSetRef(idx) - 1, "vps_profile_layer_set_ref_minus1[i]" ); 745 #endif 713 746 } 714 747 codePTL( vps->getPTLForExtn(idx), vps->getProfilePresentFlag(idx), vps->getMaxTLayers() - 1 ); 715 748 } 716 749 #endif 750 751 #if VPS_PROFILE_OUTPUT_LAYERS 752 Int numOutputLayerSets = vps->getNumOutputLayerSets() ; 753 WRITE_FLAG( (numOutputLayerSets > vps->getNumLayerSets()), "more_output_layer_sets_than_default_flag" ); 754 if(numOutputLayerSets > vps->getNumLayerSets()) 755 { 756 WRITE_CODE( numOutputLayerSets - vps->getNumLayerSets(), 10, "num_add_output_layer_sets" ); 757 } 758 if( numOutputLayerSets > 1 ) 759 { 760 WRITE_FLAG( vps->getDefaultOneTargetOutputLayerFlag(), "default_one_target_output_layer_flag" ); 761 } 762 763 for(i = 1; i < numOutputLayerSets; i++) 764 { 765 if( i > (vps->getNumLayerSets() - 1) ) 766 { 767 Int numBits = 1; 768 while ((1 << numBits) < (vps->getNumLayerSets() - 1)) 769 { 770 numBits++; 771 } 772 WRITE_CODE( vps->getOutputLayerSetIdx(i) - 1, numBits, "output_layer_set_idx_minus1"); 773 Int lsIdx = vps->getOutputLayerSetIdx(i); 774 for(j = 0; j < vps->getNumLayersInIdList(lsIdx) - 1; j++) 775 { 776 WRITE_FLAG( vps->getOutputLayerFlag(i,j), "output_layer_flag[i][j]"); 777 } 778 } 779 Int numBits = 1; 780 while ((1 << numBits) < (vps->getNumProfileTierLevel())) 781 { 782 numBits++; 783 } 784 WRITE_CODE( vps->getProfileLevelTierIdx(i), numBits, "profile_level_tier_idx[i]" ); 785 } 786 #else 717 787 #if VPS_EXTN_OP_LAYER_SETS 718 788 // Target output layer signalling … … 720 790 for(i = 0; i < vps->getNumOutputLayerSets(); i++) 721 791 { 792 #if VPS_OUTPUT_LAYER_SET_IDX 793 assert(vps->getOutputLayerSetIdx(i) > 0); 794 WRITE_UVLC( vps->getOutputLayerSetIdx(i) - 1, "vps_output_layer_set_idx_minus1[i]"); 795 #else 722 796 WRITE_UVLC( vps->getOutputLayerSetIdx(i), "vps_output_layer_set_idx[i]"); 797 #endif 723 798 Int lsIdx = vps->getOutputLayerSetIdx(i); 724 799 for(j = 0; j <= vps->getMaxLayerId(); j++) … … 731 806 } 732 807 #endif 808 #endif 809 #if JCTVC_M0458_INTERLAYER_RPS_SIG 810 WRITE_FLAG(vps->getMaxOneActiveRefLayerFlag(), "max_one_active_ref_layer_flag"); 811 #endif 812 #if !VPS_MOVE_DIR_DEPENDENCY_FLAG 733 813 #if VPS_EXTN_DIRECT_REF_LAYERS 734 814 for( Int layerCtr = 1; layerCtr <= vps->getMaxLayers() - 1; layerCtr++) … … 739 819 } 740 820 } 821 #endif 741 822 #endif 742 823 } … … 810 891 WRITE_CODE( picOrderCntLSB, pcSlice->getSPS()->getBitsForPOC(), "pic_order_cnt_lsb"); 811 892 TComReferencePictureSet* rps = pcSlice->getRPS(); 893 894 #if FIX1071 895 // Deal with bitstream restriction stating that: 896 // – If the current picture is a BLA or CRA picture, the value of NumPocTotalCurr shall be equal to 0. 897 // Ideally this process should not be repeated for each slice in a picture 898 TComReferencePictureSet altRps; 899 Bool useAltRps = false; 900 #if SVC_EXTENSION 901 if( pcSlice->getLayerId() == 0 ) 902 #endif 903 if (pcSlice->getRapPicFlag()) 904 { 905 for (Int picIdx = 0; !useAltRps && picIdx < rps->getNumberOfPictures(); picIdx++) 906 { 907 useAltRps = rps->getUsed(picIdx); 908 } 909 if (useAltRps) 910 { 911 memcpy(&altRps, rps, sizeof(TComReferencePictureSet)); 912 rps = &altRps; 913 for (Int picIdx = 0; picIdx < rps->getNumberOfPictures(); picIdx++) 914 { 915 rps->setUsed(picIdx, false); 916 } 917 } 918 } 919 920 if(pcSlice->getRPSidx() < 0 || useAltRps) 921 #else 812 922 if(pcSlice->getRPSidx() < 0) 923 #endif 813 924 { 814 925 WRITE_FLAG( 0, "short_term_ref_pic_set_sps_flag"); … … 902 1013 } 903 1014 } 1015 904 1016 if (pcSlice->getSPS()->getTMVPFlagsPresent()) 905 1017 { … … 907 1019 } 908 1020 } 1021 1022 #if JCTVC_M0458_INTERLAYER_RPS_SIG 1023 if((pcSlice->getSPS()->getLayerId() > 0) && (pcSlice->getNumILRRefIdx() > 0) ) 1024 { 1025 WRITE_FLAG(pcSlice->getInterLayerPredEnabledFlag(),"inter_layer_pred_enabled_flag"); 1026 if( pcSlice->getInterLayerPredEnabledFlag()) 1027 { 1028 if(pcSlice->getNumILRRefIdx() > 1) 1029 { 1030 Int numBits = 1; 1031 while ((1 << numBits) < pcSlice->getNumILRRefIdx()) 1032 { 1033 numBits++; 1034 } 1035 if( !pcSlice->getVPS()->getMaxOneActiveRefLayerFlag()) 1036 { 1037 WRITE_CODE(pcSlice->getNumInterLayerRefPics(), numBits,"num_inter_layer_ref_pics_minus1"); 1038 } 1039 for(Int i = 0; i < pcSlice->getActiveNumILRRefIdx(); i++ ) 1040 WRITE_CODE(pcSlice->getInterLayerPredLayerIdc(i),numBits,"inter_layer_pred_layer_idc[i]"); 1041 } 1042 } 1043 } 1044 #endif 1045 909 1046 if(pcSlice->getSPS()->getUseSAO()) 910 1047 { … … 1065 1202 } 1066 1203 } 1204 1067 1205 if(pcSlice->getPPS()->getSliceHeaderExtensionPresentFlag()) 1068 1206 { … … 1389 1527 // ==================================================================================================================== 1390 1528 1391 1392 /** Write PCM alignment bits.1393 * \returns Void1394 */1395 Void TEncCavlc::xWritePCMAlignZero ()1396 {1397 m_pcBitIf->writeAlignZero();1398 }1399 1400 Void TEncCavlc::xWriteUnaryMaxSymbol( UInt uiSymbol, UInt uiMaxSymbol )1401 {1402 if (uiMaxSymbol == 0)1403 {1404 return;1405 }1406 xWriteFlag( uiSymbol ? 1 : 0 );1407 if ( uiSymbol == 0 )1408 {1409 return;1410 }1411 1412 Bool bCodeLast = ( uiMaxSymbol > uiSymbol );1413 1414 while( --uiSymbol )1415 {1416 xWriteFlag( 1 );1417 }1418 if( bCodeLast )1419 {1420 xWriteFlag( 0 );1421 }1422 return;1423 }1424 1425 Void TEncCavlc::xWriteExGolombLevel( UInt uiSymbol )1426 {1427 if( uiSymbol )1428 {1429 xWriteFlag( 1 );1430 UInt uiCount = 0;1431 Bool bNoExGo = (uiSymbol < 13);1432 1433 while( --uiSymbol && ++uiCount < 13 )1434 {1435 xWriteFlag( 1 );1436 }1437 if( bNoExGo )1438 {1439 xWriteFlag( 0 );1440 }1441 else1442 {1443 xWriteEpExGolomb( uiSymbol, 0 );1444 }1445 }1446 else1447 {1448 xWriteFlag( 0 );1449 }1450 return;1451 }1452 1453 Void TEncCavlc::xWriteEpExGolomb( UInt uiSymbol, UInt uiCount )1454 {1455 while( uiSymbol >= (UInt)(1<<uiCount) )1456 {1457 xWriteFlag( 1 );1458 uiSymbol -= 1<<uiCount;1459 uiCount ++;1460 }1461 xWriteFlag( 0 );1462 while( uiCount-- )1463 {1464 xWriteFlag( (uiSymbol>>uiCount) & 1 );1465 }1466 return;1467 }1468 1469 1529 /** code explicit wp tables 1470 1530 * \param TComSlice* pcSlice -
trunk/source/Lib/TLibEncoder/TEncCavlc.h
r125 r189 68 68 TComSlice* m_pcSlice; 69 69 UInt m_uiCoeffCost; 70 71 Void xWritePCMAlignZero ();72 Void xWriteEpExGolomb ( UInt uiSymbol, UInt uiCount );73 Void xWriteExGolombLevel ( UInt uiSymbol );74 Void xWriteUnaryMaxSymbol ( UInt uiSymbol, UInt uiMaxSymbol );75 70 76 71 Void codeShortTermRefPicSet ( TComSPS* pcSPS, TComReferencePictureSet* pcRPS, Bool calledFromSliceHeader, Int idx ); -
trunk/source/Lib/TLibEncoder/TEncCfg.h
r125 r189 158 158 Int m_loopFilterTcOffsetDiv2; 159 159 Bool m_DeblockingFilterControlPresent; 160 #if L0386_DB_METRIC 161 Bool m_DeblockingFilterMetric; 162 #endif 160 163 Bool m_bUseSAO; 161 164 Int m_maxNumOffsetsPerPic; … … 188 191 Bool m_bUseASR; 189 192 Bool m_bUseHADME; 193 #if !L0034_COMBINED_LIST_CLEANUP 190 194 Bool m_bUseLComb; 195 #endif 191 196 Bool m_useRDOQ; 192 197 Bool m_useRDOQTS; … … 234 239 Int m_pictureTimingSEIEnabled; 235 240 Int m_recoveryPointSEIEnabled; 241 #if J0149_TONE_MAPPING_SEI 242 Bool m_toneMappingInfoSEIEnabled; 243 Int m_toneMapId; 244 Bool m_toneMapCancelFlag; 245 Bool m_toneMapPersistenceFlag; 246 Int m_codedDataBitDepth; 247 Int m_targetBitDepth; 248 Int m_modelId; 249 Int m_minValue; 250 Int m_maxValue; 251 Int m_sigmoidMidpoint; 252 Int m_sigmoidWidth; 253 Int m_numPivots; 254 Int m_cameraIsoSpeedIdc; 255 Int m_cameraIsoSpeedValue; 256 Int m_exposureCompensationValueSignFlag; 257 Int m_exposureCompensationValueNumerator; 258 Int m_exposureCompensationValueDenomIdc; 259 Int m_refScreenLuminanceWhite; 260 Int m_extendedRangeWhiteLevel; 261 Int m_nominalBlackLevelLumaCodeValue; 262 Int m_nominalWhiteLevelLumaCodeValue; 263 Int m_extendedWhiteLevelLumaCodeValue; 264 Int* m_startOfCodedInterval; 265 Int* m_codedPivotValue; 266 Int* m_targetPivotValue; 267 #endif 236 268 Int m_framePackingSEIEnabled; 237 269 Int m_framePackingSEIType; … … 243 275 Int m_gradualDecodingRefreshInfoEnabled; 244 276 Int m_decodingUnitInfoSEIEnabled; 277 #if L0208_SOP_DESCRIPTION_SEI 278 Int m_SOPDescriptionSEIEnabled; 279 #endif 280 #if K0180_SCALABLE_NESTING_SEI 281 Int m_scalableNestingSEIEnabled; 282 #endif 245 283 //====== Weighted Prediction ======== 246 284 Bool m_useWeightedPred; //< Use of Weighting Prediction (P_SLICE) … … 379 417 Void setLoopFilterTcOffset ( Int i ) { m_loopFilterTcOffsetDiv2 = i; } 380 418 Void setDeblockingFilterControlPresent ( Bool b ) { m_DeblockingFilterControlPresent = b; } 419 #if L0386_DB_METRIC 420 Void setDeblockingFilterMetric ( Bool b ) { m_DeblockingFilterMetric = b; } 421 #endif 381 422 382 423 //====== Motion search ======== … … 433 474 Int getLoopFilterTcOffset () { return m_loopFilterTcOffsetDiv2; } 434 475 Bool getDeblockingFilterControlPresent() { return m_DeblockingFilterControlPresent; } 476 #if L0386_DB_METRIC 477 Bool getDeblockingFilterMetric () { return m_DeblockingFilterMetric; } 478 #endif 435 479 436 480 //==== Motion search ======== … … 450 494 Void setUseASR ( Bool b ) { m_bUseASR = b; } 451 495 Void setUseHADME ( Bool b ) { m_bUseHADME = b; } 496 #if !L0034_COMBINED_LIST_CLEANUP 452 497 Void setUseLComb ( Bool b ) { m_bUseLComb = b; } 498 #endif 453 499 Void setUseRDOQ ( Bool b ) { m_useRDOQ = b; } 454 500 Void setUseRDOQTS ( Bool b ) { m_useRDOQTS = b; } … … 472 518 Bool getUseASR () { return m_bUseASR; } 473 519 Bool getUseHADME () { return m_bUseHADME; } 520 #if !L0034_COMBINED_LIST_CLEANUP 474 521 Bool getUseLComb () { return m_bUseLComb; } 522 #endif 475 523 Bool getUseRDOQ () { return m_useRDOQ; } 476 524 Bool getUseRDOQTS () { return m_useRDOQTS; } … … 569 617 Void setRecoveryPointSEIEnabled(Int b) { m_recoveryPointSEIEnabled = b; } 570 618 Int getRecoveryPointSEIEnabled() { return m_recoveryPointSEIEnabled; } 619 #if J0149_TONE_MAPPING_SEI 620 Void setToneMappingInfoSEIEnabled(Bool b) { m_toneMappingInfoSEIEnabled = b; } 621 Bool getToneMappingInfoSEIEnabled() { return m_toneMappingInfoSEIEnabled; } 622 Void setTMISEIToneMapId(Int b) { m_toneMapId = b; } 623 Int getTMISEIToneMapId() { return m_toneMapId; } 624 Void setTMISEIToneMapCancelFlag(Bool b) { m_toneMapCancelFlag=b; } 625 Bool getTMISEIToneMapCancelFlag() { return m_toneMapCancelFlag; } 626 Void setTMISEIToneMapPersistenceFlag(Bool b) { m_toneMapPersistenceFlag = b; } 627 Bool getTMISEIToneMapPersistenceFlag() { return m_toneMapPersistenceFlag; } 628 Void setTMISEICodedDataBitDepth(Int b) { m_codedDataBitDepth = b; } 629 Int getTMISEICodedDataBitDepth() { return m_codedDataBitDepth; } 630 Void setTMISEITargetBitDepth(Int b) { m_targetBitDepth = b; } 631 Int getTMISEITargetBitDepth() { return m_targetBitDepth; } 632 Void setTMISEIModelID(Int b) { m_modelId = b; } 633 Int getTMISEIModelID() { return m_modelId; } 634 Void setTMISEIMinValue(Int b) { m_minValue = b; } 635 Int getTMISEIMinValue() { return m_minValue; } 636 Void setTMISEIMaxValue(Int b) { m_maxValue = b; } 637 Int getTMISEIMaxValue() { return m_maxValue; } 638 Void setTMISEISigmoidMidpoint(Int b) { m_sigmoidMidpoint = b; } 639 Int getTMISEISigmoidMidpoint() { return m_sigmoidMidpoint; } 640 Void setTMISEISigmoidWidth(Int b) { m_sigmoidWidth = b; } 641 Int getTMISEISigmoidWidth() { return m_sigmoidWidth; } 642 Void setTMISEIStartOfCodedInterva( Int* p ) { m_startOfCodedInterval = p; } 643 Int* getTMISEIStartOfCodedInterva() { return m_startOfCodedInterval; } 644 Void setTMISEINumPivots(Int b) { m_numPivots = b; } 645 Int getTMISEINumPivots() { return m_numPivots; } 646 Void setTMISEICodedPivotValue( Int* p ) { m_codedPivotValue = p; } 647 Int* getTMISEICodedPivotValue() { return m_codedPivotValue; } 648 Void setTMISEITargetPivotValue( Int* p ) { m_targetPivotValue = p; } 649 Int* getTMISEITargetPivotValue() { return m_targetPivotValue; } 650 Void setTMISEICameraIsoSpeedIdc(Int b) { m_cameraIsoSpeedIdc = b; } 651 Int getTMISEICameraIsoSpeedIdc() { return m_cameraIsoSpeedIdc; } 652 Void setTMISEICameraIsoSpeedValue(Int b) { m_cameraIsoSpeedValue = b; } 653 Int getTMISEICameraIsoSpeedValue() { return m_cameraIsoSpeedValue; } 654 Void setTMISEIExposureCompensationValueSignFlag(Int b) { m_exposureCompensationValueSignFlag = b; } 655 Int getTMISEIExposureCompensationValueSignFlag() { return m_exposureCompensationValueSignFlag; } 656 Void setTMISEIExposureCompensationValueNumerator(Int b) { m_exposureCompensationValueNumerator = b; } 657 Int getTMISEIExposureCompensationValueNumerator() { return m_exposureCompensationValueNumerator; } 658 Void setTMISEIExposureCompensationValueDenomIdc(Int b) { m_exposureCompensationValueDenomIdc =b; } 659 Int getTMISEIExposureCompensationValueDenomIdc() { return m_exposureCompensationValueDenomIdc; } 660 Void setTMISEIRefScreenLuminanceWhite(Int b) { m_refScreenLuminanceWhite = b; } 661 Int getTMISEIRefScreenLuminanceWhite() { return m_refScreenLuminanceWhite; } 662 Void setTMISEIExtendedRangeWhiteLevel(Int b) { m_extendedRangeWhiteLevel = b; } 663 Int getTMISEIExtendedRangeWhiteLevel() { return m_extendedRangeWhiteLevel; } 664 Void setTMISEINominalBlackLevelLumaCodeValue(Int b) { m_nominalBlackLevelLumaCodeValue = b; } 665 Int getTMISEINominalBlackLevelLumaCodeValue() { return m_nominalBlackLevelLumaCodeValue; } 666 Void setTMISEINominalWhiteLevelLumaCodeValue(Int b) { m_nominalWhiteLevelLumaCodeValue = b; } 667 Int getTMISEINominalWhiteLevelLumaCodeValue() { return m_nominalWhiteLevelLumaCodeValue; } 668 Void setTMISEIExtendedWhiteLevelLumaCodeValue(Int b) { m_extendedWhiteLevelLumaCodeValue =b; } 669 Int getTMISEIExtendedWhiteLevelLumaCodeValue() { return m_extendedWhiteLevelLumaCodeValue; } 670 #endif 571 671 Void setFramePackingArrangementSEIEnabled(Int b) { m_framePackingSEIEnabled = b; } 572 672 Int getFramePackingArrangementSEIEnabled() { return m_framePackingSEIEnabled; } … … 587 687 Void setDecodingUnitInfoSEIEnabled(Int b) { m_decodingUnitInfoSEIEnabled = b; } 588 688 Int getDecodingUnitInfoSEIEnabled() { return m_decodingUnitInfoSEIEnabled; } 689 #if L0208_SOP_DESCRIPTION_SEI 690 Void setSOPDescriptionSEIEnabled(Int b) { m_SOPDescriptionSEIEnabled = b; } 691 Int getSOPDescriptionSEIEnabled() { return m_SOPDescriptionSEIEnabled; } 692 #endif 693 #if K0180_SCALABLE_NESTING_SEI 694 Void setScalableNestingSEIEnabled(Int b) { m_scalableNestingSEIEnabled = b; } 695 Int getScalableNestingSEIEnabled() { return m_scalableNestingSEIEnabled; } 696 #endif 589 697 Void setUseWP ( Bool b ) { m_useWeightedPred = b; } 590 698 Void setWPBiPred ( Bool b ) { m_useWeightedBiPred = b; } -
trunk/source/Lib/TLibEncoder/TEncGOP.cpp
r125 r189 96 96 #if L0045_NON_NESTED_SEI_RESTRICTIONS 97 97 xResetNonNestedSEIPresentFlags(); 98 #if K0180_SCALABLE_NESTING_SEI 99 xResetNestedSEIPresentFlags(); 100 #endif 98 101 #endif 99 102 #if SVC_UPSAMPLING … … 134 137 m_pcSliceEncoder = pcTEncTop->getSliceEncoder(); 135 138 m_pcListPic = pcTEncTop->getListPic(); 139 136 140 m_pcEntropyCoder = pcTEncTop->getEntropyCoder(); 137 141 m_pcCavlcCoder = pcTEncTop->getCavlcCoder(); … … 210 214 } 211 215 216 #if J0149_TONE_MAPPING_SEI 217 SEIToneMappingInfo* TEncGOP::xCreateSEIToneMappingInfo() 218 { 219 SEIToneMappingInfo *seiToneMappingInfo = new SEIToneMappingInfo(); 220 seiToneMappingInfo->m_toneMapId = m_pcCfg->getTMISEIToneMapId(); 221 seiToneMappingInfo->m_toneMapCancelFlag = m_pcCfg->getTMISEIToneMapCancelFlag(); 222 seiToneMappingInfo->m_toneMapPersistenceFlag = m_pcCfg->getTMISEIToneMapPersistenceFlag(); 223 224 seiToneMappingInfo->m_codedDataBitDepth = m_pcCfg->getTMISEICodedDataBitDepth(); 225 assert(seiToneMappingInfo->m_codedDataBitDepth >= 8 && seiToneMappingInfo->m_codedDataBitDepth <= 14); 226 seiToneMappingInfo->m_targetBitDepth = m_pcCfg->getTMISEITargetBitDepth(); 227 assert( (seiToneMappingInfo->m_targetBitDepth >= 1 && seiToneMappingInfo->m_targetBitDepth <= 17) || (seiToneMappingInfo->m_targetBitDepth == 255) ); 228 seiToneMappingInfo->m_modelId = m_pcCfg->getTMISEIModelID(); 229 assert(seiToneMappingInfo->m_modelId >=0 &&seiToneMappingInfo->m_modelId<=4); 230 231 switch( seiToneMappingInfo->m_modelId) 232 { 233 case 0: 234 { 235 seiToneMappingInfo->m_minValue = m_pcCfg->getTMISEIMinValue(); 236 seiToneMappingInfo->m_maxValue = m_pcCfg->getTMISEIMaxValue(); 237 break; 238 } 239 case 1: 240 { 241 seiToneMappingInfo->m_sigmoidMidpoint = m_pcCfg->getTMISEISigmoidMidpoint(); 242 seiToneMappingInfo->m_sigmoidWidth = m_pcCfg->getTMISEISigmoidWidth(); 243 break; 244 } 245 case 2: 246 { 247 UInt num = 1u<<(seiToneMappingInfo->m_targetBitDepth); 248 seiToneMappingInfo->m_startOfCodedInterval.resize(num); 249 Int* ptmp = m_pcCfg->getTMISEIStartOfCodedInterva(); 250 if(ptmp) 251 { 252 for(int i=0; i<num;i++) 253 { 254 seiToneMappingInfo->m_startOfCodedInterval[i] = ptmp[i]; 255 } 256 } 257 break; 258 } 259 case 3: 260 { 261 seiToneMappingInfo->m_numPivots = m_pcCfg->getTMISEINumPivots(); 262 seiToneMappingInfo->m_codedPivotValue.resize(seiToneMappingInfo->m_numPivots); 263 seiToneMappingInfo->m_targetPivotValue.resize(seiToneMappingInfo->m_numPivots); 264 Int* ptmpcoded = m_pcCfg->getTMISEICodedPivotValue(); 265 Int* ptmptarget = m_pcCfg->getTMISEITargetPivotValue(); 266 if(ptmpcoded&&ptmptarget) 267 { 268 for(int i=0; i<(seiToneMappingInfo->m_numPivots);i++) 269 { 270 seiToneMappingInfo->m_codedPivotValue[i]=ptmpcoded[i]; 271 seiToneMappingInfo->m_targetPivotValue[i]=ptmptarget[i]; 272 } 273 } 274 break; 275 } 276 case 4: 277 { 278 seiToneMappingInfo->m_cameraIsoSpeedIdc = m_pcCfg->getTMISEICameraIsoSpeedIdc(); 279 seiToneMappingInfo->m_cameraIsoSpeedValue = m_pcCfg->getTMISEICameraIsoSpeedValue(); 280 assert( seiToneMappingInfo->m_cameraIsoSpeedValue !=0 ); 281 seiToneMappingInfo->m_exposureCompensationValueSignFlag = m_pcCfg->getTMISEIExposureCompensationValueSignFlag(); 282 seiToneMappingInfo->m_exposureCompensationValueNumerator = m_pcCfg->getTMISEIExposureCompensationValueNumerator(); 283 seiToneMappingInfo->m_exposureCompensationValueDenomIdc = m_pcCfg->getTMISEIExposureCompensationValueDenomIdc(); 284 seiToneMappingInfo->m_refScreenLuminanceWhite = m_pcCfg->getTMISEIRefScreenLuminanceWhite(); 285 seiToneMappingInfo->m_extendedRangeWhiteLevel = m_pcCfg->getTMISEIExtendedRangeWhiteLevel(); 286 assert( seiToneMappingInfo->m_extendedRangeWhiteLevel >= 100 ); 287 seiToneMappingInfo->m_nominalBlackLevelLumaCodeValue = m_pcCfg->getTMISEINominalBlackLevelLumaCodeValue(); 288 seiToneMappingInfo->m_nominalWhiteLevelLumaCodeValue = m_pcCfg->getTMISEINominalWhiteLevelLumaCodeValue(); 289 assert( seiToneMappingInfo->m_nominalWhiteLevelLumaCodeValue > seiToneMappingInfo->m_nominalBlackLevelLumaCodeValue ); 290 seiToneMappingInfo->m_extendedWhiteLevelLumaCodeValue = m_pcCfg->getTMISEIExtendedWhiteLevelLumaCodeValue(); 291 assert( seiToneMappingInfo->m_extendedWhiteLevelLumaCodeValue >= seiToneMappingInfo->m_nominalWhiteLevelLumaCodeValue ); 292 break; 293 } 294 default: 295 { 296 assert(!"Undefined SEIToneMapModelId"); 297 break; 298 } 299 } 300 return seiToneMappingInfo; 301 } 302 #endif 212 303 Void TEncGOP::xCreateLeadingSEIMessages (/*SEIMessages seiMessages,*/ AccessUnit &accessUnit, TComSPS *sps) 213 304 { 214 OutputNALUnit nalu(NAL_UNIT_ SEI);305 OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI); 215 306 216 307 if(m_pcCfg->getActiveParameterSetsSEIEnabled()) … … 233 324 SEIFramePacking *sei = xCreateSEIFramePacking (); 234 325 235 nalu = NALUnit(NAL_UNIT_ SEI);326 nalu = NALUnit(NAL_UNIT_PREFIX_SEI); 236 327 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); 237 328 m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps); … … 244 335 SEIDisplayOrientation *sei = xCreateSEIDisplayOrientation(); 245 336 246 nalu = NALUnit(NAL_UNIT_ SEI);337 nalu = NALUnit(NAL_UNIT_PREFIX_SEI); 247 338 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); 248 339 m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps); … … 251 342 delete sei; 252 343 } 344 #if J0149_TONE_MAPPING_SEI 345 if(m_pcCfg->getToneMappingInfoSEIEnabled()) 346 { 347 SEIToneMappingInfo *sei = xCreateSEIToneMappingInfo (); 348 349 nalu = NALUnit(NAL_UNIT_PREFIX_SEI); 350 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); 351 m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps); 352 writeRBSPTrailingBits(nalu.m_Bitstream); 353 accessUnit.push_back(new NALUnitEBSP(nalu)); 354 delete sei; 355 } 356 #endif 253 357 } 254 358 … … 276 380 m_iNumPicCoded = 0; 277 381 SEIPictureTiming pictureTimingSEI; 382 #if L0208_SOP_DESCRIPTION_SEI 383 Bool writeSOP = m_pcCfg->getSOPDescriptionSEIEnabled(); 384 #endif 385 #if K0180_SCALABLE_NESTING_SEI 386 // Initialize Scalable Nesting SEI with single layer values 387 SEIScalableNesting scalableNestingSEI; 388 scalableNestingSEI.m_bitStreamSubsetFlag = 1; // If the nested SEI messages are picture buffereing SEI mesages, picure timing SEI messages or sub-picture timing SEI messages, bitstream_subset_flag shall be equal to 1 389 scalableNestingSEI.m_nestingOpFlag = 0; 390 scalableNestingSEI.m_nestingNumOpsMinus1 = 0; //nesting_num_ops_minus1 391 scalableNestingSEI.m_allLayersFlag = 0; 392 scalableNestingSEI.m_nestingNoOpMaxTemporalIdPlus1 = 6 + 1; //nesting_no_op_max_temporal_id_plus1 393 scalableNestingSEI.m_nestingNumLayersMinus1 = 1 - 1; //nesting_num_layers_minus1 394 scalableNestingSEI.m_nestingLayerId[0] = 0; 395 scalableNestingSEI.m_callerOwnsSEIs = true; 396 #endif 278 397 #if L0044_DU_DPB_OUTPUT_DELAY_HRD 279 398 Int picSptDpbOutputDuDelay = 0; … … 348 467 } 349 468 350 if( getNalUnitType(pocCurr ) == NAL_UNIT_CODED_SLICE_IDR || getNalUnitType(pocCurr) == NAL_UNIT_CODED_SLICE_IDR_N_LP )469 if( getNalUnitType(pocCurr, m_iLastIDR) == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType(pocCurr, m_iLastIDR) == NAL_UNIT_CODED_SLICE_IDR_N_LP ) 351 470 { 352 471 m_iLastIDR = pocCurr; … … 364 483 #if SVC_EXTENSION 365 484 pcPic->setLayerId( m_layerId ); 366 #endif 367 485 m_pcSliceEncoder->initEncSlice ( pcPic, iPOCLast, pocCurr, iNumPicRcvd, iGOPid, pcSlice, m_pcEncTop->getSPS(), m_pcEncTop->getPPS(), m_pcEncTop->getVPS() ); 486 #else 368 487 m_pcSliceEncoder->initEncSlice ( pcPic, iPOCLast, pocCurr, iNumPicRcvd, iGOPid, pcSlice, m_pcEncTop->getSPS(), m_pcEncTop->getPPS() ); 488 #endif 369 489 pcSlice->setLastIDR(m_iLastIDR); 370 490 pcSlice->setSliceIdx(0); … … 411 531 } 412 532 // Set the nal unit type 413 pcSlice->setNalUnitType(getNalUnitType(pocCurr ));533 pcSlice->setNalUnitType(getNalUnitType(pocCurr, m_iLastIDR)); 414 534 #if IDR_ALIGNMENT 415 535 if (m_layerId > 0) 416 536 { 537 #if VPS_EXTN_DIRECT_REF_LAYERS_CONTINUE 538 TComList<TComPic*> *cListPic = m_ppcTEncTop[m_layerId]->getRefLayerEnc(m_layerId)->getListPic(); 539 #else 417 540 TComList<TComPic*> *cListPic = m_ppcTEncTop[m_layerId-1]->getListPic(); 541 #endif 418 542 pcSlice->setBaseColPic (*cListPic, m_layerId ); 419 543 } … … 424 548 { 425 549 #if IDR_ALIGNMENT 426 if( pcSlice->getBaseColPic()->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR )427 { 428 pcSlice->setNalUnitType( NAL_UNIT_CODED_SLICE_IDR);550 if( pcSlice->getBaseColPic()->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || pcSlice->getBaseColPic()->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP ) 551 { 552 pcSlice->setNalUnitType(pcSlice->getBaseColPic()->getSlice(0)->getNalUnitType()); 429 553 } 430 554 else … … 432 556 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_CRA); 433 557 } 558 #if ZERO_NUM_DIRECT_LAYERS 559 if( m_layerId > 0 && pcSlice->getActiveNumILRRefIdx() == 0 && pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA ) 560 { 561 pcSlice->setSliceType(I_SLICE); 562 } 563 else 564 #endif 434 565 if( m_layerId > 0 && !m_pcEncTop->getElRapSliceTypeB() ) 435 566 { 436 if( (pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA ) &&567 if( (pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP) && 437 568 (pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA) && 438 569 pcSlice->getSliceType() == B_SLICE ) … … 442 573 } 443 574 #endif 444 if(pcSlice->get NalUnitType()==NAL_UNIT_CODED_SLICE_TRAIL_R)445 { 446 if(pcSlice->get TemporalLayerNonReferenceFlag())575 if(pcSlice->getTemporalLayerNonReferenceFlag()) 576 { 577 if(pcSlice->getNalUnitType()==NAL_UNIT_CODED_SLICE_TRAIL_R) 447 578 { 448 579 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_TRAIL_N); 580 } 581 if(pcSlice->getNalUnitType()==NAL_UNIT_CODED_SLICE_RADL_R) 582 { 583 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_RADL_N); 584 } 585 if(pcSlice->getNalUnitType()==NAL_UNIT_CODED_SLICE_RASL_R) 586 { 587 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_RASL_N); 449 588 } 450 589 } … … 471 610 else 472 611 { 473 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_TLA );612 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_TLA_R); 474 613 } 475 614 } … … 524 663 pcSlice->setNumRefIdx(REF_PIC_LIST_1,min(m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive,pcSlice->getRPS()->getNumberOfPictures())); 525 664 526 #if REF_LIST_BUGFIX 665 #if REF_IDX_FRAMEWORK 666 #if ZERO_NUM_DIRECT_LAYERS 667 if( m_layerId > 0 && pcSlice->getActiveNumILRRefIdx() ) 668 #else 527 669 if(m_layerId > 0) 528 { 529 if( pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA && pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA ) 670 #endif 671 { 672 #if JCTVC_M0458_INTERLAYER_RPS_SIG 673 if( pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA ) 674 { 675 pcSlice->setNumRefIdx(REF_PIC_LIST_0, pcSlice->getActiveNumILRRefIdx()); 676 pcSlice->setNumRefIdx(REF_PIC_LIST_1, pcSlice->getActiveNumILRRefIdx()); 677 } 678 else 679 { 680 pcSlice->setNumRefIdx(REF_PIC_LIST_0, pcSlice->getNumRefIdx(REF_PIC_LIST_0)+pcSlice->getActiveNumILRRefIdx()); 681 pcSlice->setNumRefIdx(REF_PIC_LIST_1, pcSlice->getNumRefIdx(REF_PIC_LIST_1)+pcSlice->getActiveNumILRRefIdx()); 682 } 683 #else 684 if( pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA ) 530 685 { 531 686 pcSlice->setNumRefIdx(REF_PIC_LIST_0, pcSlice->getNumILRRefIdx()); … … 537 692 pcSlice->setNumRefIdx(REF_PIC_LIST_1, pcSlice->getNumRefIdx(REF_PIC_LIST_1)+pcSlice->getNumILRRefIdx()); 538 693 } 694 #endif 539 695 } 540 696 #endif … … 545 701 546 702 #if SVC_EXTENSION 703 #if ZERO_NUM_DIRECT_LAYERS 704 if( m_layerId > 0 && pcSlice->getActiveNumILRRefIdx() ) 705 #else 547 706 if(m_layerId > 0) 707 #endif 548 708 { 549 709 #if !IDR_ALIGNMENT … … 553 713 #if SVC_UPSAMPLING 554 714 if ( pcPic->isSpatialEnhLayer()) 555 { 715 { 716 #if SCALED_REF_LAYER_OFFSETS 717 m_pcPredSearch->upsampleBasePic( pcPic->getFullPelBaseRec(), pcSlice->getBaseColPic()->getPicYuvRec(), pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow() ); 718 #else 556 719 m_pcPredSearch->upsampleBasePic( pcPic->getFullPelBaseRec(), pcSlice->getBaseColPic()->getPicYuvRec(), pcPic->getPicYuvRec() ); 720 #endif 557 721 } 558 722 else … … 573 737 574 738 // Set reference list 575 #if REF_LIST_BUGFIX 739 #if REF_IDX_FRAMEWORK 740 #if ZERO_NUM_DIRECT_LAYERS 741 if(m_layerId == 0 || ( m_layerId > 0 && pcSlice->getActiveNumILRRefIdx() == 0 ) ) 742 #else 576 743 if(m_layerId == 0) 744 #endif 577 745 { 578 746 pcSlice->setRefPicList( rcListPic); … … 582 750 #endif 583 751 #if REF_IDX_FRAMEWORK 752 #if ZERO_NUM_DIRECT_LAYERS 753 if( m_layerId > 0 && pcSlice->getActiveNumILRRefIdx() ) 754 #else 584 755 if(m_layerId > 0) 756 #endif 585 757 { 586 758 m_pcEncTop->setILRPic(pcPic); … … 592 764 } 593 765 #endif 594 #if REF_LIST_BUGFIX595 766 pcSlice->setRefPicListModificationSvc(); 596 pcSlice->setRefPicListSvc( rcListPic, m_pcEncTop->getIlpList() ); 597 #else 598 pcSlice->addRefPicList ( m_pcEncTop->getIlpList(), 1); 599 #endif 767 pcSlice->setRefPicList( rcListPic, false, m_pcEncTop->getIlpList()); 600 768 601 769 #if REF_IDX_MFM … … 607 775 for(Int colIdx = 0; colIdx < pcSlice->getNumRefIdx( RefPicList(1 - ColFromL0Flag) ); colIdx++) 608 776 { 609 if( pcSlice->getRefPic( RefPicList(1 - ColFromL0Flag), colIdx)->isILR( ) )777 if( pcSlice->getRefPic( RefPicList(1 - ColFromL0Flag), colIdx)->isILR(m_layerId) ) 610 778 { 611 779 ColRefIdx = colIdx; … … 620 788 for(Int colIdx = 0; colIdx < pcSlice->getNumRefIdx( RefPicList(1 - ColFromL0Flag) ); colIdx++) 621 789 { 622 if( pcSlice->getRefPic( RefPicList(1 - ColFromL0Flag), colIdx)->isILR( ) )790 if( pcSlice->getRefPic( RefPicList(1 - ColFromL0Flag), colIdx)->isILR(m_layerId) ) 623 791 { 624 792 ColRefIdx = colIdx; … … 644 812 pcSlice->setSliceType ( P_SLICE ); 645 813 } 646 814 #if !L0034_COMBINED_LIST_CLEANUP 647 815 if (pcSlice->getSliceType() != B_SLICE || !pcSlice->getSPS()->getUseLComb()) 648 816 { … … 656 824 pcSlice->setNumRefIdx(REF_PIC_LIST_C, pcSlice->getNumRefIdx(REF_PIC_LIST_0)); 657 825 } 826 #endif 658 827 659 828 if (pcSlice->getSliceType() == B_SLICE) … … 683 852 pcSlice->setCheckLDC(bLowDelay); 684 853 } 854 else 855 { 856 pcSlice->setCheckLDC(true); 857 } 685 858 686 859 uiColDir = 1-uiColDir; … … 689 862 pcSlice->setRefPOCList(); 690 863 864 #if L0034_COMBINED_LIST_CLEANUP 865 pcSlice->setList1IdxToList0Idx(); 866 #else 691 867 pcSlice->setNoBackPredFlag( false ); 692 868 if ( pcSlice->getSliceType() == B_SLICE && !pcSlice->getRefPicListCombinationFlag()) … … 712 888 } 713 889 pcSlice->generateCombinedList(); 890 #endif 714 891 715 892 if (m_pcEncTop->getTMVPModeId() == 2) … … 831 1008 UInt uiNumSlices = 1; 832 1009 1010 #if SIMPLIFIED_MV_POS_SCALING 1011 if (m_layerId > 0) 1012 { 1013 #if SCALED_REF_LAYER_OFFSETS 1014 const Window &scalEL = m_pcEncTop->getScaledRefLayerWindow(); 1015 1016 Int widthBL = pcSlice->getBaseColPic()->getPicYuvRec()->getWidth(); 1017 Int heightBL = pcSlice->getBaseColPic()->getPicYuvRec()->getHeight(); 1018 1019 Int widthEL = pcPic->getPicYuvRec()->getWidth() - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset(); 1020 Int heightEL = pcPic->getPicYuvRec()->getHeight() - scalEL.getWindowTopOffset() - scalEL.getWindowBottomOffset(); 1021 #else 1022 const Window &confBL = pcSlice->getBaseColPic()->getPicYuvRec()->getConformanceWindow(); 1023 const Window &confEL = pcPic->getPicYuvRec()->getConformanceWindow(); 1024 1025 Int widthBL = pcSlice->getBaseColPic()->getPicYuvRec()->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset(); 1026 Int heightBL = pcSlice->getBaseColPic()->getPicYuvRec()->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset(); 1027 1028 Int widthEL = pcPic->getPicYuvRec()->getWidth() - confEL.getWindowLeftOffset() - confEL.getWindowRightOffset(); 1029 Int heightEL = pcPic->getPicYuvRec()->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset(); 1030 #endif 1031 g_mvScalingFactor[m_layerId][0] = Clip3(-4096, 4095, ((widthEL << 8) + (widthBL >> 1)) / widthBL); 1032 g_mvScalingFactor[m_layerId][1] = Clip3(-4096, 4095, ((heightEL << 8) + (heightBL >> 1)) / heightBL); 1033 1034 g_posScalingFactor[m_layerId][0] = ((widthBL << 16) + (widthEL >> 1)) / widthEL; 1035 g_posScalingFactor[m_layerId][1] = ((heightBL << 16) + (heightEL >> 1)) / heightEL; 1036 } 1037 #endif 1038 833 1039 UInt uiInternalAddress = pcPic->getNumPartInCU()-4; 834 1040 UInt uiExternalAddress = pcPic->getPicSym()->getNumberOfCUsInFrame()-1; … … 949 1155 startCUAddrSliceSegmentIdx++; 950 1156 #if AVC_BASE 951 if( m_layerId == 0 )1157 if( m_layerId == 0 && m_pcEncTop->getVPS()->getAvcBaseLayerFlag() ) 952 1158 { 953 1159 pcPic->getPicYuvOrg()->copyToPic( pcPic->getPicYuvRec() ); … … 1027 1233 Bool bLFCrossTileBoundary = pcSlice->getPPS()->getLoopFilterAcrossTilesEnabledFlag(); 1028 1234 m_pcLoopFilter->setCfg(bLFCrossTileBoundary); 1235 #if L0386_DB_METRIC 1236 if ( m_pcCfg->getDeblockingFilterMetric() ) 1237 { 1238 dblMetric(pcPic, uiNumSlices); 1239 } 1240 #endif 1029 1241 m_pcLoopFilter->loopFilterPic( pcPic ); 1030 1242 … … 1059 1271 OutputNALUnit nalu(NAL_UNIT_VPS, 0, m_layerId); 1060 1272 #if AVC_BASE 1061 if( m_layerId == 1)1273 if( ( m_layerId == 1 && m_pcEncTop->getVPS()->getAvcBaseLayerFlag() ) || ( m_layerId == 0 && !m_pcEncTop->getVPS()->getAvcBaseLayerFlag() ) ) 1062 1274 #else 1063 1275 if( m_layerId == 0 ) … … 1133 1345 } 1134 1346 1347 #if L0208_SOP_DESCRIPTION_SEI 1348 if (writeSOP) // write SOP description SEI (if enabled) at the beginning of GOP 1349 { 1350 Int SOPcurrPOC = pocCurr; 1351 1352 OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI); 1353 m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice); 1354 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); 1355 1356 SEISOPDescription SOPDescriptionSEI; 1357 SOPDescriptionSEI.m_sopSeqParameterSetId = pcSlice->getSPS()->getSPSId(); 1358 1359 UInt i = 0; 1360 UInt prevEntryId = iGOPid; 1361 for (j = iGOPid; j < m_iGopSize; j++) 1362 { 1363 Int deltaPOC = m_pcCfg->getGOPEntry(j).m_POC - m_pcCfg->getGOPEntry(prevEntryId).m_POC; 1364 if ((SOPcurrPOC + deltaPOC) < m_pcCfg->getFramesToBeEncoded()) 1365 { 1366 SOPcurrPOC += deltaPOC; 1367 SOPDescriptionSEI.m_sopDescVclNaluType[i] = getNalUnitType(SOPcurrPOC, m_iLastIDR); 1368 SOPDescriptionSEI.m_sopDescTemporalId[i] = m_pcCfg->getGOPEntry(j).m_temporalId; 1369 SOPDescriptionSEI.m_sopDescStRpsIdx[i] = m_pcEncTop->getReferencePictureSetIdxForSOP(pcSlice, SOPcurrPOC, j); 1370 SOPDescriptionSEI.m_sopDescPocDelta[i] = deltaPOC; 1371 1372 prevEntryId = j; 1373 i++; 1374 } 1375 } 1376 1377 SOPDescriptionSEI.m_numPicsInSopMinus1 = i - 1; 1378 1379 m_seiWriter.writeSEImessage( nalu.m_Bitstream, SOPDescriptionSEI, pcSlice->getSPS()); 1380 writeRBSPTrailingBits(nalu.m_Bitstream); 1381 accessUnit.push_back(new NALUnitEBSP(nalu)); 1382 1383 writeSOP = false; 1384 } 1385 #endif 1386 1135 1387 if( ( m_pcCfg->getPictureTimingSEIEnabled() || m_pcCfg->getDecodingUnitInfoSEIEnabled() ) && 1136 1388 ( pcSlice->getSPS()->getVuiParametersPresentFlag() ) && … … 1178 1430 || ( pcSlice->getSPS()->getVuiParameters()->getHrdParameters()->getVclHrdParametersPresentFlag() ) ) ) 1179 1431 { 1180 OutputNALUnit nalu(NAL_UNIT_ SEI);1432 OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI); 1181 1433 m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice); 1182 1434 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); … … 1219 1471 writeRBSPTrailingBits(nalu.m_Bitstream); 1220 1472 #if L0045_NON_NESTED_SEI_RESTRICTIONS 1473 { 1221 1474 UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit); 1222 1475 UInt offsetPosition = m_activeParameterSetSEIPresentInAU; // Insert BP SEI after APS SEI … … 1228 1481 accessUnit.insert(it, new NALUnitEBSP(nalu)); 1229 1482 m_bufferingPeriodSEIPresentInAU = true; 1483 } 1230 1484 #else 1231 1485 accessUnit.push_back(new NALUnitEBSP(nalu)); 1486 #endif 1487 1488 #if K0180_SCALABLE_NESTING_SEI 1489 if (m_pcCfg->getScalableNestingSEIEnabled()) 1490 { 1491 OutputNALUnit naluTmp(NAL_UNIT_PREFIX_SEI); 1492 m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice); 1493 m_pcEntropyCoder->setBitstream(&naluTmp.m_Bitstream); 1494 scalableNestingSEI.m_nestedSEIs.clear(); 1495 scalableNestingSEI.m_nestedSEIs.push_back(&sei_buffering_period); 1496 m_seiWriter.writeSEImessage( naluTmp.m_Bitstream, scalableNestingSEI, pcSlice->getSPS()); 1497 writeRBSPTrailingBits(naluTmp.m_Bitstream); 1498 #if L0045_NON_NESTED_SEI_RESTRICTIONS 1499 UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit); 1500 UInt offsetPosition = m_activeParameterSetSEIPresentInAU + m_bufferingPeriodSEIPresentInAU + m_pictureTimingSEIPresentInAU; // Insert BP SEI after non-nested APS, BP and PT SEIs 1501 AccessUnit::iterator it; 1502 for(j = 0, it = accessUnit.begin(); j < seiPositionInAu + offsetPosition; j++) 1503 { 1504 it++; 1505 } 1506 accessUnit.insert(it, new NALUnitEBSP(naluTmp)); 1507 m_nestedBufferingPeriodSEIPresentInAU = true; 1508 #else 1509 accessUnit.push_back(new NALUnitEBSP(naluTmp)); 1510 #endif 1511 } 1232 1512 #endif 1233 1513 … … 1241 1521 { 1242 1522 // Gradual decoding refresh SEI 1243 OutputNALUnit nalu(NAL_UNIT_ SEI);1523 OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI); 1244 1524 m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice); 1245 1525 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); … … 1253 1533 } 1254 1534 // Recovery point SEI 1255 OutputNALUnit nalu(NAL_UNIT_ SEI);1535 OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI); 1256 1536 m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice); 1257 1537 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); … … 1444 1724 1445 1725 pcSlice->setTileOffstForMultES( uiOneBitstreamPerSliceLength ); 1446 if (!sliceSegment)1447 {1448 1726 pcSlice->setTileLocationCount ( 0 ); 1449 m_pcSliceEncoder->encodeSlice(pcPic, pcBitstreamRedirect, pcSubstreamsOut); // redirect is only used for CAVLC tile position info. 1450 } 1451 else 1452 { 1453 m_pcSliceEncoder->encodeSlice(pcPic, &nalu.m_Bitstream, pcSubstreamsOut); // nalu.m_Bitstream is only used for CAVLC tile position info. 1454 } 1727 m_pcSliceEncoder->encodeSlice(pcPic, pcSubstreamsOut); 1455 1728 1456 1729 { … … 1484 1757 if (ui+1 < pcSlice->getPPS()->getNumSubstreams()) 1485 1758 { 1486 puiSubstreamSizes[ui] = pcSubstreamsOut[ui].getNumberOfWrittenBits() ;1759 puiSubstreamSizes[ui] = pcSubstreamsOut[ui].getNumberOfWrittenBits() + (pcSubstreamsOut[ui].countStartCodeEmulations()<<3); 1487 1760 } 1488 1761 } … … 1516 1789 // If current NALU is the last NALU of slice and a NALU was buffered, then (a) Write current NALU (b) Update an write buffered NALU at approproate location in NALU list. 1517 1790 Bool bNALUAlignedWrittenToList = false; // used to ensure current NALU is not written more than once to the NALU list. 1518 x WriteTileLocationToSliceHeader(nalu, pcBitstreamRedirect, pcSlice);1791 xAttachSliceDataToNalUnit(nalu, pcBitstreamRedirect); 1519 1792 accessUnit.push_back(new NALUnitEBSP(nalu)); 1520 1793 #if RATE_CONTROL_LAMBDA_DOMAIN … … 1544 1817 { 1545 1818 UInt numRBSPBytes_nal = UInt((*it)->m_nalUnitData.str().size()); 1546 if ((*it)->m_nalUnitType != NAL_UNIT_ SEI && (*it)->m_nalUnitType != NAL_UNIT_SEI_SUFFIX)1819 if ((*it)->m_nalUnitType != NAL_UNIT_PREFIX_SEI && (*it)->m_nalUnitType != NAL_UNIT_SUFFIX_SEI) 1547 1820 { 1548 1821 numRBSPBytes += numRBSPBytes_nal; … … 1640 1913 } 1641 1914 #if SVC_EXTENSION 1642 OutputNALUnit nalu(NAL_UNIT_S EI_SUFFIX, pcSlice->getTLayer(), m_layerId);1643 #else 1644 OutputNALUnit nalu(NAL_UNIT_S EI_SUFFIX, pcSlice->getTLayer());1915 OutputNALUnit nalu(NAL_UNIT_SUFFIX_SEI, pcSlice->getTLayer(), m_layerId); 1916 #else 1917 OutputNALUnit nalu(NAL_UNIT_SUFFIX_SEI, pcSlice->getTLayer()); 1645 1918 #endif 1646 1919 … … 1667 1940 sei_temporal_level0_index.rapIdx = m_rapIdx; 1668 1941 1669 OutputNALUnit nalu(NAL_UNIT_ SEI);1942 OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI); 1670 1943 1671 1944 /* write the SEI messages */ … … 1807 2080 if( m_pcCfg->getPictureTimingSEIEnabled() ) 1808 2081 { 1809 OutputNALUnit nalu(NAL_UNIT_SEI, pcSlice->getTLayer()); 2082 { 2083 OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI, pcSlice->getTLayer()); 1810 2084 m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice); 1811 2085 m_seiWriter.writeSEImessage(nalu.m_Bitstream, pictureTimingSEI, pcSlice->getSPS()); … … 1827 2101 #endif 1828 2102 } 2103 #if K0180_SCALABLE_NESTING_SEI 2104 if ( m_pcCfg->getScalableNestingSEIEnabled() ) // put picture timing SEI into scalable nesting SEI 2105 { 2106 OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI, pcSlice->getTLayer()); 2107 m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice); 2108 scalableNestingSEI.m_nestedSEIs.clear(); 2109 scalableNestingSEI.m_nestedSEIs.push_back(&pictureTimingSEI); 2110 m_seiWriter.writeSEImessage(nalu.m_Bitstream, scalableNestingSEI, pcSlice->getSPS()); 2111 writeRBSPTrailingBits(nalu.m_Bitstream); 2112 #if L0045_NON_NESTED_SEI_RESTRICTIONS 2113 UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit); 2114 UInt offsetPosition = m_activeParameterSetSEIPresentInAU 2115 + m_bufferingPeriodSEIPresentInAU + m_pictureTimingSEIPresentInAU + m_nestedBufferingPeriodSEIPresentInAU; // Insert PT SEI after APS and BP SEI 2116 AccessUnit::iterator it; 2117 for(j = 0, it = accessUnit.begin(); j < seiPositionInAu + offsetPosition; j++) 2118 { 2119 it++; 2120 } 2121 accessUnit.insert(it, new NALUnitEBSP(nalu)); 2122 m_nestedPictureTimingSEIPresentInAU = true; 2123 #else 2124 AccessUnit::iterator it = find_if(accessUnit.begin(), accessUnit.end(), mem_fun(&NALUnit::isSlice)); 2125 accessUnit.insert(it, new NALUnitEBSP(nalu)); 2126 #endif 2127 } 2128 #endif 2129 2130 } 1829 2131 if( m_pcCfg->getDecodingUnitInfoSEIEnabled() && hrd->getSubPicCpbParamsPresentFlag() ) 1830 2132 { … … 1832 2134 for( Int i = 0; i < ( pictureTimingSEI.m_numDecodingUnitsMinus1 + 1 ); i ++ ) 1833 2135 { 1834 OutputNALUnit nalu(NAL_UNIT_ SEI, pcSlice->getTLayer());2136 OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI, pcSlice->getTLayer()); 1835 2137 1836 2138 SEIDecodingUnitInfo tempSEI; … … 1880 2182 break; 1881 2183 } 1882 if ((*it)->m_nalUnitType != NAL_UNIT_ SEI && (*it)->m_nalUnitType != NAL_UNIT_SEI_SUFFIX)2184 if ((*it)->m_nalUnitType != NAL_UNIT_PREFIX_SEI && (*it)->m_nalUnitType != NAL_UNIT_SUFFIX_SEI) 1883 2185 { 1884 2186 ctr++; … … 1891 2193 #if L0045_NON_NESTED_SEI_RESTRICTIONS 1892 2194 xResetNonNestedSEIPresentFlags(); 2195 #if K0180_SCALABLE_NESTING_SEI 2196 xResetNestedSEIPresentFlags(); 2197 #endif 1893 2198 #endif 1894 2199 pcPic->getPicYuvRec()->copyToPic(pcPicYuvRecOut); … … 2113 2418 case NAL_UNIT_CODED_SLICE_TRAIL_R: return "TRAIL_R"; 2114 2419 case NAL_UNIT_CODED_SLICE_TRAIL_N: return "TRAIL_N"; 2115 case NAL_UNIT_CODED_SLICE_TLA : return "TLA";2420 case NAL_UNIT_CODED_SLICE_TLA_R: return "TLA_R"; 2116 2421 case NAL_UNIT_CODED_SLICE_TSA_N: return "TSA_N"; 2117 2422 case NAL_UNIT_CODED_SLICE_STSA_R: return "STSA_R"; 2118 2423 case NAL_UNIT_CODED_SLICE_STSA_N: return "STSA_N"; 2119 case NAL_UNIT_CODED_SLICE_BLA : return "BLA";2120 case NAL_UNIT_CODED_SLICE_BLA NT: return "BLANT";2424 case NAL_UNIT_CODED_SLICE_BLA_W_LP: return "BLA_W_LP"; 2425 case NAL_UNIT_CODED_SLICE_BLA_W_RADL: return "BLA_W_RADL"; 2121 2426 case NAL_UNIT_CODED_SLICE_BLA_N_LP: return "BLA_N_LP"; 2122 case NAL_UNIT_CODED_SLICE_IDR : return "IDR";2427 case NAL_UNIT_CODED_SLICE_IDR_W_RADL: return "IDR_W_RADL"; 2123 2428 case NAL_UNIT_CODED_SLICE_IDR_N_LP: return "IDR_N_LP"; 2124 2429 case NAL_UNIT_CODED_SLICE_CRA: return "CRA"; 2125 case NAL_UNIT_CODED_SLICE_ DLP: return "DLP";2126 case NAL_UNIT_CODED_SLICE_ TFD: return "TFD";2430 case NAL_UNIT_CODED_SLICE_RADL_R: return "RADL_R"; 2431 case NAL_UNIT_CODED_SLICE_RASL_R: return "RASL_R"; 2127 2432 case NAL_UNIT_VPS: return "VPS"; 2128 2433 case NAL_UNIT_SPS: return "SPS"; … … 2132 2437 case NAL_UNIT_EOB: return "EOB"; 2133 2438 case NAL_UNIT_FILLER_DATA: return "FILLER"; 2134 case NAL_UNIT_SEI: return "SEI"; 2439 case NAL_UNIT_PREFIX_SEI: return "SEI"; 2440 case NAL_UNIT_SUFFIX_SEI: return "SEI"; 2135 2441 default: return "UNK"; 2136 2442 } … … 2223 2529 printf("*** %6s numBytesInNALunit: %u\n", nalUnitTypeToString((*it)->m_nalUnitType), numRBSPBytes_nal); 2224 2530 #endif 2225 if ((*it)->m_nalUnitType != NAL_UNIT_ SEI && (*it)->m_nalUnitType != NAL_UNIT_SEI_SUFFIX)2531 if ((*it)->m_nalUnitType != NAL_UNIT_PREFIX_SEI && (*it)->m_nalUnitType != NAL_UNIT_SUFFIX_SEI) 2226 2532 { 2227 2533 numRBSPBytes += numRBSPBytes_nal; … … 2314 2620 for (Int iRefIndex = 0; iRefIndex < pcSlice->getNumRefIdx(RefPicList(iRefList)); iRefIndex++) 2315 2621 { 2622 #if REF_IDX_FRAMEWORK && VPS_EXTN_DIRECT_REF_LAYERS_CONTINUE 2623 if( pcSlice->getRefPic(RefPicList(iRefList), iRefIndex)->isILR(m_layerId) ) 2624 { 2625 printf( "%d(%d) ", pcSlice->getRefPOC(RefPicList(iRefList), iRefIndex)-pcSlice->getLastIDR(), pcSlice->getRefPic(RefPicList(iRefList), iRefIndex)->getLayerId() ); 2626 } 2627 else 2628 #endif 2316 2629 printf ("%d ", pcSlice->getRefPOC(RefPicList(iRefList), iRefIndex)-pcSlice->getLastIDR()); 2317 2630 } … … 2325 2638 * This function checks the configuration and returns the appropriate nal_unit_type for the picture. 2326 2639 */ 2327 NalUnitType TEncGOP::getNalUnitType(Int pocCurr )2640 NalUnitType TEncGOP::getNalUnitType(Int pocCurr, Int lastIDR) 2328 2641 { 2329 2642 if (pocCurr == 0) 2330 2643 { 2331 return NAL_UNIT_CODED_SLICE_IDR ;2644 return NAL_UNIT_CODED_SLICE_IDR_W_RADL; 2332 2645 } 2333 2646 if (pocCurr % m_pcCfg->getIntraPeriod() == 0) … … 2339 2652 else if (m_pcCfg->getDecodingRefreshType() == 2) 2340 2653 { 2341 return NAL_UNIT_CODED_SLICE_IDR ;2654 return NAL_UNIT_CODED_SLICE_IDR_W_RADL; 2342 2655 } 2343 2656 } … … 2351 2664 // controlling the reference pictures used for encoding that leading picture. Such a leading 2352 2665 // picture need not be marked as a TFD picture. 2353 return NAL_UNIT_CODED_SLICE_TFD; 2666 return NAL_UNIT_CODED_SLICE_RASL_R; 2667 } 2668 } 2669 if (lastIDR>0) 2670 { 2671 if (pocCurr < lastIDR) 2672 { 2673 return NAL_UNIT_CODED_SLICE_RADL_R; 2354 2674 } 2355 2675 } … … 2402 2722 } 2403 2723 2404 /** Determine the difference between consecutive tile sizes (in bytes) and writes it to bistream rNalu [slice header] 2405 * \param rpcBitstreamRedirect contains the bitstream to be concatenated to rNalu. rpcBitstreamRedirect contains slice payload. rpcSlice contains tile location information. 2406 * \returns Updates rNalu to contain concatenated bitstream. rpcBitstreamRedirect is cleared at the end of this function call. 2724 /** Attaches the input bitstream to the stream in the output NAL unit 2725 Updates rNalu to contain concatenated bitstream. rpcBitstreamRedirect is cleared at the end of this function call. 2726 * \param codedSliceData contains the coded slice data (bitstream) to be concatenated to rNalu 2727 * \param rNalu target NAL unit 2407 2728 */ 2408 Void TEncGOP::x WriteTileLocationToSliceHeader (OutputNALUnit& rNalu, TComOutputBitstream*& rpcBitstreamRedirect, TComSlice*& rpcSlice)2729 Void TEncGOP::xAttachSliceDataToNalUnit (OutputNALUnit& rNalu, TComOutputBitstream*& codedSliceData) 2409 2730 { 2410 2731 // Byte-align … … 2412 2733 2413 2734 // Perform bitstream concatenation 2414 if (rpcBitstreamRedirect->getNumberOfWrittenBits() > 0) 2415 { 2416 UInt uiBitCount = rpcBitstreamRedirect->getNumberOfWrittenBits(); 2417 if (rpcBitstreamRedirect->getByteStreamLength()>0) 2418 { 2419 UChar *pucStart = reinterpret_cast<UChar*>(rpcBitstreamRedirect->getByteStream()); 2420 UInt uiWriteByteCount = 0; 2421 while (uiWriteByteCount < (uiBitCount >> 3) ) 2422 { 2423 UInt uiBits = (*pucStart); 2424 rNalu.m_Bitstream.write(uiBits, 8); 2425 pucStart++; 2426 uiWriteByteCount++; 2427 } 2428 } 2429 UInt uiBitsHeld = (uiBitCount & 0x07); 2430 for (UInt uiIdx=0; uiIdx < uiBitsHeld; uiIdx++) 2431 { 2432 rNalu.m_Bitstream.write((rpcBitstreamRedirect->getHeldBits() & (1 << (7-uiIdx))) >> (7-uiIdx), 1); 2433 } 2735 if (codedSliceData->getNumberOfWrittenBits() > 0) 2736 { 2737 rNalu.m_Bitstream.addSubstream(codedSliceData); 2434 2738 } 2435 2739 2436 2740 m_pcEntropyCoder->setBitstream(&rNalu.m_Bitstream); 2437 2741 2438 delete rpcBitstreamRedirect; 2439 rpcBitstreamRedirect = new TComOutputBitstream; 2742 codedSliceData->clear(); 2440 2743 } 2441 2744 … … 2562 2865 } 2563 2866 } 2564 assert(it != accessUnit.end()); 2867 // assert(it != accessUnit.end()); // Triggers with some legit configurations 2565 2868 return seiStartPos; 2566 2869 } 2567 2870 #endif 2871 2872 #if L0386_DB_METRIC 2873 Void TEncGOP::dblMetric( TComPic* pcPic, UInt uiNumSlices ) 2874 { 2875 TComPicYuv* pcPicYuvRec = pcPic->getPicYuvRec(); 2876 Pel* Rec = pcPicYuvRec->getLumaAddr( 0 ); 2877 Pel* tempRec = Rec; 2878 Int stride = pcPicYuvRec->getStride(); 2879 UInt log2maxTB = pcPic->getSlice(0)->getSPS()->getQuadtreeTULog2MaxSize(); 2880 UInt maxTBsize = (1<<log2maxTB); 2881 const UInt minBlockArtSize = 8; 2882 const UInt picWidth = pcPicYuvRec->getWidth(); 2883 const UInt picHeight = pcPicYuvRec->getHeight(); 2884 const UInt noCol = (picWidth>>log2maxTB); 2885 const UInt noRows = (picHeight>>log2maxTB); 2886 UInt64 *colSAD = (UInt64*)malloc(noCol*sizeof(UInt64)); 2887 UInt64 *rowSAD = (UInt64*)malloc(noRows*sizeof(UInt64)); 2888 UInt colIdx = 0; 2889 UInt rowIdx = 0; 2890 Pel p0, p1, p2, q0, q1, q2; 2891 2892 Int qp = pcPic->getSlice(0)->getSliceQp(); 2893 Int bitdepthScale = 1 << (g_bitDepthY-8); 2894 Int beta = TComLoopFilter::getBeta( qp ) * bitdepthScale; 2895 const Int thr2 = (beta>>2); 2896 const Int thr1 = 2*bitdepthScale; 2897 UInt a = 0; 2898 2899 memset(colSAD, 0, noCol*sizeof(UInt64)); 2900 memset(rowSAD, 0, noRows*sizeof(UInt64)); 2901 2902 if (maxTBsize > minBlockArtSize) 2903 { 2904 // Analyze vertical artifact edges 2905 for(Int c = maxTBsize; c < picWidth; c += maxTBsize) 2906 { 2907 for(Int r = 0; r < picHeight; r++) 2908 { 2909 p2 = Rec[c-3]; 2910 p1 = Rec[c-2]; 2911 p0 = Rec[c-1]; 2912 q0 = Rec[c]; 2913 q1 = Rec[c+1]; 2914 q2 = Rec[c+2]; 2915 a = ((abs(p2-(p1<<1)+p0)+abs(q0-(q1<<1)+q2))<<1); 2916 if ( thr1 < a && a < thr2) 2917 { 2918 colSAD[colIdx] += abs(p0 - q0); 2919 } 2920 Rec += stride; 2921 } 2922 colIdx++; 2923 Rec = tempRec; 2924 } 2925 2926 // Analyze horizontal artifact edges 2927 for(Int r = maxTBsize; r < picHeight; r += maxTBsize) 2928 { 2929 for(Int c = 0; c < picWidth; c++) 2930 { 2931 p2 = Rec[c + (r-3)*stride]; 2932 p1 = Rec[c + (r-2)*stride]; 2933 p0 = Rec[c + (r-1)*stride]; 2934 q0 = Rec[c + r*stride]; 2935 q1 = Rec[c + (r+1)*stride]; 2936 q2 = Rec[c + (r+2)*stride]; 2937 a = ((abs(p2-(p1<<1)+p0)+abs(q0-(q1<<1)+q2))<<1); 2938 if (thr1 < a && a < thr2) 2939 { 2940 rowSAD[rowIdx] += abs(p0 - q0); 2941 } 2942 } 2943 rowIdx++; 2944 } 2945 } 2946 2947 UInt64 colSADsum = 0; 2948 UInt64 rowSADsum = 0; 2949 for(Int c = 0; c < noCol-1; c++) 2950 { 2951 colSADsum += colSAD[c]; 2952 } 2953 for(Int r = 0; r < noRows-1; r++) 2954 { 2955 rowSADsum += rowSAD[r]; 2956 } 2957 2958 colSADsum <<= 10; 2959 rowSADsum <<= 10; 2960 colSADsum /= (noCol-1); 2961 colSADsum /= picHeight; 2962 rowSADsum /= (noRows-1); 2963 rowSADsum /= picWidth; 2964 2965 UInt64 avgSAD = ((colSADsum + rowSADsum)>>1); 2966 avgSAD >>= (g_bitDepthY-8); 2967 2968 if ( avgSAD > 2048 ) 2969 { 2970 avgSAD >>= 9; 2971 Int offset = Clip3(2,6,(Int)avgSAD); 2972 for (Int i=0; i<uiNumSlices; i++) 2973 { 2974 pcPic->getSlice(i)->setDeblockingFilterOverrideFlag(true); 2975 pcPic->getSlice(i)->setDeblockingFilterDisable(false); 2976 pcPic->getSlice(i)->setDeblockingFilterBetaOffsetDiv2( offset ); 2977 pcPic->getSlice(i)->setDeblockingFilterTcOffsetDiv2( offset ); 2978 } 2979 } 2980 else 2981 { 2982 for (Int i=0; i<uiNumSlices; i++) 2983 { 2984 pcPic->getSlice(i)->setDeblockingFilterOverrideFlag(false); 2985 pcPic->getSlice(i)->setDeblockingFilterDisable( pcPic->getSlice(i)->getPPS()->getPicDisableDeblockingFilterFlag() ); 2986 pcPic->getSlice(i)->setDeblockingFilterBetaOffsetDiv2( pcPic->getSlice(i)->getPPS()->getDeblockingFilterBetaOffsetDiv2() ); 2987 pcPic->getSlice(i)->setDeblockingFilterTcOffsetDiv2( pcPic->getSlice(i)->getPPS()->getDeblockingFilterTcOffsetDiv2() ); 2988 } 2989 } 2990 2991 free(colSAD); 2992 free(rowSAD); 2993 } 2994 #endif 2568 2995 //! \} -
trunk/source/Lib/TLibEncoder/TEncGOP.h
r125 r189 131 131 Bool m_bufferingPeriodSEIPresentInAU; 132 132 Bool m_pictureTimingSEIPresentInAU; 133 #if K0180_SCALABLE_NESTING_SEI 134 Bool m_nestedBufferingPeriodSEIPresentInAU; 135 Bool m_nestedPictureTimingSEIPresentInAU; 136 #endif 133 137 #endif 134 138 public: … … 149 153 Void compressGOP ( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRec, std::list<AccessUnit>& accessUnitsInGOP ); 150 154 #endif 151 Void xWriteTileLocationToSliceHeader (OutputNALUnit& rNalu, TComOutputBitstream*& rpcBitstreamRedirect, TComSlice*& rpcSlice);155 Void xAttachSliceDataToNalUnit (OutputNALUnit& rNalu, TComOutputBitstream*& rpcBitstreamRedirect); 152 156 153 157 … … 160 164 161 165 TEncSlice* getSliceEncoder() { return m_pcSliceEncoder; } 162 NalUnitType getNalUnitType( Int pocCurr );166 NalUnitType getNalUnitType( Int pocCurr, Int lastIdr ); 163 167 Void arrangeLongtermPicturesInRPS(TComSlice *, TComList<TComPic*>& ); 164 168 protected: … … 178 182 SEIFramePacking* xCreateSEIFramePacking(); 179 183 SEIDisplayOrientation* xCreateSEIDisplayOrientation(); 184 185 #if J0149_TONE_MAPPING_SEI 186 SEIToneMappingInfo* xCreateSEIToneMappingInfo(); 187 #endif 180 188 181 189 Void xCreateLeadingSEIMessages (/*SEIMessages seiMessages,*/ AccessUnit &accessUnit, TComSPS *sps); … … 188 196 m_pictureTimingSEIPresentInAU = false; 189 197 } 198 #if K0180_SCALABLE_NESTING_SEI 199 Void xResetNestedSEIPresentFlags() 200 { 201 m_nestedBufferingPeriodSEIPresentInAU = false; 202 m_nestedPictureTimingSEIPresentInAU = false; 203 } 204 #endif 205 #endif 206 #if L0386_DB_METRIC 207 Void dblMetric( TComPic* pcPic, UInt uiNumSlices ); 190 208 #endif 191 209 };// END CLASS DEFINITION TEncGOP -
trunk/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp
r125 r189 1677 1677 #endif 1678 1678 { 1679 #if SAO_CHROMA_LAMBDA1680 m_dLambdaLuma = dLambdaLuma;1681 m_dLambdaChroma = dLambdaChroma;1682 #else1683 m_dLambdaLuma = dLambda;1684 m_dLambdaChroma = dLambda;1685 #endif1686 1687 1679 if(m_bUseNIF) 1688 1680 { -
trunk/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.h
r125 r189 57 57 { 58 58 private: 59 Double m_dLambdaLuma;60 Double m_dLambdaChroma;61 62 59 TEncEntropy* m_pcEntropyCoder; 63 60 TEncSbac*** m_pppcRDSbacCoder; ///< for CABAC -
trunk/source/Lib/TLibEncoder/TEncSbac.h
r125 r189 109 109 Void xWriteEpExGolomb ( UInt uiSymbol, UInt uiCount ); 110 110 Void xWriteCoefRemainExGolomb ( UInt symbol, UInt &rParam ); 111 Void xWriteTerminatingBit ( UInt uiBit );112 111 113 112 Void xCopyFrom ( TEncSbac* pSrc ); -
trunk/source/Lib/TLibEncoder/TEncSearch.cpp
r125 r189 3249 3249 UInt uiBitsTempL0[MAX_NUM_REF]; 3250 3250 3251 #if L0034_COMBINED_LIST_CLEANUP 3252 TComMv mvValidList1; 3253 Int refIdxValidList1 = 0; 3254 UInt bitsValidList1 = MAX_UINT; 3255 UInt costValidList1 = MAX_UINT; 3256 #endif 3257 3251 3258 #if (ENCODER_FAST_MODE) 3252 3259 Bool testILR; … … 3289 3296 #if (ENCODER_FAST_MODE) 3290 3297 TComPic* pcPic = pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxTemp ); 3291 if( !testILR && pcPic->isILR( ) && (ePartSize == SIZE_2Nx2N) )3298 if( !testILR && pcPic->isILR(pcCU->getLayerId()) && (ePartSize == SIZE_2Nx2N) ) 3292 3299 { 3293 3300 continue; … … 3326 3333 uiBitsTemp += m_auiMVPIdxCost[aaiMvpIdx[iRefList][iRefIdxTemp]][AMVP_MAX_NUM_CANDS]; 3327 3334 #if ZERO_MVD_EST 3335 #if L0034_COMBINED_LIST_CLEANUP 3336 if ( iRefList == 0 || pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp ) < 0 ) 3337 #else 3328 3338 if ((iRefList != 1 || !pcCU->getSlice()->getNoBackPredFlag()) && 3329 3339 (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) <= 0 || pcCU->getSlice()->getRefIdxOfLC(eRefPicList, iRefIdxTemp)>=0)) 3340 #endif 3330 3341 { 3331 3342 uiZeroMvdBitsTemp = uiBitsTemp; … … 3347 3358 3348 3359 #if GPB_SIMPLE_UNI 3360 #if L0034_COMBINED_LIST_CLEANUP 3361 if ( iRefList == 1 ) // list 1 3362 { 3363 if ( pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp ) >= 0 ) 3364 { 3365 cMvTemp[1][iRefIdxTemp] = cMvTemp[0][pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp )]; 3366 uiCostTemp = uiCostTempL0[pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp )]; 3367 /*first subtract the bit-rate part of the cost of the other list*/ 3368 uiCostTemp -= m_pcRdCost->getCost( uiBitsTempL0[pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp )] ); 3369 /*correct the bit-rate part of the current ref*/ 3370 m_pcRdCost->setPredictor ( cMvPred[iRefList][iRefIdxTemp] ); 3371 uiBitsTemp += m_pcRdCost->getBits( cMvTemp[1][iRefIdxTemp].getHor(), cMvTemp[1][iRefIdxTemp].getVer() ); 3372 /*calculate the correct cost*/ 3373 uiCostTemp += m_pcRdCost->getCost( uiBitsTemp ); 3374 } 3375 else 3376 { 3377 xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp ); 3378 } 3379 } 3380 else 3381 { 3382 xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp ); 3383 } 3384 #else 3349 3385 if ( pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0) 3350 3386 { … … 3388 3424 } 3389 3425 } 3426 #endif 3390 3427 #else 3391 3428 xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp ); … … 3394 3431 xCheckBestMVP(pcCU, eRefPicList, cMvTemp[iRefList][iRefIdxTemp], cMvPred[iRefList][iRefIdxTemp], aaiMvpIdx[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp); 3395 3432 3433 #if L0034_COMBINED_LIST_CLEANUP 3434 if ( iRefList == 0 ) 3435 { 3436 uiCostTempL0[iRefIdxTemp] = uiCostTemp; 3437 uiBitsTempL0[iRefIdxTemp] = uiBitsTemp; 3438 } 3439 if ( uiCostTemp < uiCost[iRefList] ) 3440 { 3441 uiCost[iRefList] = uiCostTemp; 3442 uiBits[iRefList] = uiBitsTemp; // storing for bi-prediction 3443 3444 // set motion 3445 cMv[iRefList] = cMvTemp[iRefList][iRefIdxTemp]; 3446 iRefIdx[iRefList] = iRefIdxTemp; 3447 } 3448 3449 if ( iRefList == 1 && uiCostTemp < costValidList1 && pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp ) < 0 ) 3450 { 3451 costValidList1 = uiCostTemp; 3452 bitsValidList1 = uiBitsTemp; 3453 3454 // set motion 3455 mvValidList1 = cMvTemp[iRefList][iRefIdxTemp]; 3456 refIdxValidList1 = iRefIdxTemp; 3457 } 3458 #else 3396 3459 if(pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && !pcCU->getSlice()->getNoBackPredFlag()) 3397 3460 { … … 3449 3512 } 3450 3513 } 3514 #endif 3451 3515 } 3452 3516 } … … 3516 3580 3517 3581 Int iRefList = iIter % 2; 3582 #if L0034_COMBINED_LIST_CLEANUP 3583 if ( m_pcEncCfg->getUseFastEnc() ) 3584 { 3585 if( uiCost[0] <= uiCost[1] ) 3586 { 3587 iRefList = 1; 3588 } 3589 else 3590 { 3591 iRefList = 0; 3592 } 3593 } 3594 else if ( iIter == 0 ) 3595 { 3596 iRefList = 0; 3597 } 3598 if ( iIter == 0 && !pcCU->getSlice()->getMvdL1ZeroFlag()) 3599 { 3600 pcCU->getCUMvField(RefPicList(1-iRefList))->setAllMv( cMv[1-iRefList], ePartSize, uiPartAddr, 0, iPartIdx ); 3601 pcCU->getCUMvField(RefPicList(1-iRefList))->setAllRefIdx( iRefIdx[1-iRefList], ePartSize, uiPartAddr, 0, iPartIdx ); 3602 TComYuv* pcYuvPred = &m_acYuvPred[1-iRefList]; 3603 motionCompensation ( pcCU, pcYuvPred, RefPicList(1-iRefList), iPartIdx ); 3604 } 3605 #else 3518 3606 if ( m_pcEncCfg->getUseFastEnc() && (pcCU->getSlice()->getNoBackPredFlag() || (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(0)==0 )) ) 3519 3607 { 3520 3608 iRefList = 1; 3521 3609 } 3610 #endif 3522 3611 RefPicList eRefPicList = ( iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0 ); 3523 3612 … … 3533 3622 Bool testIter = true; 3534 3623 TComPic* pcPic = pcCU->getSlice()->getRefPic( RefPicList(1 - iRefList), iRefIdxBi[1 - iRefList] ); 3535 if(pcPic->isILR( ) && (ePartSize == SIZE_2Nx2N))3624 if(pcPic->isILR(pcCU->getLayerId()) && (ePartSize == SIZE_2Nx2N)) 3536 3625 { 3537 3626 testIter = false; //the fixed part is ILR, skip this iteration … … 3548 3637 Bool testRefIdx = true; 3549 3638 pcPic = pcCU->getSlice()->getRefPic( RefPicList(iRefList) , iRefIdxTemp ); 3550 if(pcPic->isILR( ) && (ePartSize == SIZE_2Nx2N))3639 if(pcPic->isILR(pcCU->getLayerId()) && (ePartSize == SIZE_2Nx2N)) 3551 3640 { 3552 3641 testRefIdx = false; //the refined part is ILR, skip this reference pic … … 3680 3769 UInt uiMEBits = 0; 3681 3770 // Set Motion Field_ 3771 #if L0034_COMBINED_LIST_CLEANUP 3772 cMv[1] = mvValidList1; 3773 iRefIdx[1] = refIdxValidList1; 3774 uiBits[1] = bitsValidList1; 3775 uiCost[1] = costValidList1; 3776 #else 3682 3777 if ( pcCU->getSlice()->getNoBackPredFlag() || (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(0)==0 ) ) 3683 3778 { 3684 3779 uiCost[1] = MAX_UINT; 3685 3780 } 3781 #endif 3686 3782 #if AMP_MRG 3687 3783 if (bTestNormalMC) … … 4212 4308 // Do integer search 4213 4309 #if REF_IDX_ME_ZEROMV 4214 if( pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxPred )->isILR( )) //ILR reference pic4310 if( pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxPred )->isILR(pcCU->getLayerId())) //ILR reference pic 4215 4311 { 4216 4312 rcMv.setZero(); //use Mv(0, 0) for integer ME … … 4245 4341 { 4246 4342 #if REF_IDX_ME_ZEROMV 4247 if( pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxPred )->isILR( )) //ILR reference pic4343 if( pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxPred )->isILR(pcCU->getLayerId())) //ILR reference pic 4248 4344 { 4249 4345 xPatternSearchFracDIFMv0( pcCU, pcPatternKey, piRefY, iRefStride, &rcMv, cMvHalf, cMvQter, ruiCost, bBi ); … … 4663 4759 while( pcCU->getWidth(0) > (pcCU->getSlice()->getSPS()->getMaxTrSize()<<uiTrLevel) ) uiTrLevel++; 4664 4760 } 4665 UInt uiMaxTrMode = pcCU->getSlice()->getSPS()->getMaxTrDepth()+ uiTrLevel;4761 UInt uiMaxTrMode = 1 + uiTrLevel; 4666 4762 4667 4763 while((uiWidth>>uiMaxTrMode) < (g_uiMaxCUWidth>>g_uiMaxCUDepth)) uiMaxTrMode--; … … 6219 6315 for( Int refIdx = 0; refIdx < pcCU->getSlice()->getNumRefIdx(eRefPicList); refIdx++ ) 6220 6316 { 6221 if( pcCU->getSlice()->getRefPic(eRefPicList, refIdx)->isILR( ) )6317 if( pcCU->getSlice()->getRefPic(eRefPicList, refIdx)->isILR(pcCU->getLayerId()) ) 6222 6318 { 6223 6319 iRefIdxTemp = refIdx; -
trunk/source/Lib/TLibEncoder/TEncSlice.cpp
r125 r189 178 178 \param pPPS PPS associated with the slice 179 179 */ 180 #if SVC_EXTENSION 181 //\param vps VPS associated with the slice 182 Void TEncSlice::initEncSlice( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, Int iGOPid, TComSlice*& rpcSlice, TComSPS* pSPS, TComPPS *pPPS, TComVPS *vps ) 183 #else 180 184 Void TEncSlice::initEncSlice( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, Int iGOPid, TComSlice*& rpcSlice, TComSPS* pSPS, TComPPS *pPPS ) 185 #endif 181 186 { 182 187 Double dQP; … … 189 194 rpcSlice->setPic( pcPic ); 190 195 #if SVC_EXTENSION 191 rpcSlice->initSlice( pcPic->getLayerId() ); 196 UInt layerId = pcPic->getLayerId(); 197 rpcSlice->setVPS( vps ); 198 rpcSlice->initSlice( layerId ); 192 199 #else 193 200 rpcSlice->initSlice(); … … 337 344 } 338 345 346 #if JCTVC_M0259_LAMBDAREFINEMENT 347 if( rpcSlice->getLayerId() > 0 && depth >= 3 && m_pcCfg->getGOPSize() == ( 1 << depth ) ) 348 { 349 Int nCurLayer = rpcSlice->getLayerId(); 350 Double gamma = xCalEnhLambdaFactor( m_ppcTEncTop[nCurLayer-1]->getQP() - m_ppcTEncTop[nCurLayer]->getQP() , 351 1.0 * m_ppcTEncTop[nCurLayer]->getSourceWidth() * m_ppcTEncTop[nCurLayer]->getSourceHeight() 352 / m_ppcTEncTop[nCurLayer-1]->getSourceWidth() / m_ppcTEncTop[nCurLayer-1]->getSourceHeight() ); 353 dLambda *= gamma; 354 } 355 #endif 356 339 357 // store lambda 340 358 m_pcRdCost ->setLambda( dLambda ); … … 354 372 qpc = Clip3( 0, 57, iQP + chromaQPOffset); 355 373 weight = pow( 2.0, (iQP-g_aucChromaScale[qpc])/3.0 ); // takes into account of the chroma qp mapping and chroma qp Offset 374 #if JCTVC_M0259_LAMBDAREFINEMENT 375 if( rpcSlice->getLayerId() > 0 && m_pcCfg->getGOPSize() >= 8 && rpcSlice->isIntra() == false && depth == 0 ) 376 { 377 dLambda *= 1.1; 378 weight *= 1.15; 379 } 380 #endif 356 381 m_pcRdCost->setCrDistortionWeight(weight); 357 382 #endif … … 400 425 rpcSlice->setNumRefIdx(REF_PIC_LIST_1,m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive); 401 426 427 #if L0386_DB_METRIC 428 if ( m_pcCfg->getDeblockingFilterMetric() ) 429 { 430 rpcSlice->setDeblockingFilterOverrideFlag(true); 431 rpcSlice->setDeblockingFilterDisable(false); 432 rpcSlice->setDeblockingFilterBetaOffsetDiv2( 0 ); 433 rpcSlice->setDeblockingFilterTcOffsetDiv2( 0 ); 434 } else 435 #endif 402 436 if (rpcSlice->getPPS()->getDeblockingFilterControlPresentFlag()) 403 437 { … … 452 486 rpcSlice->setMaxNumMergeCand ( m_pcCfg->getMaxNumMergeCand() ); 453 487 xStoreWPparam( pPPS->getUseWP(), pPPS->getWPBiPred() ); 488 489 #if SVC_EXTENSION && REF_IDX_FRAMEWORK 490 if( layerId > 0 ) 491 { 492 #if JCTVC_M0458_INTERLAYER_RPS_SIG 493 // currently only one reference layer is supported in software and no decision logic to select yet. 494 // hence num of active inter layer references is set to one always 495 if( rpcSlice->getNumILRRefIdx() > 0 ) 496 { 497 rpcSlice->setActiveNumILRRefIdx(1); 498 rpcSlice->setInterLayerPredEnabledFlag(1); 499 } 500 #else 501 rpcSlice->setNumILRRefIdx( rpcSlice->getVPS()->getNumDirectRefLayers( layerId ) ); 502 #endif 503 } 504 505 #endif 454 506 } 455 507 … … 1182 1234 \retval rpcBitstream bitstream class 1183 1235 */ 1184 Void TEncSlice::encodeSlice ( TComPic*& rpcPic, TComOutputBitstream* pc Bitstream, TComOutputBitstream* pcSubstreams )1236 Void TEncSlice::encodeSlice ( TComPic*& rpcPic, TComOutputBitstream* pcSubstreams ) 1185 1237 { 1186 1238 UInt uiCUAddr; … … 1362 1414 } 1363 1415 { 1364 UInt uiCounter = 0; 1365 vector<uint8_t>& rbsp = pcSubstreams[uiSubStrm].getFIFO(); 1366 for (vector<uint8_t>::iterator it = rbsp.begin(); it != rbsp.end();) 1367 { 1368 /* 1) find the next emulated 00 00 {00,01,02,03} 1369 * 2a) if not found, write all remaining bytes out, stop. 1370 * 2b) otherwise, write all non-emulated bytes out 1371 * 3) insert emulation_prevention_three_byte 1372 */ 1373 vector<uint8_t>::iterator found = it; 1374 do 1375 { 1376 /* NB, end()-1, prevents finding a trailing two byte sequence */ 1377 found = search_n(found, rbsp.end()-1, 2, 0); 1378 found++; 1379 /* if not found, found == end, otherwise found = second zero byte */ 1380 if (found == rbsp.end()) 1381 { 1382 break; 1383 } 1384 if (*(++found) <= 3) 1385 { 1386 break; 1387 } 1388 } while (true); 1389 it = found; 1390 if (found != rbsp.end()) 1391 { 1392 it++; 1393 uiCounter++; 1394 } 1395 } 1396 1416 UInt numStartCodeEmulations = pcSubstreams[uiSubStrm].countStartCodeEmulations(); 1397 1417 UInt uiAccumulatedSubstreamLength = 0; 1398 1418 for (Int iSubstrmIdx=0; iSubstrmIdx < iNumSubstreams; iSubstrmIdx++) … … 1402 1422 // add bits coded in previous dependent slices + bits coded so far 1403 1423 // add number of emulation prevention byte count in the tile 1404 pcSlice->addTileLocation( ((pcSlice->getTileOffstForMultES() + uiAccumulatedSubstreamLength - uiBitsOriginallyInSubstreams) >> 3) + uiCounter);1424 pcSlice->addTileLocation( ((pcSlice->getTileOffstForMultES() + uiAccumulatedSubstreamLength - uiBitsOriginallyInSubstreams) >> 3) + numStartCodeEmulations ); 1405 1425 } 1406 1426 } … … 1875 1895 } 1876 1896 1897 #if JCTVC_M0259_LAMBDAREFINEMENT 1898 Double TEncSlice::xCalEnhLambdaFactor( Double deltaQP , Double beta ) 1899 { 1900 double tmp = beta * pow( 2.0 , deltaQP / 6 ); 1901 double gamma = tmp / ( tmp + 1 ); 1902 return( gamma ); 1903 } 1904 #endif 1877 1905 //! \} -
trunk/source/Lib/TLibEncoder/TEncSlice.h
r125 r189 116 116 117 117 /// preparation of slice encoding (reference marking, QP and lambda) 118 #if SVC_EXTENSION 119 Void initEncSlice ( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, 120 Int iGOPid, TComSlice*& rpcSlice, TComSPS* pSPS, TComPPS *pPPS, TComVPS *vps ); 121 #else 118 122 Void initEncSlice ( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, 119 123 Int iGOPid, TComSlice*& rpcSlice, TComSPS* pSPS, TComPPS *pPPS ); 124 #endif 125 120 126 #if RATE_CONTROL_LAMBDA_DOMAIN 121 127 Void resetQP ( TComPic* pic, Int sliceQP, Double lambda ); … … 126 132 Void precompressSlice ( TComPic*& rpcPic ); ///< precompress slice for multi-loop opt. 127 133 Void compressSlice ( TComPic*& rpcPic ); ///< analysis stage of slice 128 Void encodeSlice ( TComPic*& rpcPic, TComOutputBitstream* rpcBitstream, TComOutputBitstream*pcSubstreams );134 Void encodeSlice ( TComPic*& rpcPic, TComOutputBitstream* pcSubstreams ); 129 135 130 136 // misc. functions … … 141 147 private: 142 148 Double xGetQPValueAccordingToLambda ( Double lambda ); 149 150 #if JCTVC_M0259_LAMBDAREFINEMENT 151 private: 152 Double xCalEnhLambdaFactor( Double deltaQP , Double beta ); 153 #endif 143 154 }; 144 155 -
trunk/source/Lib/TLibEncoder/TEncTop.cpp
r125 r189 294 294 if(m_cIlpPic[i]) 295 295 { 296 //m_cIlpPic[i]->setPicYuvRec(NULL);297 296 m_cIlpPic[i]->destroy(); 298 297 delete m_cIlpPic[i]; … … 500 499 { 501 500 TEncPic* pcEPic = new TEncPic; 501 502 502 #if SVC_EXTENSION //Temporal solution, should be modified 503 503 if(m_layerId > 0) 504 504 { 505 #if VPS_EXTN_DIRECT_REF_LAYERS_CONTINUE 506 TEncTop *pcEncTopBase = (TEncTop *)getRefLayerEnc( m_layerId ); 507 #else 505 508 TEncTop *pcEncTopBase = (TEncTop *)getLayerEnc( m_layerId-1 ); 509 #endif 506 510 if(m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() ) 507 511 { … … 527 531 if(m_layerId > 0) 528 532 { 533 #if VPS_EXTN_DIRECT_REF_LAYERS_CONTINUE 534 TEncTop *pcEncTopBase = (TEncTop *)getRefLayerEnc( m_layerId ); 535 #else 529 536 TEncTop *pcEncTopBase = (TEncTop *)getLayerEnc( m_layerId-1 ); 537 #endif 530 538 if(m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() ) 531 539 { … … 543 551 #endif 544 552 } 553 545 554 if (getUseSAO()) 546 555 { … … 566 575 #if REF_IDX_MFM 567 576 m_cSPS.setMFMEnabledFlag(m_bMFMEnabledFlag); 577 #endif 578 #if SCALED_REF_LAYER_OFFSETS 579 m_cSPS.getScaledRefLayerWindow() = m_scaledRefLayerWindow; 568 580 #endif 569 581 ProfileTierLevel& profileTierLevel = *m_cSPS.getPTL()->getGeneralPTL(); … … 599 611 m_cSPS.setMaxCUHeight ( g_uiMaxCUHeight ); 600 612 m_cSPS.setMaxCUDepth ( g_uiMaxCUDepth ); 601 m_cSPS.setMinTrDepth ( 0 ); 602 m_cSPS.setMaxTrDepth ( 1 ); 613 614 Int minCUSize = m_cSPS.getMaxCUWidth() >> ( m_cSPS.getMaxCUDepth()-g_uiAddCUDepth ); 615 Int log2MinCUSize = 0; 616 while(minCUSize > 1) 617 { 618 minCUSize >>= 1; 619 log2MinCUSize++; 620 } 621 622 m_cSPS.setLog2MinCodingBlockSize(log2MinCUSize); 623 m_cSPS.setLog2DiffMaxMinCodingBlockSize(m_cSPS.getMaxCUDepth()-g_uiAddCUDepth); 603 624 #if SVC_EXTENSION 604 625 m_cSPS.setSPSId ( m_iSPSIdCnt ); … … 618 639 619 640 m_cSPS.setMaxTrSize ( 1 << m_uiQuadtreeTULog2MaxSize ); 620 641 #if !L0034_COMBINED_LIST_CLEANUP 621 642 m_cSPS.setUseLComb ( m_bUseLComb ); 643 #endif 622 644 623 645 Int i; … … 763 785 m_cPPS.setOutputFlagPresentFlag( false ); 764 786 m_cPPS.setSignHideFlag(getSignHideFlag()); 787 #if L0386_DB_METRIC 788 if ( getDeblockingFilterMetric() ) 789 { 790 m_cPPS.setDeblockingFilterControlPresentFlag (true); 791 m_cPPS.setDeblockingFilterOverrideEnabledFlag(true); 792 m_cPPS.setPicDisableDeblockingFilterFlag(false); 793 m_cPPS.setDeblockingFilterBetaOffsetDiv2(0); 794 m_cPPS.setDeblockingFilterTcOffsetDiv2(0); 795 } 796 else 797 { 765 798 m_cPPS.setDeblockingFilterControlPresentFlag (m_DeblockingFilterControlPresent ); 799 } 800 #else 801 m_cPPS.setDeblockingFilterControlPresentFlag (m_DeblockingFilterControlPresent ); 802 #endif 766 803 m_cPPS.setLog2ParallelMergeLevelMinus2 (m_log2ParallelMergeLevelMinus2 ); 767 804 m_cPPS.setCabacInitPresentFlag(CABAC_INIT_PRESENT_FLAG); … … 810 847 } 811 848 } 812 #if REF_ LIST_BUGFIX849 #if REF_IDX_FRAMEWORK 813 850 if (!m_layerId) 814 851 { … … 1036 1073 } 1037 1074 1075 #if L0208_SOP_DESCRIPTION_SEI 1076 Int TEncTop::getReferencePictureSetIdxForSOP(TComSlice* slice, Int POCCurr, Int GOPid ) 1077 { 1078 int rpsIdx = GOPid; 1079 1080 for(Int extraNum=m_iGOPSize; extraNum<m_extraRPSs+m_iGOPSize; extraNum++) 1081 { 1082 if(m_uiIntraPeriod > 0 && getDecodingRefreshType() > 0) 1083 { 1084 Int POCIndex = POCCurr%m_uiIntraPeriod; 1085 if(POCIndex == 0) 1086 { 1087 POCIndex = m_uiIntraPeriod; 1088 } 1089 if(POCIndex == m_GOPList[extraNum].m_POC) 1090 { 1091 rpsIdx = extraNum; 1092 } 1093 } 1094 else 1095 { 1096 if(POCCurr==m_GOPList[extraNum].m_POC) 1097 { 1098 rpsIdx = extraNum; 1099 } 1100 } 1101 } 1102 1103 return rpsIdx; 1104 } 1105 #endif 1106 1038 1107 Void TEncTop::xInitPPSforTiles() 1039 1108 { … … 1118 1187 } 1119 1188 1189 #if SVC_EXTENSION 1190 #if VPS_EXTN_DIRECT_REF_LAYERS_CONTINUE 1191 TEncTop* TEncTop::getRefLayerEnc( UInt layerId ) 1192 { 1193 if( m_ppcTEncTop[m_layerId]->getNumDirectRefLayers() <= 0 ) 1194 { 1195 #if ZERO_NUM_DIRECT_LAYERS 1196 return (TEncTop *)getLayerEnc( 0 ); 1197 #else 1198 return NULL; 1199 #endif 1200 } 1201 1202 // currently only one reference layer is supported 1203 assert( m_ppcTEncTop[m_layerId]->getNumDirectRefLayers() == 1 ); 1204 1205 return (TEncTop *)getLayerEnc( getVPS()->getRefLayerId( m_layerId, 0 ) ); 1206 } 1207 #endif 1208 1120 1209 #if REF_IDX_FRAMEWORK 1121 1210 Void TEncTop::xInitILRP() … … 1123 1212 if(m_layerId>0) 1124 1213 { 1214 g_bitDepthY = m_cSPS.getBitDepthY(); 1215 g_bitDepthC = m_cSPS.getBitDepthC(); 1216 g_uiMaxCUWidth = m_cSPS.getMaxCUWidth(); 1217 g_uiMaxCUHeight = m_cSPS.getMaxCUHeight(); 1218 g_uiMaxCUDepth = m_cSPS.getMaxCUDepth(); 1219 g_uiAddCUDepth = max (0, m_cSPS.getLog2MinCodingBlockSize() - (Int)m_cSPS.getQuadtreeTULog2MinSize() ); 1220 1125 1221 Int numReorderPics[MAX_TLAYER]; 1126 1222 Window &conformanceWindow = m_cSPS.getConformanceWindow(); … … 1132 1228 { 1133 1229 m_cIlpPic[j] = new TComPic; 1134 //m_cIlpPic[j]->createWithOutYuv(m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, &m_cSPS, true);1135 1230 #if SVC_UPSAMPLING 1136 1231 m_cIlpPic[j]->create(m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, &m_cSPS, true); … … 1151 1246 if(m_cIlpPic[0]) 1152 1247 { 1153 //m_cIlpPic[0]->setPicYuvRec(pcPic->getFullPelBaseRec());1154 1248 m_cIlpPic[0]->copyUpsampledPictureYuv(pcPic->getFullPelBaseRec(), m_cIlpPic[0]->getPicYuvRec()); 1155 1249 m_cIlpPic[0]->getSlice(0)->setPOC(pcPic->getPOC()); 1156 m_cIlpPic[0]->setLayerId( 0); //set reference layerId1250 m_cIlpPic[0]->setLayerId(pcPic->getSlice(0)->getBaseColPic()->getLayerId()); //set reference layerId 1157 1251 m_cIlpPic[0]->getPicYuvRec()->setBorderExtension(false); 1158 1252 m_cIlpPic[0]->getPicYuvRec()->extendPicBorder(); … … 1160 1254 } 1161 1255 #endif 1256 #endif 1162 1257 //! \} -
trunk/source/Lib/TLibEncoder/TEncTop.h
r125 r189 139 139 Bool m_bMFMEnabledFlag; 140 140 #endif 141 #if SCALED_REF_LAYER_OFFSETS 142 Window m_scaledRefLayerWindow; 143 #endif 141 144 protected: 142 145 Void xGetNewPicBuffer ( TComPic*& rpcPic ); ///< get picture buffer which will be processed … … 192 195 TComPPS* getPPS () { return &m_cPPS; } 193 196 Void selectReferencePictureSet(TComSlice* slice, Int POCCurr, Int GOPid ); 197 #if L0208_SOP_DESCRIPTION_SEI 198 Int getReferencePictureSetIdxForSOP(TComSlice* slice, Int POCCurr, Int GOPid ); 199 #endif 194 200 TComScalingList* getScalingList () { return &m_scalingList; } 195 201 #if SVC_EXTENSION … … 200 206 Void setNumPicRcvd ( Int num ) { m_iNumPicRcvd = num; } 201 207 #endif 208 #if SCALED_REF_LAYER_OFFSETS 209 Window& getScaledRefLayerWindow() { return m_scaledRefLayerWindow; } 210 #endif 202 211 203 212 // ------------------------------------------------------------------------------------------------------------------- … … 209 218 #if REF_IDX_FRAMEWORK 210 219 TComPic** getIlpList() { return m_cIlpPic; } 211 Void setILRPic(TComPic *pcPic);220 Void setILRPic(TComPic *pcPic); 212 221 #endif 213 222 #if REF_IDX_MFM 214 Void setMFMEnabledFlag (Bool flag) {m_bMFMEnabledFlag = flag;}215 Bool getMFMEnabledFlag() {return m_bMFMEnabledFlag;}223 Void setMFMEnabledFlag (Bool flag) {m_bMFMEnabledFlag = flag;} 224 Bool getMFMEnabledFlag() {return m_bMFMEnabledFlag;} 216 225 #endif 217 226 #if AVC_SYNTAX … … 219 228 fstream* getBLSyntaxFile() { return m_pBLSyntaxFile; } 220 229 #endif 221 Void encode( TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, 222 std::list<AccessUnit>& accessUnitsOut, Int iPicIdInGOP ); 223 Void encodePrep( TComPicYuv* pcPicYuvOrg ); 230 Void encode( TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int iPicIdInGOP ); 231 Void encodePrep( TComPicYuv* pcPicYuvOrg ); 232 #if VPS_EXTN_DIRECT_REF_LAYERS_CONTINUE 233 TEncTop* getRefLayerEnc(UInt layerId); 234 #endif 224 235 #else 225 236 Void encode( Bool bEos, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, -
trunk/source/Lib/TLibEncoder/WeightPredAnalysis.cpp
r125 r189 235 235 Int offset = (Int)( ((currDC<<log2Denom) - ((Int64)weight * refDC) + (Int64)realOffset) >> realLog2Denom ); 236 236 237 // Chroma offset range limi nation237 // Chroma offset range limitation 238 238 if(comp) 239 239 { 240 Int shift = 1 << (g_bitDepthC - 1); 241 Int pred = ( shift - ( ( shift*weight)>>(log2Denom) ) ); 240 Int pred = ( 128 - ( ( 128*weight)>>(log2Denom) ) ); 242 241 Int deltaOffset = Clip3( -512, 511, (offset - pred) ); // signed 10bit 243 242 offset = Clip3( -128, 127, (deltaOffset + pred) ); // signed 8bit 243 } 244 // Luma offset range limitation 245 else 246 { 247 offset = Clip3( -128, 127, offset); 244 248 } 245 249
Note: See TracChangeset for help on using the changeset viewer.