source: 3DVCSoftware/branches/HTM-11.0-dev0/source/Lib/TLibCommon/CommonDef.h @ 1326

Last change on this file since 1326 was 962, checked in by tech, 11 years ago

Update to HM-14.0

Integration of:

#define H_MV_HLS_8_SYN_Q0041_03 1 #3 Syntax only (HS /Q0041/hybrid scalability) The proposed text was endorsed, with non-editorial open issues considered as follows …: #define H_MV_HLS_7_OTHER_P0187_1 0 (OTHER/P0187/NoOutputOfPriorPicsFlag) #1 Inference of NoOutputOfPriorPicsFlag and proposes to take into account colour format and bit depth for the inference in addition to spatial resolution
#define H_MV_HLS_8_SYN_39_19 1
#39 Syntax only + (PS/Q0165,Q0078/presence of num_add_output_layer_sets) proposal 2. change condition for presence of num_add_output_layer_sets to avoid sending it when there is only one layer set.
#define H_MV_HLS_8_HRD_Q0101_04 1 #4 (HRD /Q0101/Bitstream part buffer) On Bitstream Partition Buffer. Decision (BF/Cleanup): Adopt (sub-proposals 1–11, refined as described).
#define H_MV_HLS_8_PPS_NODOC_NN 1
#NN (PPS /NODOC/reserved flag): Add a flag in PPS for SHVC color gamut scalability
#define H_MV_HLS_8_MIS_Q0177_47 1 #47 (MISC /Q0177/EOS NAL) proposal 2: clarification of description of end of sequence NAL unit
#define H_MV_HLS_8_HRD_Q0182_05 1
#5 (HRD /Q0182/Bitstream part buffer) Decision (BF/Cleanup/Ed): Adopted (such that we use the main proposal for sub-proposal 1, and alternative 1 for sub-proposal 2). + #define H_MV_HLS_8_HRD_Q0182_06 0 #6 (HRD /Q0182/hrd_parameters) Sub-proposal 2 Alternative 1: Clarify that the VPS hrd_parameters( ) syntax structure that applies to the layer set which is associated with the bitstream partition initial arrival time SEI message is used to determine the lengths of the nal_initial_arrival_delay[ i ] and vcl_initial_arrival_delay[ i ] syntax elements. Decision (BF/Cleanup/Ed): Adopted alternative 1 for sub-proposal 2
#define H_MV_HLS_8_SPS_NODOC_48 1
#48 (SPS /NODOC/PPS extension cleanups) Alignment with RExt
#define H_MV_HLS_8_DBP_NODOC_42 1 #42 (DBP /NODOC/sharing) Remove sub-DPB sharing and processes that mark inter-layer reference pictures as "unused for reference"
#define H_MV_HLS_8_RPS_Q0100_36 1
#36 (RPS /Q0100/constraint to semantics) v3, add constraint to RPS semantics
#define H_MV_HLS_8_POC_Q0142_32 1 #32 (POC /Q0142/poc_lsb_not_present_flag) v2: Add semantic constraints to poc_lsb_not_present_flag.
#define H_MV_HLS_8_HRD_Q0102_08 1
#8 (HRD /Q0102/sps_max_dec_pic_buffering_minus1) Sub-proposal 2: A semantics bug fix is proposed for sps_max_dec_pic_buffering_minus1 as a bug-fix. In discussion, the first option was preferred. Decision (BF/Cleanup/Ed.): Adopt.
#define H_MV_HLS_8_MIS_Q0102_30 1 #30 (MISC /Q0102/loop index) proposal 3, change the max loop index for signaling bit rate and pic rate info to MaxSubLayersInLayerSetMinus1
#define H_MV_HLS_8_GEN_Q0108_13 1
#13 (GEN /Q0108/STSA TemporalId) Agreed to remove restriction from proposal 2, to allow STSA pics of non-base layers to have TemporalId equal to 0.
#define H_MV_HLS_8_PMS_Q0195_21 1 #21 (PS /Q0195/constraint update_ref_format_flag) proposal 2: add a semantic constraint on the value of update_ref_format_flag
#define H_MV_HLS_8_PMS_Q0195_20 1
#20 (PS /Q0195/syntax table rep format) proposal 1: restructure syntax table for sending of rep_format_idx_present_flag and vps_num_ref_formats_minus1
#define H_MV_HLS_8_MIS_Q0177_22 1 #22 (MISC /Q0177/inference sps_temporal_id_nesting_flag) proposal 1: modify inference rule for sps_temporal_id_nesting_flag when it is not present
#define H_MV_HLS_8_PMS_Q0165_18 1
#18 (PS /Q0165/disallow an empty layer set) proposal 1.a), add a constraint to disallow an empty layer set
#define H_MV_HLS_8_RPS_Q0060_17 1 #17 (RPS /Q0060/condition refLayerPicIdc) Proposal 2: Add a condition to the derivation of refLayerPicIdc of (TemporalId == 0)
#define H_MV_HLS_8_POC_Q0146_15 1
#15 (POC /Q0146/inference of poc_msb_val_present_flag) Proposal 1.1: Change inference rule in semantics of poc_msb_val_present_flag

  • Property svn:eol-style set to native
