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