/src/vvenc/source/Lib/EncoderLib/SEIEncoder.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) 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 | | #pragma once |
43 | | |
44 | | #include "CommonLib/SEI.h" |
45 | | #include "CommonLib/Unit.h" |
46 | | |
47 | | #include <deque> |
48 | | //! \ingroup EncoderLib |
49 | | //! \{ |
50 | | |
51 | | namespace vvenc { |
52 | | |
53 | | // forward declarations |
54 | | class EncHRD; |
55 | | class GOPCfg; |
56 | | |
57 | | struct DUData |
58 | | { |
59 | 0 | DUData() : accumBitsDU(0), accumNalsDU(0) {}; |
60 | | |
61 | | int accumBitsDU; |
62 | | int accumNalsDU; |
63 | | }; |
64 | | |
65 | | //! Initializes different SEI message types based on given encoder configuration parameters |
66 | | class SEIEncoder |
67 | | { |
68 | | public: |
69 | | SEIEncoder() |
70 | 0 | : m_pcEncCfg ( nullptr ) |
71 | 0 | , m_gopCfg ( nullptr ) |
72 | 0 | , m_pcEncHRD ( nullptr ) |
73 | 0 | , m_isInitialized ( false ) |
74 | 0 | , m_rapWithLeading( false ) |
75 | 0 | {}; |
76 | 0 | virtual ~SEIEncoder(){}; |
77 | | |
78 | | void init( const VVEncCfg& encCfg, const GOPCfg* gopCfg, EncHRD& encHRD); |
79 | | void initDecodedPictureHashSEI ( SEIDecodedPictureHash& dphSei, const CPelUnitBuf& pic, std::string &rHashString, const BitDepths &bitDepths); |
80 | | |
81 | | void initBufferingPeriodSEI ( SEIBufferingPeriod& bpSei, bool noLeadingPictures); |
82 | | void initPictureTimingSEI ( SEIMessages& seiMessages, SEIMessages& nestedSeiMessages, SEIMessages& duInfoSeiMessages, const Slice *slice, const uint32_t numDU, const bool bpPresentInAU); |
83 | 0 | void initDrapSEI ( SEIDependentRAPIndication& drapSei) {}; |
84 | | |
85 | | void initSEIAlternativeTransferCharacteristics(SEIAlternativeTransferCharacteristics *seiAltTransCharacteristics); |
86 | | void initSEIMasteringDisplayColourVolume(SEIMasteringDisplayColourVolume *seiMDCV); |
87 | | void initSEIContentLightLevel(SEIContentLightLevelInfo *seiCLL); |
88 | | void initSeiFgc(SeiFgc* sei); |
89 | | |
90 | | private: |
91 | | const VVEncCfg* m_pcEncCfg; |
92 | | const GOPCfg* m_gopCfg; |
93 | | EncHRD* m_pcEncHRD; |
94 | | bool m_isInitialized; |
95 | | bool m_rapWithLeading; |
96 | | uint32_t m_lastBPSEI[VVENC_MAX_TLAYER]; |
97 | | uint32_t m_totalCoded[VVENC_MAX_TLAYER]; |
98 | | }; |
99 | | |
100 | | } // namespace vvenc |
101 | | |
102 | | //! \} |
103 | | |