source: SHVCSoftware/branches/SHM-dev/source/Lib/TLibCommon/SEI.cpp @ 1550

Last change on this file since 1550 was 1550, checked in by seregin, 9 years ago

port rev 4732, update copyright notice to include 2016

  • Property svn:eol-style set to native
File size: 9.0 KB
Line 
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
4 * granted under this license.
5 *
6 * Copyright (c) 2010-2016, ITU/ISO/IEC
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
41SEIMessages 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
55SEIMessages extractSeisByType(SEIMessages &seiList, SEI::PayloadType seiType)
56{
57  SEIMessages result;
58
59  SEIMessages::iterator it=seiList.begin();
60  while ( it!=seiList.end() )
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
76Void deleteSEIs (SEIMessages &seiList)
77{
78  for (SEIMessages::iterator it=seiList.begin(); it!=seiList.end(); it++)
79  {
80    delete (*it);
81  }
82  seiList.clear();
83}
84
85void 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
99void 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
117const TChar *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_RESAMPLING_FILTER_HINT:        return "Chroma sampling filter hint";
151    case SEI::COLOUR_REMAPPING_INFO:                return "Colour remapping info";
152#if U0033_ALTERNATIVE_TRANSFER_CHARACTERISTICS_SEI
153    case SEI::ALTERNATIVE_TRANSFER_CHARACTERISTICS: return "Alternative transfer characteristics";
154#endif
155#if SVC_EXTENSION
156#if LAYERS_NOT_PRESENT_SEI
157    case SEI::LAYERS_NOT_PRESENT:                   return "Layers Present";
158#endif
159#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
160    case SEI::INTER_LAYER_CONSTRAINED_TILE_SETS:    return "Inter Layer Constrained Tile Sets";
161#endif
162#if SUB_BITSTREAM_PROPERTY_SEI
163    case SEI::SUB_BITSTREAM_PROPERTY:               return "Sub-bitstream property";
164#endif
165#if O0164_MULTI_LAYER_HRD
166    case SEI::BSP_NESTING:                          return "Bitstream parition nesting";
167    case SEI::BSP_INITIAL_ARRIVAL_TIME:             return "Bitstream parition initial arrival time";
168#endif
169#if Q0096_OVERLAY_SEI
170    case SEI::OVERLAY_INFO:                         return "Overlay Information";
171#endif
172#if P0123_ALPHA_CHANNEL_SEI
173    case SEI::ALPHA_CHANNEL_INFO:                   return "Alpha Channel Information";
174#endif
175#if Q0189_TMVP_CONSTRAINTS
176    case SEI::TMVP_CONSTRAINTS:                     return "TMVP constraints";
177#endif
178#if Q0247_FRAME_FIELD_INFO
179    case SEI::FRAME_FIELD_INFO:                     return "Frame field info";
180#endif
181#endif
182    default:                                        return "Unknown";
183  }
184}
185
186#if SUB_BITSTREAM_PROPERTY_SEI
187SEISubBitstreamProperty::SEISubBitstreamProperty()
188{
189  m_activeVpsId             = -1;
190  m_numAdditionalSubStreams = 0;
191  ::memset(m_subBitstreamMode       , 0, sizeof(m_subBitstreamMode));
192  ::memset(m_outputLayerSetIdxToVps , 0, sizeof(m_outputLayerSetIdxToVps));
193  ::memset(m_highestSublayerId      , 0, sizeof(m_highestSublayerId));
194  ::memset(m_avgBitRate             , 0, sizeof(m_avgBitRate));
195  ::memset(m_maxBitRate             , 0, sizeof(m_maxBitRate));
196}
197#endif
Note: See TracBrowser for help on using the repository browser.