source: 3DVCSoftware/branches/HTM-10.0-dev0/source/Lib/TLibCommon/TComRom.h @ 854

Last change on this file since 854 was 854, checked in by tech, 10 years ago

Integrated following MV-HEVC HLS 7 items:

H_MV_HLS7_GEN Stub for further integrations (not tested)
H_MV_HLS_7_OUTPUT_LAYERS_5_10_22_27
Output layer sets, various

(VPS/P0300/alt output layer flag) #27 Change alt output layer flag to be signalled within the loop of output layer sets, from JCTVC-P0300-v2. Decision: Adopt.
(VPS/P0156/Num of output_layer_flag) #10 Proposal 3: The output_layer_flag[ i ][ j ] is signalled for j equal to 0 to NumLayersInIdList[ lsIdx ] inclusive. It was remarked that we might be able to just assume that the top layer is always output; however, this was not entirely clear , so the safe thing to do may be to also send the flag for this layer.
(VPS/P0295/Default output layer sets) #5 Discussion from (P0110). Decision: Three-state approach (text in P0295, decoder shall allow 3 to be present and shall treat 3 the same as the value 2).

H_MV_HLS_7_HRD_P0156_7 (HRD/P0156/MaxSubLayersInLayerSetMinus1) #7 Proposal 1: signal, in the VPS extension, the DPB parameters for an output layer set for sub-DPBs only up to the maximum temporal sub-layers in the corresponding layer set
H_MV_HLS_7_VPS_P0048_14
(VPS/P0048/profile_ref_minus1 rem) #14 Remove profile_ref_minus1 from the VPS extension, from JCTVC-P0048
H_MV_HLS_7_VPS_P0076_15 (VPS/P0076/video signal info move) #15 Move video signal information syntax structure earlier in the VPS VUI.
H_MV_HLS_7_SPS_P0155_16_32
(SPS/P0155/sps_sub_layer_ordering_info) #16, #32 Not signal the sps_max_num_reorder_pics[], sps_max_latency_increase_plus1[], and sps_max_dec_pic_buffering_minus1[] syntax elements in the SPS when nuh_layer_id > 0.
H_MV_HLS_7_GEN_P0166_PPS_EXTENSION (GEN/P0166/pps_extension) #17 Add PPS extension type flags for conditional presence of syntax extensions per extension type, aligned with the SPS extension type flags, from JCTVC-P0166. Further align the SPS extension type flags syntax between RExt and MV-HEVC/SHVC
H_MV_HLS_7_FIX_SET_DPB_SIZE
Fix derivation dpb size parameters
H_MV_HLS_7_RESERVED_FLAGS Added flags

(SPS/P0312/SHVC reserved flag) The flag will be used for the syntax vert_phase_position_enable_flag in SHVC draft
(VPS/O0215/SHVC reserved flag): this flag will be used for the syntax cross_layer_phase_alignment_flag in SHVC draft.
(VPS VUI/O0199,P0312/SHVC reserved flags) the 3 reserved bits will be used for the syntaxes single_layer_for_non_irap_flag, higher_layer_irap_skip_flag and vert_phase_position_not_in_use_flag in SHVC draft.

H_MV_FIX_VPS_LAYER_ID_NOT_EQUAL_ZERO Discard VPS with nuh_layer_Id > 0
H_MV_HLS_7_MISC_P0130_EOS
(MISC/P0130/EOS NAL layer id) #19 Require that end of bitstream NAL unit shall have nuh_layer_id equal to 0, from JCTVC-P0130. Decoders shall allow an end of bitstream NAL unit with nuh_layer_id > 0 to be present, and shall ignore the NAL unit.
H_MV_HLS_7_MISC_P0182_13 (MISC/P0182/BL PS Compatibility flag) #13 Define the flag (in VPS VUI) with the proposed semantics, without specifying an associated extraction process. Editors to select the position in the VPS VUI.
H_MV_HLS_7_MISC_P0068_21
(MISC/P0068/all irap idr flag) #21 Add flag in VUI to indicate that all IRAP pictures are IDRs and that all layer pictures in an AU are IDR aligned, from JCTVC-P0068 proposal 1.
H_MV_HLS_7_FIX_INFER_CROSS_LAYER_IRAP_ALIGNED_FLAG Fix inference of cross_layer_irap_aligned_flag
H_MV_HLS_7_MISC_P0079_18
(MISC/P0079/NumActiveRefLayerPics) #18 Modification of derivation of variable NumActiveRefLayerPics.

  • Property svn:eol-style set to native
