source: 3DVCSoftware/branches/HTM-11.0-dev0/source/Lib/TLibCommon/TComRom.h @ 1250

Last change on this file since 1250 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: 14.3 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     TComRom.h
35    \brief    global variables & functions (header)
36*/
37
38#ifndef __TCOMROM__
39#define __TCOMROM__
40
41#include "CommonDef.h"
42#include "TypeDef.h"
43
44#include<stdio.h>
45#include<iostream>
46
47#if H_3D_DIM
48#include "TComWedgelet.h"
49#endif
50
51//! \ingroup TLibCommon
52//! \{
53
54// ====================================================================================================================
55// Macros
56// ====================================================================================================================
57
58#define     MAX_CU_DEPTH            6                           // log2(LCUSize)
59#define     MAX_CU_SIZE             (1<<(MAX_CU_DEPTH))         // maximum allowable size of CU
60#define     MIN_PU_SIZE             4
61#define     MAX_NUM_SPU_W           (MAX_CU_SIZE/MIN_PU_SIZE)   // maximum number of SPU in horizontal line
62
63// ====================================================================================================================
64// Initialize / destroy functions
65// ====================================================================================================================
66
67Void         initROM();
68Void         destroyROM();
69Void         initSigLastScan(UInt* pBuffD, UInt* pBuffH, UInt* pBuffV, Int iWidth, Int iHeight);
70// ====================================================================================================================
71// Data structure related table & variable
72// ====================================================================================================================
73
74// flexible conversion from relative to absolute index
75extern       UInt   g_auiZscanToRaster[ MAX_NUM_SPU_W*MAX_NUM_SPU_W ];
76extern       UInt   g_auiRasterToZscan[ MAX_NUM_SPU_W*MAX_NUM_SPU_W ];
77
78Void         initZscanToRaster ( Int iMaxDepth, Int iDepth, UInt uiStartVal, UInt*& rpuiCurrIdx );
79Void         initRasterToZscan ( UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxDepth         );
80
81// conversion of partition index to picture pel position
82extern       UInt   g_auiRasterToPelX[ MAX_NUM_SPU_W*MAX_NUM_SPU_W ];
83extern       UInt   g_auiRasterToPelY[ MAX_NUM_SPU_W*MAX_NUM_SPU_W ];
84
85Void         initRasterToPelXY ( UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxDepth );
86
87// global variable (LCU width/height, max. CU depth)
88extern       UInt g_uiMaxCUWidth;
89extern       UInt g_uiMaxCUHeight;
90extern       UInt g_uiMaxCUDepth;
91extern       UInt g_uiAddCUDepth;
92
93#define MAX_TS_WIDTH  4
94#define MAX_TS_HEIGHT 4
95
96extern       UInt g_auiPUOffset[8];
97
98#define QUANT_IQUANT_SHIFT    20 // Q(QP%6) * IQ(QP%6) = 2^20
99#define QUANT_SHIFT           14 // Q(4) = 2^14
100#define SCALE_BITS            15 // Inherited from TMuC, pressumably for fractional bit estimates in RDOQ
101#define MAX_TR_DYNAMIC_RANGE  15 // Maximum transform dynamic range (excluding sign bit)
102
103#define SHIFT_INV_1ST          7 // Shift after first inverse transform stage
104#define SHIFT_INV_2ND         12 // Shift after second inverse transform stage
105
106extern Int g_quantScales[6];             // Q(QP%6) 
107extern Int g_invQuantScales[6];          // IQ(QP%6)
108extern const Short g_aiT4[4][4];
109extern const Short g_aiT8[8][8];
110extern const Short g_aiT16[16][16];
111extern const Short g_aiT32[32][32];
112
113// ====================================================================================================================
114// Luma QP to Chroma QP mapping
115// ====================================================================================================================
116
117extern const UChar  g_aucChromaScale      [58];
118
119// ====================================================================================================================
120// Scanning order & context mapping table
121// ====================================================================================================================
122
123extern       UInt*  g_auiSigLastScan[ 3 ][ MAX_CU_DEPTH ];  // raster index from scanning index (diag, hor, ver)
124
125extern const UInt   g_uiGroupIdx[ 32 ];
126extern const UInt   g_uiMinInGroup[ 10 ];
127
128extern const UInt   g_sigLastScan8x8[ 3 ][ 4 ];           //!< coefficient group scan order for 8x8 TUs
129extern       UInt   g_sigLastScanCG32x32[ 64 ];
130
131// ====================================================================================================================
132// ADI table
133// ====================================================================================================================
134
135extern const UChar  g_aucIntraModeNumFast[ MAX_CU_DEPTH ];
136
137// ====================================================================================================================
138// Bit-depth
139// ====================================================================================================================
140
141extern        Int g_bitDepthY;
142extern        Int g_bitDepthC;
143extern       UInt g_uiPCMBitDepthLuma;
144extern       UInt g_uiPCMBitDepthChroma;
145
146// ====================================================================================================================
147// Texture type to integer mapping
148// ====================================================================================================================
149
150extern const UChar g_aucConvertTxtTypeToIdx[4];
151
152#if H_3D_DIM
153// ====================================================================================================================
154// Depth coding modes
155// ====================================================================================================================
156__inline Void mapDepthModeToIntraDir( UInt& intraMode ) { if( isDimMode( intraMode ) ) intraMode = DC_IDX; }
157__inline Void mapDepthModeToIntraDir(  Int& intraMode ) { if( isDimMode( intraMode ) ) intraMode = DC_IDX; }
158
159#if H_3D_DIM_SDC || H_3D_DIM_DLT
160__inline UInt numBitsForValue( UInt value ) { UInt bits = 0; while (value != 0) { value >>= 1; bits++; } return bits; };
161#endif
162
163#if H_3D_DIM_DMM
164extern const WedgeResolution                                 g_dmmWedgeResolution [6];
165extern const UChar                                           g_dmm1TabIdxBits     [6];
166extern const UChar                                           g_dmm3IntraTabIdxBits[6];
167
168extern       std::vector< std::vector<TComWedgelet> >        g_dmmWedgeLists;
169extern       std::vector< std::vector<TComWedgeRef> >        g_dmmWedgeRefLists;
170extern       std::vector< std::vector<TComWedgeNode> >       g_dmmWedgeNodeLists;
171
172Void initWedgeLists( Bool initNodeList = false );
173Void createWedgeList( UInt uiWidth, UInt uiHeight, std::vector<TComWedgelet> &racWedgeList, std::vector<TComWedgeRef> &racWedgeRefList, WedgeResolution eWedgeRes );
174Void addWedgeletToList( TComWedgelet cWedgelet, std::vector<TComWedgelet> &racWedgeList, std::vector<TComWedgeRef> &racWedgeRefList );
175#endif
176#endif
177
178// ==========================================
179// Mode-Dependent DST Matrices
180extern const Short g_as_DST_MAT_4 [4][4];
181extern const UChar g_aucDCTDSTMode_Vert[NUM_INTRA_MODE];
182extern const UChar g_aucDCTDSTMode_Hor[NUM_INTRA_MODE];
183// ==========================================
184
185// ====================================================================================================================
186// Misc.
187// ====================================================================================================================
188
189extern       Char   g_aucConvertToBit  [ MAX_CU_SIZE+1 ];   // from width to log2(width)-2
190
191#if MTK_LOW_LATENCY_IC_ENCODING_H0086
192extern UInt g_aICEnableCANDIDATE[10];
193extern UInt g_aICEnableNUM[ 10 ]; //10 layers
194extern Int g_lastlayer;
195#endif
196
197#ifndef ENC_DEC_TRACE
198#define ENC_DEC_TRACE   0
199#endif
200
201#if ENC_DEC_TRACE
202extern FILE*  g_hTrace;
203extern Bool   g_bJustDoIt;
204extern const Bool g_bEncDecTraceEnable;
205extern const Bool g_bEncDecTraceDisable;
206extern Bool   g_HLSTraceEnable;
207extern UInt64 g_nSymbolCounter;
208
209#define COUNTER_START    1
210#define COUNTER_END      0 //( UInt64(1) << 63 )
211
212#define DTRACE_CABAC_F(x)     if ( ( g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END )|| g_bJustDoIt ) fprintf( g_hTrace, "%f", x );
213#define DTRACE_CABAC_V(x)     if ( ( g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END )|| g_bJustDoIt ) fprintf( g_hTrace, "%d", x );
214#define DTRACE_CABAC_VL(x)    if ( ( g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END )|| g_bJustDoIt ) fprintf( g_hTrace, "%lld", x );
215#define DTRACE_CABAC_T(x)     if ( ( g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END )|| g_bJustDoIt ) fprintf( g_hTrace, "%s", x );
216#define DTRACE_CABAC_X(x)     if ( ( g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END )|| g_bJustDoIt ) fprintf( g_hTrace, "%x", x );
217#define DTRACE_CABAC_R( x,y ) if ( ( g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END )|| g_bJustDoIt ) fprintf( g_hTrace, x,    y );
218#define DTRACE_CABAC_N        if ( ( g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END )|| g_bJustDoIt ) fprintf( g_hTrace, "\n"    );
219
220#if H_MV_ENC_DEC_TRAC
221 extern Bool   g_traceCU; 
222 extern Bool   g_tracePU; 
223 extern Bool   g_traceTU; 
224 extern Bool   g_disableHLSTrace;       // USE g_HLSTraceEnable to toggle HLS trace. Not this one!
225 extern UInt64 g_stopAtCounter;         // Counter to set breakpoint.
226 extern Bool   g_traceCopyBack;         // Output samples on copy back 
227 extern Bool   g_decTraceDispDer;       // Trace derived disparity vectors (decoder only)
228 extern Bool   g_decTraceMvFromMerge;   // Trace motion vectors obtained from merge (decoder only)
229 extern Bool   g_decTracePicOutput;     // Trace output of pictures
230 extern Bool   g_stopAtPos;             // Stop at position
231 extern Bool   g_outputPos;             // Output position
232
233#define DTRACE_CU(x,y)             writeToTraceFile( x,y, g_traceCU );
234#define DTRACE_PU(x,y)             writeToTraceFile( x,y, g_tracePU );
235#define DTRACE_TU(x,y)             writeToTraceFile( x,y, g_traceTU );
236#define DTRACE_CU_S(x)             writeToTraceFile( x,   g_traceCU );
237#define DTRACE_PU_S(x)             writeToTraceFile( x,   g_tracePU );
238#define DTRACE_TU_S(x)             writeToTraceFile( x,   g_traceTU );
239
240 Void           writeToTraceFile( const Char* symbolName, Int val, Bool doIt );
241 Void           writeToTraceFile( const Char* symbolName, Bool doIt );
242 Void           stopAtPos       ( Int poc, Int layerId, Int cuPelX, Int cuPelY, Int cuWidth, Int cuHeight );
243#endif
244#else
245
246#define DTRACE_CABAC_F(x)
247#define DTRACE_CABAC_V(x)
248#define DTRACE_CABAC_VL(x)
249#define DTRACE_CABAC_T(x)
250#define DTRACE_CABAC_X(x)
251#define DTRACE_CABAC_R( x,y )
252#define DTRACE_CABAC_N
253
254#if H_MV_ENC_DEC_TRAC
255#define DTRACE_CU(x,y)             
256#define DTRACE_PU(x,y)             
257#define DTRACE_TU(x,y)             
258
259#define DTRACE_CU_S(x)             
260#define DTRACE_PU_S(x)             
261#define DTRACE_TU_S(x)             
262
263#endif
264#endif
265
266
267#define SCALING_LIST_NUM 6         ///< list number for quantization matrix
268#define SCALING_LIST_NUM_32x32 2   ///< list number for quantization matrix 32x32
269#define SCALING_LIST_REM_NUM 6     ///< remainder of QP/6
270#define SCALING_LIST_START_VALUE 8 ///< start value for dpcm mode
271#define MAX_MATRIX_COEF_NUM 64     ///< max coefficient number for quantization matrix
272#define MAX_MATRIX_SIZE_NUM 8      ///< max size number for quantization matrix
273#define SCALING_LIST_DC 16         ///< default DC value
274enum ScalingListSize
275{
276  SCALING_LIST_4x4 = 0,
277  SCALING_LIST_8x8,
278  SCALING_LIST_16x16,
279  SCALING_LIST_32x32,
280  SCALING_LIST_SIZE_NUM
281};
282static const Char MatrixType[4][6][20] =
283{
284  {
285  "INTRA4X4_LUMA",
286  "INTRA4X4_CHROMAU",
287  "INTRA4X4_CHROMAV",
288  "INTER4X4_LUMA",
289  "INTER4X4_CHROMAU",
290  "INTER4X4_CHROMAV"
291  },
292  {
293  "INTRA8X8_LUMA",
294  "INTRA8X8_CHROMAU", 
295  "INTRA8X8_CHROMAV", 
296  "INTER8X8_LUMA",
297  "INTER8X8_CHROMAU", 
298  "INTER8X8_CHROMAV" 
299  },
300  {
301  "INTRA16X16_LUMA",
302  "INTRA16X16_CHROMAU", 
303  "INTRA16X16_CHROMAV", 
304  "INTER16X16_LUMA",
305  "INTER16X16_CHROMAU", 
306  "INTER16X16_CHROMAV" 
307  },
308  {
309  "INTRA32X32_LUMA",
310  "INTER32X32_LUMA",
311  },
312};
313static const Char MatrixType_DC[4][12][22] =
314{
315  {
316  },
317  {
318  },
319  {
320  "INTRA16X16_LUMA_DC",
321  "INTRA16X16_CHROMAU_DC", 
322  "INTRA16X16_CHROMAV_DC", 
323  "INTER16X16_LUMA_DC",
324  "INTER16X16_CHROMAU_DC", 
325  "INTER16X16_CHROMAV_DC" 
326  },
327  {
328  "INTRA32X32_LUMA_DC",
329  "INTER32X32_LUMA_DC",
330  },
331};
332extern Int g_quantIntraDefault8x8[64];
333extern Int g_quantIntraDefault16x16[256];
334extern Int g_quantIntraDefault32x32[1024];
335extern Int g_quantInterDefault8x8[64];
336extern Int g_quantInterDefault16x16[256];
337extern Int g_quantInterDefault32x32[1024];
338extern Int g_quantTSDefault4x4[16];
339extern UInt g_scalingListSize [SCALING_LIST_SIZE_NUM];
340extern UInt g_scalingListSizeX[SCALING_LIST_SIZE_NUM];
341extern UInt g_scalingListNum  [SCALING_LIST_SIZE_NUM];
342extern Int  g_eTTable[4];
343//! \}
344
345#endif  //__TCOMROM__
346
Note: See TracBrowser for help on using the repository browser.