/src/vvenc/source/Lib/CommonLib/ProfileLevelTier.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 | | |
43 | | |
44 | | #pragma once |
45 | | |
46 | | #include "CommonLib/CommonDef.h" |
47 | | #include <stdint.h> |
48 | | |
49 | | namespace vvenc { |
50 | | |
51 | | struct SPS; // Forward declaration. |
52 | | |
53 | | struct LevelTierFeatures |
54 | | { |
55 | | vvencLevel level; |
56 | | uint32_t maxLumaPs; |
57 | | uint32_t maxCpb[VVENC_NUMBER_OF_TIERS]; // in units of CpbVclFactor or CpbNalFactor bits |
58 | | uint32_t maxSlicesPerAu; |
59 | | uint32_t maxTilesPerAu; |
60 | | uint32_t maxTileCols; |
61 | | uint32_t maxTileRows; |
62 | | uint64_t maxLumaSr; |
63 | | uint32_t maxBr[VVENC_NUMBER_OF_TIERS]; // in units of BrVclFactor or BrNalFactor bits/s |
64 | | uint32_t minCrBase[VVENC_NUMBER_OF_TIERS]; |
65 | | uint32_t getMaxPicWidthInLumaSamples() const; |
66 | | uint32_t getMaxPicHeightInLumaSamples() const; |
67 | | |
68 | | static vvencLevel getMaxLevel(vvencProfile profile); |
69 | | static vvencLevel getLevelForInput( uint32_t width, uint32_t height, bool tier, int temporalRate, int temporalScale, int bitrate ); |
70 | | static void getMaxTileColsRowsPerLevel( vvencLevel level, uint32_t &maxCols, uint32_t &maxRows ); |
71 | | }; |
72 | | |
73 | | |
74 | | struct ProfileFeatures |
75 | | { |
76 | | vvencProfile profile; |
77 | | const char *pNameString; |
78 | | uint32_t maxBitDepth; |
79 | | ChromaFormat maxChromaFormat; |
80 | | |
81 | | bool canUseLevel15p5; |
82 | | uint32_t cpbVclFactor; |
83 | | uint32_t cpbNalFactor; |
84 | | uint32_t formatCapabilityFactorx1000; |
85 | | uint32_t minCrScaleFactorx100; |
86 | | const LevelTierFeatures *pLevelTiersListInfo; |
87 | | bool onePictureOnlyFlagMustBe1; |
88 | | |
89 | | static const ProfileFeatures *getProfileFeatures(const vvencProfile p); |
90 | | }; |
91 | | |
92 | | |
93 | | class ProfileLevelTierFeatures |
94 | | { |
95 | | private: |
96 | | const ProfileFeatures *m_pProfile; |
97 | | const LevelTierFeatures *m_pLevelTier; |
98 | | vvencTier m_tier; |
99 | | public: |
100 | 0 | ProfileLevelTierFeatures() : m_pProfile(nullptr), m_pLevelTier(nullptr), m_tier(VVENC_TIER_MAIN) {} |
101 | | |
102 | | void extractPTLInformation(const SPS &sps); |
103 | | |
104 | 0 | const ProfileFeatures *getProfileFeatures() const { return m_pProfile; } |
105 | 0 | const LevelTierFeatures *getLevelTierFeatures() const { return m_pLevelTier; } |
106 | 0 | vvencTier getTier() const { return m_tier; } |
107 | | uint64_t getCpbSizeInBits() const; |
108 | | double getMinCr() const; |
109 | | uint32_t getMaxDpbSize( uint32_t picSizeMaxInSamplesY ) const; |
110 | | }; |
111 | | |
112 | | |
113 | | } // namespace |