Changeset 362 in 3DVCSoftware for branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder
- Timestamp:
- 3 May 2013, 15:34:11 (12 years ago)
- Location:
- branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/SEIwrite.cpp
r324 r362 84 84 fprintf( g_hTrace, "=========== Decoding Unit Information SEI message ===========\n"); 85 85 break; 86 #if J0149_TONE_MAPPING_SEI 87 case SEI::TONE_MAPPING_INFO: 88 fprintf( g_hTrace, "=========== Tone Mapping Info SEI message ===========\n"); 89 break; 90 #endif 91 #if L0208_SOP_DESCRIPTION_SEI 92 case SEI::SOP_DESCRIPTION: 93 fprintf( g_hTrace, "=========== SOP Description SEI message ===========\n"); 94 break; 95 #endif 96 #if K0180_SCALABLE_NESTING_SEI 97 case SEI::SCALABLE_NESTING: 98 fprintf( g_hTrace, "=========== Scalable Nesting SEI message ===========\n"); 99 break; 100 #endif 86 101 default: 87 102 fprintf( g_hTrace, "=========== Unknown SEI message ===========\n"); … … 91 106 #endif 92 107 108 #if K0180_SCALABLE_NESTING_SEI 109 void SEIWriter::xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComSPS *sps) 110 #else 93 111 void SEIWriter::xWriteSEIpayloadData(const SEI& sei, TComSPS *sps) 112 #endif 94 113 { 95 114 switch (sei.payloadType()) … … 128 147 xWriteSEIGradualDecodingRefreshInfo(*static_cast<const SEIGradualDecodingRefreshInfo*>(&sei)); 129 148 break; 149 #if J0149_TONE_MAPPING_SEI 150 case SEI::TONE_MAPPING_INFO: 151 xWriteSEIToneMappingInfo(*static_cast<const SEIToneMappingInfo*>(&sei)); 152 break; 153 #endif 154 #if L0208_SOP_DESCRIPTION_SEI 155 case SEI::SOP_DESCRIPTION: 156 xWriteSEISOPDescription(*static_cast<const SEISOPDescription*>(&sei)); 157 break; 158 #endif 159 #if K0180_SCALABLE_NESTING_SEI 160 case SEI::SCALABLE_NESTING: 161 xWriteSEIScalableNesting(bs, *static_cast<const SEIScalableNesting*>(&sei), sps); 162 break; 163 #endif 130 164 default: 131 165 assert(!"Unhandled SEI message"); … … 145 179 setBitstream(&bs_count); 146 180 181 182 #if K0180_SCALABLE_NESTING_SEI 183 184 #if ENC_DEC_TRACE 185 Bool traceEnable = g_HLSTraceEnable; 186 g_HLSTraceEnable = false; 187 #endif 188 xWriteSEIpayloadData(bs_count, sei, sps); 189 #if ENC_DEC_TRACE 190 g_HLSTraceEnable = traceEnable; 191 #endif 192 193 #else 194 147 195 #if ENC_DEC_TRACE 148 196 g_HLSTraceEnable = false; … … 152 200 g_HLSTraceEnable = true; 153 201 #endif 202 203 #endif 204 154 205 UInt payload_data_num_bits = bs_count.getNumberOfWrittenBits(); 155 206 assert(0 == payload_data_num_bits % 8); … … 158 209 159 210 #if ENC_DEC_TRACE 211 #if K0180_SCALABLE_NESTING_SEI 212 if (g_HLSTraceEnable) 213 #endif 160 214 xTraceSEIHeader(); 161 215 #endif … … 177 231 /* payloadData */ 178 232 #if ENC_DEC_TRACE 233 #if K0180_SCALABLE_NESTING_SEI 234 if (g_HLSTraceEnable) 235 #endif 179 236 xTraceSEIMessageType(sei.payloadType()); 180 237 #endif 181 238 239 #if K0180_SCALABLE_NESTING_SEI 240 xWriteSEIpayloadData(bs, sei, sps); 241 #else 182 242 xWriteSEIpayloadData(sei, sps); 243 #endif 183 244 } 184 245 … … 421 482 xWriteByteAlign(); 422 483 } 484 485 #if J0149_TONE_MAPPING_SEI 486 Void SEIWriter::xWriteSEIToneMappingInfo(const SEIToneMappingInfo& sei) 487 { 488 Int i; 489 WRITE_UVLC( sei.m_toneMapId, "tone_map_id" ); 490 WRITE_FLAG( sei.m_toneMapCancelFlag, "tone_map_cancel_flag" ); 491 if( !sei.m_toneMapCancelFlag ) 492 { 493 WRITE_FLAG( sei.m_toneMapPersistenceFlag, "tone_map_persistence_flag" ); 494 WRITE_CODE( sei.m_codedDataBitDepth, 8, "coded_data_bit_depth" ); 495 WRITE_CODE( sei.m_targetBitDepth, 8, "target_bit_depth" ); 496 WRITE_UVLC( sei.m_modelId, "model_id" ); 497 switch(sei.m_modelId) 498 { 499 case 0: 500 { 501 WRITE_CODE( sei.m_minValue, 32, "min_value" ); 502 WRITE_CODE( sei.m_maxValue, 32, "max_value" ); 503 break; 504 } 505 case 1: 506 { 507 WRITE_CODE( sei.m_sigmoidMidpoint, 32, "sigmoid_midpoint" ); 508 WRITE_CODE( sei.m_sigmoidWidth, 32, "sigmoid_width" ); 509 break; 510 } 511 case 2: 512 { 513 UInt num = 1u << sei.m_targetBitDepth; 514 for(i = 0; i < num; i++) 515 { 516 WRITE_CODE( sei.m_startOfCodedInterval[i], (( sei.m_codedDataBitDepth + 7 ) >> 3 ) << 3, "start_of_coded_interval" ); 517 } 518 break; 519 } 520 case 3: 521 { 522 WRITE_CODE( sei.m_numPivots, 16, "num_pivots" ); 523 for(i = 0; i < sei.m_numPivots; i++ ) 524 { 525 WRITE_CODE( sei.m_codedPivotValue[i], (( sei.m_codedDataBitDepth + 7 ) >> 3 ) << 3, "coded_pivot_value" ); 526 WRITE_CODE( sei.m_targetPivotValue[i], (( sei.m_targetBitDepth + 7 ) >> 3 ) << 3, "target_pivot_value"); 527 } 528 break; 529 } 530 case 4: 531 { 532 WRITE_CODE( sei.m_cameraIsoSpeedIdc, 8, "camera_iso_speed_idc" ); 533 if( sei.m_cameraIsoSpeedIdc == 255) //Extended_ISO 534 { 535 WRITE_CODE( sei.m_cameraIsoSpeedValue, 32, "camera_iso_speed_value" ); 536 } 537 WRITE_FLAG( sei.m_exposureCompensationValueSignFlag, "exposure_compensation_value_sign_flag" ); 538 WRITE_CODE( sei.m_exposureCompensationValueNumerator, 16, "exposure_compensation_value_numerator" ); 539 WRITE_CODE( sei.m_exposureCompensationValueDenomIdc, 16, "exposure_compensation_value_denom_idc" ); 540 WRITE_CODE( sei.m_refScreenLuminanceWhite, 32, "ref_screen_luminance_white" ); 541 WRITE_CODE( sei.m_extendedRangeWhiteLevel, 32, "extended_range_white_level" ); 542 WRITE_CODE( sei.m_nominalBlackLevelLumaCodeValue, 16, "nominal_black_level_luma_code_value" ); 543 WRITE_CODE( sei.m_nominalWhiteLevelLumaCodeValue, 16, "nominal_white_level_luma_code_value" ); 544 WRITE_CODE( sei.m_extendedWhiteLevelLumaCodeValue, 16, "extended_white_level_luma_code_value" ); 545 break; 546 } 547 default: 548 { 549 assert(!"Undefined SEIToneMapModelId"); 550 break; 551 } 552 }//switch m_modelId 553 }//if(!sei.m_toneMapCancelFlag) 554 555 xWriteByteAlign(); 556 } 557 #endif 558 423 559 Void SEIWriter::xWriteSEIDisplayOrientation(const SEIDisplayOrientation &sei) 424 560 { … … 455 591 } 456 592 593 #if L0208_SOP_DESCRIPTION_SEI 594 Void SEIWriter::xWriteSEISOPDescription(const SEISOPDescription& sei) 595 { 596 WRITE_UVLC( sei.m_sopSeqParameterSetId, "sop_seq_parameter_set_id" ); 597 WRITE_UVLC( sei.m_numPicsInSopMinus1, "num_pics_in_sop_minus1" ); 598 for (UInt i = 0; i <= sei.m_numPicsInSopMinus1; i++) 599 { 600 WRITE_CODE( sei.m_sopDescVclNaluType[i], 6, "sop_desc_vcl_nalu_type" ); 601 WRITE_CODE( sei.m_sopDescTemporalId[i], 3, "sop_desc_temporal_id" ); 602 if (sei.m_sopDescVclNaluType[i] != NAL_UNIT_CODED_SLICE_IDR_W_RADL && sei.m_sopDescVclNaluType[i] != NAL_UNIT_CODED_SLICE_IDR_N_LP) 603 { 604 WRITE_UVLC( sei.m_sopDescStRpsIdx[i], "sop_desc_st_rps_idx" ); 605 } 606 if (i > 0) 607 { 608 WRITE_SVLC( sei.m_sopDescPocDelta[i], "sop_desc_poc_delta" ); 609 } 610 } 611 612 xWriteByteAlign(); 613 } 614 #endif 615 616 #if K0180_SCALABLE_NESTING_SEI 617 Void SEIWriter::xWriteSEIScalableNesting(TComBitIf& bs, const SEIScalableNesting& sei, TComSPS *sps) 618 { 619 WRITE_FLAG( sei.m_bitStreamSubsetFlag, "bitstream_subset_flag" ); 620 WRITE_FLAG( sei.m_nestingOpFlag, "nesting_op_flag " ); 621 if (sei.m_nestingOpFlag) 622 { 623 WRITE_FLAG( sei.m_defaultOpFlag, "default_op_flag" ); 624 WRITE_UVLC( sei.m_nestingNumOpsMinus1, "nesting_num_ops" ); 625 for (UInt i = (sei.m_defaultOpFlag ? 1 : 0); i <= sei.m_nestingNumOpsMinus1; i++) 626 { 627 WRITE_CODE( sei.m_nestingNoOpMaxTemporalIdPlus1, 3, "nesting_no_op_max_temporal_id" ); 628 WRITE_CODE( sei.m_nestingMaxTemporalIdPlus1[i], 3, "nesting_max_temporal_id" ); 629 WRITE_UVLC( sei.m_nestingOpIdx[i], "nesting_op_idx" ); 630 } 631 } 632 else 633 { 634 WRITE_FLAG( sei.m_allLayersFlag, "all_layers_flag" ); 635 if (!sei.m_allLayersFlag) 636 { 637 WRITE_CODE( sei.m_nestingNoOpMaxTemporalIdPlus1, 3, "nesting_no_op_max_temporal_id" ); 638 WRITE_UVLC( sei.m_nestingNumLayersMinus1, "nesting_num_layers" ); 639 for (UInt i = 0; i <= sei.m_nestingNumLayersMinus1; i++) 640 { 641 WRITE_CODE( sei.m_nestingLayerId[i], 6, "nesting_layer_id" ); 642 } 643 } 644 } 645 646 // byte alignment 647 while ( m_pcBitIf->getNumberOfWrittenBits() % 8 != 0 ) 648 { 649 WRITE_FLAG( 0, "nesting_zero_bit" ); 650 } 651 652 // write nested SEI messages 653 for (SEIMessages::const_iterator it = sei.m_nestedSEIs.begin(); it != sei.m_nestedSEIs.end(); it++) 654 { 655 writeSEImessage(bs, *(*it), sps); 656 } 657 } 658 #endif 659 457 660 Void SEIWriter::xWriteByteAlign() 458 661 { -
branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/SEIwrite.h
r324 r362 50 50 51 51 protected: 52 #if K0180_SCALABLE_NESTING_SEI 53 Void xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComSPS *sps); 54 #else 52 55 Void xWriteSEIpayloadData(const SEI& sei, TComSPS *sps); 56 #endif 53 57 Void xWriteSEIuserDataUnregistered(const SEIuserDataUnregistered &sei); 54 58 Void xWriteSEIActiveParameterSets(const SEIActiveParameterSets& sei); … … 63 67 Void xWriteSEITemporalLevel0Index(const SEITemporalLevel0Index &sei); 64 68 Void xWriteSEIGradualDecodingRefreshInfo(const SEIGradualDecodingRefreshInfo &sei); 69 #if J0149_TONE_MAPPING_SEI 70 Void xWriteSEIToneMappingInfo(const SEIToneMappingInfo& sei); 71 #endif 72 #if L0208_SOP_DESCRIPTION_SEI 73 Void xWriteSEISOPDescription(const SEISOPDescription& sei); 74 #endif 75 #if K0180_SCALABLE_NESTING_SEI 76 Void xWriteSEIScalableNesting(TComBitIf& bs, const SEIScalableNesting& sei, TComSPS *sps); 77 #endif 65 78 Void xWriteByteAlign(); 66 79 }; -
branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/TEncCavlc.cpp
r331 r362 285 285 WRITE_FLAG(pcVUI->getNeutralChromaIndicationFlag(), "neutral_chroma_indication_flag"); 286 286 WRITE_FLAG(pcVUI->getFieldSeqFlag(), "field_seq_flag"); 287 assert(pcVUI->getFieldSeqFlag() == 0); // not currently supported288 287 WRITE_FLAG(pcVUI->getFrameFieldInfoPresentFlag(), "frame_field_info_present_flag"); 289 288 … … 474 473 for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++) 475 474 { 475 #if L0323_DPB 476 WRITE_UVLC( pcSPS->getMaxDecPicBuffering(i) - 1, "sps_max_dec_pic_buffering_minus1[i]" ); 477 #else 476 478 WRITE_UVLC( pcSPS->getMaxDecPicBuffering(i), "sps_max_dec_pic_buffering[i]" ); 479 #endif 477 480 WRITE_UVLC( pcSPS->getNumReorderPics(i), "sps_num_reorder_pics[i]" ); 478 481 WRITE_UVLC( pcSPS->getMaxLatencyIncrease(i), "sps_max_latency_increase[i]" ); … … 484 487 assert( pcSPS->getMaxCUWidth() == pcSPS->getMaxCUHeight() ); 485 488 486 UInt MinCUSize = pcSPS->getMaxCUWidth() >> ( pcSPS->getMaxCUDepth()-g_uiAddCUDepth ); 487 UInt log2MinCUSize = 0; 488 while(MinCUSize > 1) 489 { 490 MinCUSize >>= 1; 491 log2MinCUSize++; 492 } 493 494 WRITE_UVLC( log2MinCUSize - 3, "log2_min_coding_block_size_minus3" ); 495 WRITE_UVLC( pcSPS->getMaxCUDepth()-g_uiAddCUDepth, "log2_diff_max_min_coding_block_size" ); 489 WRITE_UVLC( pcSPS->getLog2MinCodingBlockSize() - 3, "log2_min_coding_block_size_minus3" ); 490 WRITE_UVLC( pcSPS->getLog2DiffMaxMinCodingBlockSize(), "log2_diff_max_min_coding_block_size" ); 496 491 WRITE_UVLC( pcSPS->getQuadtreeTULog2MinSize() - 2, "log2_min_transform_block_size_minus2" ); 497 492 WRITE_UVLC( pcSPS->getQuadtreeTULog2MaxSize() - pcSPS->getQuadtreeTULog2MinSize(), "log2_diff_max_min_transform_block_size" ); … … 575 570 WRITE_FLAG( pcVPS->getTemporalNestingFlag(), "vps_temporal_id_nesting_flag" ); 576 571 assert (pcVPS->getMaxTLayers()>1||pcVPS->getTemporalNestingFlag()); 572 #if H_MV 577 573 WRITE_CODE( 0xffff, 16, "vps_extension_offset" ); 574 #else 575 WRITE_CODE( 0xffff, 16, "vps_reserved_ffff_16bits" ); 576 #endif 578 577 codePTL( pcVPS->getPTL(), true, pcVPS->getMaxTLayers() - 1 ); 579 578 #if SIGNAL_BITRATE_PICRATE_IN_VPS … … 584 583 for(UInt i=0; i <= pcVPS->getMaxTLayers()-1; i++) 585 584 { 585 #if L0323_DPB 586 WRITE_UVLC( pcVPS->getMaxDecPicBuffering(i) - 1, "vps_max_dec_pic_buffering_minus1[i]" ); 587 #else 586 588 WRITE_UVLC( pcVPS->getMaxDecPicBuffering(i), "vps_max_dec_pic_buffering[i]" ); 589 #endif 587 590 WRITE_UVLC( pcVPS->getNumReorderPics(i), "vps_num_reorder_pics[i]" ); 588 591 WRITE_UVLC( pcVPS->getMaxLatencyIncrease(i), "vps_max_latency_increase[i]" ); … … 790 793 WRITE_CODE( picOrderCntLSB, pcSlice->getSPS()->getBitsForPOC(), "pic_order_cnt_lsb"); 791 794 TComReferencePictureSet* rps = pcSlice->getRPS(); 795 796 #if FIX1071 797 // Deal with bitstream restriction stating that: 798 // – If the current picture is a BLA or CRA picture, the value of NumPocTotalCurr shall be equal to 0. 799 // Ideally this process should not be repeated for each slice in a picture 800 TComReferencePictureSet altRps; 801 Bool useAltRps = false; 802 if (pcSlice->getRapPicFlag()) 803 { 804 for (Int picIdx = 0; !useAltRps && picIdx < rps->getNumberOfPictures(); picIdx++) 805 { 806 useAltRps = rps->getUsed(picIdx); 807 } 808 if (useAltRps) 809 { 810 memcpy(&altRps, rps, sizeof(TComReferencePictureSet)); 811 rps = &altRps; 812 for (Int picIdx = 0; picIdx < rps->getNumberOfPictures(); picIdx++) 813 { 814 rps->setUsed(picIdx, false); 815 } 816 } 817 } 818 819 if(pcSlice->getRPSidx() < 0 || useAltRps) 820 #else 792 821 if(pcSlice->getRPSidx() < 0) 822 #endif 793 823 { 794 824 WRITE_FLAG( 0, "short_term_ref_pic_set_sps_flag"); … … 1373 1403 // ==================================================================================================================== 1374 1404 1375 1376 /** Write PCM alignment bits.1377 * \returns Void1378 */1379 Void TEncCavlc::xWritePCMAlignZero ()1380 {1381 m_pcBitIf->writeAlignZero();1382 }1383 1384 Void TEncCavlc::xWriteUnaryMaxSymbol( UInt uiSymbol, UInt uiMaxSymbol )1385 {1386 if (uiMaxSymbol == 0)1387 {1388 return;1389 }1390 xWriteFlag( uiSymbol ? 1 : 0 );1391 if ( uiSymbol == 0 )1392 {1393 return;1394 }1395 1396 Bool bCodeLast = ( uiMaxSymbol > uiSymbol );1397 1398 while( --uiSymbol )1399 {1400 xWriteFlag( 1 );1401 }1402 if( bCodeLast )1403 {1404 xWriteFlag( 0 );1405 }1406 return;1407 }1408 1409 Void TEncCavlc::xWriteExGolombLevel( UInt uiSymbol )1410 {1411 if( uiSymbol )1412 {1413 xWriteFlag( 1 );1414 UInt uiCount = 0;1415 Bool bNoExGo = (uiSymbol < 13);1416 1417 while( --uiSymbol && ++uiCount < 13 )1418 {1419 xWriteFlag( 1 );1420 }1421 if( bNoExGo )1422 {1423 xWriteFlag( 0 );1424 }1425 else1426 {1427 xWriteEpExGolomb( uiSymbol, 0 );1428 }1429 }1430 else1431 {1432 xWriteFlag( 0 );1433 }1434 return;1435 }1436 1437 Void TEncCavlc::xWriteEpExGolomb( UInt uiSymbol, UInt uiCount )1438 {1439 while( uiSymbol >= (UInt)(1<<uiCount) )1440 {1441 xWriteFlag( 1 );1442 uiSymbol -= 1<<uiCount;1443 uiCount ++;1444 }1445 xWriteFlag( 0 );1446 while( uiCount-- )1447 {1448 xWriteFlag( (uiSymbol>>uiCount) & 1 );1449 }1450 return;1451 }1452 1453 1405 /** code explicit wp tables 1454 1406 * \param TComSlice* pcSlice -
branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/TEncCavlc.h
r324 r362 68 68 TComSlice* m_pcSlice; 69 69 UInt m_uiCoeffCost; 70 71 Void xWritePCMAlignZero ();72 Void xWriteEpExGolomb ( UInt uiSymbol, UInt uiCount );73 Void xWriteExGolombLevel ( UInt uiSymbol );74 Void xWriteUnaryMaxSymbol ( UInt uiSymbol, UInt uiMaxSymbol );75 70 76 71 Void codeShortTermRefPicSet ( TComSPS* pcSPS, TComReferencePictureSet* pcRPS, Bool calledFromSliceHeader, Int idx ); -
branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/TEncCfg.h
r324 r362 74 74 Int m_interViewRefPosL[2][MAX_NUM_REF_PICS]; 75 75 #endif 76 77 76 GOPEntry() 78 77 : m_POC(-1) … … 98 97 #if H_MV 99 98 ::memset( m_interViewRefs, 0, sizeof(m_interViewRefs) ); 100 ::memset( m_interViewRefPosL[0], -1, sizeof(m_interViewRefPosL[0]) ); 101 ::memset( m_interViewRefPosL[1], -1, sizeof(m_interViewRefPosL[1]) ); 102 #endif 99 ::memset( m_interViewRefPosL[0], -1, sizeof(m_interViewRefPosL[0]) ); ::memset( m_interViewRefPosL[1], -1, sizeof(m_interViewRefPosL[1]) );#endif 103 100 } 104 101 }; … … 172 169 Int m_loopFilterTcOffsetDiv2; 173 170 Bool m_DeblockingFilterControlPresent; 171 #if L0386_DB_METRIC 172 Bool m_DeblockingFilterMetric; 173 #endif 174 174 Bool m_bUseSAO; 175 175 Int m_maxNumOffsetsPerPic; … … 202 202 Bool m_bUseASR; 203 203 Bool m_bUseHADME; 204 #if !L0034_COMBINED_LIST_CLEANUP 204 205 Bool m_bUseLComb; 206 #endif 205 207 Bool m_useRDOQ; 206 208 Bool m_useRDOQTS; … … 248 250 Int m_pictureTimingSEIEnabled; 249 251 Int m_recoveryPointSEIEnabled; 252 #if J0149_TONE_MAPPING_SEI 253 Bool m_toneMappingInfoSEIEnabled; 254 Int m_toneMapId; 255 Bool m_toneMapCancelFlag; 256 Bool m_toneMapPersistenceFlag; 257 Int m_codedDataBitDepth; 258 Int m_targetBitDepth; 259 Int m_modelId; 260 Int m_minValue; 261 Int m_maxValue; 262 Int m_sigmoidMidpoint; 263 Int m_sigmoidWidth; 264 Int m_numPivots; 265 Int m_cameraIsoSpeedIdc; 266 Int m_cameraIsoSpeedValue; 267 Int m_exposureCompensationValueSignFlag; 268 Int m_exposureCompensationValueNumerator; 269 Int m_exposureCompensationValueDenomIdc; 270 Int m_refScreenLuminanceWhite; 271 Int m_extendedRangeWhiteLevel; 272 Int m_nominalBlackLevelLumaCodeValue; 273 Int m_nominalWhiteLevelLumaCodeValue; 274 Int m_extendedWhiteLevelLumaCodeValue; 275 Int* m_startOfCodedInterval; 276 Int* m_codedPivotValue; 277 Int* m_targetPivotValue; 278 #endif 250 279 Int m_framePackingSEIEnabled; 251 280 Int m_framePackingSEIType; … … 257 286 Int m_gradualDecodingRefreshInfoEnabled; 258 287 Int m_decodingUnitInfoSEIEnabled; 288 #if L0208_SOP_DESCRIPTION_SEI 289 Int m_SOPDescriptionSEIEnabled; 290 #endif 291 #if K0180_SCALABLE_NESTING_SEI 292 Int m_scalableNestingSEIEnabled; 293 #endif 259 294 //====== Weighted Prediction ======== 260 295 Bool m_useWeightedPred; //< Use of Weighting Prediction (P_SLICE) … … 325 360 #endif 326 361 #endif 327 328 362 public: 329 363 TEncCfg() … … 409 443 Void setLoopFilterTcOffset ( Int i ) { m_loopFilterTcOffsetDiv2 = i; } 410 444 Void setDeblockingFilterControlPresent ( Bool b ) { m_DeblockingFilterControlPresent = b; } 445 #if L0386_DB_METRIC 446 Void setDeblockingFilterMetric ( Bool b ) { m_DeblockingFilterMetric = b; } 447 #endif 411 448 412 449 //====== Motion search ======== … … 463 500 Int getLoopFilterTcOffset () { return m_loopFilterTcOffsetDiv2; } 464 501 Bool getDeblockingFilterControlPresent() { return m_DeblockingFilterControlPresent; } 502 #if L0386_DB_METRIC 503 Bool getDeblockingFilterMetric () { return m_DeblockingFilterMetric; } 504 #endif 465 505 466 506 //==== Motion search ======== … … 480 520 Void setUseASR ( Bool b ) { m_bUseASR = b; } 481 521 Void setUseHADME ( Bool b ) { m_bUseHADME = b; } 522 #if !L0034_COMBINED_LIST_CLEANUP 482 523 Void setUseLComb ( Bool b ) { m_bUseLComb = b; } 524 #endif 483 525 Void setUseRDOQ ( Bool b ) { m_useRDOQ = b; } 484 526 Void setUseRDOQTS ( Bool b ) { m_useRDOQTS = b; } … … 502 544 Bool getUseASR () { return m_bUseASR; } 503 545 Bool getUseHADME () { return m_bUseHADME; } 546 #if !L0034_COMBINED_LIST_CLEANUP 504 547 Bool getUseLComb () { return m_bUseLComb; } 548 #endif 505 549 Bool getUseRDOQ () { return m_useRDOQ; } 506 550 Bool getUseRDOQTS () { return m_useRDOQTS; } … … 599 643 Void setRecoveryPointSEIEnabled(Int b) { m_recoveryPointSEIEnabled = b; } 600 644 Int getRecoveryPointSEIEnabled() { return m_recoveryPointSEIEnabled; } 645 #if J0149_TONE_MAPPING_SEI 646 Void setToneMappingInfoSEIEnabled(Bool b) { m_toneMappingInfoSEIEnabled = b; } 647 Bool getToneMappingInfoSEIEnabled() { return m_toneMappingInfoSEIEnabled; } 648 Void setTMISEIToneMapId(Int b) { m_toneMapId = b; } 649 Int getTMISEIToneMapId() { return m_toneMapId; } 650 Void setTMISEIToneMapCancelFlag(Bool b) { m_toneMapCancelFlag=b; } 651 Bool getTMISEIToneMapCancelFlag() { return m_toneMapCancelFlag; } 652 Void setTMISEIToneMapPersistenceFlag(Bool b) { m_toneMapPersistenceFlag = b; } 653 Bool getTMISEIToneMapPersistenceFlag() { return m_toneMapPersistenceFlag; } 654 Void setTMISEICodedDataBitDepth(Int b) { m_codedDataBitDepth = b; } 655 Int getTMISEICodedDataBitDepth() { return m_codedDataBitDepth; } 656 Void setTMISEITargetBitDepth(Int b) { m_targetBitDepth = b; } 657 Int getTMISEITargetBitDepth() { return m_targetBitDepth; } 658 Void setTMISEIModelID(Int b) { m_modelId = b; } 659 Int getTMISEIModelID() { return m_modelId; } 660 Void setTMISEIMinValue(Int b) { m_minValue = b; } 661 Int getTMISEIMinValue() { return m_minValue; } 662 Void setTMISEIMaxValue(Int b) { m_maxValue = b; } 663 Int getTMISEIMaxValue() { return m_maxValue; } 664 Void setTMISEISigmoidMidpoint(Int b) { m_sigmoidMidpoint = b; } 665 Int getTMISEISigmoidMidpoint() { return m_sigmoidMidpoint; } 666 Void setTMISEISigmoidWidth(Int b) { m_sigmoidWidth = b; } 667 Int getTMISEISigmoidWidth() { return m_sigmoidWidth; } 668 Void setTMISEIStartOfCodedInterva( Int* p ) { m_startOfCodedInterval = p; } 669 Int* getTMISEIStartOfCodedInterva() { return m_startOfCodedInterval; } 670 Void setTMISEINumPivots(Int b) { m_numPivots = b; } 671 Int getTMISEINumPivots() { return m_numPivots; } 672 Void setTMISEICodedPivotValue( Int* p ) { m_codedPivotValue = p; } 673 Int* getTMISEICodedPivotValue() { return m_codedPivotValue; } 674 Void setTMISEITargetPivotValue( Int* p ) { m_targetPivotValue = p; } 675 Int* getTMISEITargetPivotValue() { return m_targetPivotValue; } 676 Void setTMISEICameraIsoSpeedIdc(Int b) { m_cameraIsoSpeedIdc = b; } 677 Int getTMISEICameraIsoSpeedIdc() { return m_cameraIsoSpeedIdc; } 678 Void setTMISEICameraIsoSpeedValue(Int b) { m_cameraIsoSpeedValue = b; } 679 Int getTMISEICameraIsoSpeedValue() { return m_cameraIsoSpeedValue; } 680 Void setTMISEIExposureCompensationValueSignFlag(Int b) { m_exposureCompensationValueSignFlag = b; } 681 Int getTMISEIExposureCompensationValueSignFlag() { return m_exposureCompensationValueSignFlag; } 682 Void setTMISEIExposureCompensationValueNumerator(Int b) { m_exposureCompensationValueNumerator = b; } 683 Int getTMISEIExposureCompensationValueNumerator() { return m_exposureCompensationValueNumerator; } 684 Void setTMISEIExposureCompensationValueDenomIdc(Int b) { m_exposureCompensationValueDenomIdc =b; } 685 Int getTMISEIExposureCompensationValueDenomIdc() { return m_exposureCompensationValueDenomIdc; } 686 Void setTMISEIRefScreenLuminanceWhite(Int b) { m_refScreenLuminanceWhite = b; } 687 Int getTMISEIRefScreenLuminanceWhite() { return m_refScreenLuminanceWhite; } 688 Void setTMISEIExtendedRangeWhiteLevel(Int b) { m_extendedRangeWhiteLevel = b; } 689 Int getTMISEIExtendedRangeWhiteLevel() { return m_extendedRangeWhiteLevel; } 690 Void setTMISEINominalBlackLevelLumaCodeValue(Int b) { m_nominalBlackLevelLumaCodeValue = b; } 691 Int getTMISEINominalBlackLevelLumaCodeValue() { return m_nominalBlackLevelLumaCodeValue; } 692 Void setTMISEINominalWhiteLevelLumaCodeValue(Int b) { m_nominalWhiteLevelLumaCodeValue = b; } 693 Int getTMISEINominalWhiteLevelLumaCodeValue() { return m_nominalWhiteLevelLumaCodeValue; } 694 Void setTMISEIExtendedWhiteLevelLumaCodeValue(Int b) { m_extendedWhiteLevelLumaCodeValue =b; } 695 Int getTMISEIExtendedWhiteLevelLumaCodeValue() { return m_extendedWhiteLevelLumaCodeValue; } 696 #endif 601 697 Void setFramePackingArrangementSEIEnabled(Int b) { m_framePackingSEIEnabled = b; } 602 698 Int getFramePackingArrangementSEIEnabled() { return m_framePackingSEIEnabled; } … … 617 713 Void setDecodingUnitInfoSEIEnabled(Int b) { m_decodingUnitInfoSEIEnabled = b; } 618 714 Int getDecodingUnitInfoSEIEnabled() { return m_decodingUnitInfoSEIEnabled; } 715 #if L0208_SOP_DESCRIPTION_SEI 716 Void setSOPDescriptionSEIEnabled(Int b) { m_SOPDescriptionSEIEnabled = b; } 717 Int getSOPDescriptionSEIEnabled() { return m_SOPDescriptionSEIEnabled; } 718 #endif 719 #if K0180_SCALABLE_NESTING_SEI 720 Void setScalableNestingSEIEnabled(Int b) { m_scalableNestingSEIEnabled = b; } 721 Int getScalableNestingSEIEnabled() { return m_scalableNestingSEIEnabled; } 722 #endif 619 723 Void setUseWP ( Bool b ) { m_useWeightedPred = b; } 620 724 Void setWPBiPred ( Bool b ) { m_useWeightedBiPred = b; } -
branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/TEncGOP.cpp
r324 r362 96 96 #if L0045_NON_NESTED_SEI_RESTRICTIONS 97 97 xResetNonNestedSEIPresentFlags(); 98 #endif 99 98 #if K0180_SCALABLE_NESTING_SEI 99 xResetNestedSEIPresentFlags(); 100 #endif 101 #endif 100 102 #if H_MV 101 103 m_layerId = 0; … … 106 108 #endif 107 109 #endif 108 109 110 return; 110 111 } … … 211 212 } 212 213 214 #if J0149_TONE_MAPPING_SEI 215 SEIToneMappingInfo* TEncGOP::xCreateSEIToneMappingInfo() 216 { 217 SEIToneMappingInfo *seiToneMappingInfo = new SEIToneMappingInfo(); 218 seiToneMappingInfo->m_toneMapId = m_pcCfg->getTMISEIToneMapId(); 219 seiToneMappingInfo->m_toneMapCancelFlag = m_pcCfg->getTMISEIToneMapCancelFlag(); 220 seiToneMappingInfo->m_toneMapPersistenceFlag = m_pcCfg->getTMISEIToneMapPersistenceFlag(); 221 222 seiToneMappingInfo->m_codedDataBitDepth = m_pcCfg->getTMISEICodedDataBitDepth(); 223 assert(seiToneMappingInfo->m_codedDataBitDepth >= 8 && seiToneMappingInfo->m_codedDataBitDepth <= 14); 224 seiToneMappingInfo->m_targetBitDepth = m_pcCfg->getTMISEITargetBitDepth(); 225 assert( (seiToneMappingInfo->m_targetBitDepth >= 1 && seiToneMappingInfo->m_targetBitDepth <= 17) || (seiToneMappingInfo->m_targetBitDepth == 255) ); 226 seiToneMappingInfo->m_modelId = m_pcCfg->getTMISEIModelID(); 227 assert(seiToneMappingInfo->m_modelId >=0 &&seiToneMappingInfo->m_modelId<=4); 228 229 switch( seiToneMappingInfo->m_modelId) 230 { 231 case 0: 232 { 233 seiToneMappingInfo->m_minValue = m_pcCfg->getTMISEIMinValue(); 234 seiToneMappingInfo->m_maxValue = m_pcCfg->getTMISEIMaxValue(); 235 break; 236 } 237 case 1: 238 { 239 seiToneMappingInfo->m_sigmoidMidpoint = m_pcCfg->getTMISEISigmoidMidpoint(); 240 seiToneMappingInfo->m_sigmoidWidth = m_pcCfg->getTMISEISigmoidWidth(); 241 break; 242 } 243 case 2: 244 { 245 UInt num = 1u<<(seiToneMappingInfo->m_targetBitDepth); 246 seiToneMappingInfo->m_startOfCodedInterval.resize(num); 247 Int* ptmp = m_pcCfg->getTMISEIStartOfCodedInterva(); 248 if(ptmp) 249 { 250 for(int i=0; i<num;i++) 251 { 252 seiToneMappingInfo->m_startOfCodedInterval[i] = ptmp[i]; 253 } 254 } 255 break; 256 } 257 case 3: 258 { 259 seiToneMappingInfo->m_numPivots = m_pcCfg->getTMISEINumPivots(); 260 seiToneMappingInfo->m_codedPivotValue.resize(seiToneMappingInfo->m_numPivots); 261 seiToneMappingInfo->m_targetPivotValue.resize(seiToneMappingInfo->m_numPivots); 262 Int* ptmpcoded = m_pcCfg->getTMISEICodedPivotValue(); 263 Int* ptmptarget = m_pcCfg->getTMISEITargetPivotValue(); 264 if(ptmpcoded&&ptmptarget) 265 { 266 for(int i=0; i<(seiToneMappingInfo->m_numPivots);i++) 267 { 268 seiToneMappingInfo->m_codedPivotValue[i]=ptmpcoded[i]; 269 seiToneMappingInfo->m_targetPivotValue[i]=ptmptarget[i]; 270 } 271 } 272 break; 273 } 274 case 4: 275 { 276 seiToneMappingInfo->m_cameraIsoSpeedIdc = m_pcCfg->getTMISEICameraIsoSpeedIdc(); 277 seiToneMappingInfo->m_cameraIsoSpeedValue = m_pcCfg->getTMISEICameraIsoSpeedValue(); 278 assert( seiToneMappingInfo->m_cameraIsoSpeedValue !=0 ); 279 seiToneMappingInfo->m_exposureCompensationValueSignFlag = m_pcCfg->getTMISEIExposureCompensationValueSignFlag(); 280 seiToneMappingInfo->m_exposureCompensationValueNumerator = m_pcCfg->getTMISEIExposureCompensationValueNumerator(); 281 seiToneMappingInfo->m_exposureCompensationValueDenomIdc = m_pcCfg->getTMISEIExposureCompensationValueDenomIdc(); 282 seiToneMappingInfo->m_refScreenLuminanceWhite = m_pcCfg->getTMISEIRefScreenLuminanceWhite(); 283 seiToneMappingInfo->m_extendedRangeWhiteLevel = m_pcCfg->getTMISEIExtendedRangeWhiteLevel(); 284 assert( seiToneMappingInfo->m_extendedRangeWhiteLevel >= 100 ); 285 seiToneMappingInfo->m_nominalBlackLevelLumaCodeValue = m_pcCfg->getTMISEINominalBlackLevelLumaCodeValue(); 286 seiToneMappingInfo->m_nominalWhiteLevelLumaCodeValue = m_pcCfg->getTMISEINominalWhiteLevelLumaCodeValue(); 287 assert( seiToneMappingInfo->m_nominalWhiteLevelLumaCodeValue > seiToneMappingInfo->m_nominalBlackLevelLumaCodeValue ); 288 seiToneMappingInfo->m_extendedWhiteLevelLumaCodeValue = m_pcCfg->getTMISEIExtendedWhiteLevelLumaCodeValue(); 289 assert( seiToneMappingInfo->m_extendedWhiteLevelLumaCodeValue >= seiToneMappingInfo->m_nominalWhiteLevelLumaCodeValue ); 290 break; 291 } 292 default: 293 { 294 assert(!"Undefined SEIToneMapModelId"); 295 break; 296 } 297 } 298 return seiToneMappingInfo; 299 } 300 #endif 213 301 Void TEncGOP::xCreateLeadingSEIMessages (/*SEIMessages seiMessages,*/ AccessUnit &accessUnit, TComSPS *sps) 214 302 { 215 OutputNALUnit nalu(NAL_UNIT_ SEI);303 OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI); 216 304 217 305 if(m_pcCfg->getActiveParameterSetsSEIEnabled()) … … 234 322 SEIFramePacking *sei = xCreateSEIFramePacking (); 235 323 236 nalu = NALUnit(NAL_UNIT_ SEI);324 nalu = NALUnit(NAL_UNIT_PREFIX_SEI); 237 325 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); 238 326 m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps); … … 245 333 SEIDisplayOrientation *sei = xCreateSEIDisplayOrientation(); 246 334 247 nalu = NALUnit(NAL_UNIT_ SEI);335 nalu = NALUnit(NAL_UNIT_PREFIX_SEI); 248 336 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); 249 337 m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps); … … 252 340 delete sei; 253 341 } 342 #if J0149_TONE_MAPPING_SEI 343 if(m_pcCfg->getToneMappingInfoSEIEnabled()) 344 { 345 SEIToneMappingInfo *sei = xCreateSEIToneMappingInfo (); 346 347 nalu = NALUnit(NAL_UNIT_PREFIX_SEI); 348 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); 349 m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps); 350 writeRBSPTrailingBits(nalu.m_Bitstream); 351 accessUnit.push_back(new NALUnitEBSP(nalu)); 352 delete sei; 353 } 354 #endif 254 355 } 255 356 … … 275 376 TComPicYuv* pcPicYuvRecOut; 276 377 TComSlice* pcSlice; 277 TComOutputBitstream* pcBitstreamRedirect = new TComOutputBitstream; 378 TComOutputBitstream *pcBitstreamRedirect; 379 pcBitstreamRedirect = new TComOutputBitstream; 278 380 AccessUnit::iterator itLocationToPushSliceHeaderNALU; // used to store location where NALU containing slice header is to be inserted 279 381 UInt uiOneBitstreamPerSliceLength = 0; … … 286 388 m_iNumPicCoded = 0; 287 389 #endif 288 289 390 SEIPictureTiming pictureTimingSEI; 391 #if L0208_SOP_DESCRIPTION_SEI 392 Bool writeSOP = m_pcCfg->getSOPDescriptionSEIEnabled(); 393 #endif 394 #if K0180_SCALABLE_NESTING_SEI 395 // Initialize Scalable Nesting SEI with single layer values 396 SEIScalableNesting scalableNestingSEI; 397 scalableNestingSEI.m_bitStreamSubsetFlag = 1; // If the nested SEI messages are picture buffereing SEI mesages, picure timing SEI messages or sub-picture timing SEI messages, bitstream_subset_flag shall be equal to 1 398 scalableNestingSEI.m_nestingOpFlag = 0; 399 scalableNestingSEI.m_nestingNumOpsMinus1 = 0; //nesting_num_ops_minus1 400 scalableNestingSEI.m_allLayersFlag = 0; 401 scalableNestingSEI.m_nestingNoOpMaxTemporalIdPlus1 = 6 + 1; //nesting_no_op_max_temporal_id_plus1 402 scalableNestingSEI.m_nestingNumLayersMinus1 = 1 - 1; //nesting_num_layers_minus1 403 scalableNestingSEI.m_nestingLayerId[0] = 0; 404 scalableNestingSEI.m_callerOwnsSEIs = true; 405 #endif 290 406 #if L0044_DU_DPB_OUTPUT_DELAY_HRD 291 407 Int picSptDpbOutputDuDelay = 0; … … 298 414 for ( Int iGOPid=0; iGOPid < m_iGopSize; iGOPid++ ) 299 415 #endif 300 301 416 { 302 417 UInt uiColDir = 1; … … 364 479 continue; 365 480 #endif 366 367 } 368 369 if( getNalUnitType(pocCurr) == NAL_UNIT_CODED_SLICE_IDR || getNalUnitType(pocCurr) == NAL_UNIT_CODED_SLICE_IDR_N_LP ) 481 } 482 483 if( getNalUnitType(pocCurr, m_iLastIDR) == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType(pocCurr, m_iLastIDR) == NAL_UNIT_CODED_SLICE_IDR_N_LP ) 370 484 { 371 485 m_iLastIDR = pocCurr; … … 385 499 pcSlice->setLastIDR(m_iLastIDR); 386 500 pcSlice->setSliceIdx(0); 387 388 501 #if H_MV 389 502 pcPic ->setLayerId ( getLayerId() ); … … 397 510 #endif 398 511 #endif 399 400 512 //set default slice level flag to the same as SPS level flag 401 513 pcSlice->setLFCrossSliceBoundaryFlag( pcSlice->getPPS()->getLoopFilterAcrossSlicesEnabledFlag() ); … … 437 549 #if H_MV 438 550 // Set the nal unit type 439 pcSlice->setNalUnitType(getNalUnitType(pocCurr ));551 pcSlice->setNalUnitType(getNalUnitType(pocCurr, m_iLastIDR)); 440 552 if( pcSlice->getSliceType() == B_SLICE ) 441 553 { … … 451 563 } 452 564 // Set the nal unit type 453 pcSlice->setNalUnitType(getNalUnitType(pocCurr ));454 #endif 455 if(pcSlice->get NalUnitType()==NAL_UNIT_CODED_SLICE_TRAIL_R)456 { 457 if(pcSlice->get TemporalLayerNonReferenceFlag())565 pcSlice->setNalUnitType(getNalUnitType(pocCurr, m_iLastIDR)); 566 #endif 567 if(pcSlice->getTemporalLayerNonReferenceFlag()) 568 { 569 if(pcSlice->getNalUnitType()==NAL_UNIT_CODED_SLICE_TRAIL_R) 458 570 { 459 571 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_TRAIL_N); 572 } 573 if(pcSlice->getNalUnitType()==NAL_UNIT_CODED_SLICE_RADL_R) 574 { 575 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_RADL_N); 576 } 577 if(pcSlice->getNalUnitType()==NAL_UNIT_CODED_SLICE_RASL_R) 578 { 579 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_RASL_N); 460 580 } 461 581 } … … 482 602 else 483 603 { 484 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_TLA );604 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_TLA_R); 485 605 } 486 606 } … … 568 688 } 569 689 #endif 570 690 #if !L0034_COMBINED_LIST_CLEANUP 571 691 if (pcSlice->getSliceType() != B_SLICE || !pcSlice->getSPS()->getUseLComb()) 572 692 { … … 580 700 pcSlice->setNumRefIdx(REF_PIC_LIST_C, pcSlice->getNumRefIdx(REF_PIC_LIST_0)); 581 701 } 702 #endif 582 703 583 704 if (pcSlice->getSliceType() == B_SLICE) … … 605 726 pcSlice->setCheckLDC(bLowDelay); 606 727 } 728 else 729 { 730 pcSlice->setCheckLDC(true); 731 } 607 732 608 733 uiColDir = 1-uiColDir; … … 611 736 pcSlice->setRefPOCList(); 612 737 738 #if L0034_COMBINED_LIST_CLEANUP 739 pcSlice->setList1IdxToList0Idx(); 740 #else 613 741 pcSlice->setNoBackPredFlag( false ); 614 742 if ( pcSlice->getSliceType() == B_SLICE && !pcSlice->getRefPicListCombinationFlag()) … … 634 762 } 635 763 pcSlice->generateCombinedList(); 764 #endif 636 765 637 766 if (m_pcEncTop->getTMVPModeId() == 2) … … 939 1068 Bool bLFCrossTileBoundary = pcSlice->getPPS()->getLoopFilterAcrossTilesEnabledFlag(); 940 1069 m_pcLoopFilter->setCfg(bLFCrossTileBoundary); 1070 #if L0386_DB_METRIC 1071 if ( m_pcCfg->getDeblockingFilterMetric() ) 1072 { 1073 dblMetric(pcPic, uiNumSlices); 1074 } 1075 #endif 941 1076 m_pcLoopFilter->loopFilterPic( pcPic ); 942 1077 … … 1037 1172 } 1038 1173 1174 #if L0208_SOP_DESCRIPTION_SEI 1175 if (writeSOP) // write SOP description SEI (if enabled) at the beginning of GOP 1176 { 1177 Int SOPcurrPOC = pocCurr; 1178 1179 OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI); 1180 m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice); 1181 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); 1182 1183 SEISOPDescription SOPDescriptionSEI; 1184 SOPDescriptionSEI.m_sopSeqParameterSetId = pcSlice->getSPS()->getSPSId(); 1185 1186 UInt i = 0; 1187 UInt prevEntryId = iGOPid; 1188 for (j = iGOPid; j < m_iGopSize; j++) 1189 { 1190 Int deltaPOC = m_pcCfg->getGOPEntry(j).m_POC - m_pcCfg->getGOPEntry(prevEntryId).m_POC; 1191 if ((SOPcurrPOC + deltaPOC) < m_pcCfg->getFramesToBeEncoded()) 1192 { 1193 SOPcurrPOC += deltaPOC; 1194 SOPDescriptionSEI.m_sopDescVclNaluType[i] = getNalUnitType(SOPcurrPOC, m_iLastIDR); 1195 SOPDescriptionSEI.m_sopDescTemporalId[i] = m_pcCfg->getGOPEntry(j).m_temporalId; 1196 SOPDescriptionSEI.m_sopDescStRpsIdx[i] = m_pcEncTop->getReferencePictureSetIdxForSOP(pcSlice, SOPcurrPOC, j); 1197 SOPDescriptionSEI.m_sopDescPocDelta[i] = deltaPOC; 1198 1199 prevEntryId = j; 1200 i++; 1201 } 1202 } 1203 1204 SOPDescriptionSEI.m_numPicsInSopMinus1 = i - 1; 1205 1206 m_seiWriter.writeSEImessage( nalu.m_Bitstream, SOPDescriptionSEI, pcSlice->getSPS()); 1207 writeRBSPTrailingBits(nalu.m_Bitstream); 1208 accessUnit.push_back(new NALUnitEBSP(nalu)); 1209 1210 writeSOP = false; 1211 } 1212 #endif 1213 1039 1214 if( ( m_pcCfg->getPictureTimingSEIEnabled() || m_pcCfg->getDecodingUnitInfoSEIEnabled() ) && 1040 1215 ( pcSlice->getSPS()->getVuiParametersPresentFlag() ) && … … 1082 1257 || ( pcSlice->getSPS()->getVuiParameters()->getHrdParameters()->getVclHrdParametersPresentFlag() ) ) ) 1083 1258 { 1084 OutputNALUnit nalu(NAL_UNIT_ SEI);1259 OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI); 1085 1260 m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice); 1086 1261 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); … … 1123 1298 writeRBSPTrailingBits(nalu.m_Bitstream); 1124 1299 #if L0045_NON_NESTED_SEI_RESTRICTIONS 1300 { 1125 1301 UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit); 1126 1302 UInt offsetPosition = m_activeParameterSetSEIPresentInAU; // Insert BP SEI after APS SEI … … 1132 1308 accessUnit.insert(it, new NALUnitEBSP(nalu)); 1133 1309 m_bufferingPeriodSEIPresentInAU = true; 1310 } 1134 1311 #else 1135 1312 accessUnit.push_back(new NALUnitEBSP(nalu)); 1136 1313 #endif 1137 1314 1315 #if K0180_SCALABLE_NESTING_SEI 1316 if (m_pcCfg->getScalableNestingSEIEnabled()) 1317 { 1318 OutputNALUnit naluTmp(NAL_UNIT_PREFIX_SEI); 1319 m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice); 1320 m_pcEntropyCoder->setBitstream(&naluTmp.m_Bitstream); 1321 scalableNestingSEI.m_nestedSEIs.clear(); 1322 scalableNestingSEI.m_nestedSEIs.push_back(&sei_buffering_period); 1323 m_seiWriter.writeSEImessage( naluTmp.m_Bitstream, scalableNestingSEI, pcSlice->getSPS()); 1324 writeRBSPTrailingBits(naluTmp.m_Bitstream); 1325 #if L0045_NON_NESTED_SEI_RESTRICTIONS 1326 UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit); 1327 UInt offsetPosition = m_activeParameterSetSEIPresentInAU + m_bufferingPeriodSEIPresentInAU + m_pictureTimingSEIPresentInAU; // Insert BP SEI after non-nested APS, BP and PT SEIs 1328 AccessUnit::iterator it; 1329 for(j = 0, it = accessUnit.begin(); j < seiPositionInAu + offsetPosition; j++) 1330 { 1331 it++; 1332 } 1333 accessUnit.insert(it, new NALUnitEBSP(naluTmp)); 1334 m_nestedBufferingPeriodSEIPresentInAU = true; 1335 #else 1336 accessUnit.push_back(new NALUnitEBSP(naluTmp)); 1337 #endif 1338 } 1339 #endif 1340 1138 1341 m_lastBPSEI = m_totalCoded; 1139 1342 m_cpbRemovalDelay = 0; … … 1145 1348 { 1146 1349 // Gradual decoding refresh SEI 1147 OutputNALUnit nalu(NAL_UNIT_ SEI);1350 OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI); 1148 1351 m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice); 1149 1352 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); … … 1157 1360 } 1158 1361 // Recovery point SEI 1159 OutputNALUnit nalu(NAL_UNIT_ SEI);1362 OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI); 1160 1363 m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice); 1161 1364 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); … … 1348 1551 1349 1552 pcSlice->setTileOffstForMultES( uiOneBitstreamPerSliceLength ); 1350 if (!sliceSegment)1351 {1352 1553 pcSlice->setTileLocationCount ( 0 ); 1353 m_pcSliceEncoder->encodeSlice(pcPic, pcBitstreamRedirect, pcSubstreamsOut); // redirect is only used for CAVLC tile position info. 1354 } 1355 else 1356 { 1357 m_pcSliceEncoder->encodeSlice(pcPic, &nalu.m_Bitstream, pcSubstreamsOut); // nalu.m_Bitstream is only used for CAVLC tile position info. 1358 } 1554 m_pcSliceEncoder->encodeSlice(pcPic, pcSubstreamsOut); 1359 1555 1360 1556 { … … 1388 1584 if (ui+1 < pcSlice->getPPS()->getNumSubstreams()) 1389 1585 { 1390 puiSubstreamSizes[ui] = pcSubstreamsOut[ui].getNumberOfWrittenBits() ;1586 puiSubstreamSizes[ui] = pcSubstreamsOut[ui].getNumberOfWrittenBits() + (pcSubstreamsOut[ui].countStartCodeEmulations()<<3); 1391 1587 } 1392 1588 } … … 1420 1616 // If current NALU is the last NALU of slice and a NALU was buffered, then (a) Write current NALU (b) Update an write buffered NALU at approproate location in NALU list. 1421 1617 Bool bNALUAlignedWrittenToList = false; // used to ensure current NALU is not written more than once to the NALU list. 1422 x WriteTileLocationToSliceHeader(nalu, pcBitstreamRedirect, pcSlice);1618 xAttachSliceDataToNalUnit(nalu, pcBitstreamRedirect); 1423 1619 accessUnit.push_back(new NALUnitEBSP(nalu)); 1424 1620 #if RATE_CONTROL_LAMBDA_DOMAIN … … 1448 1644 { 1449 1645 UInt numRBSPBytes_nal = UInt((*it)->m_nalUnitData.str().size()); 1450 if ((*it)->m_nalUnitType != NAL_UNIT_ SEI && (*it)->m_nalUnitType != NAL_UNIT_SEI_SUFFIX)1646 if ((*it)->m_nalUnitType != NAL_UNIT_PREFIX_SEI && (*it)->m_nalUnitType != NAL_UNIT_SUFFIX_SEI) 1451 1647 { 1452 1648 numRBSPBytes += numRBSPBytes_nal; … … 1549 1745 digestStr = digestToString(sei_recon_picture_digest.digest, 4); 1550 1746 } 1551 OutputNALUnit nalu(NAL_UNIT_S EI_SUFFIX, pcSlice->getTLayer());1747 OutputNALUnit nalu(NAL_UNIT_SUFFIX_SEI, pcSlice->getTLayer()); 1552 1748 1553 1749 /* write the SEI messages */ … … 1573 1769 sei_temporal_level0_index.rapIdx = m_rapIdx; 1574 1770 1575 OutputNALUnit nalu(NAL_UNIT_ SEI);1771 OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI); 1576 1772 1577 1773 /* write the SEI messages */ … … 1713 1909 if( m_pcCfg->getPictureTimingSEIEnabled() ) 1714 1910 { 1715 OutputNALUnit nalu(NAL_UNIT_SEI, pcSlice->getTLayer()); 1911 { 1912 OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI, pcSlice->getTLayer()); 1716 1913 m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice); 1717 1914 m_seiWriter.writeSEImessage(nalu.m_Bitstream, pictureTimingSEI, pcSlice->getSPS()); … … 1733 1930 #endif 1734 1931 } 1932 #if K0180_SCALABLE_NESTING_SEI 1933 if ( m_pcCfg->getScalableNestingSEIEnabled() ) // put picture timing SEI into scalable nesting SEI 1934 { 1935 OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI, pcSlice->getTLayer()); 1936 m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice); 1937 scalableNestingSEI.m_nestedSEIs.clear(); 1938 scalableNestingSEI.m_nestedSEIs.push_back(&pictureTimingSEI); 1939 m_seiWriter.writeSEImessage(nalu.m_Bitstream, scalableNestingSEI, pcSlice->getSPS()); 1940 writeRBSPTrailingBits(nalu.m_Bitstream); 1941 #if L0045_NON_NESTED_SEI_RESTRICTIONS 1942 UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit); 1943 UInt offsetPosition = m_activeParameterSetSEIPresentInAU 1944 + m_bufferingPeriodSEIPresentInAU + m_pictureTimingSEIPresentInAU + m_nestedBufferingPeriodSEIPresentInAU; // Insert PT SEI after APS and BP SEI 1945 AccessUnit::iterator it; 1946 for(j = 0, it = accessUnit.begin(); j < seiPositionInAu + offsetPosition; j++) 1947 { 1948 it++; 1949 } 1950 accessUnit.insert(it, new NALUnitEBSP(nalu)); 1951 m_nestedPictureTimingSEIPresentInAU = true; 1952 #else 1953 AccessUnit::iterator it = find_if(accessUnit.begin(), accessUnit.end(), mem_fun(&NALUnit::isSlice)); 1954 accessUnit.insert(it, new NALUnitEBSP(nalu)); 1955 #endif 1956 } 1957 #endif 1958 1959 } 1735 1960 if( m_pcCfg->getDecodingUnitInfoSEIEnabled() && hrd->getSubPicCpbParamsPresentFlag() ) 1736 1961 { … … 1738 1963 for( Int i = 0; i < ( pictureTimingSEI.m_numDecodingUnitsMinus1 + 1 ); i ++ ) 1739 1964 { 1740 OutputNALUnit nalu(NAL_UNIT_ SEI, pcSlice->getTLayer());1965 OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI, pcSlice->getTLayer()); 1741 1966 1742 1967 SEIDecodingUnitInfo tempSEI; … … 1786 2011 break; 1787 2012 } 1788 if ((*it)->m_nalUnitType != NAL_UNIT_ SEI && (*it)->m_nalUnitType != NAL_UNIT_SEI_SUFFIX)2013 if ((*it)->m_nalUnitType != NAL_UNIT_PREFIX_SEI && (*it)->m_nalUnitType != NAL_UNIT_SUFFIX_SEI) 1789 2014 { 1790 2015 ctr++; … … 1797 2022 #if L0045_NON_NESTED_SEI_RESTRICTIONS 1798 2023 xResetNonNestedSEIPresentFlags(); 2024 #if K0180_SCALABLE_NESTING_SEI 2025 xResetNestedSEIPresentFlags(); 2026 #endif 1799 2027 #endif 1800 2028 pcPic->getPicYuvRec()->copyToPic(pcPicYuvRecOut); … … 2023 2251 case NAL_UNIT_CODED_SLICE_TRAIL_R: return "TRAIL_R"; 2024 2252 case NAL_UNIT_CODED_SLICE_TRAIL_N: return "TRAIL_N"; 2025 case NAL_UNIT_CODED_SLICE_TLA : return "TLA";2253 case NAL_UNIT_CODED_SLICE_TLA_R: return "TLA_R"; 2026 2254 case NAL_UNIT_CODED_SLICE_TSA_N: return "TSA_N"; 2027 2255 case NAL_UNIT_CODED_SLICE_STSA_R: return "STSA_R"; 2028 2256 case NAL_UNIT_CODED_SLICE_STSA_N: return "STSA_N"; 2029 case NAL_UNIT_CODED_SLICE_BLA : return "BLA";2030 case NAL_UNIT_CODED_SLICE_BLA NT: return "BLANT";2257 case NAL_UNIT_CODED_SLICE_BLA_W_LP: return "BLA_W_LP"; 2258 case NAL_UNIT_CODED_SLICE_BLA_W_RADL: return "BLA_W_RADL"; 2031 2259 case NAL_UNIT_CODED_SLICE_BLA_N_LP: return "BLA_N_LP"; 2032 case NAL_UNIT_CODED_SLICE_IDR : return "IDR";2260 case NAL_UNIT_CODED_SLICE_IDR_W_RADL: return "IDR_W_RADL"; 2033 2261 case NAL_UNIT_CODED_SLICE_IDR_N_LP: return "IDR_N_LP"; 2034 2262 case NAL_UNIT_CODED_SLICE_CRA: return "CRA"; 2035 case NAL_UNIT_CODED_SLICE_ DLP: return "DLP";2036 case NAL_UNIT_CODED_SLICE_ TFD: return "TFD";2263 case NAL_UNIT_CODED_SLICE_RADL_R: return "RADL_R"; 2264 case NAL_UNIT_CODED_SLICE_RASL_R: return "RASL_R"; 2037 2265 case NAL_UNIT_VPS: return "VPS"; 2038 2266 case NAL_UNIT_SPS: return "SPS"; … … 2042 2270 case NAL_UNIT_EOB: return "EOB"; 2043 2271 case NAL_UNIT_FILLER_DATA: return "FILLER"; 2044 case NAL_UNIT_SEI: return "SEI"; 2272 case NAL_UNIT_PREFIX_SEI: return "SEI"; 2273 case NAL_UNIT_SUFFIX_SEI: return "SEI"; 2045 2274 default: return "UNK"; 2046 2275 } … … 2133 2362 printf("*** %6s numBytesInNALunit: %u\n", nalUnitTypeToString((*it)->m_nalUnitType), numRBSPBytes_nal); 2134 2363 #endif 2135 if ((*it)->m_nalUnitType != NAL_UNIT_ SEI && (*it)->m_nalUnitType != NAL_UNIT_SEI_SUFFIX)2364 if ((*it)->m_nalUnitType != NAL_UNIT_PREFIX_SEI && (*it)->m_nalUnitType != NAL_UNIT_SUFFIX_SEI) 2136 2365 { 2137 2366 numRBSPBytes += numRBSPBytes_nal; … … 2143 2372 2144 2373 //===== add PSNR ===== 2145 2146 2374 #if H_MV 2147 2375 m_pcEncTop->getAnalyzeAll()->addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits); … … 2153 2381 if (pcSlice->isIntra()) 2154 2382 { 2155 2156 2383 #if H_MV 2157 2384 m_pcEncTop->getAnalyzeI()->addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits); … … 2163 2390 if (pcSlice->isInterP()) 2164 2391 { 2165 2166 2392 #if H_MV 2167 2393 m_pcEncTop->getAnalyzeP()->addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits); … … 2169 2395 m_gcAnalyzeP.addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits); 2170 2396 #endif 2171 2172 2397 } 2173 2398 if (pcSlice->isInterB()) 2174 2399 { 2175 2176 2400 #if H_MV 2177 2401 m_pcEncTop->getAnalyzeB()->addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits); … … 2179 2403 m_gcAnalyzeB.addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits); 2180 2404 #endif 2181 2182 2405 } 2183 2406 … … 2186 2409 2187 2410 #if ADAPTIVE_QP_SELECTION 2188 2189 2411 #if H_MV 2190 2412 printf("Layer %3d POC %4d TId: %1d ( %c-SLICE, nQP %d QP %d ) %10d bits", … … 2205 2427 uibits ); 2206 2428 #endif 2207 2208 2429 #else 2209 2210 2430 #if H_MV 2211 2431 printf("Layer %3d POC %4d TId: %1d ( %c-SLICE, QP %d ) %10d bits", … … 2226 2446 2227 2447 #endif 2228 2229 2448 printf(" [Y %6.4lf dB U %6.4lf dB V %6.4lf dB]", dYPSNR, dUPSNR, dVPSNR ); 2230 2449 printf(" [ET %5.0f ]", dEncTime ); … … 2257 2476 * This function checks the configuration and returns the appropriate nal_unit_type for the picture. 2258 2477 */ 2259 NalUnitType TEncGOP::getNalUnitType(Int pocCurr )2478 NalUnitType TEncGOP::getNalUnitType(Int pocCurr, Int lastIDR) 2260 2479 { 2261 2480 if (pocCurr == 0) 2262 2481 { 2263 return NAL_UNIT_CODED_SLICE_IDR ;2482 return NAL_UNIT_CODED_SLICE_IDR_W_RADL; 2264 2483 } 2265 2484 if (pocCurr % m_pcCfg->getIntraPeriod() == 0) … … 2271 2490 else if (m_pcCfg->getDecodingRefreshType() == 2) 2272 2491 { 2273 return NAL_UNIT_CODED_SLICE_IDR ;2492 return NAL_UNIT_CODED_SLICE_IDR_W_RADL; 2274 2493 } 2275 2494 } … … 2283 2502 // controlling the reference pictures used for encoding that leading picture. Such a leading 2284 2503 // picture need not be marked as a TFD picture. 2285 return NAL_UNIT_CODED_SLICE_TFD; 2504 return NAL_UNIT_CODED_SLICE_RASL_R; 2505 } 2506 } 2507 if (lastIDR>0) 2508 { 2509 if (pocCurr < lastIDR) 2510 { 2511 return NAL_UNIT_CODED_SLICE_RADL_R; 2286 2512 } 2287 2513 } … … 2334 2560 } 2335 2561 2336 /** Determine the difference between consecutive tile sizes (in bytes) and writes it to bistream rNalu [slice header] 2337 * \param rpcBitstreamRedirect contains the bitstream to be concatenated to rNalu. rpcBitstreamRedirect contains slice payload. rpcSlice contains tile location information. 2338 * \returns Updates rNalu to contain concatenated bitstream. rpcBitstreamRedirect is cleared at the end of this function call. 2562 /** Attaches the input bitstream to the stream in the output NAL unit 2563 Updates rNalu to contain concatenated bitstream. rpcBitstreamRedirect is cleared at the end of this function call. 2564 * \param codedSliceData contains the coded slice data (bitstream) to be concatenated to rNalu 2565 * \param rNalu target NAL unit 2339 2566 */ 2340 Void TEncGOP::x WriteTileLocationToSliceHeader (OutputNALUnit& rNalu, TComOutputBitstream*& rpcBitstreamRedirect, TComSlice*& rpcSlice)2567 Void TEncGOP::xAttachSliceDataToNalUnit (OutputNALUnit& rNalu, TComOutputBitstream*& codedSliceData) 2341 2568 { 2342 2569 // Byte-align … … 2344 2571 2345 2572 // Perform bitstream concatenation 2346 if (rpcBitstreamRedirect->getNumberOfWrittenBits() > 0) 2347 { 2348 UInt uiBitCount = rpcBitstreamRedirect->getNumberOfWrittenBits(); 2349 if (rpcBitstreamRedirect->getByteStreamLength()>0) 2350 { 2351 UChar *pucStart = reinterpret_cast<UChar*>(rpcBitstreamRedirect->getByteStream()); 2352 UInt uiWriteByteCount = 0; 2353 while (uiWriteByteCount < (uiBitCount >> 3) ) 2354 { 2355 UInt uiBits = (*pucStart); 2356 rNalu.m_Bitstream.write(uiBits, 8); 2357 pucStart++; 2358 uiWriteByteCount++; 2359 } 2360 } 2361 UInt uiBitsHeld = (uiBitCount & 0x07); 2362 for (UInt uiIdx=0; uiIdx < uiBitsHeld; uiIdx++) 2363 { 2364 rNalu.m_Bitstream.write((rpcBitstreamRedirect->getHeldBits() & (1 << (7-uiIdx))) >> (7-uiIdx), 1); 2365 } 2573 if (codedSliceData->getNumberOfWrittenBits() > 0) 2574 { 2575 rNalu.m_Bitstream.addSubstream(codedSliceData); 2366 2576 } 2367 2577 2368 2578 m_pcEntropyCoder->setBitstream(&rNalu.m_Bitstream); 2369 2579 2370 delete rpcBitstreamRedirect; 2371 rpcBitstreamRedirect = new TComOutputBitstream; 2580 codedSliceData->clear(); 2372 2581 } 2373 2582 … … 2494 2703 } 2495 2704 } 2496 assert(it != accessUnit.end()); 2705 // assert(it != accessUnit.end()); // Triggers with some legit configurations 2497 2706 return seiStartPos; 2498 2707 } 2499 2708 #endif 2500 2709 2710 #if L0386_DB_METRIC 2711 Void TEncGOP::dblMetric( TComPic* pcPic, UInt uiNumSlices ) 2712 { 2713 TComPicYuv* pcPicYuvRec = pcPic->getPicYuvRec(); 2714 Pel* Rec = pcPicYuvRec->getLumaAddr( 0 ); 2715 Pel* tempRec = Rec; 2716 Int stride = pcPicYuvRec->getStride(); 2717 UInt log2maxTB = pcPic->getSlice(0)->getSPS()->getQuadtreeTULog2MaxSize(); 2718 UInt maxTBsize = (1<<log2maxTB); 2719 const UInt minBlockArtSize = 8; 2720 const UInt picWidth = pcPicYuvRec->getWidth(); 2721 const UInt picHeight = pcPicYuvRec->getHeight(); 2722 const UInt noCol = (picWidth>>log2maxTB); 2723 const UInt noRows = (picHeight>>log2maxTB); 2724 UInt64 *colSAD = (UInt64*)malloc(noCol*sizeof(UInt64)); 2725 UInt64 *rowSAD = (UInt64*)malloc(noRows*sizeof(UInt64)); 2726 UInt colIdx = 0; 2727 UInt rowIdx = 0; 2728 Pel p0, p1, p2, q0, q1, q2; 2729 2730 Int qp = pcPic->getSlice(0)->getSliceQp(); 2731 Int bitdepthScale = 1 << (g_bitDepthY-8); 2732 Int beta = TComLoopFilter::getBeta( qp ) * bitdepthScale; 2733 const Int thr2 = (beta>>2); 2734 const Int thr1 = 2*bitdepthScale; 2735 UInt a = 0; 2736 2737 memset(colSAD, 0, noCol*sizeof(UInt64)); 2738 memset(rowSAD, 0, noRows*sizeof(UInt64)); 2739 2740 if (maxTBsize > minBlockArtSize) 2741 { 2742 // Analyze vertical artifact edges 2743 for(Int c = maxTBsize; c < picWidth; c += maxTBsize) 2744 { 2745 for(Int r = 0; r < picHeight; r++) 2746 { 2747 p2 = Rec[c-3]; 2748 p1 = Rec[c-2]; 2749 p0 = Rec[c-1]; 2750 q0 = Rec[c]; 2751 q1 = Rec[c+1]; 2752 q2 = Rec[c+2]; 2753 a = ((abs(p2-(p1<<1)+p0)+abs(q0-(q1<<1)+q2))<<1); 2754 if ( thr1 < a && a < thr2) 2755 { 2756 colSAD[colIdx] += abs(p0 - q0); 2757 } 2758 Rec += stride; 2759 } 2760 colIdx++; 2761 Rec = tempRec; 2762 } 2763 2764 // Analyze horizontal artifact edges 2765 for(Int r = maxTBsize; r < picHeight; r += maxTBsize) 2766 { 2767 for(Int c = 0; c < picWidth; c++) 2768 { 2769 p2 = Rec[c + (r-3)*stride]; 2770 p1 = Rec[c + (r-2)*stride]; 2771 p0 = Rec[c + (r-1)*stride]; 2772 q0 = Rec[c + r*stride]; 2773 q1 = Rec[c + (r+1)*stride]; 2774 q2 = Rec[c + (r+2)*stride]; 2775 a = ((abs(p2-(p1<<1)+p0)+abs(q0-(q1<<1)+q2))<<1); 2776 if (thr1 < a && a < thr2) 2777 { 2778 rowSAD[rowIdx] += abs(p0 - q0); 2779 } 2780 } 2781 rowIdx++; 2782 } 2783 } 2784 2785 UInt64 colSADsum = 0; 2786 UInt64 rowSADsum = 0; 2787 for(Int c = 0; c < noCol-1; c++) 2788 { 2789 colSADsum += colSAD[c]; 2790 } 2791 for(Int r = 0; r < noRows-1; r++) 2792 { 2793 rowSADsum += rowSAD[r]; 2794 } 2795 2796 colSADsum <<= 10; 2797 rowSADsum <<= 10; 2798 colSADsum /= (noCol-1); 2799 colSADsum /= picHeight; 2800 rowSADsum /= (noRows-1); 2801 rowSADsum /= picWidth; 2802 2803 UInt64 avgSAD = ((colSADsum + rowSADsum)>>1); 2804 avgSAD >>= (g_bitDepthY-8); 2805 2806 if ( avgSAD > 2048 ) 2807 { 2808 avgSAD >>= 9; 2809 Int offset = Clip3(2,6,(Int)avgSAD); 2810 for (Int i=0; i<uiNumSlices; i++) 2811 { 2812 pcPic->getSlice(i)->setDeblockingFilterOverrideFlag(true); 2813 pcPic->getSlice(i)->setDeblockingFilterDisable(false); 2814 pcPic->getSlice(i)->setDeblockingFilterBetaOffsetDiv2( offset ); 2815 pcPic->getSlice(i)->setDeblockingFilterTcOffsetDiv2( offset ); 2816 } 2817 } 2818 else 2819 { 2820 for (Int i=0; i<uiNumSlices; i++) 2821 { 2822 pcPic->getSlice(i)->setDeblockingFilterOverrideFlag(false); 2823 pcPic->getSlice(i)->setDeblockingFilterDisable( pcPic->getSlice(i)->getPPS()->getPicDisableDeblockingFilterFlag() ); 2824 pcPic->getSlice(i)->setDeblockingFilterBetaOffsetDiv2( pcPic->getSlice(i)->getPPS()->getDeblockingFilterBetaOffsetDiv2() ); 2825 pcPic->getSlice(i)->setDeblockingFilterTcOffsetDiv2( pcPic->getSlice(i)->getPPS()->getDeblockingFilterTcOffsetDiv2() ); 2826 } 2827 } 2828 2829 free(colSAD); 2830 free(rowSAD); 2831 } 2832 #endif 2501 2833 #if H_MV 2502 2834 Void TEncGOP::xSetRefPicListModificationsMvc( TComSlice* pcSlice, UInt uiPOCCurr, UInt iGOPid ) … … 2578 2910 } 2579 2911 #endif 2580 2581 2912 //! \} -
branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/TEncGOP.h
r324 r362 132 132 Bool m_bufferingPeriodSEIPresentInAU; 133 133 Bool m_pictureTimingSEIPresentInAU; 134 #if K0180_SCALABLE_NESTING_SEI 135 Bool m_nestedBufferingPeriodSEIPresentInAU; 136 Bool m_nestedPictureTimingSEIPresentInAU; 137 #endif 134 138 #endif 135 139 public: … … 141 145 142 146 Void init ( TEncTop* pcTEncTop ); 143 144 147 #if H_MV 145 148 Void initGOP ( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsInGOP); … … 148 151 Void compressGOP( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRec, std::list<AccessUnit>& accessUnitsInGOP ); 149 152 #endif 150 151 Void xWriteTileLocationToSliceHeader (OutputNALUnit& rNalu, TComOutputBitstream*& rpcBitstreamRedirect, TComSlice*& rpcSlice); 153 Void xAttachSliceDataToNalUnit (OutputNALUnit& rNalu, TComOutputBitstream*& rpcBitstreamRedirect); 152 154 153 155 #if H_MV … … 167 169 Void printOutSummary ( UInt uiNumAllPicCoded ); 168 170 #endif 169 170 171 Void preLoopFilterPicAll ( TComPic* pcPic, UInt64& ruiDist, UInt64& ruiBits ); 171 172 172 173 TEncSlice* getSliceEncoder() { return m_pcSliceEncoder; } 173 NalUnitType getNalUnitType( Int pocCurr );174 NalUnitType getNalUnitType( Int pocCurr, Int lastIdr ); 174 175 Void arrangeLongtermPicturesInRPS(TComSlice *, TComList<TComPic*>& ); 175 176 protected: … … 189 190 SEIFramePacking* xCreateSEIFramePacking(); 190 191 SEIDisplayOrientation* xCreateSEIDisplayOrientation(); 192 193 #if J0149_TONE_MAPPING_SEI 194 SEIToneMappingInfo* xCreateSEIToneMappingInfo(); 195 #endif 191 196 192 197 Void xCreateLeadingSEIMessages (/*SEIMessages seiMessages,*/ AccessUnit &accessUnit, TComSPS *sps); … … 199 204 m_pictureTimingSEIPresentInAU = false; 200 205 } 201 #endif 202 206 #if K0180_SCALABLE_NESTING_SEI 207 Void xResetNestedSEIPresentFlags() 208 { 209 m_nestedBufferingPeriodSEIPresentInAU = false; 210 m_nestedPictureTimingSEIPresentInAU = false; 211 } 212 #endif 203 213 #if H_MV 204 214 Void xSetRefPicListModificationsMvc( TComSlice* pcSlice, UInt uiPOCCurr, UInt iGOPid ); 205 215 #endif 206 216 #if L0386_DB_METRIC 217 Void dblMetric( TComPic* pcPic, UInt uiNumSlices ); 218 #endif 207 219 };// END CLASS DEFINITION TEncGOP 208 220 -
branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp
r324 r362 1677 1677 #endif 1678 1678 { 1679 #if SAO_CHROMA_LAMBDA1680 m_dLambdaLuma = dLambdaLuma;1681 m_dLambdaChroma = dLambdaChroma;1682 #else1683 m_dLambdaLuma = dLambda;1684 m_dLambdaChroma = dLambda;1685 #endif1686 1687 1679 if(m_bUseNIF) 1688 1680 { -
branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.h
r324 r362 57 57 { 58 58 private: 59 Double m_dLambdaLuma;60 Double m_dLambdaChroma;61 62 59 TEncEntropy* m_pcEntropyCoder; 63 60 TEncSbac*** m_pppcRDSbacCoder; ///< for CABAC -
branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/TEncSbac.h
r324 r362 109 109 Void xWriteEpExGolomb ( UInt uiSymbol, UInt uiCount ); 110 110 Void xWriteCoefRemainExGolomb ( UInt symbol, UInt &rParam ); 111 Void xWriteTerminatingBit ( UInt uiBit );112 111 113 112 Void xCopyFrom ( TEncSbac* pSrc ); -
branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/TEncSearch.cpp
r324 r362 3209 3209 UInt uiBitsTempL0[MAX_NUM_REF]; 3210 3210 3211 #if L0034_COMBINED_LIST_CLEANUP 3212 TComMv mvValidList1; 3213 Int refIdxValidList1 = 0; 3214 UInt bitsValidList1 = MAX_UINT; 3215 UInt costValidList1 = MAX_UINT; 3216 #endif 3217 3211 3218 xGetBlkBits( ePartSize, pcCU->getSlice()->isInterP(), iPartIdx, uiLastMode, uiMbBits); 3212 3219 … … 3255 3262 uiBitsTemp += m_auiMVPIdxCost[aaiMvpIdx[iRefList][iRefIdxTemp]][AMVP_MAX_NUM_CANDS]; 3256 3263 #if ZERO_MVD_EST 3264 #if L0034_COMBINED_LIST_CLEANUP 3265 if ( iRefList == 0 || pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp ) < 0 ) 3266 #else 3257 3267 if ((iRefList != 1 || !pcCU->getSlice()->getNoBackPredFlag()) && 3258 3268 (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) <= 0 || pcCU->getSlice()->getRefIdxOfLC(eRefPicList, iRefIdxTemp)>=0)) 3269 #endif 3259 3270 { 3260 3271 uiZeroMvdBitsTemp = uiBitsTemp; … … 3276 3287 3277 3288 #if GPB_SIMPLE_UNI 3289 #if L0034_COMBINED_LIST_CLEANUP 3290 if ( iRefList == 1 ) // list 1 3291 { 3292 if ( pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp ) >= 0 ) 3293 { 3294 cMvTemp[1][iRefIdxTemp] = cMvTemp[0][pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp )]; 3295 uiCostTemp = uiCostTempL0[pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp )]; 3296 /*first subtract the bit-rate part of the cost of the other list*/ 3297 uiCostTemp -= m_pcRdCost->getCost( uiBitsTempL0[pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp )] ); 3298 /*correct the bit-rate part of the current ref*/ 3299 m_pcRdCost->setPredictor ( cMvPred[iRefList][iRefIdxTemp] ); 3300 uiBitsTemp += m_pcRdCost->getBits( cMvTemp[1][iRefIdxTemp].getHor(), cMvTemp[1][iRefIdxTemp].getVer() ); 3301 /*calculate the correct cost*/ 3302 uiCostTemp += m_pcRdCost->getCost( uiBitsTemp ); 3303 } 3304 else 3305 { 3306 xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp ); 3307 } 3308 } 3309 else 3310 { 3311 xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp ); 3312 } 3313 #else 3278 3314 if ( pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0) 3279 3315 { … … 3317 3353 } 3318 3354 } 3355 #endif 3319 3356 #else 3320 3357 xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp ); … … 3323 3360 xCheckBestMVP(pcCU, eRefPicList, cMvTemp[iRefList][iRefIdxTemp], cMvPred[iRefList][iRefIdxTemp], aaiMvpIdx[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp); 3324 3361 3362 #if L0034_COMBINED_LIST_CLEANUP 3363 if ( iRefList == 0 ) 3364 { 3365 uiCostTempL0[iRefIdxTemp] = uiCostTemp; 3366 uiBitsTempL0[iRefIdxTemp] = uiBitsTemp; 3367 } 3368 if ( uiCostTemp < uiCost[iRefList] ) 3369 { 3370 uiCost[iRefList] = uiCostTemp; 3371 uiBits[iRefList] = uiBitsTemp; // storing for bi-prediction 3372 3373 // set motion 3374 cMv[iRefList] = cMvTemp[iRefList][iRefIdxTemp]; 3375 iRefIdx[iRefList] = iRefIdxTemp; 3376 } 3377 3378 if ( iRefList == 1 && uiCostTemp < costValidList1 && pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp ) < 0 ) 3379 { 3380 costValidList1 = uiCostTemp; 3381 bitsValidList1 = uiBitsTemp; 3382 3383 // set motion 3384 mvValidList1 = cMvTemp[iRefList][iRefIdxTemp]; 3385 refIdxValidList1 = iRefIdxTemp; 3386 } 3387 #else 3325 3388 if(pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && !pcCU->getSlice()->getNoBackPredFlag()) 3326 3389 { … … 3372 3435 } 3373 3436 } 3437 #endif 3374 3438 } 3375 3439 } … … 3435 3499 3436 3500 Int iRefList = iIter % 2; 3501 #if L0034_COMBINED_LIST_CLEANUP 3502 if ( m_pcEncCfg->getUseFastEnc() ) 3503 { 3504 if( uiCost[0] <= uiCost[1] ) 3505 { 3506 iRefList = 1; 3507 } 3508 else 3509 { 3510 iRefList = 0; 3511 } 3512 } 3513 else if ( iIter == 0 ) 3514 { 3515 iRefList = 0; 3516 } 3517 if ( iIter == 0 && !pcCU->getSlice()->getMvdL1ZeroFlag()) 3518 { 3519 pcCU->getCUMvField(RefPicList(1-iRefList))->setAllMv( cMv[1-iRefList], ePartSize, uiPartAddr, 0, iPartIdx ); 3520 pcCU->getCUMvField(RefPicList(1-iRefList))->setAllRefIdx( iRefIdx[1-iRefList], ePartSize, uiPartAddr, 0, iPartIdx ); 3521 TComYuv* pcYuvPred = &m_acYuvPred[1-iRefList]; 3522 motionCompensation ( pcCU, pcYuvPred, RefPicList(1-iRefList), iPartIdx ); 3523 } 3524 #else 3437 3525 if ( m_pcEncCfg->getUseFastEnc() && (pcCU->getSlice()->getNoBackPredFlag() || (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(0)==0 )) ) 3438 3526 { 3439 3527 iRefList = 1; 3440 3528 } 3529 #endif 3441 3530 RefPicList eRefPicList = ( iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0 ); 3442 3531 … … 3573 3662 UInt uiMEBits = 0; 3574 3663 // Set Motion Field_ 3664 #if L0034_COMBINED_LIST_CLEANUP 3665 cMv[1] = mvValidList1; 3666 iRefIdx[1] = refIdxValidList1; 3667 uiBits[1] = bitsValidList1; 3668 uiCost[1] = costValidList1; 3669 #else 3575 3670 if ( pcCU->getSlice()->getNoBackPredFlag() || (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(0)==0 ) ) 3576 3671 { 3577 3672 uiCost[1] = MAX_UINT; 3578 3673 } 3674 #endif 3579 3675 #if AMP_MRG 3580 3676 if (bTestNormalMC) … … 4522 4618 while( pcCU->getWidth(0) > (pcCU->getSlice()->getSPS()->getMaxTrSize()<<uiTrLevel) ) uiTrLevel++; 4523 4619 } 4524 UInt uiMaxTrMode = pcCU->getSlice()->getSPS()->getMaxTrDepth()+ uiTrLevel;4620 UInt uiMaxTrMode = 1 + uiTrLevel; 4525 4621 4526 4622 while((uiWidth>>uiMaxTrMode) < (g_uiMaxCUWidth>>g_uiMaxCUDepth)) uiMaxTrMode--; -
branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/TEncSlice.cpp
r324 r362 438 438 #endif 439 439 440 #if L0386_DB_METRIC 441 if ( m_pcCfg->getDeblockingFilterMetric() ) 442 { 443 rpcSlice->setDeblockingFilterOverrideFlag(true); 444 rpcSlice->setDeblockingFilterDisable(false); 445 rpcSlice->setDeblockingFilterBetaOffsetDiv2( 0 ); 446 rpcSlice->setDeblockingFilterTcOffsetDiv2( 0 ); 447 } else 448 #endif 440 449 if (rpcSlice->getPPS()->getDeblockingFilterControlPresentFlag()) 441 450 { … … 1223 1232 \retval rpcBitstream bitstream class 1224 1233 */ 1225 Void TEncSlice::encodeSlice ( TComPic*& rpcPic, TComOutputBitstream* pc Bitstream, TComOutputBitstream* pcSubstreams )1234 Void TEncSlice::encodeSlice ( TComPic*& rpcPic, TComOutputBitstream* pcSubstreams ) 1226 1235 { 1227 1236 UInt uiCUAddr; … … 1403 1412 } 1404 1413 { 1405 UInt uiCounter = 0; 1406 vector<uint8_t>& rbsp = pcSubstreams[uiSubStrm].getFIFO(); 1407 for (vector<uint8_t>::iterator it = rbsp.begin(); it != rbsp.end();) 1408 { 1409 /* 1) find the next emulated 00 00 {00,01,02,03} 1410 * 2a) if not found, write all remaining bytes out, stop. 1411 * 2b) otherwise, write all non-emulated bytes out 1412 * 3) insert emulation_prevention_three_byte 1413 */ 1414 vector<uint8_t>::iterator found = it; 1415 do 1416 { 1417 /* NB, end()-1, prevents finding a trailing two byte sequence */ 1418 found = search_n(found, rbsp.end()-1, 2, 0); 1419 found++; 1420 /* if not found, found == end, otherwise found = second zero byte */ 1421 if (found == rbsp.end()) 1422 { 1423 break; 1424 } 1425 if (*(++found) <= 3) 1426 { 1427 break; 1428 } 1429 } while (true); 1430 it = found; 1431 if (found != rbsp.end()) 1432 { 1433 it++; 1434 uiCounter++; 1435 } 1436 } 1437 1414 UInt numStartCodeEmulations = pcSubstreams[uiSubStrm].countStartCodeEmulations(); 1438 1415 UInt uiAccumulatedSubstreamLength = 0; 1439 1416 for (Int iSubstrmIdx=0; iSubstrmIdx < iNumSubstreams; iSubstrmIdx++) … … 1443 1420 // add bits coded in previous dependent slices + bits coded so far 1444 1421 // add number of emulation prevention byte count in the tile 1445 pcSlice->addTileLocation( ((pcSlice->getTileOffstForMultES() + uiAccumulatedSubstreamLength - uiBitsOriginallyInSubstreams) >> 3) + uiCounter);1422 pcSlice->addTileLocation( ((pcSlice->getTileOffstForMultES() + uiAccumulatedSubstreamLength - uiBitsOriginallyInSubstreams) >> 3) + numStartCodeEmulations ); 1446 1423 } 1447 1424 } -
branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/TEncSlice.h
r324 r362 122 122 Void precompressSlice ( TComPic*& rpcPic ); ///< precompress slice for multi-loop opt. 123 123 Void compressSlice ( TComPic*& rpcPic ); ///< analysis stage of slice 124 Void encodeSlice ( TComPic*& rpcPic, TComOutputBitstream* rpcBitstream, TComOutputBitstream*pcSubstreams );124 Void encodeSlice ( TComPic*& rpcPic, TComOutputBitstream* pcSubstreams ); 125 125 126 126 // misc. functions -
branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/TEncTop.cpp
r324 r362 81 81 m_pcBitCounters = NULL; 82 82 m_pcRdCosts = NULL; 83 84 83 #if H_MV 85 84 m_ivPicLists = NULL; … … 96 95 Void TEncTop::create () 97 96 { 98 99 97 #if !H_MV 100 98 // initialize global variables … … 288 286 Void TEncTop::init() 289 287 { 290 291 288 // initialize SPS 292 289 xInitSPS(); … … 348 345 } 349 346 #endif 350 351 347 Void TEncTop::deletePicBuffer() 352 348 { … … 375 371 \retval iNumEncoded number of encoded pictures 376 372 */ 377 Void TEncTop::encode(Bool flush, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded378 373 #if H_MV 379 , Int gopId 380 #endif 381 ) 382 { 383 374 Void TEncTop::encode(Bool flush, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded , Int gopId ) 375 { 376 #else 377 Void TEncTop::encode(Bool flush, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded ) 378 { 379 #endif 384 380 #if H_3D 385 381 TComPic* picLastCoded = getPic( getGOPEncoder()->getPocLastCoded() ); … … 389 385 } 390 386 #endif 391 392 387 #if H_MV 393 388 if( gopId == 0) … … 547 542 m_cSPS.setMaxCUHeight ( g_uiMaxCUHeight ); 548 543 m_cSPS.setMaxCUDepth ( g_uiMaxCUDepth ); 549 m_cSPS.setMinTrDepth ( 0 ); 550 m_cSPS.setMaxTrDepth ( 1 ); 544 545 Int minCUSize = m_cSPS.getMaxCUWidth() >> ( m_cSPS.getMaxCUDepth()-g_uiAddCUDepth ); 546 Int log2MinCUSize = 0; 547 while(minCUSize > 1) 548 { 549 minCUSize >>= 1; 550 log2MinCUSize++; 551 } 552 553 m_cSPS.setLog2MinCodingBlockSize(log2MinCUSize); 554 m_cSPS.setLog2DiffMaxMinCodingBlockSize(m_cSPS.getMaxCUDepth()-g_uiAddCUDepth); 551 555 552 556 m_cSPS.setPCMLog2MinSize (m_uiPCMLog2MinSize); … … 563 567 564 568 m_cSPS.setMaxTrSize ( 1 << m_uiQuadtreeTULog2MaxSize ); 565 569 #if !L0034_COMBINED_LIST_CLEANUP 566 570 m_cSPS.setUseLComb ( m_bUseLComb ); 571 #endif 567 572 568 573 Int i; … … 716 721 m_cPPS.setOutputFlagPresentFlag( false ); 717 722 m_cPPS.setSignHideFlag(getSignHideFlag()); 723 #if L0386_DB_METRIC 724 if ( getDeblockingFilterMetric() ) 725 { 726 m_cPPS.setDeblockingFilterControlPresentFlag (true); 727 m_cPPS.setDeblockingFilterOverrideEnabledFlag(true); 728 m_cPPS.setPicDisableDeblockingFilterFlag(false); 729 m_cPPS.setDeblockingFilterBetaOffsetDiv2(0); 730 m_cPPS.setDeblockingFilterTcOffsetDiv2(0); 731 } 732 else 733 { 718 734 m_cPPS.setDeblockingFilterControlPresentFlag (m_DeblockingFilterControlPresent ); 735 } 736 #else 737 m_cPPS.setDeblockingFilterControlPresentFlag (m_DeblockingFilterControlPresent ); 738 #endif 719 739 m_cPPS.setLog2ParallelMergeLevelMinus2 (m_log2ParallelMergeLevelMinus2 ); 720 740 m_cPPS.setCabacInitPresentFlag(CABAC_INIT_PRESENT_FLAG); … … 990 1010 } 991 1011 1012 #if L0208_SOP_DESCRIPTION_SEI 1013 Int TEncTop::getReferencePictureSetIdxForSOP(TComSlice* slice, Int POCCurr, Int GOPid ) 1014 { 1015 int rpsIdx = GOPid; 1016 1017 for(Int extraNum=m_iGOPSize; extraNum<m_extraRPSs+m_iGOPSize; extraNum++) 1018 { 1019 if(m_uiIntraPeriod > 0 && getDecodingRefreshType() > 0) 1020 { 1021 Int POCIndex = POCCurr%m_uiIntraPeriod; 1022 if(POCIndex == 0) 1023 { 1024 POCIndex = m_uiIntraPeriod; 1025 } 1026 if(POCIndex == m_GOPList[extraNum].m_POC) 1027 { 1028 rpsIdx = extraNum; 1029 } 1030 } 1031 else 1032 { 1033 if(POCCurr==m_GOPList[extraNum].m_POC) 1034 { 1035 rpsIdx = extraNum; 1036 } 1037 } 1038 } 1039 1040 return rpsIdx; 1041 } 1042 #endif 1043 992 1044 Void TEncTop::xInitPPSforTiles() 993 1045 { -
branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/TEncTop.h
r324 r362 195 195 TComPPS* getPPS () { return &m_cPPS; } 196 196 Void selectReferencePictureSet(TComSlice* slice, Int POCCurr, Int GOPid ); 197 #if L0208_SOP_DESCRIPTION_SEI 198 Int getReferencePictureSetIdxForSOP(TComSlice* slice, Int POCCurr, Int GOPid ); 199 #endif 197 200 TComScalingList* getScalingList () { return &m_scalingList; } 198 199 201 #if H_MV 200 202 TEncAnalyze* getAnalyzeAll () { return &m_cAnalyzeAll; } … … 210 212 Void setIvPicLists ( TComPicLists* picLists) { m_ivPicLists = picLists; } 211 213 #endif 212 213 214 214 // ------------------------------------------------------------------------------------------------------------------- 215 215 // encoder function … … 217 217 218 218 /// encode several number of pictures until end-of-sequence 219 #if H_MV 220 Void encode( Bool bEos, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded , Int gopId ); 221 #else 219 222 Void encode( Bool bEos, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, 220 std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded 221 #if H_MV 222 , Int gopId 223 #endif 224 ); 225 226 #if H_MV 227 void printSummary ( Int numAllPicCoded ); 223 std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded ); 224 #endif 225 226 #if H_MV 227 Void printSummary ( Int numAllPicCoded ); 228 228 #else 229 229 void printSummary() { m_cGOPEncoder.printOutSummary (m_uiNumAllPicCoded); } 230 230 #endif 231 232 231 }; 233 232 -
branches/HTM-DEV-0.1-dev/source/Lib/TLibEncoder/WeightPredAnalysis.cpp
r324 r362 235 235 Int offset = (Int)( ((currDC<<log2Denom) - ((Int64)weight * refDC) + (Int64)realOffset) >> realLog2Denom ); 236 236 237 // Chroma offset range limi nation237 // Chroma offset range limitation 238 238 if(comp) 239 239 { 240 Int shift = 1 << (g_bitDepthC - 1); 241 Int pred = ( shift - ( ( shift*weight)>>(log2Denom) ) ); 240 Int pred = ( 128 - ( ( 128*weight)>>(log2Denom) ) ); 242 241 Int deltaOffset = Clip3( -512, 511, (offset - pred) ); // signed 10bit 243 242 offset = Clip3( -128, 127, (deltaOffset + pred) ); // signed 8bit 243 } 244 // Luma offset range limitation 245 else 246 { 247 offset = Clip3( -128, 127, offset); 244 248 } 245 249
Note: See TracChangeset for help on using the changeset viewer.