| 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-2013, 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 | |
|---|
| 45 | ///////////////////////////////////////////////////////////////////////////////////////// |
|---|
| 46 | ///////////////////////////////// EXTENSION SELECTION /////////////////////////////////// |
|---|
| 47 | ///////////////////////////////////////////////////////////////////////////////////////// |
|---|
| 48 | |
|---|
| 49 | /* HEVC_EXT might be defined by compiler/makefile options. |
|---|
| 50 | |
|---|
| 51 | Linux makefiles support the following settings: |
|---|
| 52 | make -> HEVC_EXT not defined |
|---|
| 53 | make HEVC_EXT=0 -> H_MV=0 H_3D=0 --> plain HM |
|---|
| 54 | make HEVC_EXT=1 -> H_MV=1 H_3D=0 --> MV only |
|---|
| 55 | make HEVC_EXT=2 -> H_MV=1 H_3D=1 --> full 3D |
|---|
| 56 | */ |
|---|
| 57 | |
|---|
| 58 | #ifndef HEVC_EXT |
|---|
| 59 | #define HEVC_EXT 2 |
|---|
| 60 | #endif |
|---|
| 61 | |
|---|
| 62 | #if ( HEVC_EXT < 0 )||( HEVC_EXT > 2 ) |
|---|
| 63 | #error HEVC_EXT must be in the range of 0 to 2, inclusive. |
|---|
| 64 | #endif |
|---|
| 65 | |
|---|
| 66 | #define H_MV ( HEVC_EXT != 0) |
|---|
| 67 | #define H_3D ( HEVC_EXT == 2) |
|---|
| 68 | |
|---|
| 69 | ///////////////////////////////////////////////////////////////////////////////////////// |
|---|
| 70 | /////////////////////////////////// MAJOR DEFINES /////////////////////////////////// |
|---|
| 71 | ///////////////////////////////////////////////////////////////////////////////////////// |
|---|
| 72 | |
|---|
| 73 | #if H_3D |
|---|
| 74 | #define H_3D_PDM_CAM_PARAS 0 ///< PDM related parts of camera parameters, should be removed if not used anymore. |
|---|
| 75 | #define H_3D_VSO 1 // VSO, View synthesis optimization, includes: |
|---|
| 76 | // HHI_VSO |
|---|
| 77 | // HHI_VSO_LS_TABLE_M23714 enable table base Lagrange multiplier optimization |
|---|
| 78 | // SAIT_VSO_EST_A0033, JCT3V-A0033 modification 3 |
|---|
| 79 | // LGE_WVSO_A0119 |
|---|
| 80 | #define H_3D_NBDV 1 // Neighboring block disparity derivation |
|---|
| 81 | // JCT3V-A0097 |
|---|
| 82 | // LGE_DVMCP_A0126 |
|---|
| 83 | // LGE_DVMCP_MEM_REDUCTION_B0135 |
|---|
| 84 | // QC_SIMPLE_NBDV_B0047 |
|---|
| 85 | // FIX_LGE_DVMCP_B0133 |
|---|
| 86 | // QC_NBDV_LDB_FIX_C0055 |
|---|
| 87 | // MTK_SAIT_TEMPORAL_FIRST_ORDER_C0141_C0097 |
|---|
| 88 | // MTK_SIMPLIFY_DVTC_C0135 |
|---|
| 89 | // QC_CU_NBDV_D0181 |
|---|
| 90 | // SEC_DEFAULT_DV_D0112 |
|---|
| 91 | |
|---|
| 92 | #define H_3D_ARP 1 // Advanced residual prediction (ARP), JCT3V-D0177 |
|---|
| 93 | #define H_3D_FIX 1 // Temporary for minor fixes |
|---|
| 94 | #define H_3D_IC 1 // Illumination Compensation, JCT3V-B0045, JCT3V-C0046, JCT3V-D0060 |
|---|
| 95 | // Unifying rounding offset, for IC part, JCT3V-D0135 |
|---|
| 96 | // Full Pel Interpolation for Depth, HHI_FULL_PEL_DEPTH_MAP_MV_ACC |
|---|
| 97 | #endif |
|---|
| 98 | |
|---|
| 99 | ///////////////////////////////////////////////////////////////////////////////////////// |
|---|
| 100 | /////////////////////////////////// DERIVED DEFINES /////////////////////////////////// |
|---|
| 101 | ///////////////////////////////////////////////////////////////////////////////////////// |
|---|
| 102 | |
|---|
| 103 | ///// ***** VIEW SYNTHESIS OPTIMIZAION ********* |
|---|
| 104 | #if H_3D_VSO |
|---|
| 105 | #define H_3D_VSO_DIST_INT 1 // Allow negative synthesized view distortion change |
|---|
| 106 | #define H_3D_VSO_COLOR_PLANES 1 // Compute VSO distortion on color planes |
|---|
| 107 | #define H_3D_VSO_EARLY_SKIP 1 // LGE_VSO_EARLY_SKIP_A0093, A0093 modification 4 |
|---|
| 108 | #define H_3D_VSO_RM_ASSERTIONS 0 // Output VSO assertions |
|---|
| 109 | #define H_3D_VSO_SYNTH_DIST_OUT 0 // Output of synthesized view distortion instead of depth distortion in encoder output |
|---|
| 110 | |
|---|
| 111 | #define H_3D_VSO_FIX 0 // This fix should be enabled after verification |
|---|
| 112 | |
|---|
| 113 | #endif |
|---|
| 114 | //// ****** Neighbouring block-based Disparity Vector ********* |
|---|
| 115 | #if H_3D_NBDV |
|---|
| 116 | #define IDV_CANDS 6 |
|---|
| 117 | #define DVFROM_LEFTBELOW 1 |
|---|
| 118 | #define DVFROM_LEFT 2 |
|---|
| 119 | #define DVFROM_ABOVERIGHT 3 |
|---|
| 120 | #define DVFROM_ABOVE 4 |
|---|
| 121 | #define DVFROM_ABOVELEFT 5 |
|---|
| 122 | #endif |
|---|
| 123 | |
|---|
| 124 | ///// ***** ADVANCED INTERVIEW RESIDUAL PREDICTION ********* |
|---|
| 125 | #if H_3D_ARP |
|---|
| 126 | #define H_3D_ARP_WFNR 3 |
|---|
| 127 | #define H_3D_ARP_FIX 1 // Fix of using m_ivPicLists to access the reference pictures of other views |
|---|
| 128 | #endif |
|---|
| 129 | |
|---|
| 130 | ///////////////////////////////////////////////////////////////////////////////////////// |
|---|
| 131 | /////////////////////////////////// HM RELATED DEFINES //////////////////////////////// |
|---|
| 132 | ///////////////////////////////////////////////////////////////////////////////////////// |
|---|
| 133 | |
|---|
| 134 | #define FIX1071 1 ///< Temporary fix for issue #1071 |
|---|
| 135 | |
|---|
| 136 | #define L0208_SOP_DESCRIPTION_SEI 1 ///< L0208: add SOP descrioption SEI |
|---|
| 137 | #define MAX_NUM_PICS_IN_SOP 1024 |
|---|
| 138 | |
|---|
| 139 | #define K0180_SCALABLE_NESTING_SEI 1 ///JCTVC-K0180 scalable nesting sei message |
|---|
| 140 | #define MAX_NESTING_NUM_OPS 1024 |
|---|
| 141 | #define MAX_NESTING_NUM_LAYER 64 |
|---|
| 142 | |
|---|
| 143 | #define J0149_TONE_MAPPING_SEI 1 ///< J0149: Tone mapping information SEI |
|---|
| 144 | #define L0363_DU_BIT_RATE 1 ///< L0363: add bit_rate_du_value_minus1 to HRD parameters |
|---|
| 145 | #define L0328_SPLICING 1 ///< L0328: splicing support in HRD |
|---|
| 146 | #define L0044_DU_DPB_OUTPUT_DELAY_HRD 1 ///< L0044: Include dpb_output_delay_du_length_minus1 in hrd_parameters(), dpb_output_du_delay in |
|---|
| 147 | ///< picture timing SEI and DU information SEI |
|---|
| 148 | #define L0045_PERSISTENCE_FLAGS 1 ///< L0045: Replace "repetition_period" syntax elements in SEI with "persistence_flag" |
|---|
| 149 | #define L0045_NON_NESTED_SEI_RESTRICTIONS 1 ///< L0045; Include restriction on the order of APS and non-nested BP, PT and DU info SEI messages |
|---|
| 150 | #define L0044_CPB_DPB_DELAY_OFFSET 1 ///< L0044: Include syntax elements cpb_delay_offset and dpb_delay_offset in the BP SEI message |
|---|
| 151 | #define L0047_APS_FLAGS 1 ///< L0047: Include full_random_access_flag and no_param_set_update_flag in the active parameter set SEI message |
|---|
| 152 | #define L0043_TIMING_INFO 1 ///< L0043: Timing information is signalled in VUI outside hrd_parameters() |
|---|
| 153 | #define L0046_RENAME_PROG_SRC_IDC 1 ///< L0046: Rename progressive_source_idc to source_scan_type |
|---|
| 154 | #define L0045_CONDITION_SIGNALLING 1 ///< L0045: Condition the signaling of some syntax elements in picture timing SEI message |
|---|
| 155 | #define L0043_MSS_IDC 1 |
|---|
| 156 | #define L0116_ENTRY_POINT 1 |
|---|
| 157 | #define L0363_MORE_BITS 1 |
|---|
| 158 | #define L0363_MVP_POC 1 |
|---|
| 159 | #define L0363_BYTE_ALIGN 1 |
|---|
| 160 | #define L0363_SEI_ALLOW_SUFFIX 1 |
|---|
| 161 | #define L0323_LIMIT_DEFAULT_LIST_SIZE 1 |
|---|
| 162 | #define L0046_CONSTRAINT_FLAGS 1 |
|---|
| 163 | #define L0255_MOVE_PPS_FLAGS 1 ///< move some flags to earlier positions in the PPS |
|---|
| 164 | #define L0444_FPA_TYPE 1 ///< allow only FPA types 3, 4 and 5 |
|---|
| 165 | #define L0372 1 |
|---|
| 166 | #define SIGNAL_BITRATE_PICRATE_IN_VPS 0 ///< K0125: Signal bit_rate and pic_rate in VPS |
|---|
| 167 | #define L0232_RD_PENALTY 1 ///< L0232: RD-penalty for 32x32 TU for intra in non-intra slices |
|---|
| 168 | #define L0386_DB_METRIC 1 ///< L0386: non-normative blockiness metric (automatically configures deblocking parameters in bitstream) |
|---|
| 169 | #define L0323_DPB 1 ///< L0323: Specification of active reference indices and decoded picture buffer |
|---|
| 170 | |
|---|
| 171 | #define L0034_COMBINED_LIST_CLEANUP 1 |
|---|
| 172 | |
|---|
| 173 | #define MAX_VPS_NUM_HRD_PARAMETERS 1 |
|---|
| 174 | #define MAX_VPS_OP_SETS_PLUS1 1024 |
|---|
| 175 | #if H_MV |
|---|
| 176 | #define MAX_VPS_NUH_LAYER_ID_PLUS1 64 |
|---|
| 177 | #define MAX_NUM_SCALABILITY_TYPES 16 |
|---|
| 178 | #define ENC_CFG_CONSOUT_SPACE 29 |
|---|
| 179 | #else |
|---|
| 180 | #define MAX_VPS_NUH_RESERVED_ZERO_LAYER_ID_PLUS1 1 |
|---|
| 181 | #endif |
|---|
| 182 | |
|---|
| 183 | #define RATE_CONTROL_LAMBDA_DOMAIN 1 ///< JCTVC-K0103, rate control by R-lambda model |
|---|
| 184 | #define L0033_RC_BUGFIX 1 ///< JCTVC-L0033, bug fix for R-lambda model based rate control |
|---|
| 185 | |
|---|
| 186 | #define MAX_CPB_CNT 32 ///< Upper bound of (cpb_cnt_minus1 + 1) |
|---|
| 187 | #define MAX_NUM_LAYER_IDS 64 |
|---|
| 188 | #if H_MV |
|---|
| 189 | #define MAX_NUM_LAYERS 64 |
|---|
| 190 | #endif |
|---|
| 191 | |
|---|
| 192 | #define COEF_REMAIN_BIN_REDUCTION 3 ///< indicates the level at which the VLC |
|---|
| 193 | ///< transitions from Golomb-Rice to TU+EG(k) |
|---|
| 194 | |
|---|
| 195 | #define CU_DQP_TU_CMAX 5 ///< max number bins for truncated unary |
|---|
| 196 | #define CU_DQP_EG_k 0 ///< expgolomb order |
|---|
| 197 | |
|---|
| 198 | #define SBH_THRESHOLD 4 ///< I0156: value of the fixed SBH controlling threshold |
|---|
| 199 | |
|---|
| 200 | #define SEQUENCE_LEVEL_LOSSLESS 0 ///< H0530: used only for sequence or frame-level lossless coding |
|---|
| 201 | |
|---|
| 202 | #define DISABLING_CLIP_FOR_BIPREDME 1 ///< Ticket #175 |
|---|
| 203 | |
|---|
| 204 | #define C1FLAG_NUMBER 8 // maximum number of largerThan1 flag coded in one chunk : 16 in HM5 |
|---|
| 205 | #define C2FLAG_NUMBER 1 // maximum number of largerThan2 flag coded in one chunk: 16 in HM5 |
|---|
| 206 | |
|---|
| 207 | #define REMOVE_SAO_LCU_ENC_CONSTRAINTS_3 1 ///< disable the encoder constraint that conditionally disable SAO for chroma for entire slice in interleaved mode |
|---|
| 208 | |
|---|
| 209 | #define REMOVE_SINGLE_SEI_EXTENSION_FLAGS 1 ///< remove display orientation SEI extension flag (there is a generic SEI extension mechanism now) |
|---|
| 210 | |
|---|
| 211 | #define SAO_ENCODING_CHOICE 1 ///< I0184: picture early termination |
|---|
| 212 | #if SAO_ENCODING_CHOICE |
|---|
| 213 | #define SAO_ENCODING_RATE 0.75 |
|---|
| 214 | #define SAO_ENCODING_CHOICE_CHROMA 1 ///< J0044: picture early termination Luma and Chroma are handled separately |
|---|
| 215 | #if SAO_ENCODING_CHOICE_CHROMA |
|---|
| 216 | #define SAO_ENCODING_RATE_CHROMA 0.5 |
|---|
| 217 | #endif |
|---|
| 218 | #endif |
|---|
| 219 | |
|---|
| 220 | #define MAX_NUM_VPS 16 |
|---|
| 221 | #define MAX_NUM_SPS 16 |
|---|
| 222 | #define MAX_NUM_PPS 64 |
|---|
| 223 | |
|---|
| 224 | |
|---|
| 225 | |
|---|
| 226 | #define WEIGHTED_CHROMA_DISTORTION 1 ///< F386: weighting of chroma for RDO |
|---|
| 227 | #define RDOQ_CHROMA_LAMBDA 1 ///< F386: weighting of chroma for RDOQ |
|---|
| 228 | #define SAO_CHROMA_LAMBDA 1 ///< F386: weighting of chroma for SAO |
|---|
| 229 | |
|---|
| 230 | #define MIN_SCAN_POS_CROSS 4 |
|---|
| 231 | |
|---|
| 232 | #define FAST_BIT_EST 1 ///< G763: Table-based bit estimation for CABAC |
|---|
| 233 | |
|---|
| 234 | #define MLS_GRP_NUM 64 ///< G644 : Max number of coefficient groups, max(16, 64) |
|---|
| 235 | #define MLS_CG_SIZE 4 ///< G644 : Coefficient group size of 4x4 |
|---|
| 236 | |
|---|
| 237 | #define ADAPTIVE_QP_SELECTION 1 ///< G382: Adaptive reconstruction levels, non-normative part for adaptive QP selection |
|---|
| 238 | #if ADAPTIVE_QP_SELECTION |
|---|
| 239 | #define ARL_C_PRECISION 7 ///< G382: 7-bit arithmetic precision |
|---|
| 240 | #define LEVEL_RANGE 30 ///< G382: max coefficient level in statistics collection |
|---|
| 241 | #endif |
|---|
| 242 | |
|---|
| 243 | #define NS_HAD 0 |
|---|
| 244 | |
|---|
| 245 | #define HHI_RQT_INTRA_SPEEDUP 1 ///< tests one best mode with full rqt |
|---|
| 246 | #define HHI_RQT_INTRA_SPEEDUP_MOD 0 ///< tests two best modes with full rqt |
|---|
| 247 | |
|---|
| 248 | #if HHI_RQT_INTRA_SPEEDUP_MOD && !HHI_RQT_INTRA_SPEEDUP |
|---|
| 249 | #error |
|---|
| 250 | #endif |
|---|
| 251 | |
|---|
| 252 | #define VERBOSE_RATE 0 ///< Print additional rate information in encoder |
|---|
| 253 | |
|---|
| 254 | #define AMVP_DECIMATION_FACTOR 4 |
|---|
| 255 | |
|---|
| 256 | #define SCAN_SET_SIZE 16 |
|---|
| 257 | #define LOG2_SCAN_SET_SIZE 4 |
|---|
| 258 | |
|---|
| 259 | #define FAST_UDI_MAX_RDMODE_NUM 35 ///< maximum number of RD comparison in fast-UDI estimation loop |
|---|
| 260 | |
|---|
| 261 | #define ZERO_MVD_EST 0 ///< Zero Mvd Estimation in normal mode |
|---|
| 262 | |
|---|
| 263 | #define NUM_INTRA_MODE 36 |
|---|
| 264 | #if !REMOVE_LM_CHROMA |
|---|
| 265 | #define LM_CHROMA_IDX 35 |
|---|
| 266 | #endif |
|---|
| 267 | |
|---|
| 268 | #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. |
|---|
| 269 | #define AUTO_INTER_RPS 1 ///< Enable/disable the automatic generation of refIdc from the deltaPOC and Used by current from the config file. |
|---|
| 270 | #define PRINT_RPS_INFO 0 ///< Enable/disable the printing of bits used to send the RPS. |
|---|
| 271 | // using one nearest frame as reference frame, and the other frames are high quality (POC%4==0) frames (1+X) |
|---|
| 272 | // this should be done with encoder only decision |
|---|
| 273 | // but because of the absence of reference frame management, the related code was hard coded currently |
|---|
| 274 | |
|---|
| 275 | #define RVM_VCEGAM10_M 4 |
|---|
| 276 | |
|---|
| 277 | #define PLANAR_IDX 0 |
|---|
| 278 | #define VER_IDX 26 // index for intra VERTICAL mode |
|---|
| 279 | #define HOR_IDX 10 // index for intra HORIZONTAL mode |
|---|
| 280 | #define DC_IDX 1 // index for intra DC mode |
|---|
| 281 | #define NUM_CHROMA_MODE 5 // total number of chroma modes |
|---|
| 282 | #define DM_CHROMA_IDX 36 // chroma mode index for derived from luma intra mode |
|---|
| 283 | |
|---|
| 284 | |
|---|
| 285 | #define FAST_UDI_USE_MPM 1 |
|---|
| 286 | |
|---|
| 287 | #define RDO_WITHOUT_DQP_BITS 0 ///< Disable counting dQP bits in RDO-based mode decision |
|---|
| 288 | |
|---|
| 289 | #define FULL_NBIT 0 ///< When enabled, compute costs using full sample bitdepth. When disabled, compute costs as if it is 8-bit source video. |
|---|
| 290 | #if FULL_NBIT |
|---|
| 291 | # define DISTORTION_PRECISION_ADJUSTMENT(x) 0 |
|---|
| 292 | #else |
|---|
| 293 | # define DISTORTION_PRECISION_ADJUSTMENT(x) (x) |
|---|
| 294 | #endif |
|---|
| 295 | |
|---|
| 296 | #define LOG2_MAX_NUM_COLUMNS_MINUS1 7 |
|---|
| 297 | #define LOG2_MAX_NUM_ROWS_MINUS1 7 |
|---|
| 298 | #define LOG2_MAX_COLUMN_WIDTH 13 |
|---|
| 299 | #define LOG2_MAX_ROW_HEIGHT 13 |
|---|
| 300 | |
|---|
| 301 | #define MATRIX_MULT 0 // Brute force matrix multiplication instead of partial butterfly |
|---|
| 302 | |
|---|
| 303 | #define REG_DCT 65535 |
|---|
| 304 | |
|---|
| 305 | #define AMP_SAD 1 ///< dedicated SAD functions for AMP |
|---|
| 306 | #define AMP_ENC_SPEEDUP 1 ///< encoder only speed-up by AMP mode skipping |
|---|
| 307 | #if AMP_ENC_SPEEDUP |
|---|
| 308 | #define AMP_MRG 1 ///< encoder only force merge for AMP partition (no motion search for AMP) |
|---|
| 309 | #endif |
|---|
| 310 | |
|---|
| 311 | #define SCALING_LIST_OUTPUT_RESULT 0 //JCTVC-G880/JCTVC-G1016 quantization matrices |
|---|
| 312 | |
|---|
| 313 | #define CABAC_INIT_PRESENT_FLAG 1 |
|---|
| 314 | |
|---|
| 315 | // ==================================================================================================================== |
|---|
| 316 | // Basic type redefinition |
|---|
| 317 | // ==================================================================================================================== |
|---|
| 318 | |
|---|
| 319 | typedef void Void; |
|---|
| 320 | typedef bool Bool; |
|---|
| 321 | |
|---|
| 322 | typedef char Char; |
|---|
| 323 | typedef unsigned char UChar; |
|---|
| 324 | typedef short Short; |
|---|
| 325 | typedef unsigned short UShort; |
|---|
| 326 | typedef int Int; |
|---|
| 327 | typedef unsigned int UInt; |
|---|
| 328 | typedef double Double; |
|---|
| 329 | typedef float Float; |
|---|
| 330 | |
|---|
| 331 | // ==================================================================================================================== |
|---|
| 332 | // 64-bit integer type |
|---|
| 333 | // ==================================================================================================================== |
|---|
| 334 | |
|---|
| 335 | #ifdef _MSC_VER |
|---|
| 336 | typedef __int64 Int64; |
|---|
| 337 | |
|---|
| 338 | #if _MSC_VER <= 1200 // MS VC6 |
|---|
| 339 | typedef __int64 UInt64; // MS VC6 does not support unsigned __int64 to double conversion |
|---|
| 340 | #else |
|---|
| 341 | typedef unsigned __int64 UInt64; |
|---|
| 342 | #endif |
|---|
| 343 | |
|---|
| 344 | #else |
|---|
| 345 | |
|---|
| 346 | typedef long long Int64; |
|---|
| 347 | typedef unsigned long long UInt64; |
|---|
| 348 | |
|---|
| 349 | #endif |
|---|
| 350 | |
|---|
| 351 | // ==================================================================================================================== |
|---|
| 352 | // Type definition |
|---|
| 353 | // ==================================================================================================================== |
|---|
| 354 | |
|---|
| 355 | typedef UChar Pxl; ///< 8-bit pixel type |
|---|
| 356 | typedef Short Pel; ///< 16-bit pixel type |
|---|
| 357 | typedef Int TCoeff; ///< transform coefficient |
|---|
| 358 | |
|---|
| 359 | #if H_3D_VSO |
|---|
| 360 | // ==================================================================================================================== |
|---|
| 361 | // Define Distortion Types |
|---|
| 362 | // ==================================================================================================================== |
|---|
| 363 | typedef Int64 RMDist; ///< renderer model distortion |
|---|
| 364 | |
|---|
| 365 | #if H_3D_VSO_DIST_INT |
|---|
| 366 | typedef Int Dist; ///< RDO distortion |
|---|
| 367 | typedef Int64 Dist64; |
|---|
| 368 | #define RDO_DIST_MIN MIN_INT |
|---|
| 369 | #define RDO_DIST_MAX MAX_INT |
|---|
| 370 | #else |
|---|
| 371 | typedef UInt Dist; ///< RDO distortion |
|---|
| 372 | typedef UInt64 Dist; |
|---|
| 373 | #define RDO_DIST_MIN 0 |
|---|
| 374 | #define RDO_DIST_MAX MAX_UINT |
|---|
| 375 | #endif |
|---|
| 376 | #endif |
|---|
| 377 | /// parameters for adaptive loop filter |
|---|
| 378 | class TComPicSym; |
|---|
| 379 | |
|---|
| 380 | // Slice / Slice segment encoding modes |
|---|
| 381 | enum SliceConstraint |
|---|
| 382 | { |
|---|
| 383 | NO_SLICES = 0, ///< don't use slices / slice segments |
|---|
| 384 | FIXED_NUMBER_OF_LCU = 1, ///< Limit maximum number of largest coding tree blocks in a slice / slice segments |
|---|
| 385 | FIXED_NUMBER_OF_BYTES = 2, ///< Limit maximum number of bytes in a slice / slice segment |
|---|
| 386 | FIXED_NUMBER_OF_TILES = 3, ///< slices / slice segments span an integer number of tiles |
|---|
| 387 | }; |
|---|
| 388 | |
|---|
| 389 | #define NUM_DOWN_PART 4 |
|---|
| 390 | |
|---|
| 391 | enum SAOTypeLen |
|---|
| 392 | { |
|---|
| 393 | SAO_EO_LEN = 4, |
|---|
| 394 | SAO_BO_LEN = 4, |
|---|
| 395 | SAO_MAX_BO_CLASSES = 32 |
|---|
| 396 | }; |
|---|
| 397 | |
|---|
| 398 | enum SAOType |
|---|
| 399 | { |
|---|
| 400 | SAO_EO_0 = 0, |
|---|
| 401 | SAO_EO_1, |
|---|
| 402 | SAO_EO_2, |
|---|
| 403 | SAO_EO_3, |
|---|
| 404 | SAO_BO, |
|---|
| 405 | MAX_NUM_SAO_TYPE |
|---|
| 406 | }; |
|---|
| 407 | |
|---|
| 408 | typedef struct _SaoQTPart |
|---|
| 409 | { |
|---|
| 410 | Int iBestType; |
|---|
| 411 | Int iLength; |
|---|
| 412 | Int subTypeIdx ; ///< indicates EO class or BO band position |
|---|
| 413 | Int iOffset[4]; |
|---|
| 414 | Int StartCUX; |
|---|
| 415 | Int StartCUY; |
|---|
| 416 | Int EndCUX; |
|---|
| 417 | Int EndCUY; |
|---|
| 418 | |
|---|
| 419 | Int PartIdx; |
|---|
| 420 | Int PartLevel; |
|---|
| 421 | Int PartCol; |
|---|
| 422 | Int PartRow; |
|---|
| 423 | |
|---|
| 424 | Int DownPartsIdx[NUM_DOWN_PART]; |
|---|
| 425 | Int UpPartIdx; |
|---|
| 426 | |
|---|
| 427 | Bool bSplit; |
|---|
| 428 | |
|---|
| 429 | //---- encoder only start -----// |
|---|
| 430 | Bool bProcessed; |
|---|
| 431 | Double dMinCost; |
|---|
| 432 | Int64 iMinDist; |
|---|
| 433 | Int iMinRate; |
|---|
| 434 | //---- encoder only end -----// |
|---|
| 435 | } SAOQTPart; |
|---|
| 436 | |
|---|
| 437 | typedef struct _SaoLcuParam |
|---|
| 438 | { |
|---|
| 439 | Bool mergeUpFlag; |
|---|
| 440 | Bool mergeLeftFlag; |
|---|
| 441 | Int typeIdx; |
|---|
| 442 | Int subTypeIdx; ///< indicates EO class or BO band position |
|---|
| 443 | Int offset[4]; |
|---|
| 444 | Int partIdx; |
|---|
| 445 | Int partIdxTmp; |
|---|
| 446 | Int length; |
|---|
| 447 | } SaoLcuParam; |
|---|
| 448 | |
|---|
| 449 | struct SAOParam |
|---|
| 450 | { |
|---|
| 451 | Bool bSaoFlag[2]; |
|---|
| 452 | SAOQTPart* psSaoPart[3]; |
|---|
| 453 | Int iMaxSplitLevel; |
|---|
| 454 | Bool oneUnitFlag[3]; |
|---|
| 455 | SaoLcuParam* saoLcuParam[3]; |
|---|
| 456 | Int numCuInHeight; |
|---|
| 457 | Int numCuInWidth; |
|---|
| 458 | ~SAOParam(); |
|---|
| 459 | }; |
|---|
| 460 | |
|---|
| 461 | /// parameters for deblocking filter |
|---|
| 462 | typedef struct _LFCUParam |
|---|
| 463 | { |
|---|
| 464 | Bool bInternalEdge; ///< indicates internal edge |
|---|
| 465 | Bool bLeftEdge; ///< indicates left edge |
|---|
| 466 | Bool bTopEdge; ///< indicates top edge |
|---|
| 467 | } LFCUParam; |
|---|
| 468 | |
|---|
| 469 | // ==================================================================================================================== |
|---|
| 470 | // Enumeration |
|---|
| 471 | // ==================================================================================================================== |
|---|
| 472 | |
|---|
| 473 | /// supported slice type |
|---|
| 474 | enum SliceType |
|---|
| 475 | { |
|---|
| 476 | B_SLICE, |
|---|
| 477 | P_SLICE, |
|---|
| 478 | I_SLICE |
|---|
| 479 | }; |
|---|
| 480 | |
|---|
| 481 | /// chroma formats (according to semantics of chroma_format_idc) |
|---|
| 482 | enum ChromaFormat |
|---|
| 483 | { |
|---|
| 484 | CHROMA_400 = 0, |
|---|
| 485 | CHROMA_420 = 1, |
|---|
| 486 | CHROMA_422 = 2, |
|---|
| 487 | CHROMA_444 = 3 |
|---|
| 488 | }; |
|---|
| 489 | |
|---|
| 490 | /// supported partition shape |
|---|
| 491 | enum PartSize |
|---|
| 492 | { |
|---|
| 493 | SIZE_2Nx2N, ///< symmetric motion partition, 2Nx2N |
|---|
| 494 | SIZE_2NxN, ///< symmetric motion partition, 2Nx N |
|---|
| 495 | SIZE_Nx2N, ///< symmetric motion partition, Nx2N |
|---|
| 496 | SIZE_NxN, ///< symmetric motion partition, Nx N |
|---|
| 497 | SIZE_2NxnU, ///< asymmetric motion partition, 2Nx( N/2) + 2Nx(3N/2) |
|---|
| 498 | SIZE_2NxnD, ///< asymmetric motion partition, 2Nx(3N/2) + 2Nx( N/2) |
|---|
| 499 | SIZE_nLx2N, ///< asymmetric motion partition, ( N/2)x2N + (3N/2)x2N |
|---|
| 500 | SIZE_nRx2N, ///< asymmetric motion partition, (3N/2)x2N + ( N/2)x2N |
|---|
| 501 | SIZE_NONE = 15 |
|---|
| 502 | }; |
|---|
| 503 | |
|---|
| 504 | /// supported prediction type |
|---|
| 505 | enum PredMode |
|---|
| 506 | { |
|---|
| 507 | MODE_INTER, ///< inter-prediction mode |
|---|
| 508 | MODE_INTRA, ///< intra-prediction mode |
|---|
| 509 | MODE_NONE = 15 |
|---|
| 510 | }; |
|---|
| 511 | |
|---|
| 512 | /// texture component type |
|---|
| 513 | enum TextType |
|---|
| 514 | { |
|---|
| 515 | TEXT_LUMA, ///< luma |
|---|
| 516 | TEXT_CHROMA, ///< chroma (U+V) |
|---|
| 517 | TEXT_CHROMA_U, ///< chroma U |
|---|
| 518 | TEXT_CHROMA_V, ///< chroma V |
|---|
| 519 | TEXT_ALL, ///< Y+U+V |
|---|
| 520 | TEXT_NONE = 15 |
|---|
| 521 | }; |
|---|
| 522 | |
|---|
| 523 | /// reference list index |
|---|
| 524 | enum RefPicList |
|---|
| 525 | { |
|---|
| 526 | REF_PIC_LIST_0 = 0, ///< reference list 0 |
|---|
| 527 | REF_PIC_LIST_1 = 1, ///< reference list 1 |
|---|
| 528 | #if !L0034_COMBINED_LIST_CLEANUP |
|---|
| 529 | REF_PIC_LIST_C = 2, ///< combined reference list for uni-prediction in B-Slices |
|---|
| 530 | #endif |
|---|
| 531 | REF_PIC_LIST_X = 100 ///< special mark |
|---|
| 532 | }; |
|---|
| 533 | |
|---|
| 534 | /// distortion function index |
|---|
| 535 | enum DFunc |
|---|
| 536 | { |
|---|
| 537 | DF_DEFAULT = 0, |
|---|
| 538 | DF_SSE = 1, ///< general size SSE |
|---|
| 539 | DF_SSE4 = 2, ///< 4xM SSE |
|---|
| 540 | DF_SSE8 = 3, ///< 8xM SSE |
|---|
| 541 | DF_SSE16 = 4, ///< 16xM SSE |
|---|
| 542 | DF_SSE32 = 5, ///< 32xM SSE |
|---|
| 543 | DF_SSE64 = 6, ///< 64xM SSE |
|---|
| 544 | DF_SSE16N = 7, ///< 16NxM SSE |
|---|
| 545 | |
|---|
| 546 | DF_SAD = 8, ///< general size SAD |
|---|
| 547 | DF_SAD4 = 9, ///< 4xM SAD |
|---|
| 548 | DF_SAD8 = 10, ///< 8xM SAD |
|---|
| 549 | DF_SAD16 = 11, ///< 16xM SAD |
|---|
| 550 | DF_SAD32 = 12, ///< 32xM SAD |
|---|
| 551 | DF_SAD64 = 13, ///< 64xM SAD |
|---|
| 552 | DF_SAD16N = 14, ///< 16NxM SAD |
|---|
| 553 | |
|---|
| 554 | DF_SADS = 15, ///< general size SAD with step |
|---|
| 555 | DF_SADS4 = 16, ///< 4xM SAD with step |
|---|
| 556 | DF_SADS8 = 17, ///< 8xM SAD with step |
|---|
| 557 | DF_SADS16 = 18, ///< 16xM SAD with step |
|---|
| 558 | DF_SADS32 = 19, ///< 32xM SAD with step |
|---|
| 559 | DF_SADS64 = 20, ///< 64xM SAD with step |
|---|
| 560 | DF_SADS16N = 21, ///< 16NxM SAD with step |
|---|
| 561 | |
|---|
| 562 | DF_HADS = 22, ///< general size Hadamard with step |
|---|
| 563 | DF_HADS4 = 23, ///< 4xM HAD with step |
|---|
| 564 | DF_HADS8 = 24, ///< 8xM HAD with step |
|---|
| 565 | DF_HADS16 = 25, ///< 16xM HAD with step |
|---|
| 566 | DF_HADS32 = 26, ///< 32xM HAD with step |
|---|
| 567 | DF_HADS64 = 27, ///< 64xM HAD with step |
|---|
| 568 | DF_HADS16N = 28, ///< 16NxM HAD with step |
|---|
| 569 | #if H_3D_VSO |
|---|
| 570 | DF_VSD = 29, ///< general size VSD |
|---|
| 571 | DF_VSD4 = 30, ///< 4xM VSD |
|---|
| 572 | DF_VSD8 = 31, ///< 8xM VSD |
|---|
| 573 | DF_VSD16 = 32, ///< 16xM VSD |
|---|
| 574 | DF_VSD32 = 33, ///< 32xM VSD |
|---|
| 575 | DF_VSD64 = 34, ///< 64xM VSD |
|---|
| 576 | DF_VSD16N = 35, ///< 16NxM VSD |
|---|
| 577 | #endif |
|---|
| 578 | |
|---|
| 579 | #if AMP_SAD |
|---|
| 580 | DF_SAD12 = 43, |
|---|
| 581 | DF_SAD24 = 44, |
|---|
| 582 | DF_SAD48 = 45, |
|---|
| 583 | |
|---|
| 584 | DF_SADS12 = 46, |
|---|
| 585 | DF_SADS24 = 47, |
|---|
| 586 | DF_SADS48 = 48, |
|---|
| 587 | |
|---|
| 588 | DF_SSE_FRAME = 50 ///< Frame-based SSE |
|---|
| 589 | #else |
|---|
| 590 | DF_SSE_FRAME = 33 ///< Frame-based SSE |
|---|
| 591 | #endif |
|---|
| 592 | }; |
|---|
| 593 | |
|---|
| 594 | /// index for SBAC based RD optimization |
|---|
| 595 | enum CI_IDX |
|---|
| 596 | { |
|---|
| 597 | CI_CURR_BEST = 0, ///< best mode index |
|---|
| 598 | CI_NEXT_BEST, ///< next best index |
|---|
| 599 | CI_TEMP_BEST, ///< temporal index |
|---|
| 600 | CI_CHROMA_INTRA, ///< chroma intra index |
|---|
| 601 | CI_QT_TRAFO_TEST, |
|---|
| 602 | CI_QT_TRAFO_ROOT, |
|---|
| 603 | CI_NUM, ///< total number |
|---|
| 604 | }; |
|---|
| 605 | |
|---|
| 606 | /// motion vector predictor direction used in AMVP |
|---|
| 607 | enum MVP_DIR |
|---|
| 608 | { |
|---|
| 609 | MD_LEFT = 0, ///< MVP of left block |
|---|
| 610 | MD_ABOVE, ///< MVP of above block |
|---|
| 611 | MD_ABOVE_RIGHT, ///< MVP of above right block |
|---|
| 612 | MD_BELOW_LEFT, ///< MVP of below left block |
|---|
| 613 | MD_ABOVE_LEFT ///< MVP of above left block |
|---|
| 614 | }; |
|---|
| 615 | |
|---|
| 616 | /// coefficient scanning type used in ACS |
|---|
| 617 | enum COEFF_SCAN_TYPE |
|---|
| 618 | { |
|---|
| 619 | SCAN_DIAG = 0, ///< up-right diagonal scan |
|---|
| 620 | SCAN_HOR, ///< horizontal first scan |
|---|
| 621 | SCAN_VER ///< vertical first scan |
|---|
| 622 | }; |
|---|
| 623 | |
|---|
| 624 | namespace Profile |
|---|
| 625 | { |
|---|
| 626 | enum Name |
|---|
| 627 | { |
|---|
| 628 | NONE = 0, |
|---|
| 629 | MAIN = 1, |
|---|
| 630 | MAIN10 = 2, |
|---|
| 631 | MAINSTILLPICTURE = 3, |
|---|
| 632 | #if H_MV |
|---|
| 633 | MAINSTEREO = 4, |
|---|
| 634 | MAINMULTIVIEW = 5, |
|---|
| 635 | #if H_3D |
|---|
| 636 | MAIN3D = 6, |
|---|
| 637 | #endif |
|---|
| 638 | #endif |
|---|
| 639 | }; |
|---|
| 640 | } |
|---|
| 641 | |
|---|
| 642 | namespace Level |
|---|
| 643 | { |
|---|
| 644 | enum Tier |
|---|
| 645 | { |
|---|
| 646 | MAIN = 0, |
|---|
| 647 | HIGH = 1, |
|---|
| 648 | }; |
|---|
| 649 | |
|---|
| 650 | enum Name |
|---|
| 651 | { |
|---|
| 652 | NONE = 0, |
|---|
| 653 | LEVEL1 = 30, |
|---|
| 654 | LEVEL2 = 60, |
|---|
| 655 | LEVEL2_1 = 63, |
|---|
| 656 | LEVEL3 = 90, |
|---|
| 657 | LEVEL3_1 = 93, |
|---|
| 658 | LEVEL4 = 120, |
|---|
| 659 | LEVEL4_1 = 123, |
|---|
| 660 | LEVEL5 = 150, |
|---|
| 661 | LEVEL5_1 = 153, |
|---|
| 662 | LEVEL5_2 = 156, |
|---|
| 663 | LEVEL6 = 180, |
|---|
| 664 | LEVEL6_1 = 183, |
|---|
| 665 | LEVEL6_2 = 186, |
|---|
| 666 | }; |
|---|
| 667 | } |
|---|
| 668 | //! \} |
|---|
| 669 | |
|---|
| 670 | #if H_MV |
|---|
| 671 | /// scalability types |
|---|
| 672 | enum ScalabilityType |
|---|
| 673 | { |
|---|
| 674 | VIEW_ID = 0, |
|---|
| 675 | #if H_3D |
|---|
| 676 | DEPTH_ID = 1, |
|---|
| 677 | #endif |
|---|
| 678 | }; |
|---|
| 679 | #endif |
|---|
| 680 | #if H_3D |
|---|
| 681 | // Renderer |
|---|
| 682 | enum BlenMod |
|---|
| 683 | { |
|---|
| 684 | BLEND_NONE = -1, |
|---|
| 685 | BLEND_AVRG = 0, |
|---|
| 686 | BLEND_LEFT = 1, |
|---|
| 687 | BLEND_RIGHT = 2, |
|---|
| 688 | BLEND_GEN = 3 |
|---|
| 689 | }; |
|---|
| 690 | |
|---|
| 691 | |
|---|
| 692 | enum |
|---|
| 693 | { |
|---|
| 694 | VIEWPOS_INVALID = -1, |
|---|
| 695 | VIEWPOS_LEFT = 0, |
|---|
| 696 | VIEWPOS_RIGHT = 1, |
|---|
| 697 | VIEWPOS_MERGED = 2 |
|---|
| 698 | }; |
|---|
| 699 | |
|---|
| 700 | |
|---|
| 701 | #endif |
|---|
| 702 | #endif |
|---|