/** * marshal a single SEI message sei, storing the marshalled representation * in bitstream bs. */ void SEIWriter::writeSEImessage(TComBitIf& bs, const SEI& sei, TComSPS *sps) { /* * calculate how large the payload data is * TODO: this would be far nicer if it used vectored buffers */ TComBitCounter bs_count; bs_count.resetBits(); setBitstream(&bs_count); #if ENC_DEC_TRACE bool traceEnable = g_HLSTraceEnable; g_HLSTraceEnable = false; #endif xWriteSEIpayloadData(sei, sps); #if ENC_DEC_TRACE g_HLSTraceEnable = traceEnable; #endif uint32_t payload_data_num_bits = bs_count.getNumberOfWrittenBits(); assert(0 == payload_data_num_bits % 8); setBitstream(&bs); #if ENC_DEC_TRACE if (g_HLSTraceEnable) xTraceSEIHeader(); #endif uint32_t payloadType = sei.payloadType(); for (; payloadType >= 0xff; payloadType -= 0xff) { WRITE_CODE(0xff, 8, "payload_type"); } WRITE_CODE(payloadType, 8, "payload_type"); uint32_t payloadSize = payload_data_num_bits / 8; for (; payloadSize >= 0xff; payloadSize -= 0xff) { WRITE_CODE(0xff, 8, "payload_size"); } WRITE_CODE(payloadSize, 8, "payload_size"); /* payloadData */ #if ENC_DEC_TRACE if (g_HLSTraceEnable) xTraceSEIMessageType(sei.payloadType()); #endif xWriteSEIpayloadData(sei, sps); }
void SEIWriter::xWriteSEIpayloadData(const SEI& sei) { switch (sei.payloadType()) { case SEI::USER_DATA_UNREGISTERED: xWriteSEIuserDataUnregistered(*static_cast<const SEIuserDataUnregistered*>(&sei)); break; case SEI::ACTIVE_PARAMETER_SETS: xWriteSEIActiveParameterSets(*static_cast<const SEIActiveParameterSets*>(& sei)); break; case SEI::DECODED_PICTURE_HASH: xWriteSEIDecodedPictureHash(*static_cast<const SEIDecodedPictureHash*>(&sei)); break; case SEI::BUFFERING_PERIOD: xWriteSEIBufferingPeriod(*static_cast<const SEIBufferingPeriod*>(&sei)); break; case SEI::PICTURE_TIMING: xWriteSEIPictureTiming(*static_cast<const SEIPictureTiming*>(&sei)); break; case SEI::RECOVERY_POINT: xWriteSEIRecoveryPoint(*static_cast<const SEIRecoveryPoint*>(&sei)); break; default: assert(!"Unhandled SEI message"); } }
/** * marshal a single SEI message sei, storing the marshalled representation * in bitstream bs. */ void writeSEImessage(TComBitIf& bs, const SEI& sei) { /* calculate how large the payload data is */ /* TODO: this would be far nicer if it used vectored buffers */ TComBitCounter bs_count; bs_count.resetBits(); writeSEIpayloadData(bs_count, sei); unsigned payload_data_num_bits = bs_count.getNumberOfWrittenBits(); assert(0 == payload_data_num_bits % 8); unsigned payloadType = sei.payloadType(); for (; payloadType >= 0xff; payloadType -= 0xff) { bs.write(0xff, 8); } bs.write(payloadType, 8); unsigned payloadSize = payload_data_num_bits/8; for (; payloadSize >= 0xff; payloadSize -= 0xff) { bs.write(0xff, 8); } bs.write(payloadSize, 8); /* payloadData */ writeSEIpayloadData(bs, sei); }
void writeSEIpayloadData(TComBitIf& bs, const SEI& sei) { switch (sei.payloadType()) { case SEI::USER_DATA_UNREGISTERED: writeSEIuserDataUnregistered(bs, *static_cast<const SEIuserDataUnregistered*>(&sei)); break; case SEI::PICTURE_DIGEST: writeSEIpictureDigest(bs, *static_cast<const SEIpictureDigest*>(&sei)); break; default: assert(!"Unhandled SEI message"); } }
void SEIWriter::xWriteSEIpayloadData(const SEI& sei, TComSPS *sps) { switch (sei.payloadType()) { case SEI::USER_DATA_UNREGISTERED: xWriteSEIuserDataUnregistered(*static_cast<const SEIuserDataUnregistered*>(&sei)); break; case SEI::ACTIVE_PARAMETER_SETS: xWriteSEIActiveParameterSets(*static_cast<const SEIActiveParameterSets*>(& sei)); break; case SEI::DECODING_UNIT_INFO: xWriteSEIDecodingUnitInfo(*static_cast<const SEIDecodingUnitInfo*>(& sei), sps); break; case SEI::DECODED_PICTURE_HASH: xWriteSEIDecodedPictureHash(*static_cast<const SEIDecodedPictureHash*>(&sei)); break; case SEI::BUFFERING_PERIOD: xWriteSEIBufferingPeriod(*static_cast<const SEIBufferingPeriod*>(&sei), sps); break; case SEI::PICTURE_TIMING: xWriteSEIPictureTiming(*static_cast<const SEIPictureTiming*>(&sei), sps); break; case SEI::RECOVERY_POINT: xWriteSEIRecoveryPoint(*static_cast<const SEIRecoveryPoint*>(&sei)); break; case SEI::FRAME_PACKING: xWriteSEIFramePacking(*static_cast<const SEIFramePacking*>(&sei)); break; case SEI::DISPLAY_ORIENTATION: xWriteSEIDisplayOrientation(*static_cast<const SEIDisplayOrientation*>(&sei)); break; case SEI::TEMPORAL_LEVEL0_INDEX: xWriteSEITemporalLevel0Index(*static_cast<const SEITemporalLevel0Index*>(&sei)); break; case SEI::REGION_REFRESH_INFO: xWriteSEIGradualDecodingRefreshInfo(*static_cast<const SEIGradualDecodingRefreshInfo*>(&sei)); break; default: assert(!"Unhandled SEI message"); } }
Void SEIWriter::xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComSPS *sps) { switch (sei.payloadType()) { case SEI::USER_DATA_UNREGISTERED: xWriteSEIuserDataUnregistered(*static_cast<const SEIuserDataUnregistered*>(&sei)); break; case SEI::ACTIVE_PARAMETER_SETS: xWriteSEIActiveParameterSets(*static_cast<const SEIActiveParameterSets*>(& sei)); break; case SEI::DECODING_UNIT_INFO: xWriteSEIDecodingUnitInfo(*static_cast<const SEIDecodingUnitInfo*>(& sei), sps); break; case SEI::DECODED_PICTURE_HASH: xWriteSEIDecodedPictureHash(*static_cast<const SEIDecodedPictureHash*>(&sei)); break; case SEI::BUFFERING_PERIOD: xWriteSEIBufferingPeriod(*static_cast<const SEIBufferingPeriod*>(&sei), sps); break; case SEI::PICTURE_TIMING: xWriteSEIPictureTiming(*static_cast<const SEIPictureTiming*>(&sei), sps); break; case SEI::RECOVERY_POINT: xWriteSEIRecoveryPoint(*static_cast<const SEIRecoveryPoint*>(&sei)); break; case SEI::FRAME_PACKING: xWriteSEIFramePacking(*static_cast<const SEIFramePacking*>(&sei)); break; case SEI::SEGM_RECT_FRAME_PACKING: xWriteSEISegmentedRectFramePacking(*static_cast<const SEISegmentedRectFramePacking*>(&sei)); break; case SEI::DISPLAY_ORIENTATION: xWriteSEIDisplayOrientation(*static_cast<const SEIDisplayOrientation*>(&sei)); break; case SEI::TEMPORAL_LEVEL0_INDEX: xWriteSEITemporalLevel0Index(*static_cast<const SEITemporalLevel0Index*>(&sei)); break; case SEI::REGION_REFRESH_INFO: xWriteSEIGradualDecodingRefreshInfo(*static_cast<const SEIGradualDecodingRefreshInfo*>(&sei)); break; case SEI::NO_DISPLAY: xWriteSEINoDisplay(*static_cast<const SEINoDisplay*>(&sei)); break; case SEI::TONE_MAPPING_INFO: xWriteSEIToneMappingInfo(*static_cast<const SEIToneMappingInfo*>(&sei)); break; case SEI::SOP_DESCRIPTION: xWriteSEISOPDescription(*static_cast<const SEISOPDescription*>(&sei)); break; case SEI::SCALABLE_NESTING: xWriteSEIScalableNesting(bs, *static_cast<const SEIScalableNesting*>(&sei), sps); break; case SEI::CHROMA_SAMPLING_FILTER_HINT: xWriteSEIChromaSamplingFilterHint(*static_cast<const SEIChromaSamplingFilterHint*>(&sei)/*, sps*/); break; case SEI::TEMP_MOTION_CONSTRAINED_TILE_SETS: xWriteSEITempMotionConstrainedTileSets(bs, *static_cast<const SEITempMotionConstrainedTileSets*>(&sei)); break; case SEI::TIME_CODE: xWriteSEITimeCode(*static_cast<const SEITimeCode*>(&sei)); break; case SEI::KNEE_FUNCTION_INFO: xWriteSEIKneeFunctionInfo(*static_cast<const SEIKneeFunctionInfo*>(&sei)); break; case SEI::MASTERING_DISPLAY_COLOUR_VOLUME: xWriteSEIMasteringDisplayColourVolume(*static_cast<const SEIMasteringDisplayColourVolume*>(&sei)); break; default: assert(!"Unhandled SEI message"); break; } }