Imported Upstream version 1.4+222+hg5f9f7194267b
[deb_x265.git] / source / common / constants.h
CommitLineData
72b9787e
JB
1/*****************************************************************************
2 * Copyright (C) 2014 x265 project
3 *
4 * Authors: Steve Borho <steve@borho.org>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
19 *
20 * This program is also available under a commercial proprietary license.
21 * For more information, contact us at license @ x265.com.
22 *****************************************************************************/
23
24#ifndef X265_CONSTANTS_H
25#define X265_CONSTANTS_H
26
27#include "common.h"
28
29namespace x265 {
30// private namespace
31
72b9787e
JB
32void initZscanToRaster(uint32_t maxFullDepth, uint32_t depth, uint32_t startVal, uint32_t*& curIdx);
33void initRasterToZscan(uint32_t maxFullDepth);
34
35extern double x265_lambda_tab[QP_MAX_MAX + 1];
36extern double x265_lambda2_tab[QP_MAX_MAX + 1];
37extern const uint16_t x265_chroma_lambda2_offset_tab[MAX_CHROMA_LAMBDA_OFFSET + 1];
38
39enum { ChromaQPMappingTableSize = 70 };
40enum { AngleMapping422TableSize = 36 };
41
42extern const uint8_t g_chromaScale[ChromaQPMappingTableSize];
43extern const uint8_t g_chroma422IntraAngleMappingTable[AngleMapping422TableSize];
44
45// flexible conversion from relative to absolute index
46extern uint32_t g_zscanToRaster[MAX_NUM_PARTITIONS];
47extern uint32_t g_rasterToZscan[MAX_NUM_PARTITIONS];
48
49// conversion of partition index to picture pel position
50extern const uint8_t g_zscanToPelX[MAX_NUM_PARTITIONS];
51extern const uint8_t g_zscanToPelY[MAX_NUM_PARTITIONS];
52extern const uint8_t g_log2Size[MAX_CU_SIZE + 1]; // from size to log2(size)
53
54// global variable (CTU width/height, max. CU depth)
55extern uint32_t g_maxLog2CUSize;
56extern uint32_t g_maxCUSize;
57extern uint32_t g_maxCUDepth;
58extern uint32_t g_maxFullDepth;
59
60extern const int16_t g_t4[4][4];
61extern const int16_t g_t8[8][8];
62extern const int16_t g_t16[16][16];
63extern const int16_t g_t32[32][32];
64
65// Subpel interpolation defines and constants
66
67#define NTAPS_LUMA 8 // Number of taps for luma
68#define NTAPS_CHROMA 4 // Number of taps for chroma
69#define IF_INTERNAL_PREC 14 // Number of bits for internal precision
70#define IF_FILTER_PREC 6 // Log2 of sum of filter taps
71#define IF_INTERNAL_OFFS (1 << (IF_INTERNAL_PREC - 1)) // Offset used internally
72#define SLFASE_CONSTANT 0x5f4e4a53
73
74extern const int16_t g_lumaFilter[4][NTAPS_LUMA]; // Luma filter taps
75extern const int16_t g_chromaFilter[8][NTAPS_CHROMA]; // Chroma filter taps
76
77// Scanning order & context mapping table
78
79#define NUM_SCAN_SIZE 4
80
81extern const uint16_t* const g_scanOrder[NUM_SCAN_TYPE][NUM_SCAN_SIZE];
82extern const uint16_t* const g_scanOrderCG[NUM_SCAN_TYPE][NUM_SCAN_SIZE];
83extern const uint16_t g_scan8x8diag[8 * 8];
84extern const uint16_t g_scan4x4[NUM_SCAN_TYPE][4 * 4];
85
86extern const uint8_t g_minInGroup[10];
87extern const uint8_t g_goRiceRange[5]; // maximum value coded with Rice codes
88
89// CABAC tables
90extern const uint8_t g_lpsTable[64][4];
91extern const uint8_t x265_exp2_lut[64];
92
93// Intra tables
94extern const uint8_t g_intraFilterFlags[NUM_INTRA_MODE];
95
96extern const uint32_t g_depthInc[3][4];
97extern const uint32_t g_depthScanIdx[8][8];
98
99}
100
101#endif