Imported Upstream version 1.4
[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
32void initROM();
33void destroyROM();
34
35void initZscanToRaster(uint32_t maxFullDepth, uint32_t depth, uint32_t startVal, uint32_t*& curIdx);
36void initRasterToZscan(uint32_t maxFullDepth);
37
38extern double x265_lambda_tab[QP_MAX_MAX + 1];
39extern double x265_lambda2_tab[QP_MAX_MAX + 1];
40extern const uint16_t x265_chroma_lambda2_offset_tab[MAX_CHROMA_LAMBDA_OFFSET + 1];
41
42enum { ChromaQPMappingTableSize = 70 };
43enum { AngleMapping422TableSize = 36 };
44
45extern const uint8_t g_chromaScale[ChromaQPMappingTableSize];
46extern const uint8_t g_chroma422IntraAngleMappingTable[AngleMapping422TableSize];
47
48// flexible conversion from relative to absolute index
49extern uint32_t g_zscanToRaster[MAX_NUM_PARTITIONS];
50extern uint32_t g_rasterToZscan[MAX_NUM_PARTITIONS];
51
52// conversion of partition index to picture pel position
53extern const uint8_t g_zscanToPelX[MAX_NUM_PARTITIONS];
54extern const uint8_t g_zscanToPelY[MAX_NUM_PARTITIONS];
55extern const uint8_t g_log2Size[MAX_CU_SIZE + 1]; // from size to log2(size)
56
57// global variable (CTU width/height, max. CU depth)
58extern uint32_t g_maxLog2CUSize;
59extern uint32_t g_maxCUSize;
60extern uint32_t g_maxCUDepth;
61extern uint32_t g_maxFullDepth;
62
63extern const int16_t g_t4[4][4];
64extern const int16_t g_t8[8][8];
65extern const int16_t g_t16[16][16];
66extern const int16_t g_t32[32][32];
67
68// Subpel interpolation defines and constants
69
70#define NTAPS_LUMA 8 // Number of taps for luma
71#define NTAPS_CHROMA 4 // Number of taps for chroma
72#define IF_INTERNAL_PREC 14 // Number of bits for internal precision
73#define IF_FILTER_PREC 6 // Log2 of sum of filter taps
74#define IF_INTERNAL_OFFS (1 << (IF_INTERNAL_PREC - 1)) // Offset used internally
75#define SLFASE_CONSTANT 0x5f4e4a53
76
77extern const int16_t g_lumaFilter[4][NTAPS_LUMA]; // Luma filter taps
78extern const int16_t g_chromaFilter[8][NTAPS_CHROMA]; // Chroma filter taps
79
80// Scanning order & context mapping table
81
82#define NUM_SCAN_SIZE 4
83
84extern const uint16_t* const g_scanOrder[NUM_SCAN_TYPE][NUM_SCAN_SIZE];
85extern const uint16_t* const g_scanOrderCG[NUM_SCAN_TYPE][NUM_SCAN_SIZE];
86extern const uint16_t g_scan8x8diag[8 * 8];
87extern const uint16_t g_scan4x4[NUM_SCAN_TYPE][4 * 4];
88
89extern const uint8_t g_minInGroup[10];
90extern const uint8_t g_goRiceRange[5]; // maximum value coded with Rice codes
91
92// CABAC tables
93extern const uint8_t g_lpsTable[64][4];
94extern const uint8_t x265_exp2_lut[64];
95
96// Intra tables
97extern const uint8_t g_intraFilterFlags[NUM_INTRA_MODE];
98
99extern const uint32_t g_depthInc[3][4];
100extern const uint32_t g_depthScanIdx[8][8];
101
102}
103
104#endif