1 | /* The copyright in this software is being made available under the BSD |
---|
2 | * License, included below. This software may be subject to other third party |
---|
3 | * and contributor rights, including patent rights, and no such rights are |
---|
4 | * granted under this license. |
---|
5 | * |
---|
6 | * Copyright (c) 2010-2014, ITU/ISO/IEC |
---|
7 | * All rights reserved. |
---|
8 | * |
---|
9 | * Redistribution and use in source and binary forms, with or without |
---|
10 | * modification, are permitted provided that the following conditions are met: |
---|
11 | * |
---|
12 | * * Redistributions of source code must retain the above copyright notice, |
---|
13 | * this list of conditions and the following disclaimer. |
---|
14 | * * Redistributions in binary form must reproduce the above copyright notice, |
---|
15 | * this list of conditions and the following disclaimer in the documentation |
---|
16 | * and/or other materials provided with the distribution. |
---|
17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may |
---|
18 | * be used to endorse or promote products derived from this software without |
---|
19 | * specific prior written permission. |
---|
20 | * |
---|
21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS |
---|
25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
---|
31 | * THE POSSIBILITY OF SUCH DAMAGE. |
---|
32 | */ |
---|
33 | |
---|
34 | /** \file TypeDef.h |
---|
35 | \brief Define basic types, new types and enumerations |
---|
36 | */ |
---|
37 | |
---|
38 | #ifndef _TYPEDEF__ |
---|
39 | #define _TYPEDEF__ |
---|
40 | |
---|
41 | //! \ingroup TLibCommon |
---|
42 | //! \{ |
---|
43 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
44 | ///////////////////////////////// EXTENSION SELECTION /////////////////////////////////// |
---|
45 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
46 | |
---|
47 | /* HEVC_EXT might be defined by compiler/makefile options. |
---|
48 | |
---|
49 | Linux makefiles support the following settings: |
---|
50 | make -> HEVC_EXT not defined |
---|
51 | make HEVC_EXT=0 -> H_MV=0 H_3D=0 --> plain HM |
---|
52 | make HEVC_EXT=1 -> H_MV=1 H_3D=0 --> MV only |
---|
53 | make HEVC_EXT=2 -> H_MV=1 H_3D=1 --> full 3D |
---|
54 | */ |
---|
55 | |
---|
56 | #ifndef HEVC_EXT |
---|
57 | #define HEVC_EXT 2 |
---|
58 | #endif |
---|
59 | |
---|
60 | #if ( HEVC_EXT < 0 )||( HEVC_EXT > 2 ) |
---|
61 | #error HEVC_EXT must be in the range of 0 to 2, inclusive. |
---|
62 | #endif |
---|
63 | |
---|
64 | #define H_MV ( HEVC_EXT != 0) |
---|
65 | #define H_3D ( HEVC_EXT == 2) |
---|
66 | |
---|
67 | #define NTT_BUG_FIX_TK54 1 |
---|
68 | #define BUG_FIX_TK65 1 |
---|
69 | |
---|
70 | #define MTK_I0093 1 |
---|
71 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
72 | /////////////////////////////////// MAJOR DEFINES /////////////////////////////////// |
---|
73 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
74 | |
---|
75 | #if H_MV |
---|
76 | #define H_MV_ENC_DEC_TRAC 1 //< CU/PU level tracking |
---|
77 | #endif |
---|
78 | |
---|
79 | |
---|
80 | |
---|
81 | |
---|
82 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
83 | /////////////////////////////////// DERIVED DEFINES /////////////////////////////////// |
---|
84 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
85 | |
---|
86 | // Fixes |
---|
87 | |
---|
88 | |
---|
89 | #define H_MV_FIX_REF_LAYER_PIC_FLAG 1 |
---|
90 | #define H_MV_FIX_NUM_VIEWS 1 |
---|
91 | #define H_3D_OUTPUT_ACTIVE_TOOLS 0 |
---|
92 | |
---|
93 | ///// ***** SINGLE DEPTH MODE ********* |
---|
94 | |
---|
95 | ///// ***** VIEW SYNTHESIS OPTIMIZAION ********* |
---|
96 | |
---|
97 | //// ****** NEIGHBOURING BLOCK-BASED DISPARITY VECTOR ********* |
---|
98 | |
---|
99 | ///// ***** ADVANCED INTERVIEW RESIDUAL PREDICTION ********* |
---|
100 | |
---|
101 | ///// ***** DEPTH INTRA MODES ********* |
---|
102 | ///// ***** VIEW SYNTHESIS PREDICTION ********* |
---|
103 | |
---|
104 | |
---|
105 | ///// ***** ILLUMATION COMPENSATION ********* |
---|
106 | |
---|
107 | |
---|
108 | ///// ***** DEPTH BASED BLOCK PARTITIONING ********* |
---|
109 | |
---|
110 | |
---|
111 | ///// ***** FCO ********* |
---|
112 | #define H_3D_FCO_VSP_DONBDV_E0163 0 // Adaptive depth reference for flexible coding order |
---|
113 | |
---|
114 | |
---|
115 | |
---|
116 | |
---|
117 | ///////////////////////////////////////////////////////////////////////////////// |
---|
118 | /////////////////////////////////// MV_HEVC HLS ////////////////////////////// |
---|
119 | ///////////////////////////////////////////////////////////////////////////////// |
---|
120 | // TBD: Check if integration is necessary. |
---|
121 | |
---|
122 | #define H_MV_HLS_FIX 1 |
---|
123 | #define H_MV_HLS_PTL_LIMITS 0 |
---|
124 | #define H_MV_HLS7_GEN 0 // General changes (not tested) |
---|
125 | #define H_MV_ALIGN_HM_15 1 |
---|
126 | |
---|
127 | // POC |
---|
128 | // #define H_MV_HLS_7_POC_P0041_3 0 // (POC/P0041/POC reset) #3 It was remarked that we should require each non-IRAP picture that has discardable_flag equal to 1 to have NUT value indicating that it is a sub-layer non-reference picture. This was agreed. Decision: Adopt (with constraint for discardable_flag as described above) |
---|
129 | // #define H_MV_HLS_7_POC_P0041_FIXES 0 // (POC/P0041/Fixes) For each non-IRAP picture that has discardable_flag equal to 1 to have NUT value indicating that it is a sub-layer non-reference picture. |
---|
130 | // #define H_MV_HLS_7_POC_P0056_4 0 // (POC/P0056/layer tree poc) #4 Proposal 1: If the POC reset approach is adopted as the basis for multi-layer POC derivation, it is proposed to derive the POC anchor picture from the previous TID0 picture (that is not a RASL picture, a RADL picture or a sub-layer non-reference picture and not with discardable_flag equal to 1) of the current layer or any of its reference layer. This is asserted to improve loss resilience and reduce bit rate overhead. Decision: Adopt Proposal 1 (with the suggested modifications Ewith text provided as P0297). |
---|
131 | |
---|
132 | // SEI related |
---|
133 | //#define H_MV_HLS_8_SEI_NODOC_53 0 // #53 (SEI /NODOC/Added Multiview view position SEI message) Plain copy from AVC. |
---|
134 | //#define H_MV_HLS_8_SEI_NODOC_52 0 // #52 (SEI /NODOC/Added Multiview acquisition information SEI) Plain copy from AVC. |
---|
135 | //#define H_MV_HLS_8_SEI_NODOC_51 0 // #51 (SEI /NODOC/Added Multiview scene information SEI message) |
---|
136 | //#define H_MV_HLS_8_SEI_Q0189_35 0 // #35 (SEI /Q0189/SEI message for indicating constraints on TMVP) Proposal 2.3, SEI message for indicating constraints on TMVP |
---|
137 | //#define H_MV_HLS_8_EDF_Q0116_29 0 // #29 (ED.FIX /Q0116/Recovery point SEI) , consider adding a note regarding how random accessibility is affected by the recovery point SEI message |
---|
138 | //#define H_MV_HLS_8_GEN_Q0183_23 0 // #23 (GEN /Q0183/SEI clean-ups) numerous small clean-ups on SEI messages. |
---|
139 | //#define H_MV_HLS_8_MIS_Q0247_49 0 // #49 (MISC /Q0247/frame-field information SEI message) |
---|
140 | //#define H_MV_HLS_8_MIS_Q0189_34 0 // #34 (MISC /Q0189/slice temporal mvp enabled flag) Proposal 2.2, clarification of semantics of slice temporal mvp enabled flag |
---|
141 | //#define H_MV_HLS_8_EDF_Q0081_01 0 // #1 (ED.FIX /Q0081/alpha channel persist) On reuse of alpha planes in auxiliary pictures. It was asked why there would not be a presumption that the alpha channel content would simply persist, without needing the flag to indicate it. Decision (Ed.): Delegated to editors to clarify, as necessary, that the alpha channel content persists until cancelled or updated in output order. |
---|
142 | //#define H_MV_HLS_8_SEI_Q0253_37 0 // #37 (SEI /Q0253/layer not present), modified semantics of layers not present SEI message to correct bug introduced during editing |
---|
143 | //#define H_MV_HLS_8_SEI_Q0045_11 0 // #11 (SEI /Q0045/Overlay) Proposal for an SEI message on selectable overlays. Decision: Adopt (modified for variable-length strings). |
---|
144 | //#define H_MV_HLS_7_SEI_P0133_28 0 // (SEI/P0133/Recovery point SEI) #28 Decision: Adopt change to recover point semantics only (-v3) |
---|
145 | //#define H_MV_HLS_7_SEI_P0123_25 0 // (SEI/P0123/Alpha channel info) #25 Add alpha channel information SEI message Decision: Adopt. Constrain the bit depth indicated to be equal to the coded bit depth of the aux picture. |
---|
146 | |
---|
147 | // DPB |
---|
148 | //#define H_MV_HLS_8_HRD_Q0102_09 0 // #9 (HRD /Q0102/NoOutputOfPriorPicsFlag) It was suggested that also the separate_colour_plane_flag should affect inference of NoOutputOfPriorPicsFlag. Decision (Ed.): Agreed (affects RExt text). |
---|
149 | //#define H_MV_HLS_8_DBP_Q0154_38 0 // #38 (DBP /Q0154/VPS DPB) Proposal in C.5.2.1: Add in the decoding process that when a new VPS is activated, all pictures in the DPB are marked as unused for reference |
---|
150 | //#define H_MV_HLS_8_HRD_Q0154_10 0 // #10 (HRD /Q0154/DPB Flushing and parameters) On picture flushing and DPB parameters Decision: Adopted (some details to be discussed further in BoG). |
---|
151 | //#define H_MV_HLS_7_OTHER_P0187_1 0 // (OTHER/P0187/NoOutputOfPriorPicsFlag) #1 Inference of NoOutputOfPriorPicsFlag and proposes to take into account colour format and bit depth for the inference in addition to spatial resolution |
---|
152 | |
---|
153 | // OTHERS |
---|
154 | //#define H_MV_HLS_8_HSB_Q0041_03 0 // #3 (HS /Q0041/hybrid scalability) The proposed text was endorsed, with non-editorial open issues considered as follows ?// #define H_MV_HLS_7_OTHER_P0187_1 0 // (OTHER/P0187/NoOutputOfPriorPicsFlag) #1 Inference of NoOutputOfPriorPicsFlag and proposes to take into account colour format and bit depth for the inference in addition to spatial resolution |
---|
155 | //#define H_MV_HLS_8_MIS_Q0078_24 0 // #24 (MISC /Q0078/scan and pic type) , Items 3 b,c and 4, clarifying which pictures in an output layer sets are applied the values of general_progressive_source_flag, general_interlaced_source_flag, general_non_packed_constraint_flag and general_frame_only_constraint_flag. |
---|
156 | //#define H_MV_HLS_7_HRD_P0138_6 0 // (HRD/P0138/HRD parameters for bitstreams excluding) #6 Decision: Adopt (as revised in updated contribution, with the specification of a flag in the BP SEI (HRD/P0192/sub-DPB) #12 Establish sub-DPBs based on the representation format indicated at the VPS level. It was suggested that the expressed shared capacity limit would need to be less than or equal to the sum of the individual capacity limits. Decision: Adopt as modified. Further study is encouraged on profile/level constraint selections. |
---|
157 | |
---|
158 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
159 | /////////////////////////////////// HM RELATED DEFINES //////////////////////////////// |
---|
160 | ///////////////////////////////////////////////////////////////////////////////////////// |
---|
161 | #define HARMONIZE_GOP_FIRST_FIELD_COUPLE 1 |
---|
162 | #define FIX_FIELD_DEPTH 1 |
---|
163 | #if H_MV |
---|
164 | #define EFFICIENT_FIELD_IRAP 0 |
---|
165 | #else |
---|
166 | #define EFFICIENT_FIELD_IRAP 1 |
---|
167 | #endif |
---|
168 | #define ALLOW_RECOVERY_POINT_AS_RAP 1 |
---|
169 | #define BUGFIX_INTRAPERIOD 1 |
---|
170 | #define SAO_ENCODE_ALLOW_USE_PREDEBLOCK 1 |
---|
171 | |
---|
172 | #define SAO_SGN_FUNC 1 |
---|
173 | |
---|
174 | #define TILE_SIZE_CHECK 1 |
---|
175 | |
---|
176 | #define FIX1172 1 ///< fix ticket #1172 |
---|
177 | |
---|
178 | #define SETTING_PIC_OUTPUT_MARK 1 |
---|
179 | #define SETTING_NO_OUT_PIC_PRIOR 1 |
---|
180 | #define FIX_EMPTY_PAYLOAD_NAL 1 |
---|
181 | #define FIX_WRITING_OUTPUT 1 |
---|
182 | #define FIX_OUTPUT_EOS 1 |
---|
183 | |
---|
184 | #define FIX_POC_CRA_NORASL_OUTPUT 1 |
---|
185 | |
---|
186 | #define MAX_NUM_PICS_IN_SOP 1024 |
---|
187 | |
---|
188 | #define MAX_NESTING_NUM_OPS 1024 |
---|
189 | #define MAX_NESTING_NUM_LAYER 64 |
---|
190 | |
---|
191 | #if H_MV |
---|
192 | #define MAX_VPS_NUM_HRD_PARAMETERS 1024 |
---|
193 | #else |
---|
194 | #define MAX_VPS_NUM_HRD_PARAMETERS 1 |
---|
195 | #endif |
---|
196 | #if H_MV |
---|
197 | #define MAX_NUM_SUB_LAYERS 7 |
---|
198 | #define MAX_NUM_SIGNALLED_PARTITIONING_SCHEMES 16 |
---|
199 | #endif |
---|
200 | #define MAX_VPS_OP_SETS_PLUS1 1024 |
---|
201 | #if H_MV |
---|
202 | #define MAX_VPS_NUM_ADD_LAYER_SETS 1024 |
---|
203 | #define MAX_VPS_NUH_LAYER_ID_PLUS1 63 |
---|
204 | #define MAX_NUM_SCALABILITY_TYPES 16 |
---|
205 | #define ENC_CFG_CONSOUT_SPACE 29 |
---|
206 | #else |
---|
207 | #define MAX_VPS_NUH_RESERVED_ZERO_LAYER_ID_PLUS1 1 |
---|
208 | #endif |
---|
209 | |
---|
210 | |
---|
211 | #define MAX_CPB_CNT 32 ///< Upper bound of (cpb_cnt_minus1 + 1) |
---|
212 | #if H_MV |
---|
213 | #define MAX_NUM_LAYER_IDS 63 |
---|
214 | #define MAX_NUM_LAYERS 63 |
---|
215 | #define MAX_VPS_PROFILE_TIER_LEVEL 64 |
---|
216 | #define MAX_VPS_ADD_OUTPUT_LAYER_SETS 1024 |
---|
217 | #define MAX_VPS_OUTPUTLAYER_SETS ( MAX_VPS_ADD_OUTPUT_LAYER_SETS + MAX_VPS_OP_SETS_PLUS1 + MAX_VPS_OP_SETS_PLUS1 ) |
---|
218 | #define MAX_NUM_VIDEO_SIGNAL_INFO 16 |
---|
219 | #define MAX_NUM_SCALED_REF_LAYERS MAX_NUM_LAYERS-1 |
---|
220 | #else |
---|
221 | #define MAX_NUM_LAYER_IDS 64 |
---|
222 | #endif |
---|
223 | |
---|
224 | #define COEF_REMAIN_BIN_REDUCTION 3 ///< indicates the level at which the VLC |
---|
225 | ///< transitions from Golomb-Rice to TU+EG(k) |
---|
226 | |
---|
227 | #define CU_DQP_TU_CMAX 5 ///< max number bins for truncated unary |
---|
228 | #define CU_DQP_EG_k 0 ///< expgolomb order |
---|
229 | |
---|
230 | #define SBH_THRESHOLD 4 ///< I0156: value of the fixed SBH controlling threshold |
---|
231 | |
---|
232 | #define SEQUENCE_LEVEL_LOSSLESS 0 ///< H0530: used only for sequence or frame-level lossless coding |
---|
233 | |
---|
234 | #define DISABLING_CLIP_FOR_BIPREDME 1 ///< Ticket #175 |
---|
235 | |
---|
236 | #define C1FLAG_NUMBER 8 // maximum number of largerThan1 flag coded in one chunk : 16 in HM5 |
---|
237 | #define C2FLAG_NUMBER 1 // maximum number of largerThan2 flag coded in one chunk: 16 in HM5 |
---|
238 | #define SAO_ENCODING_CHOICE 1 ///< I0184: picture early termination |
---|
239 | #if SAO_ENCODING_CHOICE |
---|
240 | #define SAO_ENCODING_RATE 0.75 |
---|
241 | #define SAO_ENCODING_CHOICE_CHROMA 1 ///< J0044: picture early termination Luma and Chroma are handled separately |
---|
242 | #if SAO_ENCODING_CHOICE_CHROMA |
---|
243 | #define SAO_ENCODING_RATE_CHROMA 0.5 |
---|
244 | #endif |
---|
245 | #endif |
---|
246 | |
---|
247 | #define MAX_NUM_VPS 16 |
---|
248 | #define MAX_NUM_SPS 16 |
---|
249 | #define MAX_NUM_PPS 64 |
---|
250 | |
---|
251 | #define RDOQ_CHROMA_LAMBDA 1 ///< F386: weighting of chroma for RDOQ |
---|
252 | |
---|
253 | #define MIN_SCAN_POS_CROSS 4 |
---|
254 | |
---|
255 | #define FAST_BIT_EST 1 ///< G763: Table-based bit estimation for CABAC |
---|
256 | |
---|
257 | #define MLS_GRP_NUM 64 ///< G644 : Max number of coefficient groups, max(16, 64) |
---|
258 | #define MLS_CG_SIZE 4 ///< G644 : Coefficient group size of 4x4 |
---|
259 | |
---|
260 | #define ADAPTIVE_QP_SELECTION 1 ///< G382: Adaptive reconstruction levels, non-normative part for adaptive QP selection |
---|
261 | #if ADAPTIVE_QP_SELECTION |
---|
262 | #define ARL_C_PRECISION 7 ///< G382: 7-bit arithmetic precision |
---|
263 | #define LEVEL_RANGE 30 ///< G382: max coefficient level in statistics collection |
---|
264 | #endif |
---|
265 | |
---|
266 | #define HHI_RQT_INTRA_SPEEDUP 1 ///< tests one best mode with full rqt |
---|
267 | #define HHI_RQT_INTRA_SPEEDUP_MOD 0 ///< tests two best modes with full rqt |
---|
268 | |
---|
269 | #if HHI_RQT_INTRA_SPEEDUP_MOD && !HHI_RQT_INTRA_SPEEDUP |
---|
270 | #error |
---|
271 | #endif |
---|
272 | |
---|
273 | #define VERBOSE_RATE 0 ///< Print additional rate information in encoder |
---|
274 | |
---|
275 | #define AMVP_DECIMATION_FACTOR 4 |
---|
276 | |
---|
277 | #define SCAN_SET_SIZE 16 |
---|
278 | #define LOG2_SCAN_SET_SIZE 4 |
---|
279 | |
---|
280 | #define FAST_UDI_MAX_RDMODE_NUM 35 ///< maximum number of RD comparison in fast-UDI estimation loop |
---|
281 | |
---|
282 | #define ZERO_MVD_EST 0 ///< Zero Mvd Estimation in normal mode |
---|
283 | |
---|
284 | #define NUM_INTRA_MODE 36 |
---|
285 | #if !REMOVE_LM_CHROMA |
---|
286 | #define LM_CHROMA_IDX 35 |
---|
287 | #endif |
---|
288 | |
---|
289 | #define WRITE_BACK 1 ///< Enable/disable the encoder to replace the deltaPOC and Used by current from the config file with the values derived by the refIdc parameter. |
---|
290 | #define AUTO_INTER_RPS 1 ///< Enable/disable the automatic generation of refIdc from the deltaPOC and Used by current from the config file. |
---|
291 | #define PRINT_RPS_INFO 0 ///< Enable/disable the printing of bits used to send the RPS. |
---|
292 | // using one nearest frame as reference frame, and the other frames are high quality (POC%4==0) frames (1+X) |
---|
293 | // this should be done with encoder only decision |
---|
294 | // but because of the absence of reference frame management, the related code was hard coded currently |
---|
295 | |
---|
296 | #define RVM_VCEGAM10_M 4 |
---|
297 | |
---|
298 | #define PLANAR_IDX 0 |
---|
299 | #define VER_IDX 26 // index for intra VERTICAL mode |
---|
300 | #define HOR_IDX 10 // index for intra HORIZONTAL mode |
---|
301 | #define DC_IDX 1 // index for intra DC mode |
---|
302 | #define NUM_CHROMA_MODE 5 // total number of chroma modes |
---|
303 | #define DM_CHROMA_IDX 36 // chroma mode index for derived from luma intra mode |
---|
304 | |
---|
305 | |
---|
306 | #define FAST_UDI_USE_MPM 1 |
---|
307 | |
---|
308 | #define RDO_WITHOUT_DQP_BITS 0 ///< Disable counting dQP bits in RDO-based mode decision |
---|
309 | |
---|
310 | #define FULL_NBIT 0 ///< When enabled, compute costs using full sample bitdepth. When disabled, compute costs as if it is 8-bit source video. |
---|
311 | #if FULL_NBIT |
---|
312 | # define DISTORTION_PRECISION_ADJUSTMENT(x) 0 |
---|
313 | #else |
---|
314 | # define DISTORTION_PRECISION_ADJUSTMENT(x) (x) |
---|
315 | #endif |
---|
316 | |
---|
317 | #define LOG2_MAX_NUM_COLUMNS_MINUS1 7 |
---|
318 | #define LOG2_MAX_NUM_ROWS_MINUS1 7 |
---|
319 | #define LOG2_MAX_COLUMN_WIDTH 13 |
---|
320 | #define LOG2_MAX_ROW_HEIGHT 13 |
---|
321 | |
---|
322 | #define MATRIX_MULT 0 // Brute force matrix multiplication instead of partial butterfly |
---|
323 | |
---|
324 | #define REG_DCT 65535 |
---|
325 | |
---|
326 | #define AMP_SAD 1 ///< dedicated SAD functions for AMP |
---|
327 | #define AMP_ENC_SPEEDUP 1 ///< encoder only speed-up by AMP mode skipping |
---|
328 | #if AMP_ENC_SPEEDUP |
---|
329 | #define AMP_MRG 1 ///< encoder only force merge for AMP partition (no motion search for AMP) |
---|
330 | #endif |
---|
331 | |
---|
332 | #define CABAC_INIT_PRESENT_FLAG 1 |
---|
333 | |
---|
334 | // ==================================================================================================================== |
---|
335 | // Basic type redefinition |
---|
336 | // ==================================================================================================================== |
---|
337 | |
---|
338 | typedef void Void; |
---|
339 | typedef bool Bool; |
---|
340 | |
---|
341 | #ifdef __arm__ |
---|
342 | typedef signed char Char; |
---|
343 | #else |
---|
344 | typedef char Char; |
---|
345 | #endif |
---|
346 | typedef unsigned char UChar; |
---|
347 | typedef short Short; |
---|
348 | typedef unsigned short UShort; |
---|
349 | typedef int Int; |
---|
350 | typedef unsigned int UInt; |
---|
351 | typedef double Double; |
---|
352 | typedef float Float; |
---|
353 | |
---|
354 | // ==================================================================================================================== |
---|
355 | // 64-bit integer type |
---|
356 | // ==================================================================================================================== |
---|
357 | |
---|
358 | #ifdef _MSC_VER |
---|
359 | typedef __int64 Int64; |
---|
360 | |
---|
361 | #if _MSC_VER <= 1200 // MS VC6 |
---|
362 | typedef __int64 UInt64; // MS VC6 does not support unsigned __int64 to double conversion |
---|
363 | #else |
---|
364 | typedef unsigned __int64 UInt64; |
---|
365 | #endif |
---|
366 | |
---|
367 | #else |
---|
368 | |
---|
369 | typedef long long Int64; |
---|
370 | typedef unsigned long long UInt64; |
---|
371 | |
---|
372 | #endif |
---|
373 | |
---|
374 | // ==================================================================================================================== |
---|
375 | // Type definition |
---|
376 | // ==================================================================================================================== |
---|
377 | |
---|
378 | typedef UChar Pxl; ///< 8-bit pixel type |
---|
379 | typedef Short Pel; ///< 16-bit pixel type |
---|
380 | typedef Int TCoeff; ///< transform coefficient |
---|
381 | |
---|
382 | /// parameters for adaptive loop filter |
---|
383 | class TComPicSym; |
---|
384 | |
---|
385 | // Slice / Slice segment encoding modes |
---|
386 | enum SliceConstraint |
---|
387 | { |
---|
388 | NO_SLICES = 0, ///< don't use slices / slice segments |
---|
389 | FIXED_NUMBER_OF_LCU = 1, ///< Limit maximum number of largest coding tree blocks in a slice / slice segments |
---|
390 | FIXED_NUMBER_OF_BYTES = 2, ///< Limit maximum number of bytes in a slice / slice segment |
---|
391 | FIXED_NUMBER_OF_TILES = 3, ///< slices / slice segments span an integer number of tiles |
---|
392 | }; |
---|
393 | |
---|
394 | enum SAOComponentIdx |
---|
395 | { |
---|
396 | SAO_Y =0, |
---|
397 | SAO_Cb, |
---|
398 | SAO_Cr, |
---|
399 | NUM_SAO_COMPONENTS |
---|
400 | }; |
---|
401 | |
---|
402 | enum SAOMode //mode |
---|
403 | { |
---|
404 | SAO_MODE_OFF = 0, |
---|
405 | SAO_MODE_NEW, |
---|
406 | SAO_MODE_MERGE, |
---|
407 | NUM_SAO_MODES |
---|
408 | }; |
---|
409 | |
---|
410 | enum SAOModeMergeTypes |
---|
411 | { |
---|
412 | SAO_MERGE_LEFT =0, |
---|
413 | SAO_MERGE_ABOVE, |
---|
414 | NUM_SAO_MERGE_TYPES |
---|
415 | }; |
---|
416 | |
---|
417 | |
---|
418 | enum SAOModeNewTypes |
---|
419 | { |
---|
420 | SAO_TYPE_START_EO =0, |
---|
421 | SAO_TYPE_EO_0 = SAO_TYPE_START_EO, |
---|
422 | SAO_TYPE_EO_90, |
---|
423 | SAO_TYPE_EO_135, |
---|
424 | SAO_TYPE_EO_45, |
---|
425 | |
---|
426 | SAO_TYPE_START_BO, |
---|
427 | SAO_TYPE_BO = SAO_TYPE_START_BO, |
---|
428 | |
---|
429 | NUM_SAO_NEW_TYPES |
---|
430 | }; |
---|
431 | #define NUM_SAO_EO_TYPES_LOG2 2 |
---|
432 | |
---|
433 | enum SAOEOClasses |
---|
434 | { |
---|
435 | SAO_CLASS_EO_FULL_VALLEY = 0, |
---|
436 | SAO_CLASS_EO_HALF_VALLEY = 1, |
---|
437 | SAO_CLASS_EO_PLAIN = 2, |
---|
438 | SAO_CLASS_EO_HALF_PEAK = 3, |
---|
439 | SAO_CLASS_EO_FULL_PEAK = 4, |
---|
440 | NUM_SAO_EO_CLASSES, |
---|
441 | }; |
---|
442 | |
---|
443 | |
---|
444 | #define NUM_SAO_BO_CLASSES_LOG2 5 |
---|
445 | enum SAOBOClasses |
---|
446 | { |
---|
447 | //SAO_CLASS_BO_BAND0 = 0, |
---|
448 | //SAO_CLASS_BO_BAND1, |
---|
449 | //SAO_CLASS_BO_BAND2, |
---|
450 | //... |
---|
451 | //SAO_CLASS_BO_BAND31, |
---|
452 | |
---|
453 | NUM_SAO_BO_CLASSES = (1<<NUM_SAO_BO_CLASSES_LOG2), |
---|
454 | }; |
---|
455 | #define MAX_NUM_SAO_CLASSES 32 //(NUM_SAO_EO_GROUPS > NUM_SAO_BO_GROUPS)?NUM_SAO_EO_GROUPS:NUM_SAO_BO_GROUPS |
---|
456 | |
---|
457 | struct SAOOffset |
---|
458 | { |
---|
459 | Int modeIdc; //NEW, MERGE, OFF |
---|
460 | Int typeIdc; //NEW: EO_0, EO_90, EO_135, EO_45, BO. MERGE: left, above |
---|
461 | Int typeAuxInfo; //BO: starting band index |
---|
462 | Int offset[MAX_NUM_SAO_CLASSES]; |
---|
463 | |
---|
464 | SAOOffset(); |
---|
465 | ~SAOOffset(); |
---|
466 | Void reset(); |
---|
467 | |
---|
468 | const SAOOffset& operator= (const SAOOffset& src); |
---|
469 | }; |
---|
470 | |
---|
471 | struct SAOBlkParam |
---|
472 | { |
---|
473 | |
---|
474 | SAOBlkParam(); |
---|
475 | ~SAOBlkParam(); |
---|
476 | Void reset(); |
---|
477 | const SAOBlkParam& operator= (const SAOBlkParam& src); |
---|
478 | SAOOffset& operator[](Int compIdx){ return offsetParam[compIdx];} |
---|
479 | private: |
---|
480 | SAOOffset offsetParam[NUM_SAO_COMPONENTS]; |
---|
481 | |
---|
482 | }; |
---|
483 | |
---|
484 | /// parameters for deblocking filter |
---|
485 | typedef struct _LFCUParam |
---|
486 | { |
---|
487 | Bool bInternalEdge; ///< indicates internal edge |
---|
488 | Bool bLeftEdge; ///< indicates left edge |
---|
489 | Bool bTopEdge; ///< indicates top edge |
---|
490 | } LFCUParam; |
---|
491 | |
---|
492 | // ==================================================================================================================== |
---|
493 | // Enumeration |
---|
494 | // ==================================================================================================================== |
---|
495 | |
---|
496 | /// supported slice type |
---|
497 | enum SliceType |
---|
498 | { |
---|
499 | B_SLICE, |
---|
500 | P_SLICE, |
---|
501 | I_SLICE |
---|
502 | }; |
---|
503 | |
---|
504 | /// chroma formats (according to semantics of chroma_format_idc) |
---|
505 | enum ChromaFormat |
---|
506 | { |
---|
507 | CHROMA_400 = 0, |
---|
508 | CHROMA_420 = 1, |
---|
509 | CHROMA_422 = 2, |
---|
510 | CHROMA_444 = 3 |
---|
511 | }; |
---|
512 | |
---|
513 | /// supported partition shape |
---|
514 | enum PartSize |
---|
515 | { |
---|
516 | SIZE_2Nx2N, ///< symmetric motion partition, 2Nx2N |
---|
517 | SIZE_2NxN, ///< symmetric motion partition, 2Nx N |
---|
518 | SIZE_Nx2N, ///< symmetric motion partition, Nx2N |
---|
519 | SIZE_NxN, ///< symmetric motion partition, Nx N |
---|
520 | SIZE_2NxnU, ///< asymmetric motion partition, 2Nx( N/2) + 2Nx(3N/2) |
---|
521 | SIZE_2NxnD, ///< asymmetric motion partition, 2Nx(3N/2) + 2Nx( N/2) |
---|
522 | SIZE_nLx2N, ///< asymmetric motion partition, ( N/2)x2N + (3N/2)x2N |
---|
523 | SIZE_nRx2N, ///< asymmetric motion partition, (3N/2)x2N + ( N/2)x2N |
---|
524 | SIZE_NONE = 15 |
---|
525 | }; |
---|
526 | |
---|
527 | /// supported prediction type |
---|
528 | enum PredMode |
---|
529 | { |
---|
530 | MODE_INTER, ///< inter-prediction mode |
---|
531 | MODE_INTRA, ///< intra-prediction mode |
---|
532 | MODE_NONE = 15 |
---|
533 | }; |
---|
534 | |
---|
535 | /// texture component type |
---|
536 | enum TextType |
---|
537 | { |
---|
538 | TEXT_LUMA, ///< luma |
---|
539 | TEXT_CHROMA, ///< chroma (U+V) |
---|
540 | TEXT_CHROMA_U, ///< chroma U |
---|
541 | TEXT_CHROMA_V, ///< chroma V |
---|
542 | TEXT_ALL, ///< Y+U+V |
---|
543 | TEXT_NONE = 15 |
---|
544 | }; |
---|
545 | |
---|
546 | /// reference list index |
---|
547 | enum RefPicList |
---|
548 | { |
---|
549 | REF_PIC_LIST_0 = 0, ///< reference list 0 |
---|
550 | REF_PIC_LIST_1 = 1, ///< reference list 1 |
---|
551 | REF_PIC_LIST_X = 100 ///< special mark |
---|
552 | }; |
---|
553 | |
---|
554 | /// distortion function index |
---|
555 | enum DFunc |
---|
556 | { |
---|
557 | DF_DEFAULT = 0, |
---|
558 | DF_SSE = 1, ///< general size SSE |
---|
559 | DF_SSE4 = 2, ///< 4xM SSE |
---|
560 | DF_SSE8 = 3, ///< 8xM SSE |
---|
561 | DF_SSE16 = 4, ///< 16xM SSE |
---|
562 | DF_SSE32 = 5, ///< 32xM SSE |
---|
563 | DF_SSE64 = 6, ///< 64xM SSE |
---|
564 | DF_SSE16N = 7, ///< 16NxM SSE |
---|
565 | |
---|
566 | DF_SAD = 8, ///< general size SAD |
---|
567 | DF_SAD4 = 9, ///< 4xM SAD |
---|
568 | DF_SAD8 = 10, ///< 8xM SAD |
---|
569 | DF_SAD16 = 11, ///< 16xM SAD |
---|
570 | DF_SAD32 = 12, ///< 32xM SAD |
---|
571 | DF_SAD64 = 13, ///< 64xM SAD |
---|
572 | DF_SAD16N = 14, ///< 16NxM SAD |
---|
573 | |
---|
574 | DF_SADS = 15, ///< general size SAD with step |
---|
575 | DF_SADS4 = 16, ///< 4xM SAD with step |
---|
576 | DF_SADS8 = 17, ///< 8xM SAD with step |
---|
577 | DF_SADS16 = 18, ///< 16xM SAD with step |
---|
578 | DF_SADS32 = 19, ///< 32xM SAD with step |
---|
579 | DF_SADS64 = 20, ///< 64xM SAD with step |
---|
580 | DF_SADS16N = 21, ///< 16NxM SAD with step |
---|
581 | |
---|
582 | DF_HADS = 22, ///< general size Hadamard with step |
---|
583 | DF_HADS4 = 23, ///< 4xM HAD with step |
---|
584 | DF_HADS8 = 24, ///< 8xM HAD with step |
---|
585 | DF_HADS16 = 25, ///< 16xM HAD with step |
---|
586 | DF_HADS32 = 26, ///< 32xM HAD with step |
---|
587 | DF_HADS64 = 27, ///< 64xM HAD with step |
---|
588 | DF_HADS16N = 28, ///< 16NxM HAD with step |
---|
589 | |
---|
590 | #if AMP_SAD |
---|
591 | DF_SAD12 = 43, |
---|
592 | DF_SAD24 = 44, |
---|
593 | DF_SAD48 = 45, |
---|
594 | |
---|
595 | DF_SADS12 = 46, |
---|
596 | DF_SADS24 = 47, |
---|
597 | DF_SADS48 = 48, |
---|
598 | |
---|
599 | DF_SSE_FRAME = 50 ///< Frame-based SSE |
---|
600 | #else |
---|
601 | DF_SSE_FRAME = 33 ///< Frame-based SSE |
---|
602 | #endif |
---|
603 | }; |
---|
604 | |
---|
605 | /// index for SBAC based RD optimization |
---|
606 | enum CI_IDX |
---|
607 | { |
---|
608 | CI_CURR_BEST = 0, ///< best mode index |
---|
609 | CI_NEXT_BEST, ///< next best index |
---|
610 | CI_TEMP_BEST, ///< temporal index |
---|
611 | CI_CHROMA_INTRA, ///< chroma intra index |
---|
612 | CI_QT_TRAFO_TEST, |
---|
613 | CI_QT_TRAFO_ROOT, |
---|
614 | CI_NUM, ///< total number |
---|
615 | }; |
---|
616 | |
---|
617 | /// motion vector predictor direction used in AMVP |
---|
618 | enum MVP_DIR |
---|
619 | { |
---|
620 | MD_LEFT = 0, ///< MVP of left block |
---|
621 | MD_ABOVE, ///< MVP of above block |
---|
622 | MD_ABOVE_RIGHT, ///< MVP of above right block |
---|
623 | MD_BELOW_LEFT, ///< MVP of below left block |
---|
624 | MD_ABOVE_LEFT ///< MVP of above left block |
---|
625 | }; |
---|
626 | |
---|
627 | /// merging candidates |
---|
628 | |
---|
629 | /// coefficient scanning type used in ACS |
---|
630 | enum COEFF_SCAN_TYPE |
---|
631 | { |
---|
632 | SCAN_DIAG = 0, ///< up-right diagonal scan |
---|
633 | SCAN_HOR, ///< horizontal first scan |
---|
634 | SCAN_VER ///< vertical first scan |
---|
635 | }; |
---|
636 | |
---|
637 | namespace Profile |
---|
638 | { |
---|
639 | enum Name |
---|
640 | { |
---|
641 | NONE = 0, |
---|
642 | MAIN = 1, |
---|
643 | MAIN10 = 2, |
---|
644 | MAINSTILLPICTURE = 3, |
---|
645 | #if H_MV |
---|
646 | MULTIVIEWMAIN = 6, |
---|
647 | #endif |
---|
648 | }; |
---|
649 | } |
---|
650 | |
---|
651 | namespace Level |
---|
652 | { |
---|
653 | enum Tier |
---|
654 | { |
---|
655 | MAIN = 0, |
---|
656 | HIGH = 1, |
---|
657 | }; |
---|
658 | |
---|
659 | enum Name |
---|
660 | { |
---|
661 | NONE = 0, |
---|
662 | LEVEL1 = 30, |
---|
663 | LEVEL2 = 60, |
---|
664 | LEVEL2_1 = 63, |
---|
665 | LEVEL3 = 90, |
---|
666 | LEVEL3_1 = 93, |
---|
667 | LEVEL4 = 120, |
---|
668 | LEVEL4_1 = 123, |
---|
669 | LEVEL5 = 150, |
---|
670 | LEVEL5_1 = 153, |
---|
671 | LEVEL5_2 = 156, |
---|
672 | LEVEL6 = 180, |
---|
673 | LEVEL6_1 = 183, |
---|
674 | LEVEL6_2 = 186, |
---|
675 | }; |
---|
676 | } |
---|
677 | //! \} |
---|
678 | |
---|
679 | #if H_MV |
---|
680 | |
---|
681 | /// scalability types |
---|
682 | enum ScalabilityType |
---|
683 | { |
---|
684 | VIEW_ORDER_INDEX = 1, |
---|
685 | DEPENDENCY_ID = 2, |
---|
686 | AUX_ID = 3, |
---|
687 | }; |
---|
688 | #endif |
---|
689 | #endif |
---|