/src/vvdec/source/Lib/CommonLib/SEI_internal.h
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) 2018-2026, Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. & The VVdeC 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 | | #pragma once |
44 | | |
45 | | #include <list> |
46 | | #include <vector> |
47 | | #include <cstdint> |
48 | | #include <cstring> |
49 | | |
50 | | #include "vvdec/sei.h" |
51 | | |
52 | | namespace vvdec |
53 | | { |
54 | | |
55 | | typedef std::list<vvdecSEI*> seiMessages; |
56 | | |
57 | | class SEI_internal |
58 | | { |
59 | | public: |
60 | | |
61 | 0 | SEI_internal() {} |
62 | 0 | virtual ~SEI_internal() {} |
63 | | |
64 | | static const char *getSEIMessageString( vvdecSEIPayloadType payloadType); |
65 | | |
66 | | /// output a selection of SEI messages by payload type. Ownership stays in original message list. |
67 | | static seiMessages getSeisByType(const seiMessages &seiList, vvdecSEIPayloadType seiType); |
68 | | |
69 | | /// remove a selection of SEI messages by payload type from the original list and return them in a new list. |
70 | | static seiMessages extractSeisByType(seiMessages &seiList, vvdecSEIPayloadType seiType); |
71 | | |
72 | | /// delete list of SEI messages (freeing the referenced objects) |
73 | | static void deleteSEIs (seiMessages &seiList); |
74 | | |
75 | | static vvdecSEI* allocSEI ( vvdecSEIPayloadType payloadType ); |
76 | | static int allocSEIPayload( vvdecSEI* sei, int userDefSize = -1 ); |
77 | | static int getPayloadSize ( vvdecSEIPayloadType payloadType); |
78 | | }; |
79 | | |
80 | | |
81 | | |
82 | | struct PictureHash |
83 | | { |
84 | | std::vector<uint8_t> hash = {}; |
85 | | |
86 | | bool operator==(const PictureHash &other) const |
87 | 0 | { |
88 | 0 | if (other.hash.size() != hash.size()) |
89 | 0 | { |
90 | 0 | return false; |
91 | 0 | } |
92 | 0 | for(uint32_t i=0; i<uint32_t(hash.size()); i++) |
93 | 0 | { |
94 | 0 | if (other.hash[i] != hash[i]) |
95 | 0 | { |
96 | 0 | return false; |
97 | 0 | } |
98 | 0 | } |
99 | 0 | return true; |
100 | 0 | } |
101 | | |
102 | | bool operator!=(const PictureHash &other) const |
103 | 0 | { |
104 | 0 | return !(*this == other); |
105 | 0 | } |
106 | | |
107 | | bool equal( vvdecSEIDecodedPictureHash digest ) const |
108 | 0 | { |
109 | 0 | if ((size_t)digest.digest_length != hash.size()) |
110 | 0 | { |
111 | 0 | return false; |
112 | 0 | } |
113 | 0 | for(uint32_t i=0; i<uint32_t(hash.size()); i++) |
114 | 0 | { |
115 | 0 | if (digest.digest[i] != hash[i]) |
116 | 0 | { |
117 | 0 | return false; |
118 | 0 | } |
119 | 0 | } |
120 | 0 | return true; |
121 | 0 | } |
122 | | }; |
123 | | |
124 | | } |