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