HEVC Test Model (HM)  HM-16.18
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TComRom.h
Go to the documentation of this file.
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-2017, 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 
38 #ifndef __TCOMROM__
39 #define __TCOMROM__
40 
41 #include "CommonDef.h"
42 
43 #include<stdio.h>
44 #include<iostream>
45 
48 
49 // ====================================================================================================================
50 // Initialize / destroy functions
51 // ====================================================================================================================
52 
53 Void initROM();
55 
56 // ====================================================================================================================
57 // Data structure related table & variable
58 // ====================================================================================================================
59 
60 // flexible conversion from relative to absolute index
64 
65 Void initZscanToRaster ( Int iMaxDepth, Int iDepth, UInt uiStartVal, UInt*& rpuiCurrIdx );
66 Void initRasterToZscan ( UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxDepth );
67 
68 // conversion of partition index to picture pel position
71 
72 Void initRasterToPelXY ( UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxDepth );
73 
75 
76 extern const Int g_quantScales[SCALING_LIST_REM_NUM]; // Q(QP%6)
77 extern const Int g_invQuantScales[SCALING_LIST_REM_NUM]; // IQ(QP%6)
78 
79 #if RExt__HIGH_PRECISION_FORWARD_TRANSFORM
81 #else
83 #endif
84 
89 
90 // ====================================================================================================================
91 // Luma QP to Chroma QP mapping
92 // ====================================================================================================================
93 
94 static const Int chromaQPMappingTableSize = 58;
95 
97 
98 
99 // ====================================================================================================================
100 // Scanning order & context mapping table
101 // ====================================================================================================================
102 
103 extern const UInt ctxIndMap4x4[4*4];
104 
105 extern const UInt g_uiGroupIdx[ MAX_TU_SIZE ];
107 
108 // ====================================================================================================================
109 // Intra prediction table
110 // ====================================================================================================================
111 
114 
116 
117 // ====================================================================================================================
118 // Mode-Dependent DST Matrices
119 // ====================================================================================================================
120 
122 
123 // ====================================================================================================================
124 // Misc.
125 // ====================================================================================================================
126 
127 extern SChar g_aucConvertToBit [ MAX_CU_SIZE+1 ]; // from width to log2(width)-2
128 
129 
130 #if ENC_DEC_TRACE
131 extern FILE* g_hTrace;
132 extern Bool g_bJustDoIt;
133 extern const Bool g_bEncDecTraceEnable;
134 extern const Bool g_bEncDecTraceDisable;
135 extern Bool g_HLSTraceEnable;
136 extern UInt64 g_nSymbolCounter;
137 
138 #define COUNTER_START 1
139 #define COUNTER_END 0 //( UInt64(1) << 63 )
140 
141 #define DTRACE_CABAC_F(x) if ( ( g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END )|| g_bJustDoIt ) fprintf( g_hTrace, "%f", x );
142 #define DTRACE_CABAC_V(x) if ( ( g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END )|| g_bJustDoIt ) fprintf( g_hTrace, "%d", x );
143 #define DTRACE_CABAC_VL(x) if ( ( g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END )|| g_bJustDoIt ) fprintf( g_hTrace, "%lld", x );
144 #define DTRACE_CABAC_T(x) if ( ( g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END )|| g_bJustDoIt ) fprintf( g_hTrace, "%s", x );
145 #define DTRACE_CABAC_X(x) if ( ( g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END )|| g_bJustDoIt ) fprintf( g_hTrace, "%x", x );
146 #define DTRACE_CABAC_R( x,y ) if ( ( g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END )|| g_bJustDoIt ) fprintf( g_hTrace, x, y );
147 #define DTRACE_CABAC_N if ( ( g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END )|| g_bJustDoIt ) fprintf( g_hTrace, "\n" );
148 
149 #else
150 
151 #define DTRACE_CABAC_F(x)
152 #define DTRACE_CABAC_V(x)
153 #define DTRACE_CABAC_VL(x)
154 #define DTRACE_CABAC_T(x)
155 #define DTRACE_CABAC_X(x)
156 #define DTRACE_CABAC_R( x,y )
157 #define DTRACE_CABAC_N
158 
159 #endif
160 
162 
165 
166 extern const Int g_quantTSDefault4x4[4*4];
167 extern const Int g_quantIntraDefault8x8[8*8];
168 extern const Int g_quantInterDefault8x8[8*8];
169 
173 
174 #endif //__TCOMROM__
175 
SChar g_aucConvertToBit[MAX_CU_SIZE+1]
Definition: TComRom.cpp:572
const Int g_quantScales[SCALING_LIST_REM_NUM]
Definition: TComRom.cpp:354
const Int g_quantTSDefault4x4[4 *4]
Definition: TComRom.cpp:660
static const Int SCALING_LIST_REM_NUM
Definition: CommonDef.h:226
static const Int SCALING_LIST_NUM
list number for quantization matrix
Definition: CommonDef.h:232
static const Int g_transformMatrixShift[TRANSFORM_NUMBER_OF_DIRECTIONS]
Definition: TComRom.h:82
Void initROM()
Definition: TComRom.cpp:179
const TMatrixCoeff g_aiT16[TRANSFORM_NUMBER_OF_DIRECTIONS][16][16]
Definition: TComRom.cpp:501
Defines version information, constants and small in-line functions.
void Void
Definition: TypeDef.h:203
const TChar * nalUnitTypeToString(NalUnitType type)
Definition: TComRom.cpp:53
static const Int MAX_CU_DEPTH
log2(CTUSize)
Definition: CommonDef.h:220
static const Int MAX_TU_SIZE
Definition: CommonDef.h:224
const TMatrixCoeff g_aiT4[TRANSFORM_NUMBER_OF_DIRECTIONS][4][4]
Definition: TComRom.cpp:489
const Int g_quantInterDefault8x8[8 *8]
Definition: TComRom.cpp:680
unsigned int UInt
Definition: TypeDef.h:212
char TChar
Definition: TypeDef.h:206
Short TMatrixCoeff
transform matrix coefficient
Definition: TypeDef.h:251
const UInt g_auiPUOffset[NUMBER_OF_PART_SIZES]
Definition: TComRom.cpp:289
signed char SChar
Definition: TypeDef.h:207
bool Bool
Definition: TypeDef.h:204
Void initRasterToPelXY(UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxDepth)
Definition: TComRom.cpp:324
const TChar * MatrixType[SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]
Definition: TComRom.cpp:600
Void initRasterToZscan(UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxDepth)
Definition: TComRom.cpp:310
UInt * g_scanOrder[SCAN_NUMBER_OF_GROUP_TYPES][SCAN_NUMBER_OF_TYPES][MAX_CU_DEPTH][MAX_CU_DEPTH]
Definition: TComRom.cpp:587
const UChar g_aucIntraModeNumFast_UseMPM[MAX_CU_DEPTH]
Definition: TComRom.cpp:545
const Int g_invQuantScales[SCALING_LIST_REM_NUM]
Definition: TComRom.cpp:359
unsigned char UChar
Definition: TypeDef.h:208
const UInt g_scalingListSize[SCALING_LIST_SIZE_NUM]
Definition: TComRom.cpp:692
UInt g_auiZscanToRaster[MAX_NUM_PART_IDXS_IN_CTU_WIDTH *MAX_NUM_PART_IDXS_IN_CTU_WIDTH]
Definition: TComRom.cpp:284
UInt g_auiRasterToZscan[MAX_NUM_PART_IDXS_IN_CTU_WIDTH *MAX_NUM_PART_IDXS_IN_CTU_WIDTH]
Definition: TComRom.cpp:285
const TMatrixCoeff g_aiT32[TRANSFORM_NUMBER_OF_DIRECTIONS][32][32]
Definition: TComRom.cpp:507
static const Int NUM_INTRA_MODE
Definition: CommonDef.h:182
const UInt g_uiMinInGroup[LAST_SIGNIFICANT_GROUPS]
Definition: TComRom.cpp:597
const TMatrixCoeff g_aiT8[TRANSFORM_NUMBER_OF_DIRECTIONS][8][8]
Definition: TComRom.cpp:495
unsigned long long UInt64
Definition: TypeDef.h:233
const UChar g_chroma422IntraAngleMappingTable[NUM_INTRA_MODE]
Definition: TComRom.cpp:564
const UInt g_uiGroupIdx[MAX_TU_SIZE]
Definition: TComRom.cpp:598
const UInt ctxIndMap4x4[4 *4]
Definition: TComRom.cpp:589
static const Int MAX_CU_SIZE
= 1&lt;&lt;(MAX_CU_DEPTH)
Definition: CommonDef.h:221
const TMatrixCoeff g_as_DST_MAT_4[TRANSFORM_NUMBER_OF_DIRECTIONS][4][4]
Definition: TComRom.cpp:513
Void initZscanToRaster(Int iMaxDepth, Int iDepth, UInt uiStartVal, UInt *&rpuiCurrIdx)
Definition: TComRom.cpp:291
const UInt g_scalingListSizeX[SCALING_LIST_SIZE_NUM]
Definition: TComRom.cpp:693
static const Int chromaQPMappingTableSize
Definition: TComRom.h:94
int Int
Definition: TypeDef.h:211
static const Int MAX_NUM_PART_IDXS_IN_CTU_WIDTH
maximum number of partition indices across the width of a CTU (or height of a CTU) ...
Definition: CommonDef.h:225
NalUnitType
Definition: TypeDef.h:664
const TChar * MatrixType_DC[SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]
Definition: TComRom.cpp:636
const UChar g_aucChromaScale[NUM_CHROMA_FORMAT][chromaQPMappingTableSize]
Definition: TComRom.cpp:532
UInt g_auiRasterToPelX[MAX_NUM_PART_IDXS_IN_CTU_WIDTH *MAX_NUM_PART_IDXS_IN_CTU_WIDTH]
Definition: TComRom.cpp:286
Void destroyROM()
Definition: TComRom.cpp:263
UInt g_auiRasterToPelY[MAX_NUM_PART_IDXS_IN_CTU_WIDTH *MAX_NUM_PART_IDXS_IN_CTU_WIDTH]
Definition: TComRom.cpp:287
const Int g_quantIntraDefault8x8[8 *8]
Definition: TComRom.cpp:668
static const Int LAST_SIGNIFICANT_GROUPS
Definition: CommonDef.h:242
const UChar g_aucIntraModeNumFast_NotUseMPM[MAX_CU_DEPTH]
Definition: TComRom.cpp:554