File size: 12.1 KB
Line 
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-2014, 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     CommonDef.h
35    \brief    Defines constants, macros and tool parameters
36*/
37
38#ifndef __COMMONDEF__
39#define __COMMONDEF__
40
41#include <algorithm>
42
43#if _MSC_VER > 1000
44// disable "signed and unsigned mismatch"
45#pragma warning( disable : 4018 )
46// disable bool coercion "performance warning"
47#pragma warning( disable : 4800 )
48#endif // _MSC_VER > 1000
49#include "TypeDef.h"
50#if H_MV
51#include <assert.h>
52#endif
53
54//! \ingroup TLibCommon
55//! \{
56
57// ====================================================================================================================
58// Version information
59// ====================================================================================================================
60
61#if H_MV
62#define NV_VERSION        "11.0"                ///< Current software version
63#define HM_VERSION        "14.0"                ///<
64#else
65#define NV_VERSION        "14.0"                 ///< Current software version
66#endif
67
68// ====================================================================================================================
69// Platform information
70// ====================================================================================================================
71
72#ifdef __GNUC__
73#define NVM_COMPILEDBY  "[GCC %d.%d.%d]", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__
74#ifdef __IA64__
75#define NVM_ONARCH    "[on 64-bit] "
76#else
77#define NVM_ONARCH    "[on 32-bit] "
78#endif
79#endif
80
81#ifdef __INTEL_COMPILER
82#define NVM_COMPILEDBY  "[ICC %d]", __INTEL_COMPILER
83#elif  _MSC_VER
84#define NVM_COMPILEDBY  "[VS %d]", _MSC_VER
85#endif
86
87#ifndef NVM_COMPILEDBY
88#define NVM_COMPILEDBY "[Unk-CXX]"
89#endif
90
91#ifdef _WIN32
92#define NVM_ONOS        "[Windows]"
93#elif  __linux
94#define NVM_ONOS        "[Linux]"
95#elif  __CYGWIN__
96#define NVM_ONOS        "[Cygwin]"
97#elif __APPLE__
98#define NVM_ONOS        "[Mac OS X]"
99#else
100#define NVM_ONOS "[Unk-OS]"
101#endif
102
103#define NVM_BITS          "[%d bit] ", (sizeof(void*) == 8 ? 64 : 32) ///< used for checking 64-bit O/S
104
105#ifndef NULL
106#define NULL              0
107#endif
108
109// ====================================================================================================================
110// Common constants
111// ====================================================================================================================
112
113#define _SUMMARY_OUT_               0           ///< print-out PSNR results of all slices to summary.txt
114#define _SUMMARY_PIC_               0           ///< print-out PSNR results for each slice type to summary.txt
115
116#define MAX_GOP                     64          ///< max. value of hierarchical GOP size
117
118#define MAX_NUM_REF_PICS            16          ///< max. number of pictures used for reference
119#define MAX_NUM_REF                 16          ///< max. number of entries in picture reference list
120
121#define MAX_UINT                    0xFFFFFFFFU ///< max. value of unsigned 32-bit integer
122#define MAX_INT                     2147483647  ///< max. value of signed 32-bit integer
123#define MIN_INT                     (-2147483647-1) // < min. value of signed 32-bit integer
124
125#define MAX_INT64                   0x7FFFFFFFFFFFFFFFLL  ///< max. value of signed 64-bit integer
126#define MAX_DOUBLE                  1.7e+308    ///< max. value of double-type value
127
128#define MIN_QP                      0
129#define MAX_QP                      51
130
131#define NOT_VALID                   -1
132
133// ====================================================================================================================
134// Macro functions
135// ====================================================================================================================
136extern Int g_bitDepthY;
137extern Int g_bitDepthC;
138
139/** clip x, such that 0 <= x <= #g_maxLumaVal */
140template <typename T> inline T ClipY(T x) { return std::min<T>(T((1 << g_bitDepthY)-1), std::max<T>( T(0), x)); }
141template <typename T> inline T ClipC(T x) { return std::min<T>(T((1 << g_bitDepthC)-1), std::max<T>( T(0), x)); }
142
143/** clip a, such that minVal <= a <= maxVal */
144template <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
145
146#define DATA_ALIGN                  1                                                                 ///< use 32-bit aligned malloc/free
147#if     DATA_ALIGN && _WIN32 && ( _MSC_VER > 1300 )
148#define xMalloc( type, len )        _aligned_malloc( sizeof(type)*(len), 32 )
149#define xFree( ptr )                _aligned_free  ( ptr )
150#else
151#define xMalloc( type, len )        malloc   ( sizeof(type)*(len) )
152#define xFree( ptr )                free     ( ptr )
153#endif
154
155#define FATAL_ERROR_0(MESSAGE, EXITCODE)                      \
156{                                                             \
157  printf(MESSAGE);                                            \
158  exit(EXITCODE);                                             \
159}
160
161#if H_MV
162
163#define AOF( exp )                  \
164{                                   \
165  if( !( exp ) )                    \
166{                                 \
167  assert( 0 );                    \
168}                                 \
169}
170
171#define AOT( exp )            \
172{                             \
173  if( ( exp ) )               \
174{                           \
175  assert( 0 );              \
176}                           \
177}
178
179template <typename T>
180__inline T gSign(const T& t)
181{
182  if( t == 0 )
183    return T(0);
184  else
185    return (t < 0) ? T(-1) : T(1);
186}
187
188template <typename T>
189__inline T gCeilLog2( T val )
190{
191  assert( val > 0 ); 
192  Int ceilLog2 = 0;
193  while( val > ( 1 << ceilLog2 ) ) ceilLog2++;
194  return ceilLog2;
195}
196
197#define RemoveBitIncrement( exp ) ( exp >> ( g_bitDepthY - 8 ) )
198
199#endif
200
201// ====================================================================================================================
202// Coding tool configuration
203// ====================================================================================================================
204
205// AMVP: advanced motion vector prediction
206#define AMVP_MAX_NUM_CANDS          2           ///< max number of final candidates
207#define AMVP_MAX_NUM_CANDS_MEM      3           ///< max number of candidates
208// MERGE
209#define MRG_MAX_NUM_CANDS           5
210#if H_3D_IV_MERGE
211#define MRG_MAX_NUM_CANDS_MEM       (MRG_MAX_NUM_CANDS+1) // one extra for inter-view motion prediction
212#endif
213// Reference memory management
214#define DYN_REF_FREE                0           ///< dynamic free of reference memories
215
216// Explicit temporal layer QP offset
217#define MAX_TLAYER                  7           ///< max number of temporal layer
218#define HB_LAMBDA_FOR_LDC           1           ///< use of B-style lambda for non-key pictures in low-delay mode
219
220// Fast estimation of generalized B in low-delay mode
221#define GPB_SIMPLE                  1           ///< Simple GPB mode
222#if     GPB_SIMPLE
223#define GPB_SIMPLE_UNI              1           ///< Simple mode for uni-direction
224#endif
225
226// Fast ME using smoother MV assumption
227#define FASTME_SMOOTHER_MV          1           ///< reduce ME time using faster option
228
229// Adaptive search range depending on POC difference
230#define ADAPT_SR_SCALE              1           ///< division factor for adaptive search range
231
232#define CLIP_TO_709_RANGE           0
233
234// Early-skip threshold (encoder)
235#define EARLY_SKIP_THRES            1.50        ///< if RD < thres*avg[BestSkipRD]
236
237
238#define MAX_CHROMA_FORMAT_IDC      3
239
240// TODO: Existing names used for the different NAL unit types can be altered to better reflect the names in the spec.
241//       However, the names in the spec are not yet stable at this point. Once the names are stable, a cleanup
242//       effort can be done without use of macros to alter the names used to indicate the different NAL unit types.
243enum NalUnitType
244{
245  NAL_UNIT_CODED_SLICE_TRAIL_N = 0,   // 0
246  NAL_UNIT_CODED_SLICE_TRAIL_R,   // 1
247 
248  NAL_UNIT_CODED_SLICE_TSA_N,     // 2
249  NAL_UNIT_CODED_SLICE_TSA_R,       // 3
250 
251  NAL_UNIT_CODED_SLICE_STSA_N,    // 4
252  NAL_UNIT_CODED_SLICE_STSA_R,    // 5
253
254  NAL_UNIT_CODED_SLICE_RADL_N,    // 6
255  NAL_UNIT_CODED_SLICE_RADL_R,      // 7
256 
257  NAL_UNIT_CODED_SLICE_RASL_N,    // 8
258  NAL_UNIT_CODED_SLICE_RASL_R,      // 9
259
260  NAL_UNIT_RESERVED_VCL_N10,
261  NAL_UNIT_RESERVED_VCL_R11,
262  NAL_UNIT_RESERVED_VCL_N12,
263  NAL_UNIT_RESERVED_VCL_R13,
264  NAL_UNIT_RESERVED_VCL_N14,
265  NAL_UNIT_RESERVED_VCL_R15,
266
267  NAL_UNIT_CODED_SLICE_BLA_W_LP,    // 16
268  NAL_UNIT_CODED_SLICE_BLA_W_RADL,  // 17
269  NAL_UNIT_CODED_SLICE_BLA_N_LP,  // 18
270  NAL_UNIT_CODED_SLICE_IDR_W_RADL,  // 19
271  NAL_UNIT_CODED_SLICE_IDR_N_LP,  // 20
272  NAL_UNIT_CODED_SLICE_CRA,       // 21
273  NAL_UNIT_RESERVED_IRAP_VCL22,
274  NAL_UNIT_RESERVED_IRAP_VCL23,
275
276  NAL_UNIT_RESERVED_VCL24,
277  NAL_UNIT_RESERVED_VCL25,
278  NAL_UNIT_RESERVED_VCL26,
279  NAL_UNIT_RESERVED_VCL27,
280  NAL_UNIT_RESERVED_VCL28,
281  NAL_UNIT_RESERVED_VCL29,
282  NAL_UNIT_RESERVED_VCL30,
283  NAL_UNIT_RESERVED_VCL31,
284
285  NAL_UNIT_VPS,                   // 32
286  NAL_UNIT_SPS,                   // 33
287  NAL_UNIT_PPS,                   // 34
288  NAL_UNIT_ACCESS_UNIT_DELIMITER, // 35
289  NAL_UNIT_EOS,                   // 36
290  NAL_UNIT_EOB,                   // 37
291  NAL_UNIT_FILLER_DATA,           // 38
292  NAL_UNIT_PREFIX_SEI,              // 39
293  NAL_UNIT_SUFFIX_SEI,              // 40
294  NAL_UNIT_RESERVED_NVCL41,
295  NAL_UNIT_RESERVED_NVCL42,
296  NAL_UNIT_RESERVED_NVCL43,
297  NAL_UNIT_RESERVED_NVCL44,
298  NAL_UNIT_RESERVED_NVCL45,
299  NAL_UNIT_RESERVED_NVCL46,
300  NAL_UNIT_RESERVED_NVCL47,
301  NAL_UNIT_UNSPECIFIED_48,
302  NAL_UNIT_UNSPECIFIED_49,
303  NAL_UNIT_UNSPECIFIED_50,
304  NAL_UNIT_UNSPECIFIED_51,
305  NAL_UNIT_UNSPECIFIED_52,
306  NAL_UNIT_UNSPECIFIED_53,
307  NAL_UNIT_UNSPECIFIED_54,
308  NAL_UNIT_UNSPECIFIED_55,
309  NAL_UNIT_UNSPECIFIED_56,
310  NAL_UNIT_UNSPECIFIED_57,
311  NAL_UNIT_UNSPECIFIED_58,
312  NAL_UNIT_UNSPECIFIED_59,
313  NAL_UNIT_UNSPECIFIED_60,
314  NAL_UNIT_UNSPECIFIED_61,
315  NAL_UNIT_UNSPECIFIED_62,
316  NAL_UNIT_UNSPECIFIED_63,
317  NAL_UNIT_INVALID,
318};
319
320#if H_3D
321//PICYUV
322#define PICYUV_PAD         16
323
324//RENDERER
325#define REN_LUMA_MARGIN   ( g_uiMaxCUWidth + PICYUV_PAD )
326#define REN_VDWEIGHT_PREC  8
327#define REN_IS_FILLED     ( 1 << REN_VDWEIGHT_PREC )
328#define REN_USED_PEL       ( (1 << g_bitDepthY) - 1 )
329#define REN_UNUSED_PEL     0
330#define REN_IS_HOLE        0
331
332
333// CAMERA PARAMETERS
334#define LOG2_DISP_PREC_LUT           2           ///< log2 of disparity precision used in integer disparity LUTs
335#define STD_CAM_PARAMETERS_PRECISION 5        ///< quarter luma sample accuarcy for derived disparities (as default)
336
337#endif // end of H_3D
338//! \}
339
340#endif // end of #ifndef  __COMMONDEF__
341
Note: See TracBrowser for help on using the repository browser.