source: SHVCSoftware/branches/SHM-dev/source/Lib/TLibCommon/TypeDef.h @ 1506

Last change on this file since 1506 was 1506, checked in by seregin, 8 years ago

disable UNAVAILABLE_PIC_BUGFIX

  • Property svn:eol-style set to native
File size: 33.4 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-2015, 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 macros, basic types, new types and enumerations
36*/
37
38#ifndef __TYPEDEF__
39#define __TYPEDEF__
40
41#ifndef __COMMONDEF__
42#error Include CommonDef.h not TypeDef.h
43#endif
44
45#include <vector>
46
47#define SVC_EXTENSION                    1
48
49#if SVC_EXTENSION
50#define SCALABLE_REXT                    1
51#define FORMATIDX_CHECK                  1
52
53#define MAX_LAYERS                       8      ///< max number of layers the codec is supposed to handle
54
55#define CONFORMANCE_BITSTREAM_MODE       1      ///< In order to generate the metadata related to conformance bitstreams
56
57#define AUXILIARY_PICTURES               1      ///< JCTVC-O0041: auxiliary picture layers
58#define AVC_BASE                         1      ///< YUV BL reading for AVC base SVC
59#define SVC_POC                          1      ///< POC signalling and reset
60#define O0164_MULTI_LAYER_HRD            1      ///< JCTVC-O0164: Multi-layer HRD operation
61
62#define CGS_3D_ASYMLUT                   1      ///< Colour gamut scalability with look-up table
63#if CGS_3D_ASYMLUT
64#define CGS_GCC_NO_VECTORIZATION         1      ///< disable victorization to avoid issues with some compilers
65#define R0164_CGS_LUT_BUGFIX_CHECK       0      ///< JCTVC-R0164: Add traces explicitly/non-explicitly encoded vertices and check if 3DLUT is correctly filled
66#define R0179_ENC_OPT_3DLUT_SIZE         0      ///< JCTVC-R0179: RD decision based LUT size selection
67#endif
68
69#define UNAVAILABLE_PIC_BUGFIX           0
70#define ALIGNED_BUMPING                  1      ///< JCTVC-P0192: Align bumping of pictures in an AU
71#define NO_CLRAS_OUTPUT_FLAG             1
72
73#define CONFORMANCE_BITSTREAM_FIX        1
74/// scalability types
75enum ScalabilityType
76{
77  VIEW_ORDER_INDEX  = 1,
78  SCALABILITY_ID    = 2,
79  AUX_ID            = 3,
80};
81
82enum AuxType
83{
84  AUX_ALPHA = 1,
85  AUX_DEPTH = 2,
86};
87
88/// normative encoder constraints --------
89#define REF_IDX_ME_ZEROMV                1      ///< JCTVC-L0051: use zero motion for inter-layer reference picture (without fractional ME)
90
91/// encoder settings ---------------------
92#define FAST_INTRA_SHVC                  1      ///< JCTVC-M0115: reduction number of intra modes in the EL (encoder only)
93#if FAST_INTRA_SHVC
94#define NB_REMAIN_MODES                  2      ///< JCTVC-M0115: nb of remaining modes
95#endif
96#define RC_SHVC_HARMONIZATION            1      ///< JCTVC-M0037: rate control for SHVC
97#define JCTVC_M0259_LAMBDAREFINEMENT     1      ///< JCTVC-M0259: lambda refinement (encoder only optimization)
98#define ENCODER_FAST_MODE                1      ///< JCTVC-L0174: enable encoder fast mode. TestMethod 1 is enabled by setting to 1 and TestMethod 2 is enable by setting to 2. By default it is set to 1.
99#define HIGHER_LAYER_IRAP_SKIP_FLAG      1      ///< JCTVC-O0199: Indication that higher layer IRAP picture uses skip blocks only
100#define LAYER_CTB                        0      ///< enable layer-specific CTB structure
101
102/// SEI messages -------------------------
103#define SUB_BITSTREAM_PROPERTY_SEI       1      ///< JCTVC-P0204: Sub-bitstream property SEI message
104#if SUB_BITSTREAM_PROPERTY_SEI
105#define MAX_SUB_STREAMS                  1024
106#endif
107#define LAYERS_NOT_PRESENT_SEI           1      ///< JCTVC-M0043: add layers not present SEI.
108#define N0383_IL_CONSTRAINED_TILE_SETS_SEI  1
109#define Q0189_TMVP_CONSTRAINTS           1      ///< JCTVC-Q0189: indicate constraints on TMVP
110#define Q0247_FRAME_FIELD_INFO           1      ///< JCTVC-Q0247: field_frame_info SEI message
111#define R0247_SEI_ACTIVE                 1      ///< JCTVC-R0247: active parameter sets SEI message
112#define Q0096_OVERLAY_SEI                1      ///< JCTVC-Q0096, JCTVC-Q0045: selectable overlays SEI message
113#if Q0096_OVERLAY_SEI
114#define MAX_OVERLAYS                     16
115#define MAX_OVERLAY_ELEMENTS             256
116#define MAX_OVERLAY_STRING_BYTES         256
117#endif
118#define P0123_ALPHA_CHANNEL_SEI          1      ///< JCTVC-P0123: SEI message for alpha channel information
119#define BSP_INIT_ARRIVAL_SEI             1      ///< JCTVC-R0231: Make signalling of vcl_initial_arrival_delay independent of NalHrdBpPresentFlag
120#define P0138_USE_ALT_CPB_PARAMS_FLAG    1      ///< JCTVC-P0138: use_alt_cpb_params_flag syntax in buffering period SEI message extension
121
122/// constants
123#define MAX_NUM_ADD_LAYER_SETS           1023
124#define MAX_SEIS_IN_BSP_NESTING          64
125#define MAX_VPS_NUM_SCALABILITY_TYPES    16
126#define MAX_REF_LAYERS                   7
127#define MAX_VPS_OP_LAYER_SETS_PLUS1          (MAX_LAYERS+1)
128#define MAX_VPS_LAYER_SETS_PLUS1                       1024
129#define MAX_VPS_OUTPUT_LAYER_SETS_PLUS1                1024
130#define MAX_VPS_LAYER_IDX_PLUS1                   MAX_LAYERS
131
132#endif // SVC_EXTENSION
133
134//! \ingroup TLibCommon
135//! \{
136
137// ====================================================================================================================
138// Debugging
139// ====================================================================================================================
140
141#define DEBUG_STRING                                      0 ///< When enabled, prints out final decision debug info at encoder and decoder
142#define DEBUG_ENCODER_SEARCH_BINS                         0 ///< When enabled, prints out each bin as it is coded during encoder search
143#define DEBUG_CABAC_BINS                                  0 ///< When enabled, prints out each bin as it is coded during final encode and decode
144#define DEBUG_INTRA_SEARCH_COSTS                          0 ///< When enabled, prints out the cost for each mode during encoder search
145#define DEBUG_TRANSFORM_AND_QUANTISE                      0 ///< When enabled, prints out each TU as it passes through the transform-quantise-dequantise-inverseTransform process
146
147#define ENVIRONMENT_VARIABLE_DEBUG_AND_TEST               0 ///< When enabled, allows control of debug modifications via environment variables
148#define PRINT_MACRO_VALUES                                1 ///< When enabled, the encoder prints out a list of the non-environment-variable controlled macros and their values on startup
149
150// TODO: rename this macro to DECODER_DEBUG_BIT_STATISTICS (may currently cause merge issues with other branches)
151// This can be enabled by the makefile
152#ifndef RExt__DECODER_DEBUG_BIT_STATISTICS
153#define RExt__DECODER_DEBUG_BIT_STATISTICS                0 ///< 0 (default) = decoder reports as normal, 1 = decoder produces bit usage statistics (will impact decoder run time by up to ~10%)
154#endif
155
156// This can be enabled by the makefile
157#ifndef ENC_DEC_TRACE
158#define ENC_DEC_TRACE                                     0
159#endif
160#define DEC_NUH_TRACE                                     0 ///< When trace enabled, enable tracing of NAL unit headers at the decoder (currently not possible at the encoder)
161
162#define PRINT_RPS_INFO                                    0 ///< Enable/disable the printing of bits used to send the RPS.
163
164// ====================================================================================================================
165// Tool Switches - transitory (these macros are likely to be removed in future revisions)
166// ====================================================================================================================
167
168#define DECODER_CHECK_SUBSTREAM_AND_SLICE_TRAILING_BYTES  1 ///< TODO: integrate this macro into a broader conformance checking system.
169#define T0196_SELECTIVE_RDOQ                              1 ///< selective RDOQ
170#define U0040_MODIFIED_WEIGHTEDPREDICTION_WITH_BIPRED_AND_CLIPPING 1
171
172// ====================================================================================================================
173// Tool Switches
174// ====================================================================================================================
175
176#define ADAPTIVE_QP_SELECTION                             1 ///< G382: Adaptive reconstruction levels, non-normative part for adaptive QP selection
177
178#define AMP_ENC_SPEEDUP                                   1 ///< encoder only speed-up by AMP mode skipping
179#if AMP_ENC_SPEEDUP
180#define AMP_MRG                                           1 ///< encoder only force merge for AMP partition (no motion search for AMP)
181#endif
182
183#define FAST_BIT_EST                                      1 ///< G763: Table-based bit estimation for CABAC
184
185#define HHI_RQT_INTRA_SPEEDUP                             1 ///< tests one best mode with full rqt
186#define HHI_RQT_INTRA_SPEEDUP_MOD                         0 ///< tests two best modes with full rqt
187
188#if HHI_RQT_INTRA_SPEEDUP_MOD && !HHI_RQT_INTRA_SPEEDUP
189#error
190#endif
191
192#define MATRIX_MULT                                       0 ///< Brute force matrix multiplication instead of partial butterfly
193
194#define O0043_BEST_EFFORT_DECODING                        0 ///< 0 (default) = disable code related to best effort decoding, 1 = enable code relating to best effort decoding [ decode-side only ].
195
196#define ME_ENABLE_ROUNDING_OF_MVS                         1 ///< 0 (default) = disables rounding of motion vectors when right shifted,  1 = enables rounding
197
198#define RDOQ_CHROMA_LAMBDA                                1 ///< F386: weighting of chroma for RDOQ
199
200// This can be enabled by the makefile
201#ifndef RExt__HIGH_BIT_DEPTH_SUPPORT
202#define RExt__HIGH_BIT_DEPTH_SUPPORT                      SCALABLE_REXT ///< 0 (default) use data type definitions for 8-10 bit video, 1 = use larger data types to allow for up to 16-bit video (originally developed as part of N0188)
203#endif
204
205#define U0132_TARGET_BITS_SATURATION                      1 ///< Rate control with target bits saturation method
206
207// ====================================================================================================================
208// Derived macros
209// ====================================================================================================================
210
211#if RExt__HIGH_BIT_DEPTH_SUPPORT
212#define FULL_NBIT                                         1 ///< When enabled, use distortion measure derived from all bits of source data, otherwise discard (bitDepth - 8) least-significant bits of distortion
213#define RExt__HIGH_PRECISION_FORWARD_TRANSFORM            1 ///< 0 use original 6-bit transform matrices for both forward and inverse transform, 1 (default) = use original matrices for inverse transform and high precision matrices for forward transform
214#else
215#define FULL_NBIT                                         0 ///< When enabled, use distortion measure derived from all bits of source data, otherwise discard (bitDepth - 8) least-significant bits of distortion
216#define RExt__HIGH_PRECISION_FORWARD_TRANSFORM            0 ///< 0 (default) use original 6-bit transform matrices for both forward and inverse transform, 1 = use original matrices for inverse transform and high precision matrices for forward transform
217#endif
218
219#if FULL_NBIT
220# define DISTORTION_PRECISION_ADJUSTMENT(x)  0
221#else
222# define DISTORTION_PRECISION_ADJUSTMENT(x) (x)
223#endif
224
225#if DEBUG_STRING
226  #define DEBUG_STRING_PASS_INTO(name) , name
227  #define DEBUG_STRING_PASS_INTO_OPTIONAL(name, exp) , (exp==0)?0:name
228  #define DEBUG_STRING_FN_DECLARE(name) , std::string &name
229  #define DEBUG_STRING_FN_DECLAREP(name) , std::string *name
230  #define DEBUG_STRING_NEW(name) std::string name;
231  #define DEBUG_STRING_OUTPUT(os, name) os << name;
232  #define DEBUG_STRING_APPEND(str1, str2) str1+=str2;
233  #define DEBUG_STRING_SWAP(str1, str2) str1.swap(str2);
234  #define DEBUG_STRING_CHANNEL_CONDITION(compID) (true)
235  #include <sstream>
236  #include <iomanip>
237#else
238  #define DEBUG_STRING_PASS_INTO(name)
239  #define DEBUG_STRING_PASS_INTO_OPTIONAL(name, exp)
240  #define DEBUG_STRING_FN_DECLARE(name)
241  #define DEBUG_STRING_FN_DECLAREP(name)
242  #define DEBUG_STRING_NEW(name)
243  #define DEBUG_STRING_OUTPUT(os, name)
244  #define DEBUG_STRING_APPEND(str1, str2)
245  #define DEBUG_STRING_SWAP(srt1, str2)
246  #define DEBUG_STRING_CHANNEL_CONDITION(compID)
247#endif
248
249// ====================================================================================================================
250// Error checks
251// ====================================================================================================================
252
253#if ((RExt__HIGH_PRECISION_FORWARD_TRANSFORM != 0) && (RExt__HIGH_BIT_DEPTH_SUPPORT == 0))
254#error ERROR: cannot enable RExt__HIGH_PRECISION_FORWARD_TRANSFORM without RExt__HIGH_BIT_DEPTH_SUPPORT
255#endif
256
257// ====================================================================================================================
258// Basic type redefinition
259// ====================================================================================================================
260
261typedef       void                Void;
262typedef       bool                Bool;
263
264typedef       char                TChar; // Used for text/characters
265typedef       signed char         SChar; // Signed 8-bit values
266typedef       unsigned char       UChar; // Unsigned 8-bit values
267typedef       short               Short;
268typedef       unsigned short      UShort;
269typedef       int                 Int;
270typedef       unsigned int        UInt;
271typedef       double              Double;
272typedef       float               Float;
273
274
275// ====================================================================================================================
276// 64-bit integer type
277// ====================================================================================================================
278
279#ifdef _MSC_VER
280typedef       __int64             Int64;
281
282#if _MSC_VER <= 1200 // MS VC6
283typedef       __int64             UInt64;   // MS VC6 does not support unsigned __int64 to double conversion
284#else
285typedef       unsigned __int64    UInt64;
286#endif
287
288#else
289
290typedef       long long           Int64;
291typedef       unsigned long long  UInt64;
292
293#endif
294
295// ====================================================================================================================
296// Named numerical types
297// ====================================================================================================================
298
299#if RExt__HIGH_BIT_DEPTH_SUPPORT
300typedef       Int             Pel;               ///< pixel type
301typedef       Int64           TCoeff;            ///< transform coefficient
302typedef       Int             TMatrixCoeff;      ///< transform matrix coefficient
303typedef       Short           TFilterCoeff;      ///< filter coefficient
304typedef       Int64           Intermediate_Int;  ///< used as intermediate value in calculations
305typedef       UInt64          Intermediate_UInt; ///< used as intermediate value in calculations
306#else
307typedef       Short           Pel;               ///< pixel type
308typedef       Int             TCoeff;            ///< transform coefficient
309typedef       Short           TMatrixCoeff;      ///< transform matrix coefficient
310typedef       Short           TFilterCoeff;      ///< filter coefficient
311typedef       Int             Intermediate_Int;  ///< used as intermediate value in calculations
312typedef       UInt            Intermediate_UInt; ///< used as intermediate value in calculations
313#endif
314
315#if FULL_NBIT
316typedef       UInt64          Distortion;        ///< distortion measurement
317#else
318typedef       UInt            Distortion;        ///< distortion measurement
319#endif
320
321// ====================================================================================================================
322// Enumeration
323// ====================================================================================================================
324
325enum RDPCMMode
326{
327  RDPCM_OFF             = 0,
328  RDPCM_HOR             = 1,
329  RDPCM_VER             = 2,
330  NUMBER_OF_RDPCM_MODES = 3
331};
332
333enum RDPCMSignallingMode
334{
335  RDPCM_SIGNAL_IMPLICIT            = 0,
336  RDPCM_SIGNAL_EXPLICIT            = 1,
337  NUMBER_OF_RDPCM_SIGNALLING_MODES = 2
338};
339
340/// supported slice type
341enum SliceType
342{
343  B_SLICE               = 0,
344  P_SLICE               = 1,
345  I_SLICE               = 2,
346  NUMBER_OF_SLICE_TYPES = 3
347};
348
349/// chroma formats (according to semantics of chroma_format_idc)
350enum ChromaFormat
351{
352  CHROMA_400        = 0,
353  CHROMA_420        = 1,
354  CHROMA_422        = 2,
355  CHROMA_444        = 3,
356  NUM_CHROMA_FORMAT = 4
357};
358
359enum ChannelType
360{
361  CHANNEL_TYPE_LUMA    = 0,
362  CHANNEL_TYPE_CHROMA  = 1,
363  MAX_NUM_CHANNEL_TYPE = 2
364};
365
366enum ComponentID
367{
368  COMPONENT_Y       = 0,
369  COMPONENT_Cb      = 1,
370  COMPONENT_Cr      = 2,
371  MAX_NUM_COMPONENT = 3
372};
373
374enum InputColourSpaceConversion // defined in terms of conversion prior to input of encoder.
375{
376  IPCOLOURSPACE_UNCHANGED               = 0,
377  IPCOLOURSPACE_YCbCrtoYCrCb            = 1, // Mainly used for debug!
378  IPCOLOURSPACE_YCbCrtoYYY              = 2, // Mainly used for debug!
379  IPCOLOURSPACE_RGBtoGBR                = 3,
380  NUMBER_INPUT_COLOUR_SPACE_CONVERSIONS = 4
381};
382
383enum MATRIX_COEFFICIENTS // Table E.5 (Matrix coefficients)
384{
385  MATRIX_COEFFICIENTS_RGB                           = 0,
386  MATRIX_COEFFICIENTS_BT709                         = 1,
387  MATRIX_COEFFICIENTS_UNSPECIFIED                   = 2,
388  MATRIX_COEFFICIENTS_RESERVED_BY_ITUISOIEC         = 3,
389  MATRIX_COEFFICIENTS_USFCCT47                      = 4,
390  MATRIX_COEFFICIENTS_BT601_625                     = 5,
391  MATRIX_COEFFICIENTS_BT601_525                     = 6,
392  MATRIX_COEFFICIENTS_SMPTE240                      = 7,
393  MATRIX_COEFFICIENTS_YCGCO                         = 8,
394  MATRIX_COEFFICIENTS_BT2020_NON_CONSTANT_LUMINANCE = 9,
395  MATRIX_COEFFICIENTS_BT2020_CONSTANT_LUMINANCE     = 10,
396};
397
398enum DeblockEdgeDir
399{
400  EDGE_VER     = 0,
401  EDGE_HOR     = 1,
402  NUM_EDGE_DIR = 2
403};
404
405/// supported partition shape
406enum PartSize
407{
408  SIZE_2Nx2N           = 0,           ///< symmetric motion partition,  2Nx2N
409  SIZE_2NxN            = 1,           ///< symmetric motion partition,  2Nx N
410  SIZE_Nx2N            = 2,           ///< symmetric motion partition,   Nx2N
411  SIZE_NxN             = 3,           ///< symmetric motion partition,   Nx N
412  SIZE_2NxnU           = 4,           ///< asymmetric motion partition, 2Nx( N/2) + 2Nx(3N/2)
413  SIZE_2NxnD           = 5,           ///< asymmetric motion partition, 2Nx(3N/2) + 2Nx( N/2)
414  SIZE_nLx2N           = 6,           ///< asymmetric motion partition, ( N/2)x2N + (3N/2)x2N
415  SIZE_nRx2N           = 7,           ///< asymmetric motion partition, (3N/2)x2N + ( N/2)x2N
416  NUMBER_OF_PART_SIZES = 8
417};
418
419/// supported prediction type
420enum PredMode
421{
422  MODE_INTER                 = 0,     ///< inter-prediction mode
423  MODE_INTRA                 = 1,     ///< intra-prediction mode
424  NUMBER_OF_PREDICTION_MODES = 2,
425};
426
427/// reference list index
428enum RefPicList
429{
430  REF_PIC_LIST_0               = 0,   ///< reference list 0
431  REF_PIC_LIST_1               = 1,   ///< reference list 1
432  NUM_REF_PIC_LIST_01          = 2,
433  REF_PIC_LIST_X               = 100  ///< special mark
434};
435
436/// distortion function index
437enum DFunc
438{
439  DF_DEFAULT         = 0,
440  DF_SSE             = 1,      ///< general size SSE
441  DF_SSE4            = 2,      ///<   4xM SSE
442  DF_SSE8            = 3,      ///<   8xM SSE
443  DF_SSE16           = 4,      ///<  16xM SSE
444  DF_SSE32           = 5,      ///<  32xM SSE
445  DF_SSE64           = 6,      ///<  64xM SSE
446  DF_SSE16N          = 7,      ///< 16NxM SSE
447
448  DF_SAD             = 8,      ///< general size SAD
449  DF_SAD4            = 9,      ///<   4xM SAD
450  DF_SAD8            = 10,     ///<   8xM SAD
451  DF_SAD16           = 11,     ///<  16xM SAD
452  DF_SAD32           = 12,     ///<  32xM SAD
453  DF_SAD64           = 13,     ///<  64xM SAD
454  DF_SAD16N          = 14,     ///< 16NxM SAD
455
456  DF_SADS            = 15,     ///< general size SAD with step
457  DF_SADS4           = 16,     ///<   4xM SAD with step
458  DF_SADS8           = 17,     ///<   8xM SAD with step
459  DF_SADS16          = 18,     ///<  16xM SAD with step
460  DF_SADS32          = 19,     ///<  32xM SAD with step
461  DF_SADS64          = 20,     ///<  64xM SAD with step
462  DF_SADS16N         = 21,     ///< 16NxM SAD with step
463
464  DF_HADS            = 22,     ///< general size Hadamard with step
465  DF_HADS4           = 23,     ///<   4xM HAD with step
466  DF_HADS8           = 24,     ///<   8xM HAD with step
467  DF_HADS16          = 25,     ///<  16xM HAD with step
468  DF_HADS32          = 26,     ///<  32xM HAD with step
469  DF_HADS64          = 27,     ///<  64xM HAD with step
470  DF_HADS16N         = 28,     ///< 16NxM HAD with step
471
472  DF_SAD12           = 43,
473  DF_SAD24           = 44,
474  DF_SAD48           = 45,
475
476  DF_SADS12          = 46,
477  DF_SADS24          = 47,
478  DF_SADS48          = 48,
479
480  DF_SSE_FRAME       = 50,     ///< Frame-based SSE
481  DF_TOTAL_FUNCTIONS = 64
482};
483
484/// index for SBAC based RD optimization
485enum CI_IDX
486{
487  CI_CURR_BEST = 0,     ///< best mode index
488  CI_NEXT_BEST,         ///< next best index
489  CI_TEMP_BEST,         ///< temporal index
490  CI_CHROMA_INTRA,      ///< chroma intra index
491  CI_QT_TRAFO_TEST,
492  CI_QT_TRAFO_ROOT,
493  CI_NUM,               ///< total number
494};
495
496/// motion vector predictor direction used in AMVP
497enum MVP_DIR
498{
499  MD_LEFT = 0,          ///< MVP of left block
500  MD_ABOVE,             ///< MVP of above block
501  MD_ABOVE_RIGHT,       ///< MVP of above right block
502  MD_BELOW_LEFT,        ///< MVP of below left block
503  MD_ABOVE_LEFT         ///< MVP of above left block
504};
505
506enum StoredResidualType
507{
508  RESIDUAL_RECONSTRUCTED          = 0,
509  RESIDUAL_ENCODER_SIDE           = 1,
510  NUMBER_OF_STORED_RESIDUAL_TYPES = 2
511};
512
513enum TransformDirection
514{
515  TRANSFORM_FORWARD              = 0,
516  TRANSFORM_INVERSE              = 1,
517  TRANSFORM_NUMBER_OF_DIRECTIONS = 2
518};
519
520/// supported ME search methods
521enum MESearchMethod
522{
523  MESEARCH_FULL              = 0,
524  MESEARCH_DIAMOND           = 1,
525  MESEARCH_SELECTIVE         = 2,
526  MESEARCH_DIAMOND_ENHANCED  = 3,
527  MESEARCH_NUMBER_OF_METHODS = 4
528};
529
530/// coefficient scanning type used in ACS
531enum COEFF_SCAN_TYPE
532{
533  SCAN_DIAG = 0,        ///< up-right diagonal scan
534  SCAN_HOR  = 1,        ///< horizontal first scan
535  SCAN_VER  = 2,        ///< vertical first scan
536  SCAN_NUMBER_OF_TYPES = 3
537};
538
539enum COEFF_SCAN_GROUP_TYPE
540{
541  SCAN_UNGROUPED   = 0,
542  SCAN_GROUPED_4x4 = 1,
543  SCAN_NUMBER_OF_GROUP_TYPES = 2
544};
545
546enum SignificanceMapContextType
547{
548  CONTEXT_TYPE_4x4    = 0,
549  CONTEXT_TYPE_8x8    = 1,
550  CONTEXT_TYPE_NxN    = 2,
551  CONTEXT_TYPE_SINGLE = 3,
552  CONTEXT_NUMBER_OF_TYPES = 4
553};
554
555enum ScalingListMode
556{
557  SCALING_LIST_OFF,
558  SCALING_LIST_DEFAULT,
559  SCALING_LIST_FILE_READ
560};
561
562enum ScalingListSize
563{
564  SCALING_LIST_4x4 = 0,
565  SCALING_LIST_8x8,
566  SCALING_LIST_16x16,
567  SCALING_LIST_32x32,
568  SCALING_LIST_SIZE_NUM
569};
570
571// Slice / Slice segment encoding modes
572enum SliceConstraint
573{
574  NO_SLICES              = 0,          ///< don't use slices / slice segments
575  FIXED_NUMBER_OF_CTU    = 1,          ///< Limit maximum number of largest coding tree units in a slice / slice segments
576  FIXED_NUMBER_OF_BYTES  = 2,          ///< Limit maximum number of bytes in a slice / slice segment
577  FIXED_NUMBER_OF_TILES  = 3,          ///< slices / slice segments span an integer number of tiles
578  NUMBER_OF_SLICE_CONSTRAINT_MODES = 4
579};
580
581// For use with decoded picture hash SEI messages, generated by encoder.
582enum HashType
583{
584  HASHTYPE_MD5             = 0,
585  HASHTYPE_CRC             = 1,
586  HASHTYPE_CHECKSUM        = 2,
587  HASHTYPE_NONE            = 3,
588  NUMBER_OF_HASHTYPES      = 4
589};
590
591enum SAOMode //mode
592{
593  SAO_MODE_OFF = 0,
594  SAO_MODE_NEW,
595  SAO_MODE_MERGE,
596  NUM_SAO_MODES
597};
598
599enum SAOModeMergeTypes
600{
601  SAO_MERGE_LEFT =0,
602  SAO_MERGE_ABOVE,
603  NUM_SAO_MERGE_TYPES
604};
605
606
607enum SAOModeNewTypes
608{
609  SAO_TYPE_START_EO =0,
610  SAO_TYPE_EO_0 = SAO_TYPE_START_EO,
611  SAO_TYPE_EO_90,
612  SAO_TYPE_EO_135,
613  SAO_TYPE_EO_45,
614
615  SAO_TYPE_START_BO,
616  SAO_TYPE_BO = SAO_TYPE_START_BO,
617
618  NUM_SAO_NEW_TYPES
619};
620#define NUM_SAO_EO_TYPES_LOG2 2
621
622enum SAOEOClasses
623{
624  SAO_CLASS_EO_FULL_VALLEY = 0,
625  SAO_CLASS_EO_HALF_VALLEY = 1,
626  SAO_CLASS_EO_PLAIN       = 2,
627  SAO_CLASS_EO_HALF_PEAK   = 3,
628  SAO_CLASS_EO_FULL_PEAK   = 4,
629  NUM_SAO_EO_CLASSES,
630};
631
632#define NUM_SAO_BO_CLASSES_LOG2  5
633#define NUM_SAO_BO_CLASSES       (1<<NUM_SAO_BO_CLASSES_LOG2)
634
635namespace Profile
636{
637  enum Name
638  {
639    NONE = 0,
640    MAIN = 1,
641    MAIN10 = 2,
642    MAINSTILLPICTURE = 3,
643    MAINREXT = 4,
644    HIGHTHROUGHPUTREXT = 5,
645#if SVC_EXTENSION
646    MULTIVIEWMAIN = 6,
647    SCALABLEMAIN = 7,
648    SCALABLEMAIN10 = 8,
649#if SCALABLE_REXT
650    SCALABLEREXT = 10
651#endif
652#endif
653  };
654}
655
656namespace Level
657{
658  enum Tier
659  {
660    MAIN = 0,
661    HIGH = 1,
662  };
663
664  enum Name
665  {
666    // code = (level * 30)
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    LEVEL8_5 = 255,
682  };
683}
684
685enum CostMode
686{
687  COST_STANDARD_LOSSY              = 0,
688  COST_SEQUENCE_LEVEL_LOSSLESS     = 1,
689  COST_LOSSLESS_CODING             = 2,
690  COST_MIXED_LOSSLESS_LOSSY_CODING = 3
691};
692
693enum WeightedPredictionMethod
694{
695  WP_PER_PICTURE_WITH_SIMPLE_DC_COMBINED_COMPONENT                          =0,
696  WP_PER_PICTURE_WITH_SIMPLE_DC_PER_COMPONENT                               =1,
697  WP_PER_PICTURE_WITH_HISTOGRAM_AND_PER_COMPONENT                           =2,
698  WP_PER_PICTURE_WITH_HISTOGRAM_AND_PER_COMPONENT_AND_CLIPPING              =3,
699  WP_PER_PICTURE_WITH_HISTOGRAM_AND_PER_COMPONENT_AND_CLIPPING_AND_EXTENSION=4
700};
701
702enum FastInterSearchMode
703{
704  FASTINTERSEARCH_DISABLED = 0,
705  FASTINTERSEARCH_MODE1    = 1, // TODO: assign better names to these.
706  FASTINTERSEARCH_MODE2    = 2,
707  FASTINTERSEARCH_MODE3    = 3
708};
709
710enum SPSExtensionFlagIndex
711{
712  SPS_EXT__REXT           = 0,
713#if SVC_EXTENSION
714  SPS_EXT__MLAYER         = 1,
715#else
716//SPS_EXT__MVHEVC         = 1, //for use in future versions
717//SPS_EXT__SHVC           = 2, //for use in future versions
718#endif
719  NUM_SPS_EXTENSION_FLAGS = 8
720};
721
722enum PPSExtensionFlagIndex
723{
724  PPS_EXT__REXT           = 0,
725#if SVC_EXTENSION
726  PPS_EXT__MLAYER         = 1, // multilayer extension
727#else
728//PPS_EXT__MVHEVC         = 1, //for use in future versions
729//PPS_EXT__SHVC           = 2, //for use in future versions
730#endif
731  NUM_PPS_EXTENSION_FLAGS = 8
732};
733
734// TODO: Existing names used for the different NAL unit types can be altered to better reflect the names in the spec.
735//       However, the names in the spec are not yet stable at this point. Once the names are stable, a cleanup
736//       effort can be done without use of macros to alter the names used to indicate the different NAL unit types.
737enum NalUnitType
738{
739  NAL_UNIT_CODED_SLICE_TRAIL_N = 0, // 0
740  NAL_UNIT_CODED_SLICE_TRAIL_R,     // 1
741
742  NAL_UNIT_CODED_SLICE_TSA_N,       // 2
743  NAL_UNIT_CODED_SLICE_TSA_R,       // 3
744
745  NAL_UNIT_CODED_SLICE_STSA_N,      // 4
746  NAL_UNIT_CODED_SLICE_STSA_R,      // 5
747
748  NAL_UNIT_CODED_SLICE_RADL_N,      // 6
749  NAL_UNIT_CODED_SLICE_RADL_R,      // 7
750
751  NAL_UNIT_CODED_SLICE_RASL_N,      // 8
752  NAL_UNIT_CODED_SLICE_RASL_R,      // 9
753
754  NAL_UNIT_RESERVED_VCL_N10,
755  NAL_UNIT_RESERVED_VCL_R11,
756  NAL_UNIT_RESERVED_VCL_N12,
757  NAL_UNIT_RESERVED_VCL_R13,
758  NAL_UNIT_RESERVED_VCL_N14,
759  NAL_UNIT_RESERVED_VCL_R15,
760
761  NAL_UNIT_CODED_SLICE_BLA_W_LP,    // 16
762  NAL_UNIT_CODED_SLICE_BLA_W_RADL,  // 17
763  NAL_UNIT_CODED_SLICE_BLA_N_LP,    // 18
764  NAL_UNIT_CODED_SLICE_IDR_W_RADL,  // 19
765  NAL_UNIT_CODED_SLICE_IDR_N_LP,    // 20
766  NAL_UNIT_CODED_SLICE_CRA,         // 21
767  NAL_UNIT_RESERVED_IRAP_VCL22,
768  NAL_UNIT_RESERVED_IRAP_VCL23,
769
770  NAL_UNIT_RESERVED_VCL24,
771  NAL_UNIT_RESERVED_VCL25,
772  NAL_UNIT_RESERVED_VCL26,
773  NAL_UNIT_RESERVED_VCL27,
774  NAL_UNIT_RESERVED_VCL28,
775  NAL_UNIT_RESERVED_VCL29,
776  NAL_UNIT_RESERVED_VCL30,
777  NAL_UNIT_RESERVED_VCL31,
778
779  NAL_UNIT_VPS,                     // 32
780  NAL_UNIT_SPS,                     // 33
781  NAL_UNIT_PPS,                     // 34
782  NAL_UNIT_ACCESS_UNIT_DELIMITER,   // 35
783  NAL_UNIT_EOS,                     // 36
784  NAL_UNIT_EOB,                     // 37
785  NAL_UNIT_FILLER_DATA,             // 38
786  NAL_UNIT_PREFIX_SEI,              // 39
787  NAL_UNIT_SUFFIX_SEI,              // 40
788
789  NAL_UNIT_RESERVED_NVCL41,
790  NAL_UNIT_RESERVED_NVCL42,
791  NAL_UNIT_RESERVED_NVCL43,
792  NAL_UNIT_RESERVED_NVCL44,
793  NAL_UNIT_RESERVED_NVCL45,
794  NAL_UNIT_RESERVED_NVCL46,
795  NAL_UNIT_RESERVED_NVCL47,
796  NAL_UNIT_UNSPECIFIED_48,
797  NAL_UNIT_UNSPECIFIED_49,
798  NAL_UNIT_UNSPECIFIED_50,
799  NAL_UNIT_UNSPECIFIED_51,
800  NAL_UNIT_UNSPECIFIED_52,
801  NAL_UNIT_UNSPECIFIED_53,
802  NAL_UNIT_UNSPECIFIED_54,
803  NAL_UNIT_UNSPECIFIED_55,
804  NAL_UNIT_UNSPECIFIED_56,
805  NAL_UNIT_UNSPECIFIED_57,
806  NAL_UNIT_UNSPECIFIED_58,
807  NAL_UNIT_UNSPECIFIED_59,
808  NAL_UNIT_UNSPECIFIED_60,
809  NAL_UNIT_UNSPECIFIED_61,
810  NAL_UNIT_UNSPECIFIED_62,
811  NAL_UNIT_UNSPECIFIED_63,
812  NAL_UNIT_INVALID,
813};
814
815// ====================================================================================================================
816// Type definition
817// ====================================================================================================================
818
819/// parameters for adaptive loop filter
820class TComPicSym;
821
822#define MAX_NUM_SAO_CLASSES  32  //(NUM_SAO_EO_GROUPS > NUM_SAO_BO_GROUPS)?NUM_SAO_EO_GROUPS:NUM_SAO_BO_GROUPS
823
824struct SAOOffset
825{
826  SAOMode modeIdc; // NEW, MERGE, OFF
827  Int typeIdc;     // union of SAOModeMergeTypes and SAOModeNewTypes, depending on modeIdc.
828  Int typeAuxInfo; // BO: starting band index
829  Int offset[MAX_NUM_SAO_CLASSES];
830
831  SAOOffset();
832  ~SAOOffset();
833  Void reset();
834
835  const SAOOffset& operator= (const SAOOffset& src);
836};
837
838struct SAOBlkParam
839{
840
841  SAOBlkParam();
842  ~SAOBlkParam();
843  Void reset();
844  const SAOBlkParam& operator= (const SAOBlkParam& src);
845  SAOOffset& operator[](Int compIdx){ return offsetParam[compIdx];}
846private:
847  SAOOffset offsetParam[MAX_NUM_COMPONENT];
848
849};
850
851
852struct BitDepths
853{
854#if O0043_BEST_EFFORT_DECODING
855  Int recon[MAX_NUM_CHANNEL_TYPE]; ///< the bit depth used for reconstructing the video
856  Int stream[MAX_NUM_CHANNEL_TYPE];///< the bit depth used indicated in the SPS
857#else
858  Int recon[MAX_NUM_CHANNEL_TYPE]; ///< the bit depth as indicated in the SPS
859#endif
860
861#if SVC_EXTENSION
862  BitDepths()
863  {
864  }
865  BitDepths(Int bitDepthY, Int bitDepthC)
866  {
867    recon[CHANNEL_TYPE_LUMA] = bitDepthY;
868    recon[CHANNEL_TYPE_CHROMA] = bitDepthC;
869  }
870#endif
871};
872
873/// parameters for deblocking filter
874typedef struct _LFCUParam
875{
876  Bool bInternalEdge;                     ///< indicates internal edge
877  Bool bLeftEdge;                         ///< indicates left edge
878  Bool bTopEdge;                          ///< indicates top edge
879} LFCUParam;
880
881
882
883//TU settings for entropy encoding
884struct TUEntropyCodingParameters
885{
886  const UInt            *scan;
887  const UInt            *scanCG;
888        COEFF_SCAN_TYPE  scanType;
889        UInt             widthInGroups;
890        UInt             heightInGroups;
891        UInt             firstSignificanceMapContext;
892};
893
894
895struct TComPictureHash
896{
897  std::vector<UChar> hash;
898
899  Bool operator==(const TComPictureHash &other) const
900  {
901    if (other.hash.size() != hash.size())
902    {
903      return false;
904    }
905    for(UInt i=0; i<UInt(hash.size()); i++)
906    {
907      if (other.hash[i] != hash[i])
908      {
909        return false;
910      }
911    }
912    return true;
913  }
914
915  Bool operator!=(const TComPictureHash &other) const
916  {
917    return !(*this == other);
918  }
919};
920
921struct TComSEITimeSet
922{
923  TComSEITimeSet() : clockTimeStampFlag(false),
924                     numUnitFieldBasedFlag(false),
925                     countingType(0),
926                     fullTimeStampFlag(false),
927                     discontinuityFlag(false),
928                     cntDroppedFlag(false),
929                     numberOfFrames(0),
930                     secondsValue(0),
931                     minutesValue(0),
932                     hoursValue(0),
933                     secondsFlag(false),
934                     minutesFlag(false),
935                     hoursFlag(false),
936                     timeOffsetLength(0),
937                     timeOffsetValue(0)
938  { }
939  Bool clockTimeStampFlag;
940  Bool numUnitFieldBasedFlag;
941  Int  countingType;
942  Bool fullTimeStampFlag;
943  Bool discontinuityFlag;
944  Bool cntDroppedFlag;
945  Int  numberOfFrames;
946  Int  secondsValue;
947  Int  minutesValue;
948  Int  hoursValue;
949  Bool secondsFlag;
950  Bool minutesFlag;
951  Bool hoursFlag;
952  Int  timeOffsetLength;
953  Int  timeOffsetValue;
954};
955
956struct TComSEIMasteringDisplay
957{
958  Bool      colourVolumeSEIEnabled;
959  UInt      maxLuminance;
960  UInt      minLuminance;
961  UShort    primaries[3][2];
962  UShort    whitePoint[2];
963};
964//! \}
965
966#endif
967
968
Note: See TracBrowser for help on using the repository browser.