[5] | 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 |
---|
[56] | 4 | * granted under this license. |
---|
[5] | 5 | * |
---|
[56] | 6 | * Copyright (c) 2010-2012, ITU/ISO/IEC |
---|
[5] | 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. |
---|
[56] | 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may |
---|
[5] | 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 | */ |
---|
[2] | 33 | |
---|
| 34 | /** \file CommonDef.h |
---|
| 35 | \brief Defines constants, macros and tool parameters |
---|
| 36 | */ |
---|
| 37 | |
---|
| 38 | #ifndef __COMMONDEF__ |
---|
| 39 | #define __COMMONDEF__ |
---|
| 40 | |
---|
[56] | 41 | #include <algorithm> |
---|
| 42 | |
---|
[2] | 43 | #if _MSC_VER > 1000 |
---|
[56] | 44 | // disable "signed and unsigned mismatch" |
---|
[2] | 45 | #pragma warning( disable : 4018 ) |
---|
[56] | 46 | // disable bool coercion "performance warning" |
---|
| 47 | #pragma warning( disable : 4800 ) |
---|
[2] | 48 | #endif // _MSC_VER > 1000 |
---|
| 49 | #include "TypeDef.h" |
---|
| 50 | |
---|
[56] | 51 | #include <stdio.h> |
---|
| 52 | //! \ingroup TLibCommon |
---|
| 53 | //! \{ |
---|
[2] | 54 | |
---|
| 55 | // ==================================================================================================================== |
---|
| 56 | // Version information |
---|
| 57 | // ==================================================================================================================== |
---|
| 58 | |
---|
[56] | 59 | #define HM_VERSION "6.1" |
---|
[213] | 60 | #define NV_VERSION "5.1" ///< Current software version |
---|
[2] | 61 | |
---|
| 62 | // ==================================================================================================================== |
---|
| 63 | // Platform information |
---|
| 64 | // ==================================================================================================================== |
---|
| 65 | |
---|
| 66 | #ifdef __GNUC__ |
---|
| 67 | #define NVM_COMPILEDBY "[GCC %d.%d.%d]", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__ |
---|
| 68 | #ifdef __IA64__ |
---|
| 69 | #define NVM_ONARCH "[on 64-bit] " |
---|
| 70 | #else |
---|
| 71 | #define NVM_ONARCH "[on 32-bit] " |
---|
| 72 | #endif |
---|
| 73 | #endif |
---|
| 74 | |
---|
| 75 | #ifdef __INTEL_COMPILER |
---|
| 76 | #define NVM_COMPILEDBY "[ICC %d]", __INTEL_COMPILER |
---|
| 77 | #elif _MSC_VER |
---|
| 78 | #define NVM_COMPILEDBY "[VS %d]", _MSC_VER |
---|
| 79 | #endif |
---|
| 80 | |
---|
| 81 | #ifndef NVM_COMPILEDBY |
---|
| 82 | #define NVM_COMPILEDBY "[Unk-CXX]" |
---|
| 83 | #endif |
---|
| 84 | |
---|
| 85 | #ifdef _WIN32 |
---|
| 86 | #define NVM_ONOS "[Windows]" |
---|
| 87 | #elif __linux |
---|
| 88 | #define NVM_ONOS "[Linux]" |
---|
| 89 | #elif __CYGWIN__ |
---|
| 90 | #define NVM_ONOS "[Cygwin]" |
---|
| 91 | #elif __APPLE__ |
---|
| 92 | #define NVM_ONOS "[Mac OS X]" |
---|
| 93 | #else |
---|
| 94 | #define NVM_ONOS "[Unk-OS]" |
---|
| 95 | #endif |
---|
| 96 | |
---|
| 97 | #define NVM_BITS "[%d bit] ", (sizeof(void*) == 8 ? 64 : 32) ///< used for checking 64-bit O/S |
---|
| 98 | |
---|
| 99 | #ifndef NULL |
---|
| 100 | #define NULL 0 |
---|
| 101 | #endif |
---|
| 102 | |
---|
| 103 | // ==================================================================================================================== |
---|
| 104 | // Common constants |
---|
| 105 | // ==================================================================================================================== |
---|
| 106 | |
---|
| 107 | #define _SUMMARY_OUT_ 0 ///< print-out PSNR results of all slices to summary.txt |
---|
| 108 | #define _SUMMARY_PIC_ 0 ///< print-out PSNR results for each slice type to summary.txt |
---|
| 109 | |
---|
| 110 | #define MAX_GOP 64 ///< max. value of hierarchical GOP size |
---|
| 111 | |
---|
[166] | 112 | #if VSP_N |
---|
| 113 | #define MAX_NUM_REF 5 ///< max. value of multiple reference frames |
---|
| 114 | #define MAX_NUM_REF_LC 10 ///< max. value of combined reference frames |
---|
| 115 | #else |
---|
[2] | 116 | #define MAX_NUM_REF 4 ///< max. value of multiple reference frames |
---|
| 117 | #define MAX_NUM_REF_LC 8 ///< max. value of combined reference frames |
---|
[166] | 118 | #endif |
---|
[2] | 119 | |
---|
| 120 | #define MAX_UINT 0xFFFFFFFFU ///< max. value of unsigned 32-bit integer |
---|
| 121 | #define MAX_INT 2147483647 ///< max. value of signed 32-bit integer |
---|
| 122 | #define MIN_INT (-2147483647-1) // < min. value of signed 32-bit integer |
---|
| 123 | #define MAX_DOUBLE 1.7e+308 ///< max. value of double-type value |
---|
| 124 | |
---|
| 125 | #define MIN_QP 0 |
---|
| 126 | #define MAX_QP 51 |
---|
| 127 | |
---|
| 128 | #define NOT_VALID -1 |
---|
| 129 | |
---|
[56] | 130 | // ==================================================================================================================== |
---|
| 131 | // 3D constants |
---|
| 132 | // ==================================================================================================================== |
---|
| 133 | #define MAX_VIEW_NUM 10 |
---|
[2] | 134 | |
---|
[5] | 135 | #if ( HHI_INTER_VIEW_MOTION_PRED || HHI_INTER_VIEW_RESIDUAL_PRED ) |
---|
| 136 | #define DEPTH_MAP_GENERATION 1 |
---|
[100] | 137 | #define PDM_REMOVE_DEPENDENCE 1 //bug-fix for DMDV JCT2-A0095 |
---|
[5] | 138 | #else |
---|
| 139 | #define DEPTH_MAP_GENERATION 0 |
---|
| 140 | #endif |
---|
| 141 | |
---|
[2] | 142 | //>>>>> generation and usage of virtual prediction depth maps >>>>> |
---|
| 143 | #define PDM_ONE_DEPTH_PER_PU 1 // use only a single depth for a prediction unit (in update) |
---|
[21] | 144 | #define PDM_NO_INTER_UPDATE 1 // no update for inter (but not inter-view) predicted blocks |
---|
[56] | 145 | #define PDM_MERGE_POS 0 // position of pdm in merge list (0..4) |
---|
[213] | 146 | |
---|
| 147 | #if QC_MRG_CANS_B0048 |
---|
| 148 | #if OL_DISMV_POS_B0069 |
---|
| 149 | #define DMV_MERGE_POS 4 |
---|
| 150 | #else |
---|
| 151 | #define DMV_MERGE_POS 1 |
---|
| 152 | #endif |
---|
| 153 | #endif |
---|
| 154 | |
---|
| 155 | #if SAIT_IMPROV_MOTION_PRED_M24829&!QC_MULTI_DIS_CAN_A0097 |
---|
[77] | 156 | #define PDM_AMVP_POS 0 // position of pdm in amvp list (0..3) |
---|
| 157 | #else |
---|
[2] | 158 | #define PDM_AMVP_POS 2 // position of pdm in amvp list (0..3) |
---|
[77] | 159 | #endif |
---|
[2] | 160 | #define PDM_OUTPUT_PRED_DEPTH_MAP 0 // output prediction depth map (for debugging) |
---|
| 161 | |
---|
| 162 | #define PDM_INTERNAL_CALC_BIT_DEPTH 31 // bit depth for internal calculations (32 - 1 for signed values) |
---|
| 163 | #define PDM_BITDEPTH_VIRT_DEPTH 15 // bit depth for virtual depth storage (16 - 1 for signed values) |
---|
| 164 | #define PDM_LOG2_MAX_ABS_NORMAL_DISPARITY 8 // maximum absolute normal disparity = 256 (for setting accuracy) |
---|
| 165 | #define PDM_VIRT_DEPTH_PRECISION 4 // must be greater than or equal to 2 (since MVs are given in quarter-pel units) |
---|
| 166 | |
---|
| 167 | #define PDM_INTER_CALC_SHIFT ( PDM_INTERNAL_CALC_BIT_DEPTH - PDM_BITDEPTH_VIRT_DEPTH ) // avoids overflow |
---|
| 168 | #define PDM_LOG4_SCALE_DENOMINATOR ( PDM_LOG2_MAX_ABS_NORMAL_DISPARITY + PDM_VIRT_DEPTH_PRECISION ) // accuracy of scaling factor |
---|
| 169 | #define PDM_OFFSET_SHIFT ( PDM_LOG2_MAX_ABS_NORMAL_DISPARITY ) // accuracy of offset |
---|
| 170 | |
---|
| 171 | #define PDM_MAX_ABS_VIRT_DEPTH ( ( 1 << PDM_BITDEPTH_VIRT_DEPTH ) - 1 ) |
---|
| 172 | #define PDM_UNDEFINED_DEPTH ( -( 1 << PDM_BITDEPTH_VIRT_DEPTH ) ) |
---|
| 173 | |
---|
| 174 | #define PDM_USE_FOR_IVIEW 1 |
---|
| 175 | #define PDM_USE_FOR_INTER 2 |
---|
| 176 | #define PDM_USE_FOR_MERGE 4 |
---|
[21] | 177 | |
---|
[56] | 178 | #define PDM_SUBSAMPLING_EXP 2 // subsampling factor is 2^PDM_SUBSAMPLING_EXP |
---|
[21] | 179 | #define PDM_SUB_SAMP_EXP_X(Pdm) ((Pdm)==1?PDM_SUBSAMPLING_EXP:0) |
---|
| 180 | #define PDM_SUB_SAMP_EXP_Y(Pdm) ((Pdm)==1?PDM_SUBSAMPLING_EXP:0) |
---|
[2] | 181 | //<<<<< generation and usage of virtual prediction depth maps <<<<< |
---|
| 182 | |
---|
| 183 | #define OUTPUT_RESIDUAL_PICTURES 0 // output residual pictures (for debugging) |
---|
| 184 | |
---|
[56] | 185 | #define STD_CAM_PARAMETERS_PRECISION 5 ///< quarter luma sample accuarcy for derived disparities (as default) |
---|
[2] | 186 | |
---|
[100] | 187 | #define LOG2_DISP_PREC_LUT 2 ///< log2 of disparity precision used in integer disparity LUTs |
---|
[2] | 188 | |
---|
[77] | 189 | // ==================================================================================================================== |
---|
| 190 | // VPS constants |
---|
| 191 | // ==================================================================================================================== |
---|
[213] | 192 | #if QC_MVHEVC_B0046 |
---|
| 193 | #define MAX_LAYER_NUM MAX_VIEW_NUM |
---|
| 194 | #endif |
---|
[77] | 195 | #if VIDYO_VPS_INTEGRATION |
---|
| 196 | #define MAX_LAYER_NUM MAX_VIEW_NUM |
---|
| 197 | #define VPS_EXTENSION_TYPE_MULTI_VIEW 0 |
---|
| 198 | #endif |
---|
[56] | 199 | |
---|
[2] | 200 | // ==================================================================================================================== |
---|
| 201 | // Macro functions |
---|
| 202 | // ==================================================================================================================== |
---|
[56] | 203 | extern UInt g_uiIBDI_MAX; |
---|
[2] | 204 | |
---|
[56] | 205 | /** clip x, such that 0 <= x <= #g_uiIBDI_MAX */ |
---|
| 206 | template <typename T> inline T Clip(T x) { return std::min<T>(T(g_uiIBDI_MAX), std::max<T>( T(0), x)); } |
---|
[2] | 207 | |
---|
[56] | 208 | /** clip a, such that minVal <= a <= maxVal */ |
---|
| 209 | template <typename T> inline T Clip3( T minVal, T maxVal, T a) { return std::min<T> (std::max<T> (minVal, a) , maxVal); } ///< general min/max clip |
---|
| 210 | |
---|
[2] | 211 | #define DATA_ALIGN 1 ///< use 32-bit aligned malloc/free |
---|
| 212 | #if DATA_ALIGN && _WIN32 && ( _MSC_VER > 1300 ) |
---|
| 213 | #define xMalloc( type, len ) _aligned_malloc( sizeof(type)*(len), 32 ) |
---|
| 214 | #define xFree( ptr ) _aligned_free ( ptr ) |
---|
| 215 | #else |
---|
| 216 | #define xMalloc( type, len ) malloc ( sizeof(type)*(len) ) |
---|
| 217 | #define xFree( ptr ) free ( ptr ) |
---|
| 218 | #endif |
---|
| 219 | |
---|
| 220 | #define FATAL_ERROR_0(MESSAGE, EXITCODE) \ |
---|
| 221 | { \ |
---|
| 222 | printf(MESSAGE); \ |
---|
| 223 | exit(EXITCODE); \ |
---|
| 224 | } |
---|
| 225 | |
---|
| 226 | #define ROF( exp ) \ |
---|
| 227 | { \ |
---|
| 228 | if( !( exp ) ) \ |
---|
[56] | 229 | { \ |
---|
| 230 | assert( 0 ); \ |
---|
| 231 | return -1; \ |
---|
| 232 | } \ |
---|
[2] | 233 | } |
---|
| 234 | |
---|
| 235 | #define ROT( exp ) \ |
---|
| 236 | { \ |
---|
| 237 | if( ( exp ) ) \ |
---|
[56] | 238 | { \ |
---|
| 239 | assert( 0 ); \ |
---|
| 240 | return -1; \ |
---|
| 241 | } \ |
---|
[2] | 242 | } |
---|
| 243 | |
---|
| 244 | #define ROFS( exp ) \ |
---|
| 245 | { \ |
---|
| 246 | if( !( exp ) ) \ |
---|
[56] | 247 | { \ |
---|
| 248 | return -1; \ |
---|
| 249 | } \ |
---|
[2] | 250 | } |
---|
| 251 | |
---|
| 252 | #define ROTS( exp ) \ |
---|
| 253 | { \ |
---|
| 254 | if( ( exp ) ) \ |
---|
[56] | 255 | { \ |
---|
| 256 | return -1; \ |
---|
| 257 | } \ |
---|
[2] | 258 | } |
---|
| 259 | |
---|
| 260 | #define ROFR( exp, retVal ) \ |
---|
| 261 | { \ |
---|
| 262 | if( !( exp ) ) \ |
---|
[56] | 263 | { \ |
---|
| 264 | assert( 0 ); \ |
---|
| 265 | return retVal; \ |
---|
| 266 | } \ |
---|
[2] | 267 | } |
---|
| 268 | |
---|
| 269 | #define ROTR( exp, retVal ) \ |
---|
| 270 | { \ |
---|
| 271 | if( ( exp ) ) \ |
---|
[56] | 272 | { \ |
---|
| 273 | assert( 0 ); \ |
---|
| 274 | return retVal; \ |
---|
| 275 | } \ |
---|
[2] | 276 | } |
---|
| 277 | |
---|
| 278 | #define ROFRS( exp, retVal ) \ |
---|
| 279 | { \ |
---|
| 280 | if( !( exp ) ) \ |
---|
[56] | 281 | { \ |
---|
| 282 | return retVal; \ |
---|
| 283 | } \ |
---|
[2] | 284 | } |
---|
| 285 | |
---|
| 286 | #define ROTRS( exp, retVal ) \ |
---|
| 287 | { \ |
---|
| 288 | if( ( exp ) ) \ |
---|
[56] | 289 | { \ |
---|
| 290 | return retVal; \ |
---|
| 291 | } \ |
---|
[2] | 292 | } |
---|
| 293 | |
---|
| 294 | #define ROFV( exp ) \ |
---|
| 295 | { \ |
---|
| 296 | if( !( exp ) ) \ |
---|
[56] | 297 | { \ |
---|
| 298 | assert( 0 ); \ |
---|
| 299 | return; \ |
---|
| 300 | } \ |
---|
[2] | 301 | } |
---|
| 302 | |
---|
| 303 | #define ROTV( exp ) \ |
---|
| 304 | { \ |
---|
| 305 | if( ( exp ) ) \ |
---|
[56] | 306 | { \ |
---|
| 307 | assert( 0 ); \ |
---|
| 308 | return; \ |
---|
| 309 | } \ |
---|
[2] | 310 | } |
---|
| 311 | |
---|
| 312 | #define ROFVS( exp ) \ |
---|
| 313 | { \ |
---|
| 314 | if( !( exp ) ) \ |
---|
[56] | 315 | { \ |
---|
| 316 | return; \ |
---|
| 317 | } \ |
---|
[2] | 318 | } |
---|
| 319 | |
---|
| 320 | #define ROTVS( exp ) \ |
---|
| 321 | { \ |
---|
| 322 | if( ( exp ) ) \ |
---|
[56] | 323 | { \ |
---|
| 324 | return; \ |
---|
| 325 | } \ |
---|
[2] | 326 | } |
---|
| 327 | |
---|
| 328 | #define RNOK( exp ) \ |
---|
| 329 | { \ |
---|
| 330 | const ErrVal nMSysRetVal = ( exp ); \ |
---|
| 331 | if( 0 != nMSysRetVal ) \ |
---|
[56] | 332 | { \ |
---|
| 333 | assert( 0 ); \ |
---|
| 334 | return nMSysRetVal; \ |
---|
| 335 | } \ |
---|
[2] | 336 | } |
---|
| 337 | |
---|
| 338 | #define RNOKR( exp, retVal ) \ |
---|
| 339 | { \ |
---|
| 340 | if( 0 != ( exp ) ) \ |
---|
[56] | 341 | { \ |
---|
| 342 | assert( 0 ); \ |
---|
| 343 | return retVal; \ |
---|
| 344 | } \ |
---|
[2] | 345 | } |
---|
| 346 | |
---|
| 347 | #define RNOKS( exp ) \ |
---|
| 348 | { \ |
---|
| 349 | const ErrVal nMSysRetVal = ( exp ); \ |
---|
| 350 | if( 0 != nMSysRetVal ) \ |
---|
[56] | 351 | { \ |
---|
| 352 | return nMSysRetVal; \ |
---|
| 353 | } \ |
---|
[2] | 354 | } |
---|
| 355 | |
---|
| 356 | #define RNOKRS( exp, retVal ) \ |
---|
| 357 | { \ |
---|
| 358 | if( 0 != ( exp ) ) \ |
---|
[56] | 359 | { \ |
---|
| 360 | return retVal; \ |
---|
| 361 | } \ |
---|
[2] | 362 | } |
---|
| 363 | |
---|
| 364 | #define RNOKV( exp ) \ |
---|
| 365 | { \ |
---|
| 366 | if( 0 != ( exp ) ) \ |
---|
[56] | 367 | { \ |
---|
| 368 | assert( 0 ); \ |
---|
| 369 | return; \ |
---|
| 370 | } \ |
---|
[2] | 371 | } |
---|
| 372 | |
---|
| 373 | #define RNOKVS( exp ) \ |
---|
| 374 | { \ |
---|
| 375 | if( 0 != ( exp ) ) \ |
---|
[56] | 376 | { \ |
---|
| 377 | return; \ |
---|
| 378 | } \ |
---|
[2] | 379 | } |
---|
| 380 | |
---|
| 381 | #define ANOK( exp ) \ |
---|
| 382 | { \ |
---|
| 383 | if( 0 != ( exp ) ) \ |
---|
[56] | 384 | { \ |
---|
| 385 | assert( 0 ); \ |
---|
| 386 | } \ |
---|
[2] | 387 | } |
---|
| 388 | |
---|
| 389 | #define AOF( exp ) \ |
---|
| 390 | { \ |
---|
| 391 | if( !( exp ) ) \ |
---|
[56] | 392 | { \ |
---|
| 393 | assert( 0 ); \ |
---|
| 394 | } \ |
---|
[2] | 395 | } |
---|
| 396 | |
---|
| 397 | #define AOT( exp ) \ |
---|
| 398 | { \ |
---|
| 399 | if( ( exp ) ) \ |
---|
[56] | 400 | { \ |
---|
| 401 | assert( 0 ); \ |
---|
| 402 | } \ |
---|
[2] | 403 | } |
---|
| 404 | |
---|
[56] | 405 | template <typename T> |
---|
| 406 | __inline T gSign(const T& t) |
---|
| 407 | { |
---|
| 408 | if( t == 0 ) |
---|
| 409 | return T(0); |
---|
| 410 | else |
---|
| 411 | return (t < 0) ? T(-1) : T(1); |
---|
| 412 | } |
---|
[2] | 413 | |
---|
[56] | 414 | #define Max(x, y) ((x)>(y)?(x):(y)) ///< max of (x, y) |
---|
| 415 | #define Min(x, y) ((x)<(y)?(x):(y)) ///< min of (x, y) |
---|
| 416 | #define Median(a,b,c) ((a)>(b)?(a)>(c)?(b)>(c)?(b):(c):(a):(b)>(c)?(a)>(c)?(a):(c):(b)) ///< 3-point median |
---|
| 417 | #define Clip(x) ( Min(g_uiIBDI_MAX, Max( 0, (x)) ) ) ///< clip with bit-depth range |
---|
| 418 | #define Clip3( MinVal, MaxVal, a) ( ((a)<(MinVal)) ? (MinVal) : (((a)>(MaxVal)) ? (MaxVal) :(a)) ) ///< general min/max clip |
---|
| 419 | #define RemoveBitIncrement(x) ( (x + ( (1 << g_uiBitIncrement) >> 1 )) >> g_uiBitIncrement ) ///< Remove Bit increment |
---|
[2] | 420 | |
---|
[100] | 421 | #if SAIT_VSO_EST_A0033 |
---|
| 422 | #define ROUND(a) (((a) < 0)? (int)((a) - 0.5) : (int)((a) + 0.5)) |
---|
| 423 | #endif |
---|
| 424 | |
---|
[56] | 425 | // ==================================================================================================================== |
---|
| 426 | // Coding tool configuration |
---|
| 427 | // ==================================================================================================================== |
---|
| 428 | |
---|
| 429 | // AMVP: advanced motion vector prediction |
---|
| 430 | #define AMVP_MAX_NUM_CANDS 2 ///< max number of final candidates |
---|
| 431 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
| 432 | #define AMVP_MAX_NUM_CANDS_MEM 4 ///< max number of candidates |
---|
[2] | 433 | #else |
---|
[56] | 434 | #define AMVP_MAX_NUM_CANDS_MEM 3 ///< max number of candidates |
---|
| 435 | #endif |
---|
| 436 | // MERGE |
---|
| 437 | #define MRG_MAX_NUM_CANDS 5 |
---|
| 438 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
| 439 | #define MRG_MAX_NUM_CANDS_MEM (MRG_MAX_NUM_CANDS+1) // one extra for inter-view motion prediction |
---|
| 440 | #endif |
---|
[2] | 441 | |
---|
[56] | 442 | // Reference memory management |
---|
| 443 | #define DYN_REF_FREE 0 ///< dynamic free of reference memories |
---|
[2] | 444 | |
---|
[56] | 445 | // Explicit temporal layer QP offset |
---|
| 446 | #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER |
---|
| 447 | #define MAX_TLAYER 8 ///< max number of temporal layer |
---|
| 448 | #else |
---|
| 449 | #define MAX_TLAYER 4 ///< max number of temporal layer |
---|
[2] | 450 | #endif |
---|
[56] | 451 | #define HB_LAMBDA_FOR_LDC 1 ///< use of B-style lambda for non-key pictures in low-delay mode |
---|
[2] | 452 | |
---|
[56] | 453 | // Fast estimation of generalized B in low-delay mode |
---|
| 454 | #define GPB_SIMPLE 1 ///< Simple GPB mode |
---|
| 455 | #if GPB_SIMPLE |
---|
| 456 | #define GPB_SIMPLE_UNI 1 ///< Simple mode for uni-direction |
---|
| 457 | #endif |
---|
[2] | 458 | |
---|
[56] | 459 | // Fast ME using smoother MV assumption |
---|
| 460 | #define FASTME_SMOOTHER_MV 1 ///< reduce ME time using faster option |
---|
[2] | 461 | |
---|
[56] | 462 | // Adaptive search range depending on POC difference |
---|
| 463 | #define ADAPT_SR_SCALE 1 ///< division factor for adaptive search range |
---|
[2] | 464 | |
---|
[56] | 465 | #define CLIP_TO_709_RANGE 0 |
---|
[2] | 466 | |
---|
[56] | 467 | // IBDI range restriction for skipping clip |
---|
| 468 | #define IBDI_NOCLIP_RANGE 0 ///< restrict max. value after IBDI to skip clip |
---|
[2] | 469 | |
---|
[56] | 470 | // Early-skip threshold (encoder) |
---|
| 471 | #define EARLY_SKIP_THRES 1.50 ///< if RD < thres*avg[BestSkipRD] |
---|
| 472 | |
---|
| 473 | #define MAX_NUM_REF_PICS 16 |
---|
| 474 | |
---|
| 475 | #if !NAL_REF_FLAG |
---|
| 476 | enum NalRefIdc |
---|
[2] | 477 | { |
---|
[56] | 478 | NAL_REF_IDC_PRIORITY_LOWEST = 0, |
---|
| 479 | NAL_REF_IDC_PRIORITY_LOW, |
---|
| 480 | NAL_REF_IDC_PRIORITY_HIGH, |
---|
| 481 | NAL_REF_IDC_PRIORITY_HIGHEST |
---|
| 482 | }; |
---|
| 483 | #endif |
---|
[2] | 484 | |
---|
[56] | 485 | enum NalUnitType |
---|
| 486 | { |
---|
| 487 | NAL_UNIT_UNSPECIFIED_0 = 0, |
---|
| 488 | NAL_UNIT_CODED_SLICE, |
---|
| 489 | #if H0566_TLA |
---|
[213] | 490 | #if QC_REM_IDV_B0046 |
---|
| 491 | NAL_UNIT_RESERVED, |
---|
| 492 | #else |
---|
[56] | 493 | NAL_UNIT_CODED_SLICE_IDV, |
---|
[213] | 494 | #endif |
---|
[56] | 495 | NAL_UNIT_CODED_SLICE_TLA, |
---|
| 496 | NAL_UNIT_CODED_SLICE_CRA, |
---|
| 497 | #else |
---|
| 498 | NAL_UNIT_CODED_SLICE_DATAPART_A, |
---|
| 499 | NAL_UNIT_CODED_SLICE_DATAPART_B, |
---|
| 500 | NAL_UNIT_CODED_SLICE_CDR, |
---|
| 501 | #endif |
---|
| 502 | NAL_UNIT_CODED_SLICE_IDR, |
---|
| 503 | NAL_UNIT_SEI, |
---|
| 504 | NAL_UNIT_SPS, |
---|
| 505 | NAL_UNIT_PPS, |
---|
| 506 | NAL_UNIT_ACCESS_UNIT_DELIMITER, |
---|
| 507 | NAL_UNIT_RESERVED_10, |
---|
| 508 | NAL_UNIT_RESERVED_11, |
---|
| 509 | NAL_UNIT_FILLER_DATA, |
---|
| 510 | NAL_UNIT_RESERVED_13, |
---|
| 511 | NAL_UNIT_APS, |
---|
| 512 | NAL_UNIT_RESERVED_15, |
---|
| 513 | NAL_UNIT_RESERVED_16, |
---|
| 514 | NAL_UNIT_RESERVED_17, |
---|
| 515 | NAL_UNIT_RESERVED_18, |
---|
| 516 | NAL_UNIT_RESERVED_19, |
---|
| 517 | NAL_UNIT_RESERVED_20, |
---|
| 518 | NAL_UNIT_RESERVED_21, |
---|
| 519 | NAL_UNIT_RESERVED_22, |
---|
| 520 | NAL_UNIT_RESERVED_23, |
---|
| 521 | NAL_UNIT_UNSPECIFIED_24, |
---|
[213] | 522 | #if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046 |
---|
[100] | 523 | NAL_UNIT_VPS, |
---|
[77] | 524 | #else |
---|
[56] | 525 | NAL_UNIT_UNSPECIFIED_25, |
---|
[77] | 526 | #endif |
---|
[56] | 527 | NAL_UNIT_UNSPECIFIED_26, |
---|
| 528 | NAL_UNIT_UNSPECIFIED_27, |
---|
| 529 | NAL_UNIT_UNSPECIFIED_28, |
---|
| 530 | NAL_UNIT_UNSPECIFIED_29, |
---|
| 531 | NAL_UNIT_UNSPECIFIED_30, |
---|
| 532 | NAL_UNIT_UNSPECIFIED_31, |
---|
| 533 | NAL_UNIT_INVALID, |
---|
| 534 | }; |
---|
[2] | 535 | |
---|
[56] | 536 | //PICYUV |
---|
| 537 | #define PICYUV_PAD 16 |
---|
[2] | 538 | |
---|
[56] | 539 | //RENDERER |
---|
| 540 | #define REN_LUMA_MARGIN ( g_uiMaxCUWidth + PICYUV_PAD ) |
---|
| 541 | #define REN_VDWEIGHT_PREC 8 |
---|
| 542 | #define REN_IS_FILLED ( 1 << REN_VDWEIGHT_PREC ) |
---|
| 543 | #define REN_USED_PEL g_uiIBDI_MAX |
---|
| 544 | #define REN_UNUSED_PEL 0 |
---|
| 545 | #define REN_IS_HOLE 0 |
---|
| 546 | |
---|
| 547 | |
---|
| 548 | typedef Int64 PicOrderCnt; |
---|
| 549 | |
---|
| 550 | //! \} |
---|
| 551 | |
---|
[2] | 552 | #endif // end of #ifndef __COMMONDEF__ |
---|
| 553 | |
---|