TUT HEVC Encoder
tables.h
Go to the documentation of this file.
1#ifndef TABLES_H_
2#define TABLES_H_
3/*****************************************************************************
4 * This file is part of Kvazaar HEVC encoder.
5 *
6 * Copyright (c) 2021, Tampere University, ITU/ISO/IEC, project contributors
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without modification,
10 * are permitted provided that the following conditions are met:
11 *
12 * * Redistributions of source code must retain the above copyright notice, this
13 * list of conditions and the following disclaimer.
14 *
15 * * Redistributions in binary form must reproduce the above copyright notice, this
16 * list of conditions and the following disclaimer in the documentation and/or
17 * other materials provided with the distribution.
18 *
19 * * Neither the name of the Tampere University or ITU/ISO/IEC nor the names of its
20 * contributors may be used to endorse or promote products derived from
21 * this software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
27 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION HOWEVER CAUSED AND ON
30 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 * INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS
33 ****************************************************************************/
34
41#include "global.h" // IWYU pragma: keep
42
43
44/***
45 * List of indices for 4x4 coefficient groups within 8x8 transform block.
46 * First index: 0 = diagonal, 1 = vertical, 2 horizontal scan pattern.
47 * Second index: (log2 - 2) size of transform block. 4x4 .. 32x32
48 */
49static const uint32_t g_sig_last_scan_8x8[3][4] =
50{ {0, 2, 1, 3},
51 {0, 1, 2, 3},
52 {0, 2, 1, 3}
53};
54
55/***
56 * List of indices for 4x4 coefficient groups within 16x16 transform block.
57 */
58static const uint32_t g_sig_last_scan_16x16[16] = {
59 0, 4, 1, 8,
60 5, 2, 12, 9,
61 6, 3, 13, 10,
62 7, 14, 11, 15
63};
64
65/***
66 * List of indices for 4x4 coefficient groups within 32x32 transform block.
67 */
68static const uint32_t g_sig_last_scan_32x32[64] = {
69 0, 8, 1, 16, 9, 2, 24, 17,
70 10, 3, 32, 25, 18, 11, 4, 40,
71 33, 26, 19, 12, 5, 48, 41, 34,
72 27, 20, 13, 6, 56, 49, 42, 35,
73 28, 21, 14, 7, 57, 50, 43, 36,
74 29, 22, 15, 58, 51, 44, 37, 30,
75 23, 59, 52, 45, 38, 31, 60, 53,
76 46, 39, 61, 54, 47, 62, 55, 63
77};
78
84static const uint32_t * const g_sig_last_scan_cg[4][3] = {
85 { g_sig_last_scan_8x8[0], g_sig_last_scan_8x8[1], g_sig_last_scan_8x8[2] }, // 4x4, only first element is used
87 { g_sig_last_scan_16x16, 0, 0 },
88 { g_sig_last_scan_32x32, 0, 0 }
89};
90
91
92typedef enum
93{
94 SCAN_DIAG = 0, // up-right diagonal scan
95 SCAN_HOR, // horizontal first scan
96 SCAN_VER // vertical first scan
98
99
105extern const uint32_t* const kvz_g_sig_last_scan[3][5];
106extern const int8_t kvz_g_convert_to_bit[LCU_WIDTH + 1];
107
108#endif //TABLES_H_
Header that is included in every other header.
#define LCU_WIDTH
spec: CtbSizeY
Definition: global.h:153
coeff_scan_order_t
Definition: tables.h:93
@ SCAN_HOR
Definition: tables.h:95
@ SCAN_VER
Definition: tables.h:96
@ SCAN_DIAG
Definition: tables.h:94
const int8_t kvz_g_convert_to_bit[(1<<(3+3))+1]
Definition: tables.c:9
static const uint32_t g_sig_last_scan_32x32[64]
Definition: tables.h:68
static const uint32_t *const g_sig_last_scan_cg[4][3]
List of pointers to coefficient group mappings.
Definition: tables.h:84
static const uint32_t g_sig_last_scan_8x8[3][4]
Definition: tables.h:49
const uint32_t *const kvz_g_sig_last_scan[3][5]
List of mappings for coefficients within a transform block.
Definition: tables.c:67
static const uint32_t g_sig_last_scan_16x16[16]
Definition: tables.h:58