Changeset 438 in 3DVCSoftware for branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder
- Timestamp:
- 23 May 2013, 15:40:36 (12 years ago)
- Location:
- branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/SEIwrite.cpp
r362 r438 84 84 fprintf( g_hTrace, "=========== Decoding Unit Information SEI message ===========\n"); 85 85 break; 86 #if J0149_TONE_MAPPING_SEI87 case SEI::TONE_MAPPING_INFO:88 fprintf( g_hTrace, "=========== Tone Mapping Info SEI message ===========\n");89 break;90 #endif91 #if L0208_SOP_DESCRIPTION_SEI92 case SEI::SOP_DESCRIPTION:93 fprintf( g_hTrace, "=========== SOP Description SEI message ===========\n");94 break;95 #endif96 #if K0180_SCALABLE_NESTING_SEI97 case SEI::SCALABLE_NESTING:98 fprintf( g_hTrace, "=========== Scalable Nesting SEI message ===========\n");99 break;100 #endif101 86 default: 102 87 fprintf( g_hTrace, "=========== Unknown SEI message ===========\n"); … … 106 91 #endif 107 92 108 #if K0180_SCALABLE_NESTING_SEI109 void SEIWriter::xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComSPS *sps)110 #else111 93 void SEIWriter::xWriteSEIpayloadData(const SEI& sei, TComSPS *sps) 112 #endif113 94 { 114 95 switch (sei.payloadType()) … … 147 128 xWriteSEIGradualDecodingRefreshInfo(*static_cast<const SEIGradualDecodingRefreshInfo*>(&sei)); 148 129 break; 149 #if J0149_TONE_MAPPING_SEI150 case SEI::TONE_MAPPING_INFO:151 xWriteSEIToneMappingInfo(*static_cast<const SEIToneMappingInfo*>(&sei));152 break;153 #endif154 #if L0208_SOP_DESCRIPTION_SEI155 case SEI::SOP_DESCRIPTION:156 xWriteSEISOPDescription(*static_cast<const SEISOPDescription*>(&sei));157 break;158 #endif159 #if K0180_SCALABLE_NESTING_SEI160 case SEI::SCALABLE_NESTING:161 xWriteSEIScalableNesting(bs, *static_cast<const SEIScalableNesting*>(&sei), sps);162 break;163 #endif164 130 default: 165 131 assert(!"Unhandled SEI message"); … … 179 145 setBitstream(&bs_count); 180 146 181 182 #if K0180_SCALABLE_NESTING_SEI183 184 #if ENC_DEC_TRACE185 Bool traceEnable = g_HLSTraceEnable;186 g_HLSTraceEnable = false;187 #endif188 xWriteSEIpayloadData(bs_count, sei, sps);189 #if ENC_DEC_TRACE190 g_HLSTraceEnable = traceEnable;191 #endif192 193 #else194 195 147 #if ENC_DEC_TRACE 196 148 g_HLSTraceEnable = false; … … 200 152 g_HLSTraceEnable = true; 201 153 #endif 202 203 #endif204 205 154 UInt payload_data_num_bits = bs_count.getNumberOfWrittenBits(); 206 155 assert(0 == payload_data_num_bits % 8); … … 209 158 210 159 #if ENC_DEC_TRACE 211 #if K0180_SCALABLE_NESTING_SEI212 if (g_HLSTraceEnable)213 #endif214 160 xTraceSEIHeader(); 215 161 #endif … … 231 177 /* payloadData */ 232 178 #if ENC_DEC_TRACE 233 #if K0180_SCALABLE_NESTING_SEI234 if (g_HLSTraceEnable)235 #endif236 179 xTraceSEIMessageType(sei.payloadType()); 237 180 #endif 238 181 239 #if K0180_SCALABLE_NESTING_SEI240 xWriteSEIpayloadData(bs, sei, sps);241 #else242 182 xWriteSEIpayloadData(sei, sps); 243 #endif244 183 } 245 184 … … 482 421 xWriteByteAlign(); 483 422 } 484 485 #if J0149_TONE_MAPPING_SEI486 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_ISO534 {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_modelId553 }//if(!sei.m_toneMapCancelFlag)554 555 xWriteByteAlign();556 }557 #endif558 559 423 Void SEIWriter::xWriteSEIDisplayOrientation(const SEIDisplayOrientation &sei) 560 424 { … … 591 455 } 592 456 593 #if L0208_SOP_DESCRIPTION_SEI594 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 #endif615 616 #if K0180_SCALABLE_NESTING_SEI617 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 else633 {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 alignment647 while ( m_pcBitIf->getNumberOfWrittenBits() % 8 != 0 )648 {649 WRITE_FLAG( 0, "nesting_zero_bit" );650 }651 652 // write nested SEI messages653 for (SEIMessages::const_iterator it = sei.m_nestedSEIs.begin(); it != sei.m_nestedSEIs.end(); it++)654 {655 writeSEImessage(bs, *(*it), sps);656 }657 }658 #endif659 660 457 Void SEIWriter::xWriteByteAlign() 661 458 { -
branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/SEIwrite.h
r362 r438 50 50 51 51 protected: 52 #if K0180_SCALABLE_NESTING_SEI53 Void xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComSPS *sps);54 #else55 52 Void xWriteSEIpayloadData(const SEI& sei, TComSPS *sps); 56 #endif57 53 Void xWriteSEIuserDataUnregistered(const SEIuserDataUnregistered &sei); 58 54 Void xWriteSEIActiveParameterSets(const SEIActiveParameterSets& sei); … … 67 63 Void xWriteSEITemporalLevel0Index(const SEITemporalLevel0Index &sei); 68 64 Void xWriteSEIGradualDecodingRefreshInfo(const SEIGradualDecodingRefreshInfo &sei); 69 #if J0149_TONE_MAPPING_SEI70 Void xWriteSEIToneMappingInfo(const SEIToneMappingInfo& sei);71 #endif72 #if L0208_SOP_DESCRIPTION_SEI73 Void xWriteSEISOPDescription(const SEISOPDescription& sei);74 #endif75 #if K0180_SCALABLE_NESTING_SEI76 Void xWriteSEIScalableNesting(TComBitIf& bs, const SEIScalableNesting& sei, TComSPS *sps);77 #endif78 65 Void xWriteByteAlign(); 79 66 }; -
branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncBinCoderCABAC.cpp
r401 r438 185 185 { 186 186 { 187 #if !H_MV188 187 DTRACE_CABAC_VL( g_nSymbolCounter++ ) 189 188 DTRACE_CABAC_T( "\tstate=" ) … … 192 191 DTRACE_CABAC_V( binValue ) 193 192 DTRACE_CABAC_T( "\n" ) 194 #endif195 193 } 196 194 m_uiBinsCoded += m_binCountIncrement; … … 233 231 { 234 232 { 235 #if !H_MV236 233 DTRACE_CABAC_VL( g_nSymbolCounter++ ) 237 234 DTRACE_CABAC_T( "\tEPsymbol=" ) 238 235 DTRACE_CABAC_V( binValue ) 239 236 DTRACE_CABAC_T( "\n" ) 240 #endif241 237 } 242 238 m_uiBinsCoded += m_binCountIncrement; … … 263 259 for ( Int i = 0; i < numBins; i++ ) 264 260 { 265 #if !H_MV266 261 DTRACE_CABAC_VL( g_nSymbolCounter++ ) 267 262 DTRACE_CABAC_T( "\tEPsymbol=" ) 268 263 DTRACE_CABAC_V( ( binValues >> ( numBins - 1 - i ) ) & 1 ) 269 264 DTRACE_CABAC_T( "\n" ) 270 #endif271 265 } 272 266 -
branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncCavlc.cpp
r401 r438 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 supported 287 288 WRITE_FLAG(pcVUI->getFrameFieldInfoPresentFlag(), "frame_field_info_present_flag"); 288 289 … … 473 474 for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++) 474 475 { 475 #if L0323_DPB476 WRITE_UVLC( pcSPS->getMaxDecPicBuffering(i) - 1, "sps_max_dec_pic_buffering_minus1[i]" );477 #else478 476 WRITE_UVLC( pcSPS->getMaxDecPicBuffering(i), "sps_max_dec_pic_buffering[i]" ); 479 #endif480 477 WRITE_UVLC( pcSPS->getNumReorderPics(i), "sps_num_reorder_pics[i]" ); 481 478 WRITE_UVLC( pcSPS->getMaxLatencyIncrease(i), "sps_max_latency_increase[i]" ); … … 487 484 assert( pcSPS->getMaxCUWidth() == pcSPS->getMaxCUHeight() ); 488 485 489 WRITE_UVLC( pcSPS->getLog2MinCodingBlockSize() - 3, "log2_min_coding_block_size_minus3" ); 490 WRITE_UVLC( pcSPS->getLog2DiffMaxMinCodingBlockSize(), "log2_diff_max_min_coding_block_size" ); 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" ); 491 496 WRITE_UVLC( pcSPS->getQuadtreeTULog2MinSize() - 2, "log2_min_transform_block_size_minus2" ); 492 497 WRITE_UVLC( pcSPS->getQuadtreeTULog2MaxSize() - pcSPS->getQuadtreeTULog2MinSize(), "log2_diff_max_min_transform_block_size" ); … … 549 554 } 550 555 551 #if H_MV552 WRITE_FLAG( 1, "sps_extension_flag" );553 554 WRITE_FLAG( pcSPS->getInterViewMvVertConstraintFlag() ? 1 : 0, "inter_view_mv_vert_constraint_flag" );555 #else556 556 WRITE_FLAG( 0, "sps_extension_flag" ); 557 #endif558 557 } 559 558 … … 570 569 WRITE_FLAG( pcVPS->getTemporalNestingFlag(), "vps_temporal_id_nesting_flag" ); 571 570 assert (pcVPS->getMaxTLayers()>1||pcVPS->getTemporalNestingFlag()); 572 #if H_MV573 571 WRITE_CODE( 0xffff, 16, "vps_extension_offset" ); 574 #else575 WRITE_CODE( 0xffff, 16, "vps_reserved_ffff_16bits" );576 #endif577 572 codePTL( pcVPS->getPTL(), true, pcVPS->getMaxTLayers() - 1 ); 578 573 #if SIGNAL_BITRATE_PICRATE_IN_VPS … … 583 578 for(UInt i=0; i <= pcVPS->getMaxTLayers()-1; i++) 584 579 { 585 #if L0323_DPB586 WRITE_UVLC( pcVPS->getMaxDecPicBuffering(i) - 1, "vps_max_dec_pic_buffering_minus1[i]" );587 #else588 580 WRITE_UVLC( pcVPS->getMaxDecPicBuffering(i), "vps_max_dec_pic_buffering[i]" ); 589 #endif590 581 WRITE_UVLC( pcVPS->getNumReorderPics(i), "vps_num_reorder_pics[i]" ); 591 582 WRITE_UVLC( pcVPS->getMaxLatencyIncrease(i), "vps_max_latency_increase[i]" ); … … 654 645 } 655 646 #endif 647 656 648 #if H_MV 657 649 WRITE_FLAG( 1, "vps_extension_flag" ); … … 792 784 WRITE_CODE( picOrderCntLSB, pcSlice->getSPS()->getBitsForPOC(), "pic_order_cnt_lsb"); 793 785 TComReferencePictureSet* rps = pcSlice->getRPS(); 794 795 #if FIX1071796 // Deal with bitstream restriction stating that:797 // – If the current picture is a BLA or CRA picture, the value of NumPocTotalCurr shall be equal to 0.798 // Ideally this process should not be repeated for each slice in a picture799 TComReferencePictureSet altRps;800 Bool useAltRps = false;801 #if H_MV802 if (pcSlice->getRapPicFlag() && ( pcSlice->getLayerId() == 0 ) )803 #else804 if (pcSlice->getRapPicFlag())805 #endif806 {807 for (Int picIdx = 0; !useAltRps && picIdx < rps->getNumberOfPictures(); picIdx++)808 {809 useAltRps = rps->getUsed(picIdx);810 }811 if (useAltRps)812 {813 memcpy(&altRps, rps, sizeof(TComReferencePictureSet));814 rps = &altRps;815 for (Int picIdx = 0; picIdx < rps->getNumberOfPictures(); picIdx++)816 {817 rps->setUsed(picIdx, false);818 }819 }820 }821 822 if(pcSlice->getRPSidx() < 0 || useAltRps)823 #else824 786 if(pcSlice->getRPSidx() < 0) 825 #endif826 787 { 827 788 WRITE_FLAG( 0, "short_term_ref_pic_set_sps_flag"); … … 1406 1367 // ==================================================================================================================== 1407 1368 1369 1370 /** Write PCM alignment bits. 1371 * \returns Void 1372 */ 1373 Void TEncCavlc::xWritePCMAlignZero () 1374 { 1375 m_pcBitIf->writeAlignZero(); 1376 } 1377 1378 Void TEncCavlc::xWriteUnaryMaxSymbol( UInt uiSymbol, UInt uiMaxSymbol ) 1379 { 1380 if (uiMaxSymbol == 0) 1381 { 1382 return; 1383 } 1384 xWriteFlag( uiSymbol ? 1 : 0 ); 1385 if ( uiSymbol == 0 ) 1386 { 1387 return; 1388 } 1389 1390 Bool bCodeLast = ( uiMaxSymbol > uiSymbol ); 1391 1392 while( --uiSymbol ) 1393 { 1394 xWriteFlag( 1 ); 1395 } 1396 if( bCodeLast ) 1397 { 1398 xWriteFlag( 0 ); 1399 } 1400 return; 1401 } 1402 1403 Void TEncCavlc::xWriteExGolombLevel( UInt uiSymbol ) 1404 { 1405 if( uiSymbol ) 1406 { 1407 xWriteFlag( 1 ); 1408 UInt uiCount = 0; 1409 Bool bNoExGo = (uiSymbol < 13); 1410 1411 while( --uiSymbol && ++uiCount < 13 ) 1412 { 1413 xWriteFlag( 1 ); 1414 } 1415 if( bNoExGo ) 1416 { 1417 xWriteFlag( 0 ); 1418 } 1419 else 1420 { 1421 xWriteEpExGolomb( uiSymbol, 0 ); 1422 } 1423 } 1424 else 1425 { 1426 xWriteFlag( 0 ); 1427 } 1428 return; 1429 } 1430 1431 Void TEncCavlc::xWriteEpExGolomb( UInt uiSymbol, UInt uiCount ) 1432 { 1433 while( uiSymbol >= (UInt)(1<<uiCount) ) 1434 { 1435 xWriteFlag( 1 ); 1436 uiSymbol -= 1<<uiCount; 1437 uiCount ++; 1438 } 1439 xWriteFlag( 0 ); 1440 while( uiCount-- ) 1441 { 1442 xWriteFlag( (uiSymbol>>uiCount) & 1 ); 1443 } 1444 return; 1445 } 1446 1408 1447 /** code explicit wp tables 1409 1448 * \param TComSlice* pcSlice -
branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncCavlc.h
r362 r438 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 ); 70 75 71 76 Void codeShortTermRefPicSet ( TComSPS* pcSPS, TComReferencePictureSet* pcRPS, Bool calledFromSliceHeader, Int idx ); -
branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncCfg.h
r372 r438 74 74 Int m_interViewRefPosL[2][MAX_NUM_REF_PICS]; 75 75 #endif 76 76 77 GOPEntry() 77 78 : m_POC(-1) … … 171 172 Int m_loopFilterTcOffsetDiv2; 172 173 Bool m_DeblockingFilterControlPresent; 173 #if L0386_DB_METRIC174 Bool m_DeblockingFilterMetric;175 #endif176 174 Bool m_bUseSAO; 177 175 Int m_maxNumOffsetsPerPic; … … 204 202 Bool m_bUseASR; 205 203 Bool m_bUseHADME; 206 #if !L0034_COMBINED_LIST_CLEANUP207 204 Bool m_bUseLComb; 208 #endif209 205 Bool m_useRDOQ; 210 206 Bool m_useRDOQTS; … … 252 248 Int m_pictureTimingSEIEnabled; 253 249 Int m_recoveryPointSEIEnabled; 254 #if J0149_TONE_MAPPING_SEI255 Bool m_toneMappingInfoSEIEnabled;256 Int m_toneMapId;257 Bool m_toneMapCancelFlag;258 Bool m_toneMapPersistenceFlag;259 Int m_codedDataBitDepth;260 Int m_targetBitDepth;261 Int m_modelId;262 Int m_minValue;263 Int m_maxValue;264 Int m_sigmoidMidpoint;265 Int m_sigmoidWidth;266 Int m_numPivots;267 Int m_cameraIsoSpeedIdc;268 Int m_cameraIsoSpeedValue;269 Int m_exposureCompensationValueSignFlag;270 Int m_exposureCompensationValueNumerator;271 Int m_exposureCompensationValueDenomIdc;272 Int m_refScreenLuminanceWhite;273 Int m_extendedRangeWhiteLevel;274 Int m_nominalBlackLevelLumaCodeValue;275 Int m_nominalWhiteLevelLumaCodeValue;276 Int m_extendedWhiteLevelLumaCodeValue;277 Int* m_startOfCodedInterval;278 Int* m_codedPivotValue;279 Int* m_targetPivotValue;280 #endif281 250 Int m_framePackingSEIEnabled; 282 251 Int m_framePackingSEIType; … … 288 257 Int m_gradualDecodingRefreshInfoEnabled; 289 258 Int m_decodingUnitInfoSEIEnabled; 290 #if L0208_SOP_DESCRIPTION_SEI291 Int m_SOPDescriptionSEIEnabled;292 #endif293 #if K0180_SCALABLE_NESTING_SEI294 Int m_scalableNestingSEIEnabled;295 #endif296 259 //====== Weighted Prediction ======== 297 260 Bool m_useWeightedPred; //< Use of Weighting Prediction (P_SLICE) … … 362 325 #endif 363 326 #endif 327 364 328 public: 365 329 TEncCfg() … … 407 371 #endif 408 372 #endif 373 409 374 //====== Coding Structure ======== 410 375 Void setIntraPeriod ( Int i ) { m_uiIntraPeriod = (UInt)i; } … … 444 409 Void setLoopFilterTcOffset ( Int i ) { m_loopFilterTcOffsetDiv2 = i; } 445 410 Void setDeblockingFilterControlPresent ( Bool b ) { m_DeblockingFilterControlPresent = b; } 446 #if L0386_DB_METRIC447 Void setDeblockingFilterMetric ( Bool b ) { m_DeblockingFilterMetric = b; }448 #endif449 411 450 412 //====== Motion search ======== … … 501 463 Int getLoopFilterTcOffset () { return m_loopFilterTcOffsetDiv2; } 502 464 Bool getDeblockingFilterControlPresent() { return m_DeblockingFilterControlPresent; } 503 #if L0386_DB_METRIC504 Bool getDeblockingFilterMetric () { return m_DeblockingFilterMetric; }505 #endif506 465 507 466 //==== Motion search ======== … … 521 480 Void setUseASR ( Bool b ) { m_bUseASR = b; } 522 481 Void setUseHADME ( Bool b ) { m_bUseHADME = b; } 523 #if !L0034_COMBINED_LIST_CLEANUP524 482 Void setUseLComb ( Bool b ) { m_bUseLComb = b; } 525 #endif526 483 Void setUseRDOQ ( Bool b ) { m_useRDOQ = b; } 527 484 Void setUseRDOQTS ( Bool b ) { m_useRDOQTS = b; } … … 545 502 Bool getUseASR () { return m_bUseASR; } 546 503 Bool getUseHADME () { return m_bUseHADME; } 547 #if !L0034_COMBINED_LIST_CLEANUP548 504 Bool getUseLComb () { return m_bUseLComb; } 549 #endif550 505 Bool getUseRDOQ () { return m_useRDOQ; } 551 506 Bool getUseRDOQTS () { return m_useRDOQTS; } … … 644 599 Void setRecoveryPointSEIEnabled(Int b) { m_recoveryPointSEIEnabled = b; } 645 600 Int getRecoveryPointSEIEnabled() { return m_recoveryPointSEIEnabled; } 646 #if J0149_TONE_MAPPING_SEI647 Void setToneMappingInfoSEIEnabled(Bool b) { m_toneMappingInfoSEIEnabled = b; }648 Bool getToneMappingInfoSEIEnabled() { return m_toneMappingInfoSEIEnabled; }649 Void setTMISEIToneMapId(Int b) { m_toneMapId = b; }650 Int getTMISEIToneMapId() { return m_toneMapId; }651 Void setTMISEIToneMapCancelFlag(Bool b) { m_toneMapCancelFlag=b; }652 Bool getTMISEIToneMapCancelFlag() { return m_toneMapCancelFlag; }653 Void setTMISEIToneMapPersistenceFlag(Bool b) { m_toneMapPersistenceFlag = b; }654 Bool getTMISEIToneMapPersistenceFlag() { return m_toneMapPersistenceFlag; }655 Void setTMISEICodedDataBitDepth(Int b) { m_codedDataBitDepth = b; }656 Int getTMISEICodedDataBitDepth() { return m_codedDataBitDepth; }657 Void setTMISEITargetBitDepth(Int b) { m_targetBitDepth = b; }658 Int getTMISEITargetBitDepth() { return m_targetBitDepth; }659 Void setTMISEIModelID(Int b) { m_modelId = b; }660 Int getTMISEIModelID() { return m_modelId; }661 Void setTMISEIMinValue(Int b) { m_minValue = b; }662 Int getTMISEIMinValue() { return m_minValue; }663 Void setTMISEIMaxValue(Int b) { m_maxValue = b; }664 Int getTMISEIMaxValue() { return m_maxValue; }665 Void setTMISEISigmoidMidpoint(Int b) { m_sigmoidMidpoint = b; }666 Int getTMISEISigmoidMidpoint() { return m_sigmoidMidpoint; }667 Void setTMISEISigmoidWidth(Int b) { m_sigmoidWidth = b; }668 Int getTMISEISigmoidWidth() { return m_sigmoidWidth; }669 Void setTMISEIStartOfCodedInterva( Int* p ) { m_startOfCodedInterval = p; }670 Int* getTMISEIStartOfCodedInterva() { return m_startOfCodedInterval; }671 Void setTMISEINumPivots(Int b) { m_numPivots = b; }672 Int getTMISEINumPivots() { return m_numPivots; }673 Void setTMISEICodedPivotValue( Int* p ) { m_codedPivotValue = p; }674 Int* getTMISEICodedPivotValue() { return m_codedPivotValue; }675 Void setTMISEITargetPivotValue( Int* p ) { m_targetPivotValue = p; }676 Int* getTMISEITargetPivotValue() { return m_targetPivotValue; }677 Void setTMISEICameraIsoSpeedIdc(Int b) { m_cameraIsoSpeedIdc = b; }678 Int getTMISEICameraIsoSpeedIdc() { return m_cameraIsoSpeedIdc; }679 Void setTMISEICameraIsoSpeedValue(Int b) { m_cameraIsoSpeedValue = b; }680 Int getTMISEICameraIsoSpeedValue() { return m_cameraIsoSpeedValue; }681 Void setTMISEIExposureCompensationValueSignFlag(Int b) { m_exposureCompensationValueSignFlag = b; }682 Int getTMISEIExposureCompensationValueSignFlag() { return m_exposureCompensationValueSignFlag; }683 Void setTMISEIExposureCompensationValueNumerator(Int b) { m_exposureCompensationValueNumerator = b; }684 Int getTMISEIExposureCompensationValueNumerator() { return m_exposureCompensationValueNumerator; }685 Void setTMISEIExposureCompensationValueDenomIdc(Int b) { m_exposureCompensationValueDenomIdc =b; }686 Int getTMISEIExposureCompensationValueDenomIdc() { return m_exposureCompensationValueDenomIdc; }687 Void setTMISEIRefScreenLuminanceWhite(Int b) { m_refScreenLuminanceWhite = b; }688 Int getTMISEIRefScreenLuminanceWhite() { return m_refScreenLuminanceWhite; }689 Void setTMISEIExtendedRangeWhiteLevel(Int b) { m_extendedRangeWhiteLevel = b; }690 Int getTMISEIExtendedRangeWhiteLevel() { return m_extendedRangeWhiteLevel; }691 Void setTMISEINominalBlackLevelLumaCodeValue(Int b) { m_nominalBlackLevelLumaCodeValue = b; }692 Int getTMISEINominalBlackLevelLumaCodeValue() { return m_nominalBlackLevelLumaCodeValue; }693 Void setTMISEINominalWhiteLevelLumaCodeValue(Int b) { m_nominalWhiteLevelLumaCodeValue = b; }694 Int getTMISEINominalWhiteLevelLumaCodeValue() { return m_nominalWhiteLevelLumaCodeValue; }695 Void setTMISEIExtendedWhiteLevelLumaCodeValue(Int b) { m_extendedWhiteLevelLumaCodeValue =b; }696 Int getTMISEIExtendedWhiteLevelLumaCodeValue() { return m_extendedWhiteLevelLumaCodeValue; }697 #endif698 601 Void setFramePackingArrangementSEIEnabled(Int b) { m_framePackingSEIEnabled = b; } 699 602 Int getFramePackingArrangementSEIEnabled() { return m_framePackingSEIEnabled; } … … 714 617 Void setDecodingUnitInfoSEIEnabled(Int b) { m_decodingUnitInfoSEIEnabled = b; } 715 618 Int getDecodingUnitInfoSEIEnabled() { return m_decodingUnitInfoSEIEnabled; } 716 #if L0208_SOP_DESCRIPTION_SEI717 Void setSOPDescriptionSEIEnabled(Int b) { m_SOPDescriptionSEIEnabled = b; }718 Int getSOPDescriptionSEIEnabled() { return m_SOPDescriptionSEIEnabled; }719 #endif720 #if K0180_SCALABLE_NESTING_SEI721 Void setScalableNestingSEIEnabled(Int b) { m_scalableNestingSEIEnabled = b; }722 Int getScalableNestingSEIEnabled() { return m_scalableNestingSEIEnabled; }723 #endif724 619 Void setUseWP ( Bool b ) { m_useWeightedPred = b; } 725 620 Void setWPBiPred ( Bool b ) { m_useWeightedBiPred = b; } -
branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncEntropy.cpp
r401 r438 587 587 if( pcCU->isIntra(uiAbsPartIdx) ) 588 588 { 589 #if !H_MV590 589 DTRACE_CABAC_VL( g_nSymbolCounter++ ) 591 590 DTRACE_CABAC_T( "\tdecodeTransformIdx()\tCUDepth=" ) 592 591 DTRACE_CABAC_V( uiDepth ) 593 592 DTRACE_CABAC_T( "\n" ) 594 #endif595 593 } 596 594 else -
branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncGOP.cpp
r401 r438 96 96 #if L0045_NON_NESTED_SEI_RESTRICTIONS 97 97 xResetNonNestedSEIPresentFlags(); 98 #if K0180_SCALABLE_NESTING_SEI 99 xResetNestedSEIPresentFlags(); 100 #endif 101 #endif 98 #endif 99 102 100 #if H_MV 103 101 m_layerId = 0; … … 108 106 #endif 109 107 #endif 108 110 109 return; 111 110 } … … 212 211 } 213 212 214 #if J0149_TONE_MAPPING_SEI215 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 #endif301 213 Void TEncGOP::xCreateLeadingSEIMessages (/*SEIMessages seiMessages,*/ AccessUnit &accessUnit, TComSPS *sps) 302 214 { 303 OutputNALUnit nalu(NAL_UNIT_ PREFIX_SEI);215 OutputNALUnit nalu(NAL_UNIT_SEI); 304 216 305 217 if(m_pcCfg->getActiveParameterSetsSEIEnabled()) … … 322 234 SEIFramePacking *sei = xCreateSEIFramePacking (); 323 235 324 nalu = NALUnit(NAL_UNIT_ PREFIX_SEI);236 nalu = NALUnit(NAL_UNIT_SEI); 325 237 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); 326 238 m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps); … … 333 245 SEIDisplayOrientation *sei = xCreateSEIDisplayOrientation(); 334 246 335 nalu = NALUnit(NAL_UNIT_ PREFIX_SEI);247 nalu = NALUnit(NAL_UNIT_SEI); 336 248 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); 337 249 m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps); … … 340 252 delete sei; 341 253 } 342 #if J0149_TONE_MAPPING_SEI343 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 #endif355 254 } 356 255 … … 358 257 // Public member functions 359 258 // ==================================================================================================================== 259 360 260 #if H_MV 361 261 Void TEncGOP::initGOP( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsInGOP) … … 365 265 } 366 266 #endif 267 367 268 #if H_MV 368 269 Void TEncGOP::compressPicInGOP( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsInGOP, Int iGOPid) … … 374 275 TComPicYuv* pcPicYuvRecOut; 375 276 TComSlice* pcSlice; 376 TComOutputBitstream *pcBitstreamRedirect; 377 pcBitstreamRedirect = new TComOutputBitstream; 277 TComOutputBitstream* pcBitstreamRedirect = new TComOutputBitstream; 378 278 AccessUnit::iterator itLocationToPushSliceHeaderNALU; // used to store location where NALU containing slice header is to be inserted 379 279 UInt uiOneBitstreamPerSliceLength = 0; … … 386 286 m_iNumPicCoded = 0; 387 287 #endif 288 388 289 SEIPictureTiming pictureTimingSEI; 389 #if L0208_SOP_DESCRIPTION_SEI390 Bool writeSOP = m_pcCfg->getSOPDescriptionSEIEnabled();391 #endif392 #if K0180_SCALABLE_NESTING_SEI393 // Initialize Scalable Nesting SEI with single layer values394 SEIScalableNesting scalableNestingSEI;395 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 1396 scalableNestingSEI.m_nestingOpFlag = 0;397 scalableNestingSEI.m_nestingNumOpsMinus1 = 0; //nesting_num_ops_minus1398 scalableNestingSEI.m_allLayersFlag = 0;399 scalableNestingSEI.m_nestingNoOpMaxTemporalIdPlus1 = 6 + 1; //nesting_no_op_max_temporal_id_plus1400 scalableNestingSEI.m_nestingNumLayersMinus1 = 1 - 1; //nesting_num_layers_minus1401 scalableNestingSEI.m_nestingLayerId[0] = 0;402 scalableNestingSEI.m_callerOwnsSEIs = true;403 #endif404 290 #if L0044_DU_DPB_OUTPUT_DELAY_HRD 405 291 Int picSptDpbOutputDuDelay = 0; … … 408 294 UInt *accumNalsDU = NULL; 409 295 SEIDecodingUnitInfo decodingUnitInfoSEI; 296 410 297 #if !H_MV 411 298 for ( Int iGOPid=0; iGOPid < m_iGopSize; iGOPid++ ) 412 299 #endif 300 413 301 { 414 302 UInt uiColDir = 1; … … 469 357 if(pocCurr>=m_pcCfg->getFramesToBeEncoded()) 470 358 { 359 471 360 #if H_MV 472 361 delete pcBitstreamRedirect; … … 475 364 continue; 476 365 #endif 477 } 478 479 if( getNalUnitType(pocCurr, m_iLastIDR) == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType(pocCurr, m_iLastIDR) == NAL_UNIT_CODED_SLICE_IDR_N_LP ) 366 367 } 368 369 if( getNalUnitType(pocCurr) == NAL_UNIT_CODED_SLICE_IDR || getNalUnitType(pocCurr) == NAL_UNIT_CODED_SLICE_IDR_N_LP ) 480 370 { 481 371 m_iLastIDR = pocCurr; … … 495 385 pcSlice->setLastIDR(m_iLastIDR); 496 386 pcSlice->setSliceIdx(0); 387 497 388 #if H_MV 498 389 pcPic ->setLayerId ( getLayerId() ); … … 506 397 #endif 507 398 #endif 399 508 400 //set default slice level flag to the same as SPS level flag 509 401 pcSlice->setLFCrossSliceBoundaryFlag( pcSlice->getPPS()->getLoopFilterAcrossSlicesEnabledFlag() ); … … 545 437 #if H_MV 546 438 // Set the nal unit type 547 pcSlice->setNalUnitType(getNalUnitType(pocCurr , m_iLastIDR));439 pcSlice->setNalUnitType(getNalUnitType(pocCurr)); 548 440 if( pcSlice->getSliceType() == B_SLICE ) 549 441 { … … 559 451 } 560 452 // Set the nal unit type 561 pcSlice->setNalUnitType(getNalUnitType(pocCurr , m_iLastIDR));562 #endif 563 if(pcSlice->get TemporalLayerNonReferenceFlag())564 { 565 if(pcSlice->get NalUnitType()==NAL_UNIT_CODED_SLICE_TRAIL_R)453 pcSlice->setNalUnitType(getNalUnitType(pocCurr)); 454 #endif 455 if(pcSlice->getNalUnitType()==NAL_UNIT_CODED_SLICE_TRAIL_R) 456 { 457 if(pcSlice->getTemporalLayerNonReferenceFlag()) 566 458 { 567 459 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_TRAIL_N); 568 }569 if(pcSlice->getNalUnitType()==NAL_UNIT_CODED_SLICE_RADL_R)570 {571 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_RADL_N);572 }573 if(pcSlice->getNalUnitType()==NAL_UNIT_CODED_SLICE_RASL_R)574 {575 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_RASL_N);576 460 } 577 461 } … … 598 482 else 599 483 { 600 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_TLA _R);484 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_TLA); 601 485 } 602 486 } … … 684 568 } 685 569 #endif 686 #if !L0034_COMBINED_LIST_CLEANUP 570 687 571 if (pcSlice->getSliceType() != B_SLICE || !pcSlice->getSPS()->getUseLComb()) 688 572 { … … 696 580 pcSlice->setNumRefIdx(REF_PIC_LIST_C, pcSlice->getNumRefIdx(REF_PIC_LIST_0)); 697 581 } 698 #endif699 582 700 583 if (pcSlice->getSliceType() == B_SLICE) … … 722 605 pcSlice->setCheckLDC(bLowDelay); 723 606 } 724 else725 {726 pcSlice->setCheckLDC(true);727 }728 607 729 608 uiColDir = 1-uiColDir; … … 732 611 pcSlice->setRefPOCList(); 733 612 734 #if L0034_COMBINED_LIST_CLEANUP735 pcSlice->setList1IdxToList0Idx();736 #else737 613 pcSlice->setNoBackPredFlag( false ); 738 614 if ( pcSlice->getSliceType() == B_SLICE && !pcSlice->getRefPicListCombinationFlag()) … … 758 634 } 759 635 pcSlice->generateCombinedList(); 760 #endif761 636 762 637 if (m_pcEncTop->getTMVPModeId() == 2) … … 1064 939 Bool bLFCrossTileBoundary = pcSlice->getPPS()->getLoopFilterAcrossTilesEnabledFlag(); 1065 940 m_pcLoopFilter->setCfg(bLFCrossTileBoundary); 1066 #if L0386_DB_METRIC1067 if ( m_pcCfg->getDeblockingFilterMetric() )1068 {1069 dblMetric(pcPic, uiNumSlices);1070 }1071 #endif1072 941 m_pcLoopFilter->loopFilterPic( pcPic ); 1073 942 … … 1168 1037 } 1169 1038 1170 #if L0208_SOP_DESCRIPTION_SEI1171 if (writeSOP) // write SOP description SEI (if enabled) at the beginning of GOP1172 {1173 Int SOPcurrPOC = pocCurr;1174 1175 OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI);1176 m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice);1177 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);1178 1179 SEISOPDescription SOPDescriptionSEI;1180 SOPDescriptionSEI.m_sopSeqParameterSetId = pcSlice->getSPS()->getSPSId();1181 1182 UInt i = 0;1183 UInt prevEntryId = iGOPid;1184 for (j = iGOPid; j < m_iGopSize; j++)1185 {1186 Int deltaPOC = m_pcCfg->getGOPEntry(j).m_POC - m_pcCfg->getGOPEntry(prevEntryId).m_POC;1187 if ((SOPcurrPOC + deltaPOC) < m_pcCfg->getFramesToBeEncoded())1188 {1189 SOPcurrPOC += deltaPOC;1190 SOPDescriptionSEI.m_sopDescVclNaluType[i] = getNalUnitType(SOPcurrPOC, m_iLastIDR);1191 SOPDescriptionSEI.m_sopDescTemporalId[i] = m_pcCfg->getGOPEntry(j).m_temporalId;1192 SOPDescriptionSEI.m_sopDescStRpsIdx[i] = m_pcEncTop->getReferencePictureSetIdxForSOP(pcSlice, SOPcurrPOC, j);1193 SOPDescriptionSEI.m_sopDescPocDelta[i] = deltaPOC;1194 1195 prevEntryId = j;1196 i++;1197 }1198 }1199 1200 SOPDescriptionSEI.m_numPicsInSopMinus1 = i - 1;1201 1202 m_seiWriter.writeSEImessage( nalu.m_Bitstream, SOPDescriptionSEI, pcSlice->getSPS());1203 writeRBSPTrailingBits(nalu.m_Bitstream);1204 accessUnit.push_back(new NALUnitEBSP(nalu));1205 1206 writeSOP = false;1207 }1208 #endif1209 1210 1039 if( ( m_pcCfg->getPictureTimingSEIEnabled() || m_pcCfg->getDecodingUnitInfoSEIEnabled() ) && 1211 1040 ( pcSlice->getSPS()->getVuiParametersPresentFlag() ) && … … 1253 1082 || ( pcSlice->getSPS()->getVuiParameters()->getHrdParameters()->getVclHrdParametersPresentFlag() ) ) ) 1254 1083 { 1255 OutputNALUnit nalu(NAL_UNIT_ PREFIX_SEI);1084 OutputNALUnit nalu(NAL_UNIT_SEI); 1256 1085 m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice); 1257 1086 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); … … 1294 1123 writeRBSPTrailingBits(nalu.m_Bitstream); 1295 1124 #if L0045_NON_NESTED_SEI_RESTRICTIONS 1296 {1297 1125 UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit); 1298 1126 UInt offsetPosition = m_activeParameterSetSEIPresentInAU; // Insert BP SEI after APS SEI … … 1304 1132 accessUnit.insert(it, new NALUnitEBSP(nalu)); 1305 1133 m_bufferingPeriodSEIPresentInAU = true; 1306 }1307 1134 #else 1308 1135 accessUnit.push_back(new NALUnitEBSP(nalu)); 1309 1136 #endif 1310 1137 1311 #if K0180_SCALABLE_NESTING_SEI1312 if (m_pcCfg->getScalableNestingSEIEnabled())1313 {1314 OutputNALUnit naluTmp(NAL_UNIT_PREFIX_SEI);1315 m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice);1316 m_pcEntropyCoder->setBitstream(&naluTmp.m_Bitstream);1317 scalableNestingSEI.m_nestedSEIs.clear();1318 scalableNestingSEI.m_nestedSEIs.push_back(&sei_buffering_period);1319 m_seiWriter.writeSEImessage( naluTmp.m_Bitstream, scalableNestingSEI, pcSlice->getSPS());1320 writeRBSPTrailingBits(naluTmp.m_Bitstream);1321 #if L0045_NON_NESTED_SEI_RESTRICTIONS1322 UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit);1323 UInt offsetPosition = m_activeParameterSetSEIPresentInAU + m_bufferingPeriodSEIPresentInAU + m_pictureTimingSEIPresentInAU; // Insert BP SEI after non-nested APS, BP and PT SEIs1324 AccessUnit::iterator it;1325 for(j = 0, it = accessUnit.begin(); j < seiPositionInAu + offsetPosition; j++)1326 {1327 it++;1328 }1329 accessUnit.insert(it, new NALUnitEBSP(naluTmp));1330 m_nestedBufferingPeriodSEIPresentInAU = true;1331 #else1332 accessUnit.push_back(new NALUnitEBSP(naluTmp));1333 #endif1334 }1335 #endif1336 1337 1138 m_lastBPSEI = m_totalCoded; 1338 1139 m_cpbRemovalDelay = 0; … … 1344 1145 { 1345 1146 // Gradual decoding refresh SEI 1346 OutputNALUnit nalu(NAL_UNIT_ PREFIX_SEI);1147 OutputNALUnit nalu(NAL_UNIT_SEI); 1347 1148 m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice); 1348 1149 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); … … 1356 1157 } 1357 1158 // Recovery point SEI 1358 OutputNALUnit nalu(NAL_UNIT_ PREFIX_SEI);1159 OutputNALUnit nalu(NAL_UNIT_SEI); 1359 1160 m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice); 1360 1161 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); … … 1547 1348 1548 1349 pcSlice->setTileOffstForMultES( uiOneBitstreamPerSliceLength ); 1350 if (!sliceSegment) 1351 { 1549 1352 pcSlice->setTileLocationCount ( 0 ); 1550 m_pcSliceEncoder->encodeSlice(pcPic, pcSubstreamsOut); 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 } 1551 1359 1552 1360 { … … 1580 1388 if (ui+1 < pcSlice->getPPS()->getNumSubstreams()) 1581 1389 { 1582 puiSubstreamSizes[ui] = pcSubstreamsOut[ui].getNumberOfWrittenBits() + (pcSubstreamsOut[ui].countStartCodeEmulations()<<3);1390 puiSubstreamSizes[ui] = pcSubstreamsOut[ui].getNumberOfWrittenBits(); 1583 1391 } 1584 1392 } … … 1612 1420 // 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. 1613 1421 Bool bNALUAlignedWrittenToList = false; // used to ensure current NALU is not written more than once to the NALU list. 1614 x AttachSliceDataToNalUnit(nalu, pcBitstreamRedirect);1422 xWriteTileLocationToSliceHeader(nalu, pcBitstreamRedirect, pcSlice); 1615 1423 accessUnit.push_back(new NALUnitEBSP(nalu)); 1616 1424 #if RATE_CONTROL_LAMBDA_DOMAIN … … 1640 1448 { 1641 1449 UInt numRBSPBytes_nal = UInt((*it)->m_nalUnitData.str().size()); 1642 if ((*it)->m_nalUnitType != NAL_UNIT_ PREFIX_SEI && (*it)->m_nalUnitType != NAL_UNIT_SUFFIX_SEI)1450 if ((*it)->m_nalUnitType != NAL_UNIT_SEI && (*it)->m_nalUnitType != NAL_UNIT_SEI_SUFFIX) 1643 1451 { 1644 1452 numRBSPBytes += numRBSPBytes_nal; … … 1710 1518 pcPic->compressMotion(); 1711 1519 #endif 1520 1712 1521 #if H_MV 1713 1522 m_pocLastCoded = pcPic->getPOC(); … … 1740 1549 digestStr = digestToString(sei_recon_picture_digest.digest, 4); 1741 1550 } 1742 OutputNALUnit nalu(NAL_UNIT_S UFFIX_SEI, pcSlice->getTLayer());1551 OutputNALUnit nalu(NAL_UNIT_SEI_SUFFIX, pcSlice->getTLayer()); 1743 1552 1744 1553 /* write the SEI messages */ … … 1764 1573 sei_temporal_level0_index.rapIdx = m_rapIdx; 1765 1574 1766 OutputNALUnit nalu(NAL_UNIT_ PREFIX_SEI);1575 OutputNALUnit nalu(NAL_UNIT_SEI); 1767 1576 1768 1577 /* write the SEI messages */ … … 1904 1713 if( m_pcCfg->getPictureTimingSEIEnabled() ) 1905 1714 { 1906 { 1907 OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI, pcSlice->getTLayer()); 1715 OutputNALUnit nalu(NAL_UNIT_SEI, pcSlice->getTLayer()); 1908 1716 m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice); 1909 1717 m_seiWriter.writeSEImessage(nalu.m_Bitstream, pictureTimingSEI, pcSlice->getSPS()); … … 1925 1733 #endif 1926 1734 } 1927 #if K0180_SCALABLE_NESTING_SEI1928 if ( m_pcCfg->getScalableNestingSEIEnabled() ) // put picture timing SEI into scalable nesting SEI1929 {1930 OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI, pcSlice->getTLayer());1931 m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice);1932 scalableNestingSEI.m_nestedSEIs.clear();1933 scalableNestingSEI.m_nestedSEIs.push_back(&pictureTimingSEI);1934 m_seiWriter.writeSEImessage(nalu.m_Bitstream, scalableNestingSEI, pcSlice->getSPS());1935 writeRBSPTrailingBits(nalu.m_Bitstream);1936 #if L0045_NON_NESTED_SEI_RESTRICTIONS1937 UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit);1938 UInt offsetPosition = m_activeParameterSetSEIPresentInAU1939 + m_bufferingPeriodSEIPresentInAU + m_pictureTimingSEIPresentInAU + m_nestedBufferingPeriodSEIPresentInAU; // Insert PT SEI after APS and BP SEI1940 AccessUnit::iterator it;1941 for(j = 0, it = accessUnit.begin(); j < seiPositionInAu + offsetPosition; j++)1942 {1943 it++;1944 }1945 accessUnit.insert(it, new NALUnitEBSP(nalu));1946 m_nestedPictureTimingSEIPresentInAU = true;1947 #else1948 AccessUnit::iterator it = find_if(accessUnit.begin(), accessUnit.end(), mem_fun(&NALUnit::isSlice));1949 accessUnit.insert(it, new NALUnitEBSP(nalu));1950 #endif1951 }1952 #endif1953 1954 }1955 1735 if( m_pcCfg->getDecodingUnitInfoSEIEnabled() && hrd->getSubPicCpbParamsPresentFlag() ) 1956 1736 { … … 1958 1738 for( Int i = 0; i < ( pictureTimingSEI.m_numDecodingUnitsMinus1 + 1 ); i ++ ) 1959 1739 { 1960 OutputNALUnit nalu(NAL_UNIT_ PREFIX_SEI, pcSlice->getTLayer());1740 OutputNALUnit nalu(NAL_UNIT_SEI, pcSlice->getTLayer()); 1961 1741 1962 1742 SEIDecodingUnitInfo tempSEI; … … 2006 1786 break; 2007 1787 } 2008 if ((*it)->m_nalUnitType != NAL_UNIT_ PREFIX_SEI && (*it)->m_nalUnitType != NAL_UNIT_SUFFIX_SEI)1788 if ((*it)->m_nalUnitType != NAL_UNIT_SEI && (*it)->m_nalUnitType != NAL_UNIT_SEI_SUFFIX) 2009 1789 { 2010 1790 ctr++; … … 2017 1797 #if L0045_NON_NESTED_SEI_RESTRICTIONS 2018 1798 xResetNonNestedSEIPresentFlags(); 2019 #if K0180_SCALABLE_NESTING_SEI2020 xResetNestedSEIPresentFlags();2021 #endif2022 1799 #endif 2023 1800 pcPic->getPicYuvRec()->copyToPic(pcPicYuvRecOut); … … 2052 1829 assert ( m_iNumPicCoded == iNumPicRcvd ); 2053 1830 #endif 1831 2054 1832 } 2055 1833 … … 2245 2023 case NAL_UNIT_CODED_SLICE_TRAIL_R: return "TRAIL_R"; 2246 2024 case NAL_UNIT_CODED_SLICE_TRAIL_N: return "TRAIL_N"; 2247 case NAL_UNIT_CODED_SLICE_TLA _R: return "TLA_R";2025 case NAL_UNIT_CODED_SLICE_TLA: return "TLA"; 2248 2026 case NAL_UNIT_CODED_SLICE_TSA_N: return "TSA_N"; 2249 2027 case NAL_UNIT_CODED_SLICE_STSA_R: return "STSA_R"; 2250 2028 case NAL_UNIT_CODED_SLICE_STSA_N: return "STSA_N"; 2251 case NAL_UNIT_CODED_SLICE_BLA _W_LP: return "BLA_W_LP";2252 case NAL_UNIT_CODED_SLICE_BLA _W_RADL: return "BLA_W_RADL";2029 case NAL_UNIT_CODED_SLICE_BLA: return "BLA"; 2030 case NAL_UNIT_CODED_SLICE_BLANT: return "BLANT"; 2253 2031 case NAL_UNIT_CODED_SLICE_BLA_N_LP: return "BLA_N_LP"; 2254 case NAL_UNIT_CODED_SLICE_IDR _W_RADL: return "IDR_W_RADL";2032 case NAL_UNIT_CODED_SLICE_IDR: return "IDR"; 2255 2033 case NAL_UNIT_CODED_SLICE_IDR_N_LP: return "IDR_N_LP"; 2256 2034 case NAL_UNIT_CODED_SLICE_CRA: return "CRA"; 2257 case NAL_UNIT_CODED_SLICE_ RADL_R: return "RADL_R";2258 case NAL_UNIT_CODED_SLICE_ RASL_R: return "RASL_R";2035 case NAL_UNIT_CODED_SLICE_DLP: return "DLP"; 2036 case NAL_UNIT_CODED_SLICE_TFD: return "TFD"; 2259 2037 case NAL_UNIT_VPS: return "VPS"; 2260 2038 case NAL_UNIT_SPS: return "SPS"; … … 2264 2042 case NAL_UNIT_EOB: return "EOB"; 2265 2043 case NAL_UNIT_FILLER_DATA: return "FILLER"; 2266 case NAL_UNIT_PREFIX_SEI: return "SEI"; 2267 case NAL_UNIT_SUFFIX_SEI: return "SEI"; 2044 case NAL_UNIT_SEI: return "SEI"; 2268 2045 default: return "UNK"; 2269 2046 } … … 2356 2133 printf("*** %6s numBytesInNALunit: %u\n", nalUnitTypeToString((*it)->m_nalUnitType), numRBSPBytes_nal); 2357 2134 #endif 2358 if ((*it)->m_nalUnitType != NAL_UNIT_ PREFIX_SEI && (*it)->m_nalUnitType != NAL_UNIT_SUFFIX_SEI)2135 if ((*it)->m_nalUnitType != NAL_UNIT_SEI && (*it)->m_nalUnitType != NAL_UNIT_SEI_SUFFIX) 2359 2136 { 2360 2137 numRBSPBytes += numRBSPBytes_nal; … … 2366 2143 2367 2144 //===== add PSNR ===== 2145 2368 2146 #if H_MV 2369 2147 m_pcEncTop->getAnalyzeAll()->addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits); … … 2371 2149 m_gcAnalyzeAll.addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits); 2372 2150 #endif 2151 2373 2152 TComSlice* pcSlice = pcPic->getSlice(0); 2374 2153 if (pcSlice->isIntra()) 2375 2154 { 2155 2376 2156 #if H_MV 2377 2157 m_pcEncTop->getAnalyzeI()->addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits); … … 2379 2159 m_gcAnalyzeI.addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits); 2380 2160 #endif 2161 2381 2162 } 2382 2163 if (pcSlice->isInterP()) 2383 2164 { 2165 2384 2166 #if H_MV 2385 2167 m_pcEncTop->getAnalyzeP()->addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits); … … 2387 2169 m_gcAnalyzeP.addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits); 2388 2170 #endif 2171 2389 2172 } 2390 2173 if (pcSlice->isInterB()) 2391 2174 { 2175 2392 2176 #if H_MV 2393 2177 m_pcEncTop->getAnalyzeB()->addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits); … … 2395 2179 m_gcAnalyzeB.addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits); 2396 2180 #endif 2181 2397 2182 } 2398 2183 … … 2401 2186 2402 2187 #if ADAPTIVE_QP_SELECTION 2188 2403 2189 #if H_MV 2404 2190 printf("Layer %3d POC %4d TId: %1d ( %c-SLICE, nQP %d QP %d ) %10d bits", … … 2419 2205 uibits ); 2420 2206 #endif 2207 2421 2208 #else 2209 2422 2210 #if H_MV 2423 2211 printf("Layer %3d POC %4d TId: %1d ( %c-SLICE, QP %d ) %10d bits", … … 2436 2224 uibits ); 2437 2225 #endif 2226 2438 2227 #endif 2439 2228 … … 2468 2257 * This function checks the configuration and returns the appropriate nal_unit_type for the picture. 2469 2258 */ 2470 NalUnitType TEncGOP::getNalUnitType(Int pocCurr , Int lastIDR)2259 NalUnitType TEncGOP::getNalUnitType(Int pocCurr) 2471 2260 { 2472 2261 if (pocCurr == 0) 2473 2262 { 2474 return NAL_UNIT_CODED_SLICE_IDR _W_RADL;2263 return NAL_UNIT_CODED_SLICE_IDR; 2475 2264 } 2476 2265 if (pocCurr % m_pcCfg->getIntraPeriod() == 0) … … 2482 2271 else if (m_pcCfg->getDecodingRefreshType() == 2) 2483 2272 { 2484 return NAL_UNIT_CODED_SLICE_IDR _W_RADL;2273 return NAL_UNIT_CODED_SLICE_IDR; 2485 2274 } 2486 2275 } … … 2494 2283 // controlling the reference pictures used for encoding that leading picture. Such a leading 2495 2284 // picture need not be marked as a TFD picture. 2496 return NAL_UNIT_CODED_SLICE_RASL_R; 2497 } 2498 } 2499 if (lastIDR>0) 2500 { 2501 if (pocCurr < lastIDR) 2502 { 2503 return NAL_UNIT_CODED_SLICE_RADL_R; 2285 return NAL_UNIT_CODED_SLICE_TFD; 2504 2286 } 2505 2287 } … … 2552 2334 } 2553 2335 2554 /** Attaches the input bitstream to the stream in the output NAL unit 2555 Updates rNalu to contain concatenated bitstream. rpcBitstreamRedirect is cleared at the end of this function call. 2556 * \param codedSliceData contains the coded slice data (bitstream) to be concatenated to rNalu 2557 * \param rNalu target NAL unit 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. 2558 2339 */ 2559 Void TEncGOP::x AttachSliceDataToNalUnit (OutputNALUnit& rNalu, TComOutputBitstream*& codedSliceData)2340 Void TEncGOP::xWriteTileLocationToSliceHeader (OutputNALUnit& rNalu, TComOutputBitstream*& rpcBitstreamRedirect, TComSlice*& rpcSlice) 2560 2341 { 2561 2342 // Byte-align … … 2563 2344 2564 2345 // Perform bitstream concatenation 2565 if (codedSliceData->getNumberOfWrittenBits() > 0) 2566 { 2567 rNalu.m_Bitstream.addSubstream(codedSliceData); 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 } 2568 2366 } 2569 2367 2570 2368 m_pcEntropyCoder->setBitstream(&rNalu.m_Bitstream); 2571 2369 2572 codedSliceData->clear(); 2370 delete rpcBitstreamRedirect; 2371 rpcBitstreamRedirect = new TComOutputBitstream; 2573 2372 } 2574 2373 … … 2695 2494 } 2696 2495 } 2697 // assert(it != accessUnit.end()); // Triggers with some legit configurations 2496 assert(it != accessUnit.end()); 2698 2497 return seiStartPos; 2699 2498 } 2700 2499 #endif 2701 2500 2702 #if L0386_DB_METRIC2703 Void TEncGOP::dblMetric( TComPic* pcPic, UInt uiNumSlices )2704 {2705 TComPicYuv* pcPicYuvRec = pcPic->getPicYuvRec();2706 Pel* Rec = pcPicYuvRec->getLumaAddr( 0 );2707 Pel* tempRec = Rec;2708 Int stride = pcPicYuvRec->getStride();2709 UInt log2maxTB = pcPic->getSlice(0)->getSPS()->getQuadtreeTULog2MaxSize();2710 UInt maxTBsize = (1<<log2maxTB);2711 const UInt minBlockArtSize = 8;2712 const UInt picWidth = pcPicYuvRec->getWidth();2713 const UInt picHeight = pcPicYuvRec->getHeight();2714 const UInt noCol = (picWidth>>log2maxTB);2715 const UInt noRows = (picHeight>>log2maxTB);2716 UInt64 *colSAD = (UInt64*)malloc(noCol*sizeof(UInt64));2717 UInt64 *rowSAD = (UInt64*)malloc(noRows*sizeof(UInt64));2718 UInt colIdx = 0;2719 UInt rowIdx = 0;2720 Pel p0, p1, p2, q0, q1, q2;2721 2722 Int qp = pcPic->getSlice(0)->getSliceQp();2723 Int bitdepthScale = 1 << (g_bitDepthY-8);2724 Int beta = TComLoopFilter::getBeta( qp ) * bitdepthScale;2725 const Int thr2 = (beta>>2);2726 const Int thr1 = 2*bitdepthScale;2727 UInt a = 0;2728 2729 memset(colSAD, 0, noCol*sizeof(UInt64));2730 memset(rowSAD, 0, noRows*sizeof(UInt64));2731 2732 if (maxTBsize > minBlockArtSize)2733 {2734 // Analyze vertical artifact edges2735 for(Int c = maxTBsize; c < picWidth; c += maxTBsize)2736 {2737 for(Int r = 0; r < picHeight; r++)2738 {2739 p2 = Rec[c-3];2740 p1 = Rec[c-2];2741 p0 = Rec[c-1];2742 q0 = Rec[c];2743 q1 = Rec[c+1];2744 q2 = Rec[c+2];2745 a = ((abs(p2-(p1<<1)+p0)+abs(q0-(q1<<1)+q2))<<1);2746 if ( thr1 < a && a < thr2)2747 {2748 colSAD[colIdx] += abs(p0 - q0);2749 }2750 Rec += stride;2751 }2752 colIdx++;2753 Rec = tempRec;2754 }2755 2756 // Analyze horizontal artifact edges2757 for(Int r = maxTBsize; r < picHeight; r += maxTBsize)2758 {2759 for(Int c = 0; c < picWidth; c++)2760 {2761 p2 = Rec[c + (r-3)*stride];2762 p1 = Rec[c + (r-2)*stride];2763 p0 = Rec[c + (r-1)*stride];2764 q0 = Rec[c + r*stride];2765 q1 = Rec[c + (r+1)*stride];2766 q2 = Rec[c + (r+2)*stride];2767 a = ((abs(p2-(p1<<1)+p0)+abs(q0-(q1<<1)+q2))<<1);2768 if (thr1 < a && a < thr2)2769 {2770 rowSAD[rowIdx] += abs(p0 - q0);2771 }2772 }2773 rowIdx++;2774 }2775 }2776 2777 UInt64 colSADsum = 0;2778 UInt64 rowSADsum = 0;2779 for(Int c = 0; c < noCol-1; c++)2780 {2781 colSADsum += colSAD[c];2782 }2783 for(Int r = 0; r < noRows-1; r++)2784 {2785 rowSADsum += rowSAD[r];2786 }2787 2788 colSADsum <<= 10;2789 rowSADsum <<= 10;2790 colSADsum /= (noCol-1);2791 colSADsum /= picHeight;2792 rowSADsum /= (noRows-1);2793 rowSADsum /= picWidth;2794 2795 UInt64 avgSAD = ((colSADsum + rowSADsum)>>1);2796 avgSAD >>= (g_bitDepthY-8);2797 2798 if ( avgSAD > 2048 )2799 {2800 avgSAD >>= 9;2801 Int offset = Clip3(2,6,(Int)avgSAD);2802 for (Int i=0; i<uiNumSlices; i++)2803 {2804 pcPic->getSlice(i)->setDeblockingFilterOverrideFlag(true);2805 pcPic->getSlice(i)->setDeblockingFilterDisable(false);2806 pcPic->getSlice(i)->setDeblockingFilterBetaOffsetDiv2( offset );2807 pcPic->getSlice(i)->setDeblockingFilterTcOffsetDiv2( offset );2808 }2809 }2810 else2811 {2812 for (Int i=0; i<uiNumSlices; i++)2813 {2814 pcPic->getSlice(i)->setDeblockingFilterOverrideFlag(false);2815 pcPic->getSlice(i)->setDeblockingFilterDisable( pcPic->getSlice(i)->getPPS()->getPicDisableDeblockingFilterFlag() );2816 pcPic->getSlice(i)->setDeblockingFilterBetaOffsetDiv2( pcPic->getSlice(i)->getPPS()->getDeblockingFilterBetaOffsetDiv2() );2817 pcPic->getSlice(i)->setDeblockingFilterTcOffsetDiv2( pcPic->getSlice(i)->getPPS()->getDeblockingFilterTcOffsetDiv2() );2818 }2819 }2820 2821 free(colSAD);2822 free(rowSAD);2823 }2824 #endif2825 2501 #if H_MV 2826 2502 Void TEncGOP::xSetRefPicListModificationsMvc( TComSlice* pcSlice, UInt uiPOCCurr, UInt iGOPid ) … … 2846 2522 { 2847 2523 Int numModifications = 0; 2848 2524 2849 2525 for( Int k = 0; k < ge.m_numInterViewRefPics; k++ ) 2850 2526 { … … 2853 2529 2854 2530 // set inter-view modifications 2855 Bool isModified = false;2856 Int tempList[16];2857 for( Int k = 0; k < 16; k++ ) { tempList[k] = -1; }2858 2859 2531 if( (maxRefListSize > 1) && (numModifications > 0) ) 2860 2532 { 2533 refPicListModification->setRefPicListModificationFlagL( li, true ); 2534 Int tempList[16]; 2535 for( Int k = 0; k < 16; k++ ) { tempList[k] = -1; } 2536 2537 Bool isModified = false; 2861 2538 for( Int k = 0; k < ge.m_numInterViewRefPics; k++ ) 2862 2539 { … … 2877 2554 } 2878 2555 } 2879 } 2880 2881 refPicListModification->setRefPicListModificationFlagL( li, isModified ); 2882 2883 if( isModified ) 2884 { 2885 Int temporalRefIdx = 0; 2886 for( Int i = 0; i < pcSlice->getNumRefIdx( ( li == 0 ) ? REF_PIC_LIST_0 : REF_PIC_LIST_1 ); i++ ) 2887 { 2888 if( tempList[i] >= 0 ) 2889 { 2890 refPicListModification->setRefPicSetIdxL( li, i, tempList[i] ); 2891 } 2892 else 2893 { 2894 refPicListModification->setRefPicSetIdxL( li, i, temporalRefIdx ); 2895 temporalRefIdx++; 2896 } 2897 } 2898 } 2556 if( isModified ) 2557 { 2558 Int temporalRefIdx = 0; 2559 for( Int i = 0; i < pcSlice->getNumRefIdx( ( li == 0 ) ? REF_PIC_LIST_0 : REF_PIC_LIST_1 ); i++ ) 2560 { 2561 if( tempList[i] >= 0 ) 2562 { 2563 refPicListModification->setRefPicSetIdxL( li, i, tempList[i] ); 2564 } 2565 else 2566 { 2567 refPicListModification->setRefPicSetIdxL( li, i, temporalRefIdx ); 2568 temporalRefIdx++; 2569 } 2570 } 2571 } 2572 else 2573 { 2574 refPicListModification->setRefPicListModificationFlagL( li, false ); 2575 } 2576 } 2899 2577 } 2900 2578 } 2901 2579 #endif 2580 2902 2581 //! \} -
branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncGOP.h
r368 r438 108 108 #endif 109 109 #endif 110 110 111 //--Adaptive Loop filter 111 112 TEncSampleAdaptiveOffset* m_pcSAO; … … 131 132 Bool m_bufferingPeriodSEIPresentInAU; 132 133 Bool m_pictureTimingSEIPresentInAU; 133 #if K0180_SCALABLE_NESTING_SEI134 Bool m_nestedBufferingPeriodSEIPresentInAU;135 Bool m_nestedPictureTimingSEIPresentInAU;136 #endif137 134 #endif 138 135 public: … … 144 141 145 142 Void init ( TEncTop* pcTEncTop ); 143 146 144 #if H_MV 147 145 Void initGOP ( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsInGOP); … … 150 148 Void compressGOP( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRec, std::list<AccessUnit>& accessUnitsInGOP ); 151 149 #endif 152 Void xAttachSliceDataToNalUnit (OutputNALUnit& rNalu, TComOutputBitstream*& rpcBitstreamRedirect); 150 151 Void xWriteTileLocationToSliceHeader (OutputNALUnit& rNalu, TComOutputBitstream*& rpcBitstreamRedirect, TComSlice*& rpcSlice); 153 152 154 153 #if H_MV … … 168 167 Void printOutSummary ( UInt uiNumAllPicCoded ); 169 168 #endif 169 170 170 Void preLoopFilterPicAll ( TComPic* pcPic, UInt64& ruiDist, UInt64& ruiBits ); 171 171 172 172 TEncSlice* getSliceEncoder() { return m_pcSliceEncoder; } 173 NalUnitType getNalUnitType( Int pocCurr , Int lastIdr);173 NalUnitType getNalUnitType( Int pocCurr ); 174 174 Void arrangeLongtermPicturesInRPS(TComSlice *, TComList<TComPic*>& ); 175 175 protected: … … 189 189 SEIFramePacking* xCreateSEIFramePacking(); 190 190 SEIDisplayOrientation* xCreateSEIDisplayOrientation(); 191 192 #if J0149_TONE_MAPPING_SEI193 SEIToneMappingInfo* xCreateSEIToneMappingInfo();194 #endif195 191 196 192 Void xCreateLeadingSEIMessages (/*SEIMessages seiMessages,*/ AccessUnit &accessUnit, TComSPS *sps); … … 203 199 m_pictureTimingSEIPresentInAU = false; 204 200 } 205 #if K0180_SCALABLE_NESTING_SEI 206 Void xResetNestedSEIPresentFlags() 207 { 208 m_nestedBufferingPeriodSEIPresentInAU = false; 209 m_nestedPictureTimingSEIPresentInAU = false; 210 } 211 #endif 212 #endif 201 #endif 202 213 203 #if H_MV 214 204 Void xSetRefPicListModificationsMvc( TComSlice* pcSlice, UInt uiPOCCurr, UInt iGOPid ); 215 205 #endif 216 #if L0386_DB_METRIC 217 Void dblMetric( TComPic* pcPic, UInt uiNumSlices ); 218 #endif 206 219 207 };// END CLASS DEFINITION TEncGOP 220 208 -
branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp
r362 r438 1677 1677 #endif 1678 1678 { 1679 #if SAO_CHROMA_LAMBDA 1680 m_dLambdaLuma = dLambdaLuma; 1681 m_dLambdaChroma = dLambdaChroma; 1682 #else 1683 m_dLambdaLuma = dLambda; 1684 m_dLambdaChroma = dLambda; 1685 #endif 1686 1679 1687 if(m_bUseNIF) 1680 1688 { -
branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.h
r362 r438 57 57 { 58 58 private: 59 Double m_dLambdaLuma; 60 Double m_dLambdaChroma; 61 59 62 TEncEntropy* m_pcEntropyCoder; 60 63 TEncSbac*** m_pppcRDSbacCoder; ///< for CABAC -
branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncSbac.h
r362 r438 109 109 Void xWriteEpExGolomb ( UInt uiSymbol, UInt uiCount ); 110 110 Void xWriteCoefRemainExGolomb ( UInt symbol, UInt &rParam ); 111 Void xWriteTerminatingBit ( UInt uiBit ); 111 112 112 113 Void xCopyFrom ( TEncSbac* pSrc ); -
branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncSearch.cpp
r362 r438 3209 3209 UInt uiBitsTempL0[MAX_NUM_REF]; 3210 3210 3211 #if L0034_COMBINED_LIST_CLEANUP3212 TComMv mvValidList1;3213 Int refIdxValidList1 = 0;3214 UInt bitsValidList1 = MAX_UINT;3215 UInt costValidList1 = MAX_UINT;3216 #endif3217 3218 3211 xGetBlkBits( ePartSize, pcCU->getSlice()->isInterP(), iPartIdx, uiLastMode, uiMbBits); 3219 3212 … … 3262 3255 uiBitsTemp += m_auiMVPIdxCost[aaiMvpIdx[iRefList][iRefIdxTemp]][AMVP_MAX_NUM_CANDS]; 3263 3256 #if ZERO_MVD_EST 3264 #if L0034_COMBINED_LIST_CLEANUP3265 if ( iRefList == 0 || pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp ) < 0 )3266 #else3267 3257 if ((iRefList != 1 || !pcCU->getSlice()->getNoBackPredFlag()) && 3268 3258 (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) <= 0 || pcCU->getSlice()->getRefIdxOfLC(eRefPicList, iRefIdxTemp)>=0)) 3269 #endif3270 3259 { 3271 3260 uiZeroMvdBitsTemp = uiBitsTemp; … … 3287 3276 3288 3277 #if GPB_SIMPLE_UNI 3289 #if L0034_COMBINED_LIST_CLEANUP3290 if ( iRefList == 1 ) // list 13291 {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 else3305 {3306 xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp );3307 }3308 }3309 else3310 {3311 xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp );3312 }3313 #else3314 3278 if ( pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0) 3315 3279 { … … 3353 3317 } 3354 3318 } 3355 #endif3356 3319 #else 3357 3320 xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp ); … … 3360 3323 xCheckBestMVP(pcCU, eRefPicList, cMvTemp[iRefList][iRefIdxTemp], cMvPred[iRefList][iRefIdxTemp], aaiMvpIdx[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp); 3361 3324 3362 #if L0034_COMBINED_LIST_CLEANUP3363 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-prediction3372 3373 // set motion3374 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 motion3384 mvValidList1 = cMvTemp[iRefList][iRefIdxTemp];3385 refIdxValidList1 = iRefIdxTemp;3386 }3387 #else3388 3325 if(pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && !pcCU->getSlice()->getNoBackPredFlag()) 3389 3326 { … … 3435 3372 } 3436 3373 } 3437 #endif3438 3374 } 3439 3375 } … … 3499 3435 3500 3436 Int iRefList = iIter % 2; 3501 #if L0034_COMBINED_LIST_CLEANUP3502 if ( m_pcEncCfg->getUseFastEnc() )3503 {3504 if( uiCost[0] <= uiCost[1] )3505 {3506 iRefList = 1;3507 }3508 else3509 {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 #else3525 3437 if ( m_pcEncCfg->getUseFastEnc() && (pcCU->getSlice()->getNoBackPredFlag() || (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(0)==0 )) ) 3526 3438 { 3527 3439 iRefList = 1; 3528 3440 } 3529 #endif3530 3441 RefPicList eRefPicList = ( iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0 ); 3531 3442 … … 3662 3573 UInt uiMEBits = 0; 3663 3574 // Set Motion Field_ 3664 #if L0034_COMBINED_LIST_CLEANUP3665 cMv[1] = mvValidList1;3666 iRefIdx[1] = refIdxValidList1;3667 uiBits[1] = bitsValidList1;3668 uiCost[1] = costValidList1;3669 #else3670 3575 if ( pcCU->getSlice()->getNoBackPredFlag() || (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(0)==0 ) ) 3671 3576 { 3672 3577 uiCost[1] = MAX_UINT; 3673 3578 } 3674 #endif3675 3579 #if AMP_MRG 3676 3580 if (bTestNormalMC) … … 4618 4522 while( pcCU->getWidth(0) > (pcCU->getSlice()->getSPS()->getMaxTrSize()<<uiTrLevel) ) uiTrLevel++; 4619 4523 } 4620 UInt uiMaxTrMode = 1+ uiTrLevel;4524 UInt uiMaxTrMode = pcCU->getSlice()->getSPS()->getMaxTrDepth() + uiTrLevel; 4621 4525 4622 4526 while((uiWidth>>uiMaxTrMode) < (g_uiMaxCUWidth>>g_uiMaxCUDepth)) uiMaxTrMode--; -
branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncSlice.cpp
r368 r438 414 414 eSliceType = (pocLast == 0 || pocCurr % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType; 415 415 #endif 416 417 416 rpcSlice->setSliceType ( eSliceType ); 418 417 #endif … … 439 438 #endif 440 439 441 #if L0386_DB_METRIC442 if ( m_pcCfg->getDeblockingFilterMetric() )443 {444 rpcSlice->setDeblockingFilterOverrideFlag(true);445 rpcSlice->setDeblockingFilterDisable(false);446 rpcSlice->setDeblockingFilterBetaOffsetDiv2( 0 );447 rpcSlice->setDeblockingFilterTcOffsetDiv2( 0 );448 } else449 #endif450 440 if (rpcSlice->getPPS()->getDeblockingFilterControlPresentFlag()) 451 441 { … … 1233 1223 \retval rpcBitstream bitstream class 1234 1224 */ 1235 Void TEncSlice::encodeSlice ( TComPic*& rpcPic, TComOutputBitstream* pc Substreams )1225 Void TEncSlice::encodeSlice ( TComPic*& rpcPic, TComOutputBitstream* pcBitstream, TComOutputBitstream* pcSubstreams ) 1236 1226 { 1237 1227 UInt uiCUAddr; … … 1413 1403 } 1414 1404 { 1415 UInt numStartCodeEmulations = pcSubstreams[uiSubStrm].countStartCodeEmulations(); 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 1416 1438 UInt uiAccumulatedSubstreamLength = 0; 1417 1439 for (Int iSubstrmIdx=0; iSubstrmIdx < iNumSubstreams; iSubstrmIdx++) … … 1421 1443 // add bits coded in previous dependent slices + bits coded so far 1422 1444 // add number of emulation prevention byte count in the tile 1423 pcSlice->addTileLocation( ((pcSlice->getTileOffstForMultES() + uiAccumulatedSubstreamLength - uiBitsOriginallyInSubstreams) >> 3) + numStartCodeEmulations);1445 pcSlice->addTileLocation( ((pcSlice->getTileOffstForMultES() + uiAccumulatedSubstreamLength - uiBitsOriginallyInSubstreams) >> 3) + uiCounter ); 1424 1446 } 1425 1447 } -
branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncSlice.h
r362 r438 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* pcSubstreams );124 Void encodeSlice ( TComPic*& rpcPic, TComOutputBitstream* rpcBitstream, TComOutputBitstream* pcSubstreams ); 125 125 126 126 // misc. functions -
branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncTop.cpp
r368 r438 81 81 m_pcBitCounters = NULL; 82 82 m_pcRdCosts = NULL; 83 83 84 #if H_MV 84 85 m_ivPicLists = NULL; … … 95 96 Void TEncTop::create () 96 97 { 98 97 99 #if !H_MV 98 100 // initialize global variables … … 286 288 Void TEncTop::init() 287 289 { 290 288 291 // initialize SPS 289 292 xInitSPS(); … … 345 348 } 346 349 #endif 350 347 351 Void TEncTop::deletePicBuffer() 348 352 { … … 371 375 \retval iNumEncoded number of encoded pictures 372 376 */ 377 Void TEncTop::encode(Bool flush, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded 373 378 #if H_MV 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 379 , Int gopId 380 #endif 381 ) 382 { 383 380 384 #if H_3D 381 385 TComPic* picLastCoded = getPic( getGOPEncoder()->getPocLastCoded() ); … … 385 389 } 386 390 #endif 391 387 392 #if H_MV 388 393 if( gopId == 0) … … 438 443 m_iNumPicRcvd = 0; 439 444 m_uiNumAllPicCoded += iNumEncoded; 445 440 446 #if H_MV 441 447 } 442 448 #endif 449 443 450 } 444 451 … … 540 547 m_cSPS.setMaxCUHeight ( g_uiMaxCUHeight ); 541 548 m_cSPS.setMaxCUDepth ( g_uiMaxCUDepth ); 542 543 Int minCUSize = m_cSPS.getMaxCUWidth() >> ( m_cSPS.getMaxCUDepth()-g_uiAddCUDepth ); 544 Int log2MinCUSize = 0; 545 while(minCUSize > 1) 546 { 547 minCUSize >>= 1; 548 log2MinCUSize++; 549 } 550 551 m_cSPS.setLog2MinCodingBlockSize(log2MinCUSize); 552 m_cSPS.setLog2DiffMaxMinCodingBlockSize(m_cSPS.getMaxCUDepth()-g_uiAddCUDepth); 549 m_cSPS.setMinTrDepth ( 0 ); 550 m_cSPS.setMaxTrDepth ( 1 ); 553 551 554 552 m_cSPS.setPCMLog2MinSize (m_uiPCMLog2MinSize); … … 565 563 566 564 m_cSPS.setMaxTrSize ( 1 << m_uiQuadtreeTULog2MaxSize ); 567 #if !L0034_COMBINED_LIST_CLEANUP 565 568 566 m_cSPS.setUseLComb ( m_bUseLComb ); 569 #endif570 567 571 568 Int i; … … 719 716 m_cPPS.setOutputFlagPresentFlag( false ); 720 717 m_cPPS.setSignHideFlag(getSignHideFlag()); 721 #if L0386_DB_METRIC722 if ( getDeblockingFilterMetric() )723 {724 m_cPPS.setDeblockingFilterControlPresentFlag (true);725 m_cPPS.setDeblockingFilterOverrideEnabledFlag(true);726 m_cPPS.setPicDisableDeblockingFilterFlag(false);727 m_cPPS.setDeblockingFilterBetaOffsetDiv2(0);728 m_cPPS.setDeblockingFilterTcOffsetDiv2(0);729 }730 else731 {732 718 m_cPPS.setDeblockingFilterControlPresentFlag (m_DeblockingFilterControlPresent ); 733 }734 #else735 m_cPPS.setDeblockingFilterControlPresentFlag (m_DeblockingFilterControlPresent );736 #endif737 719 m_cPPS.setLog2ParallelMergeLevelMinus2 (m_log2ParallelMergeLevelMinus2 ); 738 720 m_cPPS.setCabacInitPresentFlag(CABAC_INIT_PRESENT_FLAG); … … 1006 988 } 1007 989 #endif 1008 1009 } 1010 1011 #if L0208_SOP_DESCRIPTION_SEI 1012 Int TEncTop::getReferencePictureSetIdxForSOP(TComSlice* slice, Int POCCurr, Int GOPid ) 1013 { 1014 int rpsIdx = GOPid; 1015 1016 for(Int extraNum=m_iGOPSize; extraNum<m_extraRPSs+m_iGOPSize; extraNum++) 1017 { 1018 if(m_uiIntraPeriod > 0 && getDecodingRefreshType() > 0) 1019 { 1020 Int POCIndex = POCCurr%m_uiIntraPeriod; 1021 if(POCIndex == 0) 1022 { 1023 POCIndex = m_uiIntraPeriod; 1024 } 1025 if(POCIndex == m_GOPList[extraNum].m_POC) 1026 { 1027 rpsIdx = extraNum; 1028 } 1029 } 1030 else 1031 { 1032 if(POCCurr==m_GOPList[extraNum].m_POC) 1033 { 1034 rpsIdx = extraNum; 1035 } 1036 } 1037 } 1038 1039 return rpsIdx; 1040 } 1041 #endif 990 } 1042 991 1043 992 Void TEncTop::xInitPPSforTiles() … … 1120 1069 } 1121 1070 } 1071 1122 1072 #if H_MV 1123 1073 Void TEncTop::printSummary( Int numAllPicCoded ) … … 1182 1132 } 1183 1133 #endif 1134 1184 1135 //! \} -
branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncTop.h
r368 r438 63 63 // Class definition 64 64 // ==================================================================================================================== 65 66 65 67 66 68 /// encoder class … … 131 133 TEncAnalyze m_cAnalyzeB; 132 134 #endif 135 133 136 protected: 134 137 Void xGetNewPicBuffer ( TComPic*& rpcPic ); ///< get picture buffer which will be processed … … 145 148 Void create (); 146 149 Void destroy (); 150 147 151 Void init (); 152 148 153 #if H_MV 149 154 TComPicLists* getIvPicLists() { return m_ivPicLists; } 150 155 #endif 156 151 157 Void deletePicBuffer (); 152 158 … … 156 162 Void initNewPic(TComPicYuv* pcPicYuvOrg); 157 163 #endif 164 158 165 // ------------------------------------------------------------------------------------------------------------------- 159 166 // member access functions … … 188 195 TComPPS* getPPS () { return &m_cPPS; } 189 196 Void selectReferencePictureSet(TComSlice* slice, Int POCCurr, Int GOPid ); 190 #if L0208_SOP_DESCRIPTION_SEI191 Int getReferencePictureSetIdxForSOP(TComSlice* slice, Int POCCurr, Int GOPid );192 #endif193 197 TComScalingList* getScalingList () { return &m_scalingList; } 198 194 199 #if H_MV 195 200 TEncAnalyze* getAnalyzeAll () { return &m_cAnalyzeAll; } … … 205 210 Void setIvPicLists ( TComPicLists* picLists) { m_ivPicLists = picLists; } 206 211 #endif 212 213 207 214 // ------------------------------------------------------------------------------------------------------------------- 208 215 // encoder function … … 210 217 211 218 /// encode several number of pictures until end-of-sequence 212 #if H_MV213 Void encode( Bool bEos, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded , Int gopId );214 #else215 219 Void encode( Bool bEos, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, 216 std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded ); 217 #endif 218 219 #if H_MV 220 Void printSummary ( Int numAllPicCoded ); 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 ); 221 228 #else 222 229 void printSummary() { m_cGOPEncoder.printOutSummary (m_uiNumAllPicCoded); } 223 230 #endif 231 224 232 }; 225 233 -
branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/WeightPredAnalysis.cpp
r362 r438 235 235 Int offset = (Int)( ((currDC<<log2Denom) - ((Int64)weight * refDC) + (Int64)realOffset) >> realLog2Denom ); 236 236 237 // Chroma offset range limi tation237 // Chroma offset range limination 238 238 if(comp) 239 239 { 240 Int pred = ( 128 - ( ( 128*weight)>>(log2Denom) ) ); 240 Int shift = 1 << (g_bitDepthC - 1); 241 Int pred = ( shift - ( ( shift*weight)>>(log2Denom) ) ); 241 242 Int deltaOffset = Clip3( -512, 511, (offset - pred) ); // signed 10bit 242 243 offset = Clip3( -128, 127, (deltaOffset + pred) ); // signed 8bit 243 }244 // Luma offset range limitation245 else246 {247 offset = Clip3( -128, 127, offset);248 244 } 249 245
Note: See TracChangeset for help on using the changeset viewer.