Changeset 438 in 3DVCSoftware for branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/SEIwrite.cpp
- Timestamp:
- 23 May 2013, 15:40:36 (12 years ago)
- File:
-
- 1 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 {
Note: See TracChangeset for help on using the changeset viewer.