/src/vvdec/source/Lib/CommonLib/Rom.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 | | /** \file Rom.h |
44 | | \brief global variables & functions (header) |
45 | | */ |
46 | | |
47 | | #pragma once |
48 | | |
49 | | #include "CommonDef.h" |
50 | | #include "Common.h" |
51 | | |
52 | | #if ENABLE_TIME_PROFILING || ENABLE_TIME_PROFILING_EXTENDED |
53 | | # include "TimeProfiler.h" |
54 | | #endif |
55 | | |
56 | | #include <atomic> |
57 | | |
58 | | namespace vvdec |
59 | | { |
60 | | |
61 | | |
62 | | //! \ingroup CommonLib |
63 | | //! \{ |
64 | | |
65 | | // ==================================================================================================================== |
66 | | // Initialize / destroy functions |
67 | | // ==================================================================================================================== |
68 | | |
69 | | void initROM(); |
70 | | void destroyROM(); |
71 | | |
72 | | extern std::atomic_bool romInitialized; |
73 | | |
74 | | // ==================================================================================================================== |
75 | | // Data structure related table & variable |
76 | | // ==================================================================================================================== |
77 | | |
78 | | // flexible conversion from relative to absolute index |
79 | | extern const uint16_t g_log2SbbSize [MAX_LOG2_TU_SIZE_PLUS_ONE][MAX_LOG2_TU_SIZE_PLUS_ONE][2]; |
80 | | extern const uint16_t g_scanOrderBuf [32258]; |
81 | | extern const uint16_t* g_scanOrder [SCAN_NUMBER_OF_GROUP_TYPES][MAX_LOG2_TU_SIZE_PLUS_ONE][MAX_LOG2_TU_SIZE_PLUS_ONE]; |
82 | | |
83 | | extern const uint16_t g_coefTopLeftDiagScan8x8[MAX_LOG2_TU_SIZE_PLUS_ONE][64]; |
84 | | |
85 | | extern const int g_InvQuantScales[2/*0=4^n blocks, 1=2*4^n blocks*/][SCALING_LIST_REM_NUM]; // IQ(QP%6) |
86 | | |
87 | | static const int g_numTransformMatrixSizes = 6; |
88 | | static const int g_transformMatrixShift = 6; |
89 | | |
90 | | |
91 | | // ==================================================================================================================== |
92 | | // Scanning order & context mapping table |
93 | | // ==================================================================================================================== |
94 | | |
95 | | extern const uint32_t ctxIndMap4x4[4*4]; |
96 | | |
97 | | extern const uint32_t g_uiGroupIdx[ MAX_TU_SIZE_FOR_PROFILE ]; |
98 | | extern const uint32_t g_uiMinInGroup[ LAST_SIGNIFICANT_GROUPS ]; |
99 | | extern const uint32_t g_auiGoRiceParsCoeff [ 32 ]; |
100 | | static inline uint32_t g_auiGoRicePosCoeff0(int st, uint32_t ricePar) |
101 | 0 | { |
102 | 0 | return (st < 2 ? 1 : 2) << ricePar; |
103 | 0 | } Unexecuted instantiation: vvdec.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) Unexecuted instantiation: vvdecimpl.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) Unexecuted instantiation: Buffer.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) Unexecuted instantiation: InterpolationFilter.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) Unexecuted instantiation: LoopFilter.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) Unexecuted instantiation: PicListManager.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) Unexecuted instantiation: Picture.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) Unexecuted instantiation: Rom.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) Unexecuted instantiation: SampleAdaptiveOffset.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) Unexecuted instantiation: Slice.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) Unexecuted instantiation: Unit.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) Unexecuted instantiation: UnitTools.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) Unexecuted instantiation: DecLib.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) Unexecuted instantiation: DecLibParser.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) Unexecuted instantiation: DecLibRecon.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) Unexecuted instantiation: DecSlice.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) Unexecuted instantiation: HLSyntaxReader.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) Unexecuted instantiation: NALread.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) Unexecuted instantiation: SEIread.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) Unexecuted instantiation: InitX86.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) Unexecuted instantiation: InterPred_sse41.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) Unexecuted instantiation: InterpolationFilter_sse41.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) Unexecuted instantiation: LoopFilter_sse41.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) Unexecuted instantiation: Picture_sse41.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) Unexecuted instantiation: Trafo_sse41.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) Unexecuted instantiation: InterPred_avx2.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) Unexecuted instantiation: InterpolationFilter_avx2.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) Unexecuted instantiation: LoopFilter_avx2.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) Unexecuted instantiation: Picture_avx2.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) Unexecuted instantiation: Trafo_avx2.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) Unexecuted instantiation: AdaptiveLoopFilter.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) Unexecuted instantiation: CodingStructure.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) Unexecuted instantiation: InterPrediction.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) Unexecuted instantiation: IntraPrediction.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) Unexecuted instantiation: MatrixIntraPrediction.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) Unexecuted instantiation: PicYuvMD5.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) Unexecuted instantiation: Quant.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) Unexecuted instantiation: Reshape.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) Unexecuted instantiation: RomLFNST.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) Unexecuted instantiation: TrQuant.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) Unexecuted instantiation: TrQuant_EMT.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) Unexecuted instantiation: UnitPartitioner.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) Unexecuted instantiation: WeightPrediction.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) Unexecuted instantiation: BinDecoder.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) Unexecuted instantiation: CABACReader.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) Unexecuted instantiation: DecCu.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) Unexecuted instantiation: ContextModelling.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) Unexecuted instantiation: RomTr.cpp:vvdec::g_auiGoRicePosCoeff0(int, unsigned int) |
104 | | extern const uint32_t g_auiGoRiceRange[ MAX_GR_ORDER_RESIDUAL ]; //!< maximum value coded with Rice codes |
105 | | |
106 | | // ==================================================================================================================== |
107 | | // Intra prediction table |
108 | | // ==================================================================================================================== |
109 | | |
110 | | extern const uint8_t g_chroma422IntraAngleMappingTable[NUM_INTRA_MODE]; |
111 | | |
112 | | // ==================================================================================================================== |
113 | | // Mode-Dependent DST Matrices |
114 | | // ==================================================================================================================== |
115 | | |
116 | | |
117 | | extern const TMatrixCoeff g_trCoreDCT2P2 [ 2][ 2]; |
118 | | extern const TMatrixCoeff g_trCoreDCT2P4 [ 4][ 4]; |
119 | | extern const TMatrixCoeff g_trCoreDCT2P8 [ 8][ 8]; |
120 | | extern const TMatrixCoeff g_trCoreDCT2P16[ 16][ 16]; |
121 | | extern const TMatrixCoeff g_trCoreDCT2P32[ 32][ 32]; |
122 | | extern const TMatrixCoeff g_trCoreDCT2P64[ 64][ 64]; |
123 | | |
124 | | extern const TMatrixCoeff g_trCoreDCT8P4 [ 4][ 4]; |
125 | | extern const TMatrixCoeff g_trCoreDCT8P8 [ 8][ 8]; |
126 | | extern const TMatrixCoeff g_trCoreDCT8P16[ 16][ 16]; |
127 | | extern const TMatrixCoeff g_trCoreDCT8P32[ 32][ 32]; |
128 | | |
129 | | extern const TMatrixCoeff g_trCoreDST7P4 [ 4][ 4]; |
130 | | extern const TMatrixCoeff g_trCoreDST7P8 [ 8][ 8]; |
131 | | extern const TMatrixCoeff g_trCoreDST7P16[ 16][ 16]; |
132 | | extern const TMatrixCoeff g_trCoreDST7P32[ 32][ 32]; |
133 | | |
134 | | extern const int8_t g_lfnst8x8[ 4 ][ 2 ][ 48 ][ 16 ]; |
135 | | extern const int8_t g_lfnst4x4[ 4 ][ 2 ][ 16 ][ 16 ]; |
136 | | |
137 | | extern const uint8_t g_lfnstLut[ NUM_INTRA_MODE + NUM_EXT_LUMA_MODE - 1 ]; |
138 | | |
139 | | // ==================================================================================================================== |
140 | | // Misc. |
141 | | // ==================================================================================================================== |
142 | | #if !( ENABLE_SIMD_LOG2 && defined( TARGET_SIMD_X86 ) ) |
143 | | extern int8_t g_aucLog2 [MAX_CU_SIZE + 1]; |
144 | | extern int8_t g_aucNextLog2 [MAX_CU_SIZE + 1]; |
145 | | extern int8_t g_aucPrevLog2 [MAX_CU_SIZE + 1]; |
146 | | #endif |
147 | | |
148 | | extern const int g_ictModes[2][4]; |
149 | | |
150 | | class SizeIndexInfoLog2 |
151 | | { |
152 | | public: |
153 | 0 | constexpr static inline SizeType numAllWidths() { return MAX_LOG2_TU_SIZE_PLUS_ONE; } |
154 | 0 | constexpr static inline SizeType numAllHeights() { return MAX_LOG2_TU_SIZE_PLUS_ONE; } |
155 | 0 | constexpr static inline SizeType sizeFrom( SizeType idx ) { return (1 << idx); } |
156 | 0 | static inline SizeType idxFrom( SizeType size ) { return getLog2(size); } |
157 | | }; |
158 | | |
159 | | extern const SizeIndexInfoLog2 g_sizeIdxInfo; |
160 | | |
161 | | extern const UnitScale g_miScaling; // scaling object for motion scaling |
162 | | extern const UnitScale g_colMiScaling; |
163 | | |
164 | | |
165 | | #if ENABLE_TIME_PROFILING || ENABLE_TIME_PROFILING_EXTENDED |
166 | | # if ENABLE_TIME_PROFILING |
167 | | extern TimeProfiler* g_timeProfiler; |
168 | | # else |
169 | | extern TimeProfiler2D* g_timeProfiler; |
170 | | # endif |
171 | | #endif |
172 | | |
173 | | const char* nalUnitTypeToString(NalUnitType type); |
174 | | |
175 | | extern const int g_quantTSDefault4x4 [4*4]; |
176 | | extern const int g_quantIntraDefault8x8[8*8]; |
177 | | extern const int g_quantInterDefault8x8[8*8]; |
178 | | |
179 | | extern const uint32_t g_vvcScalingListSizeX[SCALING_LIST_SIZE_NUM]; |
180 | | extern const uint32_t g_scalingListId[SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; |
181 | | |
182 | | extern MsgLevel g_verbosity; |
183 | | |
184 | | extern const int8_t g_BcwLog2WeightBase; |
185 | | extern const int8_t g_BcwWeightBase; |
186 | | extern const int8_t g_BcwWeights[BCW_NUM]; |
187 | | extern const int8_t g_BcwParsingOrder[BCW_NUM]; |
188 | | extern const int8_t g_BcwInternFwd[BCW_NUM]; |
189 | | extern const int8_t g_BcwInternBcw[BCW_NUM]; |
190 | | |
191 | | int8_t getBcwWeight(uint8_t bcwIdx, uint8_t uhRefFrmList); |
192 | | |
193 | | constexpr uint8_t g_tbMax[257] = { 0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, |
194 | | 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, |
195 | | 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, |
196 | | 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, |
197 | | 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, |
198 | | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, |
199 | | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, |
200 | | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, |
201 | | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, |
202 | | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8 }; |
203 | | |
204 | | //! \} |
205 | | |
206 | | |
207 | | |
208 | | extern const int g_alfNumCoeff[ALF_NUM_OF_FILTER_TYPES]; |
209 | | |
210 | | const int g_IBCBufferSize = 256 * 128; |
211 | | |
212 | | void initGeoTemplate(); |
213 | | |
214 | | extern int16_t g_weightOffset [GEO_NUM_PARTITION_MODE][GEO_NUM_CU_SIZE][GEO_NUM_CU_SIZE][2]; |
215 | | extern int16_t g_GeoParams [GEO_NUM_PARTITION_MODE][2]; |
216 | | extern int16_t g_globalGeoWeights [GEO_NUM_PRESTORED_MASK][GEO_WEIGHT_MASK_SIZE * GEO_WEIGHT_MASK_SIZE]; |
217 | | extern const int8_t g_angle2mask [GEO_NUM_ANGLES]; |
218 | | extern const int8_t g_Dis [GEO_NUM_ANGLES]; |
219 | | extern const int8_t g_angle2mirror [GEO_NUM_ANGLES]; |
220 | | |
221 | | } // namespace vvdec |