[608] | 1 | /* The copyright in this software is being made available under the BSD |
---|
| 2 | * License, included below. This software may be subject to other third party |
---|
| 3 | * and contributor rights, including patent rights, and no such rights are |
---|
[1313] | 4 | * granted under this license. |
---|
[608] | 5 | * |
---|
[1313] | 6 | * Copyright (c) 2010-2015, ITU/ISO/IEC |
---|
[608] | 7 | * All rights reserved. |
---|
| 8 | * |
---|
| 9 | * Redistribution and use in source and binary forms, with or without |
---|
| 10 | * modification, are permitted provided that the following conditions are met: |
---|
| 11 | * |
---|
| 12 | * * Redistributions of source code must retain the above copyright notice, |
---|
| 13 | * this list of conditions and the following disclaimer. |
---|
| 14 | * * Redistributions in binary form must reproduce the above copyright notice, |
---|
| 15 | * this list of conditions and the following disclaimer in the documentation |
---|
| 16 | * and/or other materials provided with the distribution. |
---|
| 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may |
---|
| 18 | * be used to endorse or promote products derived from this software without |
---|
| 19 | * specific prior written permission. |
---|
| 20 | * |
---|
| 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
| 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
| 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
| 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS |
---|
| 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
| 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
| 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
| 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
| 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
| 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
---|
| 31 | * THE POSSIBILITY OF SUCH DAMAGE. |
---|
| 32 | */ |
---|
| 33 | |
---|
| 34 | /** \file SEI.cpp |
---|
| 35 | \brief helper functions for SEI handling |
---|
| 36 | */ |
---|
| 37 | |
---|
| 38 | #include "CommonDef.h" |
---|
| 39 | #include "SEI.h" |
---|
| 40 | |
---|
| 41 | SEIMessages getSeisByType(SEIMessages &seiList, SEI::PayloadType seiType) |
---|
| 42 | { |
---|
| 43 | SEIMessages result; |
---|
| 44 | |
---|
| 45 | for (SEIMessages::iterator it=seiList.begin(); it!=seiList.end(); it++) |
---|
| 46 | { |
---|
| 47 | if ((*it)->payloadType() == seiType) |
---|
| 48 | { |
---|
| 49 | result.push_back(*it); |
---|
| 50 | } |
---|
| 51 | } |
---|
| 52 | return result; |
---|
| 53 | } |
---|
| 54 | |
---|
| 55 | SEIMessages extractSeisByType(SEIMessages &seiList, SEI::PayloadType seiType) |
---|
| 56 | { |
---|
| 57 | SEIMessages result; |
---|
| 58 | |
---|
[1313] | 59 | SEIMessages::iterator it=seiList.begin(); |
---|
| 60 | while ( it!=seiList.end() ) |
---|
[608] | 61 | { |
---|
| 62 | if ((*it)->payloadType() == seiType) |
---|
| 63 | { |
---|
| 64 | result.push_back(*it); |
---|
| 65 | it = seiList.erase(it); |
---|
| 66 | } |
---|
| 67 | else |
---|
| 68 | { |
---|
| 69 | it++; |
---|
| 70 | } |
---|
| 71 | } |
---|
| 72 | return result; |
---|
| 73 | } |
---|
| 74 | |
---|
| 75 | |
---|
| 76 | Void deleteSEIs (SEIMessages &seiList) |
---|
| 77 | { |
---|
| 78 | for (SEIMessages::iterator it=seiList.begin(); it!=seiList.end(); it++) |
---|
| 79 | { |
---|
| 80 | delete (*it); |
---|
| 81 | } |
---|
| 82 | seiList.clear(); |
---|
| 83 | } |
---|
[1313] | 84 | |
---|
| 85 | void SEIBufferingPeriod::copyTo (SEIBufferingPeriod& target) |
---|
| 86 | { |
---|
| 87 | target.m_bpSeqParameterSetId = m_bpSeqParameterSetId; |
---|
| 88 | target.m_rapCpbParamsPresentFlag = m_rapCpbParamsPresentFlag; |
---|
| 89 | target.m_cpbDelayOffset = m_cpbDelayOffset; |
---|
| 90 | target.m_dpbDelayOffset = m_dpbDelayOffset; |
---|
| 91 | target.m_concatenationFlag = m_concatenationFlag; |
---|
| 92 | target.m_auCpbRemovalDelayDelta = m_auCpbRemovalDelayDelta; |
---|
| 93 | ::memcpy(target.m_initialCpbRemovalDelay, m_initialCpbRemovalDelay, sizeof(m_initialCpbRemovalDelay)); |
---|
| 94 | ::memcpy(target.m_initialCpbRemovalDelayOffset, m_initialCpbRemovalDelayOffset, sizeof(m_initialCpbRemovalDelayOffset)); |
---|
| 95 | ::memcpy(target.m_initialAltCpbRemovalDelay, m_initialAltCpbRemovalDelay, sizeof(m_initialAltCpbRemovalDelay)); |
---|
| 96 | ::memcpy(target.m_initialAltCpbRemovalDelayOffset, m_initialAltCpbRemovalDelayOffset, sizeof(m_initialAltCpbRemovalDelayOffset)); |
---|
| 97 | } |
---|
| 98 | |
---|
| 99 | void SEIPictureTiming::copyTo (SEIPictureTiming& target) |
---|
| 100 | { |
---|
| 101 | target.m_picStruct = m_picStruct; |
---|
| 102 | target.m_sourceScanType = m_sourceScanType; |
---|
| 103 | target.m_duplicateFlag = m_duplicateFlag; |
---|
| 104 | |
---|
| 105 | target.m_auCpbRemovalDelay = m_auCpbRemovalDelay; |
---|
| 106 | target.m_picDpbOutputDelay = m_picDpbOutputDelay; |
---|
| 107 | target.m_picDpbOutputDuDelay = m_picDpbOutputDuDelay; |
---|
| 108 | target.m_numDecodingUnitsMinus1 = m_numDecodingUnitsMinus1; |
---|
| 109 | target.m_duCommonCpbRemovalDelayFlag = m_duCommonCpbRemovalDelayFlag; |
---|
| 110 | target.m_duCommonCpbRemovalDelayMinus1 = m_duCommonCpbRemovalDelayMinus1; |
---|
| 111 | |
---|
| 112 | target.m_numNalusInDuMinus1 = m_numNalusInDuMinus1; |
---|
| 113 | target.m_duCpbRemovalDelayMinus1 = m_duCpbRemovalDelayMinus1; |
---|
| 114 | } |
---|
| 115 | |
---|
| 116 | // Static member |
---|
| 117 | const Char *SEI::getSEIMessageString(SEI::PayloadType payloadType) |
---|
| 118 | { |
---|
| 119 | switch (payloadType) |
---|
| 120 | { |
---|
| 121 | case SEI::BUFFERING_PERIOD: return "Buffering period"; |
---|
| 122 | case SEI::PICTURE_TIMING: return "Picture timing"; |
---|
| 123 | case SEI::PAN_SCAN_RECT: return "Pan-scan rectangle"; // not currently decoded |
---|
| 124 | case SEI::FILLER_PAYLOAD: return "Filler payload"; // not currently decoded |
---|
| 125 | case SEI::USER_DATA_REGISTERED_ITU_T_T35: return "User data registered"; // not currently decoded |
---|
| 126 | case SEI::USER_DATA_UNREGISTERED: return "User data unregistered"; |
---|
| 127 | case SEI::RECOVERY_POINT: return "Recovery point"; |
---|
| 128 | case SEI::SCENE_INFO: return "Scene information"; // not currently decoded |
---|
| 129 | case SEI::FULL_FRAME_SNAPSHOT: return "Picture snapshot"; // not currently decoded |
---|
| 130 | case SEI::PROGRESSIVE_REFINEMENT_SEGMENT_START: return "Progressive refinement segment start"; // not currently decoded |
---|
| 131 | case SEI::PROGRESSIVE_REFINEMENT_SEGMENT_END: return "Progressive refinement segment end"; // not currently decoded |
---|
| 132 | case SEI::FILM_GRAIN_CHARACTERISTICS: return "Film grain characteristics"; // not currently decoded |
---|
| 133 | case SEI::POST_FILTER_HINT: return "Post filter hint"; // not currently decoded |
---|
| 134 | case SEI::TONE_MAPPING_INFO: return "Tone mapping information"; |
---|
| 135 | case SEI::KNEE_FUNCTION_INFO: return "Knee function information"; |
---|
| 136 | case SEI::FRAME_PACKING: return "Frame packing arrangement"; |
---|
| 137 | case SEI::DISPLAY_ORIENTATION: return "Display orientation"; |
---|
| 138 | case SEI::SOP_DESCRIPTION: return "Structure of pictures information"; |
---|
| 139 | case SEI::ACTIVE_PARAMETER_SETS: return "Active parameter sets"; |
---|
| 140 | case SEI::DECODING_UNIT_INFO: return "Decoding unit information"; |
---|
| 141 | case SEI::TEMPORAL_LEVEL0_INDEX: return "Temporal sub-layer zero index"; |
---|
| 142 | case SEI::DECODED_PICTURE_HASH: return "Decoded picture hash"; |
---|
| 143 | case SEI::SCALABLE_NESTING: return "Scalable nesting"; |
---|
| 144 | case SEI::REGION_REFRESH_INFO: return "Region refresh information"; |
---|
| 145 | case SEI::NO_DISPLAY: return "No display"; |
---|
| 146 | case SEI::TIME_CODE: return "Time code"; |
---|
| 147 | case SEI::MASTERING_DISPLAY_COLOUR_VOLUME: return "Mastering display colour volume"; |
---|
| 148 | case SEI::SEGM_RECT_FRAME_PACKING: return "Segmented rectangular frame packing arrangement"; |
---|
| 149 | case SEI::TEMP_MOTION_CONSTRAINED_TILE_SETS: return "Temporal motion constrained tile sets"; |
---|
| 150 | case SEI::CHROMA_SAMPLING_FILTER_HINT: return "Chroma sampling filter hint"; |
---|
| 151 | #if NH_MV |
---|
| 152 | case SEI::SUB_BITSTREAM_PROPERTY: return "Sub-bitstream property SEI message"; |
---|
| 153 | #endif |
---|
| 154 | default: return "Unknown"; |
---|
| 155 | } |
---|
| 156 | } |
---|