/src/vvenc/source/Lib/CommonLib/SEI.cpp
Line | Count | Source |
1 | | /* ----------------------------------------------------------------------------- |
2 | | The copyright in this software is being made available under the Clear BSD |
3 | | License, included below. No patent rights, trademark rights and/or |
4 | | other Intellectual Property Rights other than the copyrights concerning |
5 | | the Software are granted under this license. |
6 | | |
7 | | The Clear BSD License |
8 | | |
9 | | Copyright (c) 2019-2026, Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. & The VVenC Authors. |
10 | | All rights reserved. |
11 | | |
12 | | Redistribution and use in source and binary forms, with or without modification, |
13 | | are permitted (subject to the limitations in the disclaimer below) provided that |
14 | | the following conditions are met: |
15 | | |
16 | | * Redistributions of source code must retain the above copyright notice, |
17 | | this list of conditions and the following disclaimer. |
18 | | |
19 | | * Redistributions in binary form must reproduce the above copyright |
20 | | notice, this list of conditions and the following disclaimer in the |
21 | | documentation and/or other materials provided with the distribution. |
22 | | |
23 | | * Neither the name of the copyright holder nor the names of its |
24 | | contributors may be used to endorse or promote products derived from this |
25 | | software without specific prior written permission. |
26 | | |
27 | | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY |
28 | | THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND |
29 | | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
30 | | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
31 | | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR |
32 | | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
33 | | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
34 | | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
35 | | BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER |
36 | | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
37 | | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
38 | | POSSIBILITY OF SUCH DAMAGE. |
39 | | |
40 | | |
41 | | ------------------------------------------------------------------------------------------- */ |
42 | | |
43 | | |
44 | | /** \file SEI.cpp |
45 | | \brief helper functions for SEI handling |
46 | | */ |
47 | | |
48 | | #include "SEI.h" |
49 | | #include "CommonDef.h" |
50 | | #include "dtrace_next.h" |
51 | | |
52 | | //! \ingroup CommonLib |
53 | | //! \{ |
54 | | |
55 | | namespace vvenc { |
56 | | |
57 | | #if ENABLE_TRACING |
58 | | void xTraceSEIHeader() |
59 | | { |
60 | | DTRACE( g_trace_ctx, D_HEADER, "=========== SEI message ===========\n" ); |
61 | | } |
62 | | |
63 | | void xTraceSEIMessageType( SEI::PayloadType payloadType ) |
64 | | { |
65 | | DTRACE( g_trace_ctx, D_HEADER, "=========== %s SEI message ===========\n", SEI::getSEIMessageString( payloadType ) ); |
66 | | } |
67 | | #endif |
68 | | |
69 | | SEIMessages getSeisByType(const SEIMessages &seiList, SEI::PayloadType seiType) |
70 | 0 | { |
71 | 0 | SEIMessages result; |
72 | |
|
73 | 0 | for (SEIMessages::const_iterator it=seiList.begin(); it!=seiList.end(); it++) |
74 | 0 | { |
75 | 0 | if ((*it)->payloadType() == seiType) |
76 | 0 | { |
77 | 0 | result.push_back(*it); |
78 | 0 | } |
79 | 0 | } |
80 | 0 | return result; |
81 | 0 | } |
82 | | |
83 | | SEIMessages extractSeisByType(SEIMessages &seiList, SEI::PayloadType seiType) |
84 | 0 | { |
85 | 0 | SEIMessages result; |
86 | |
|
87 | 0 | SEIMessages::iterator it=seiList.begin(); |
88 | 0 | while ( it!=seiList.end() ) |
89 | 0 | { |
90 | 0 | if ((*it)->payloadType() == seiType) |
91 | 0 | { |
92 | 0 | result.push_back(*it); |
93 | 0 | it = seiList.erase(it); |
94 | 0 | } |
95 | 0 | else |
96 | 0 | { |
97 | 0 | it++; |
98 | 0 | } |
99 | 0 | } |
100 | 0 | return result; |
101 | 0 | } |
102 | | |
103 | | |
104 | | void deleteSEIs (SEIMessages &seiList) |
105 | 0 | { |
106 | 0 | for (SEIMessages::iterator it=seiList.begin(); it!=seiList.end(); it++) |
107 | 0 | { |
108 | 0 | delete (*it); |
109 | 0 | } |
110 | 0 | seiList.clear(); |
111 | 0 | } |
112 | | |
113 | | // Static member |
114 | | const char *SEI::getSEIMessageString(SEI::PayloadType payloadType) |
115 | 0 | { |
116 | 0 | switch (payloadType) |
117 | 0 | { |
118 | 0 | case SEI::BUFFERING_PERIOD: return "Buffering period"; |
119 | 0 | case SEI::PICTURE_TIMING: return "Picture timing"; |
120 | 0 | case SEI::FILLER_PAYLOAD: return "Filler payload"; // not currently decoded |
121 | 0 | case SEI::USER_DATA_REGISTERED_ITU_T_T35: return "User data registered"; // not currently decoded |
122 | 0 | case SEI::USER_DATA_UNREGISTERED: return "User data unregistered"; |
123 | 0 | case SEI::FILM_GRAIN_CHARACTERISTICS: return "Film grain characteristics"; // not currently decoded |
124 | 0 | case SEI::FRAME_PACKING: return "Frame packing arrangement"; |
125 | 0 | case SEI::PARAMETER_SETS_INCLUSION_INDICATION: return "Parameter sets inclusion indication"; |
126 | 0 | case SEI::DECODING_UNIT_INFO: return "Decoding unit information"; |
127 | 0 | case SEI::SCALABLE_NESTING: return "Scalable nesting"; |
128 | 0 | case SEI::DECODED_PICTURE_HASH: return "Decoded picture hash"; |
129 | 0 | case SEI::DEPENDENT_RAP_INDICATION: return "Dependent RAP indication"; |
130 | 0 | case SEI::MASTERING_DISPLAY_COLOUR_VOLUME: return "Mastering display colour volume"; |
131 | 0 | case SEI::ALTERNATIVE_TRANSFER_CHARACTERISTICS: return "Alternative transfer characteristics"; |
132 | 0 | case SEI::CONTENT_LIGHT_LEVEL_INFO: return "Content light level information"; |
133 | 0 | case SEI::AMBIENT_VIEWING_ENVIRONMENT: return "Ambient viewing environment"; |
134 | 0 | case SEI::CONTENT_COLOUR_VOLUME: return "Content colour volume"; |
135 | 0 | case SEI::EQUIRECTANGULAR_PROJECTION: return "Equirectangular projection"; |
136 | 0 | case SEI::SPHERE_ROTATION: return "Sphere rotation"; |
137 | 0 | case SEI::REGION_WISE_PACKING: return "Region wise packing information"; |
138 | 0 | case SEI::OMNI_VIEWPORT: return "Omni viewport"; |
139 | 0 | case SEI::GENERALIZED_CUBEMAP_PROJECTION: return "Generalized cubemap projection"; |
140 | 0 | case SEI::SAMPLE_ASPECT_RATIO_INFO: return "Sample aspect ratio information"; |
141 | 0 | case SEI::SUBPICTURE_LEVEL_INFO: return "Subpicture level information"; |
142 | 0 | default: return "Unknown"; |
143 | 0 | } |
144 | 0 | } |
145 | | |
146 | | } // namespace vvenc |
147 | | |
148 | | //! \} |
149 | | |