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