File size: 14.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     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#ifndef ENC_DEC_TRACE
192#define ENC_DEC_TRACE   0
193#endif
194
195#if ENC_DEC_TRACE
196extern FILE*  g_hTrace;
197extern Bool   g_bJustDoIt;
198extern const Bool g_bEncDecTraceEnable;
199extern const Bool g_bEncDecTraceDisable;
200extern Bool   g_HLSTraceEnable;
201extern UInt64 g_nSymbolCounter;
202
203#define COUNTER_START    1
204#define COUNTER_END      0 //( UInt64(1) << 63 )
205
206#define DTRACE_CABAC_F(x)     if ( ( g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END )|| g_bJustDoIt ) fprintf( g_hTrace, "%f", x );
207#define DTRACE_CABAC_V(x)     if ( ( g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END )|| g_bJustDoIt ) fprintf( g_hTrace, "%d", x );
208#define DTRACE_CABAC_VL(x)    if ( ( g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END )|| g_bJustDoIt ) fprintf( g_hTrace, "%lld", x );
209#define DTRACE_CABAC_T(x)     if ( ( g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END )|| g_bJustDoIt ) fprintf( g_hTrace, "%s", x );
210#define DTRACE_CABAC_X(x)     if ( ( g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END )|| g_bJustDoIt ) fprintf( g_hTrace, "%x", x );
211#define DTRACE_CABAC_R( x,y ) if ( ( g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END )|| g_bJustDoIt ) fprintf( g_hTrace, x,    y );
212#define DTRACE_CABAC_N        if ( ( g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END )|| g_bJustDoIt ) fprintf( g_hTrace, "\n"    );
213
214#if H_MV_ENC_DEC_TRAC
215 extern Bool   g_traceCU; 
216 extern Bool   g_tracePU; 
217 extern Bool   g_traceTU; 
218 extern Bool   g_disableHLSTrace;       // USE g_HLSTraceEnable to toggle HLS trace. Not this one!
219 extern UInt64 g_stopAtCounter;         // Counter to set breakpoint.
220 extern Bool   g_traceCopyBack;         // Output samples on copy back 
221 extern Bool   g_decTraceDispDer; // Trace derived disparity vectors (decoder only)
222 extern Bool   g_decTraceMvFromMerge;   // Trace motion vectors obtained from merge (decoder only)
223 extern Bool   g_stopAtPos;             // Stop at position
224 extern Bool   g_outputPos;             // Output position
225
226#define DTRACE_CU(x,y)             writeToTraceFile( x,y, g_traceCU );
227#define DTRACE_PU(x,y)             writeToTraceFile( x,y, g_tracePU );
228#define DTRACE_TU(x,y)             writeToTraceFile( x,y, g_traceTU );
229#define DTRACE_CU_S(x)             writeToTraceFile( x,   g_traceCU );
230#define DTRACE_PU_S(x)             writeToTraceFile( x,   g_tracePU );
231#define DTRACE_TU_S(x)             writeToTraceFile( x,   g_traceTU );
232
233
234 Void           writeToTraceFile( const Char* symbolName, Int val, Bool doIt );
235 Void           writeToTraceFile( const Char* symbolName, Bool doIt );
236 Void           stopAtPos       ( Int poc, Int layerId, Int cuPelX, Int cuPelY, Int cuWidth, Int cuHeight );
237#endif
238#else
239
240#define DTRACE_CABAC_F(x)
241#define DTRACE_CABAC_V(x)
242#define DTRACE_CABAC_VL(x)
243#define DTRACE_CABAC_T(x)
244#define DTRACE_CABAC_X(x)
245#define DTRACE_CABAC_R( x,y )
246#define DTRACE_CABAC_N
247
248#if H_MV_ENC_DEC_TRAC
249#define DTRACE_CU(x,y)             
250#define DTRACE_PU(x,y)             
251#define DTRACE_TU(x,y)             
252
253#define DTRACE_CU_S(x)             
254#define DTRACE_PU_S(x)             
255#define DTRACE_TU_S(x)             
256
257#endif
258#endif
259
260
261#define SCALING_LIST_NUM 6         ///< list number for quantization matrix
262#define SCALING_LIST_NUM_32x32 2   ///< list number for quantization matrix 32x32
263#define SCALING_LIST_REM_NUM 6     ///< remainder of QP/6
264#define SCALING_LIST_START_VALUE 8 ///< start value for dpcm mode
265#define MAX_MATRIX_COEF_NUM 64     ///< max coefficient number for quantization matrix
266#define MAX_MATRIX_SIZE_NUM 8      ///< max size number for quantization matrix
267#define SCALING_LIST_DC 16         ///< default DC value
268enum ScalingListSize
269{
270  SCALING_LIST_4x4 = 0,
271  SCALING_LIST_8x8,
272  SCALING_LIST_16x16,
273  SCALING_LIST_32x32,
274  SCALING_LIST_SIZE_NUM
275};
276static const Char MatrixType[4][6][20] =
277{
278  {
279  "INTRA4X4_LUMA",
280  "INTRA4X4_CHROMAU",
281  "INTRA4X4_CHROMAV",
282  "INTER4X4_LUMA",
283  "INTER4X4_CHROMAU",
284  "INTER4X4_CHROMAV"
285  },
286  {
287  "INTRA8X8_LUMA",
288  "INTRA8X8_CHROMAU", 
289  "INTRA8X8_CHROMAV", 
290  "INTER8X8_LUMA",
291  "INTER8X8_CHROMAU", 
292  "INTER8X8_CHROMAV" 
293  },
294  {
295  "INTRA16X16_LUMA",
296  "INTRA16X16_CHROMAU", 
297  "INTRA16X16_CHROMAV", 
298  "INTER16X16_LUMA",
299  "INTER16X16_CHROMAU", 
300  "INTER16X16_CHROMAV" 
301  },
302  {
303  "INTRA32X32_LUMA",
304  "INTER32X32_LUMA",
305  },
306};
307static const Char MatrixType_DC[4][12][22] =
308{
309  {
310  },
311  {
312  },
313  {
314  "INTRA16X16_LUMA_DC",
315  "INTRA16X16_CHROMAU_DC", 
316  "INTRA16X16_CHROMAV_DC", 
317  "INTER16X16_LUMA_DC",
318  "INTER16X16_CHROMAU_DC", 
319  "INTER16X16_CHROMAV_DC" 
320  },
321  {
322  "INTRA32X32_LUMA_DC",
323  "INTER32X32_LUMA_DC",
324  },
325};
326extern Int g_quantIntraDefault8x8[64];
327extern Int g_quantIntraDefault16x16[256];
328extern Int g_quantIntraDefault32x32[1024];
329extern Int g_quantInterDefault8x8[64];
330extern Int g_quantInterDefault16x16[256];
331extern Int g_quantInterDefault32x32[1024];
332extern Int g_quantTSDefault4x4[16];
333extern UInt g_scalingListSize [SCALING_LIST_SIZE_NUM];
334extern UInt g_scalingListSizeX[SCALING_LIST_SIZE_NUM];
335extern UInt g_scalingListNum  [SCALING_LIST_SIZE_NUM];
336extern Int  g_eTTable[4];
337//! \}
338
339#endif  //__TCOMROM__
340
Note: See TracBrowser for help on using the repository browser.